Search in sources :

Example 1 with EnumTier

use of icbm.classic.api.EnumTier in project ICBM-Classic by BuiltBrokenModding.

the class BlockLaunchScreen method getActualState.

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumTier tier = EnumTier.ONE;
    TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof TileLauncherScreen) {
        tier = ((TileLauncherScreen) tile)._tier;
    }
    return state.withProperty(TIER_PROP, tier);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumTier(icbm.classic.api.EnumTier)

Example 2 with EnumTier

use of icbm.classic.api.EnumTier in project ICBM-Classic by BuiltBrokenModding.

the class BlockLauncherBase method getActualState.

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumTier tier = EnumTier.ONE;
    TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof TileLauncherBase) {
        tier = ((TileLauncherBase) tile)._tier;
    }
    return state.withProperty(TIER_PROP, tier);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumTier(icbm.classic.api.EnumTier)

Example 3 with EnumTier

use of icbm.classic.api.EnumTier in project ICBM-Classic by BuiltBrokenModding.

the class ItemBlockExplosive method getDetailedInfo.

@Override
public void getDetailedInfo(ItemStack stack, @Nullable EntityPlayer player, List list) {
    final IExplosiveData data = ICBMClassicHelpers.getExplosive(stack.getItemDamage(), true);
    if (data != null) {
        final EnumTier tierdata = data.getTier();
        list.add(TextFormatting.DARK_RED + LanguageUtility.getLocal("info.misc.tier") + ": " + tierdata.getTooltipColor() + tierdata.getLocalizedName());
    }
    if (// TODO add hook for any explosive via content reg
    stack.getItemDamage() == ICBMExplosives.REDMATTER.getRegistryID()) {
        // /Shhh!!! tell no one this exists, tis a surprise
        boolean taunt = shouldTauntPlayer(player);
        if (taunt) {
            switch(tauntCount) {
                case 0:
                    list.add("Place me, you know you want to :)");
                // $FALL-THROUGH$
                case 1:
                    list.add("Mine with me, lets get some minerals!!");
                // $FALL-THROUGH$
                case 2:
                    list.add("Can you hear the noises in the dark?");
                // $FALL-THROUGH$
                case 3:
                    list.add("One does not simply use");
                    list.add("redmatter to cancel redmatter");
                // $FALL-THROUGH$
                case 4:
                    list.add("Nice base you have");
                    list.add("be a shame if something");
                    list.add("would happen to it");
                // $FALL-THROUGH$
                case 5:
                    list.add("Don't worry i've changed");
                // $FALL-THROUGH$
                case 6:
                    list.add("Lets eat a world together");
                // $FALL-THROUGH$
                case 7:
                    list.add("I'm back for you");
            }
        } else {
            normalDetailedInfo(list);
        }
        // Cycle next message
        if (player != null && System.currentTimeMillis() - lastTranslationChange > changeOverDelay) {
            lastTranslationChange = System.currentTimeMillis();
            if (taunt) {
                tauntCount = player.world.rand.nextInt(7);
            } else if (redmatterRandomTranslations > 0) {
                tauntCount = player.world.rand.nextInt(redmatterRandomTranslations);
            }
        }
    } else {
        super.getDetailedInfo(stack, player, list);
    }
}
Also used : IExplosiveData(icbm.classic.api.reg.IExplosiveData) EnumTier(icbm.classic.api.EnumTier)

Example 4 with EnumTier

use of icbm.classic.api.EnumTier in project ICBM-Classic by BuiltBrokenModding.

the class BlockLaunchFrame method getActualState.

@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
    EnumTier tier = EnumTier.ONE;
    TileEntity tile = worldIn.getTileEntity(pos);
    if (tile instanceof TileLauncherFrame) {
        tier = ((TileLauncherFrame) tile)._tier;
    }
    return state.withProperty(TIER_PROP, tier);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) EnumTier(icbm.classic.api.EnumTier)

Example 5 with EnumTier

use of icbm.classic.api.EnumTier in project ICBM-Classic by BuiltBrokenModding.

the class ClientReg method registerLauncherPart.

protected static void registerLauncherPart(Block block) {
    final String resourcePath = block.getRegistryName().toString();
    ModelLoader.setCustomStateMapper(block, new DefaultStateMapper() {

        @Override
        protected ModelResourceLocation getModelResourceLocation(IBlockState state) {
            return new ModelResourceLocation(resourcePath, getPropertyString(state.getProperties()));
        }
    });
    for (EnumTier tier : new EnumTier[] { EnumTier.ONE, EnumTier.TWO, EnumTier.THREE }) {
        IBlockState state = block.getDefaultState().withProperty(BlockICBM.TIER_PROP, tier).withProperty(BlockICBM.ROTATION_PROP, EnumFacing.UP);
        String properties_string = getPropertyString(state.getProperties());
        ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), tier.ordinal(), new ModelResourceLocation(resourcePath, properties_string));
    }
}
Also used : DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) IBlockState(net.minecraft.block.state.IBlockState) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) EnumTier(icbm.classic.api.EnumTier)

Aggregations

EnumTier (icbm.classic.api.EnumTier)5 TileEntity (net.minecraft.tileentity.TileEntity)3 IExplosiveData (icbm.classic.api.reg.IExplosiveData)1 IBlockState (net.minecraft.block.state.IBlockState)1 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)1 DefaultStateMapper (net.minecraft.client.renderer.block.statemap.DefaultStateMapper)1