From 14bf3ed937c346d23cff3be085834b50704dcb35 Mon Sep 17 00:00:00 2001 From: Tictim Date: Fri, 12 May 2023 04:35:39 +0900 Subject: [PATCH] Material Block Cleanup + Block Registration Cleanup + annotations (#1715) --- .../gregtech/api/block/DelayedStateBlock.java | 2 + .../multiblock/MultiblockControllerBase.java | 12 +- .../gregtech/api/pipenet/block/BlockPipe.java | 23 +-- .../crafttweaker/MetaItemBracketHandler.java | 1 - .../gregtech/api/util/CTRecipeHelper.java | 4 +- .../java/gregtech/api/util/GTStringUtils.java | 6 +- .../java/gregtech/client/ClientProxy.java | 41 ---- .../java/gregtech/common/CommonProxy.java | 36 ++-- .../common/blocks/BlockCompressed.java | 138 +++++--------- .../gregtech/common/blocks/BlockFrame.java | 175 ++++++++---------- .../common/blocks/BlockMachineCasing.java | 3 +- .../common/blocks/BlockMaterialBase.java | 94 ++++++++++ .../java/gregtech/common/blocks/BlockOre.java | 10 +- .../common/blocks/BlockSurfaceRock.java | 65 ++----- .../common/blocks/CompressedItemBlock.java | 49 ----- .../common/blocks/FrameItemBlock.java | 49 ----- .../common/blocks/MaterialItemBlock.java | 36 ++++ .../gregtech/common/blocks/MetaBlocks.java | 118 +++++++----- .../gregtech/common/blocks/OreItemBlock.java | 8 - .../common/command/CommandRecipeCheck.java | 4 +- .../multi/MetaTileEntityLargeBoiler.java | 2 +- .../multi/MetaTileEntityMultiblockTank.java | 4 +- .../electric/MetaTileEntityLargeMiner.java | 14 +- .../multi/steam/MetaTileEntitySteamOven.java | 3 - 24 files changed, 401 insertions(+), 496 deletions(-) create mode 100644 src/main/java/gregtech/common/blocks/BlockMaterialBase.java delete mode 100644 src/main/java/gregtech/common/blocks/CompressedItemBlock.java delete mode 100644 src/main/java/gregtech/common/blocks/FrameItemBlock.java create mode 100644 src/main/java/gregtech/common/blocks/MaterialItemBlock.java diff --git a/src/main/java/gregtech/api/block/DelayedStateBlock.java b/src/main/java/gregtech/api/block/DelayedStateBlock.java index 4f188849acb..8bb16928201 100644 --- a/src/main/java/gregtech/api/block/DelayedStateBlock.java +++ b/src/main/java/gregtech/api/block/DelayedStateBlock.java @@ -11,7 +11,9 @@ * This class allows lazy initialization of block state of block * Useful when you need some parameters from constructor to construct a BlockStateContainer * All child classes must call initBlockState() in their constructors + * @deprecated No usage */ +@Deprecated public abstract class DelayedStateBlock extends Block { public DelayedStateBlock(Material materialIn) { diff --git a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java index b41c9c14ca2..4688bc7f26b 100644 --- a/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java +++ b/src/main/java/gregtech/api/metatileentity/multiblock/MultiblockControllerBase.java @@ -54,6 +54,7 @@ public abstract class MultiblockControllerBase extends MetaTileEntity implements IMultiblockController { + @Nullable public BlockPattern structurePattern; private final Map, List> multiblockAbilities = new HashMap<>(); @@ -143,8 +144,8 @@ public static TraceabilityPredicate metaTileEntities(MetaTileEntity... metaTileE return tilePredicate((state, tile) -> ArrayUtils.contains(ids, tile.metaTileEntityId), getCandidates(metaTileEntities)); } - private static Supplier getCandidates(MetaTileEntity... metaTileEntities){ - return ()->Arrays.stream(metaTileEntities).filter(Objects::nonNull).map(tile -> { + private static Supplier getCandidates(MetaTileEntity... metaTileEntities) { + return () -> Arrays.stream(metaTileEntities).filter(Objects::nonNull).map(tile -> { // TODO MetaTileEntityHolder holder = new MetaTileEntityHolder(); holder.setMetaTileEntity(tile); @@ -174,7 +175,9 @@ public static TraceabilityPredicate states(IBlockState... allowedStates) { }, getCandidates(allowedStates)); } - /** Use this predicate for Frames in your Multiblock. Allows for Framed Pipes as well as normal Frame blocks. */ + /** + * Use this predicate for Frames in your Multiblock. Allows for Framed Pipes as well as normal Frame blocks. + */ public static TraceabilityPredicate frames(Material... frameMaterials) { return states(Arrays.stream(frameMaterials).map(m -> MetaBlocks.FRAMES.get(m).getBlock(m)).toArray(IBlockState[]::new)) .or(new TraceabilityPredicate(blockWorldState -> { @@ -249,6 +252,7 @@ public void checkStructurePattern() { Map, List> abilities = new HashMap<>(); for (IMultiblockPart multiblockPart : parts) { if (multiblockPart instanceof IMultiblockAbilityPart) { + @SuppressWarnings("unchecked") IMultiblockAbilityPart abilityPart = (IMultiblockAbilityPart) multiblockPart; List abilityInstancesList = abilities.computeIfAbsent(abilityPart.getAbility(), k -> new ArrayList<>()); abilityPart.registerAbilities(abilityInstancesList); @@ -391,7 +395,7 @@ private List repetitionDFS(List pages, for (int i = 0; i < repetitionStack.size(); i++) { repetition[i] = repetitionStack.get(i); } - pages.add(new MultiblockShapeInfo(this.structurePattern.getPreview(repetition))); + pages.add(new MultiblockShapeInfo(Objects.requireNonNull(this.structurePattern).getPreview(repetition))); } else { for (int i = aisleRepetitions[repetitionStack.size()][0]; i <= aisleRepetitions[repetitionStack.size()][1]; i++) { repetitionStack.push(i); diff --git a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java index 59b552908f3..0c6d916c73d 100644 --- a/src/main/java/gregtech/api/pipenet/block/BlockPipe.java +++ b/src/main/java/gregtech/api/pipenet/block/BlockPipe.java @@ -17,11 +17,9 @@ import gregtech.api.pipenet.WorldPipeNet; import gregtech.api.pipenet.tile.IPipeTile; import gregtech.api.pipenet.tile.TileEntityPipeBase; -import gregtech.api.unification.material.Material; import gregtech.api.util.GTUtility; import gregtech.common.ConfigHolder; import gregtech.common.blocks.BlockFrame; -import gregtech.common.blocks.FrameItemBlock; import gregtech.common.blocks.MetaBlocks; import gregtech.common.items.MetaItems; import gregtech.integration.ctm.IFacadeWrapper; @@ -295,16 +293,19 @@ public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @ public boolean onPipeActivated(World world, IBlockState state, BlockPos pos, EntityPlayer entityPlayer, EnumHand hand, EnumFacing side, CuboidRayTraceResult hit, IPipeTile pipeTile) { ItemStack itemStack = entityPlayer.getHeldItem(hand); - if (pipeTile.getFrameMaterial() == null && pipeTile instanceof TileEntityPipeBase && itemStack.getItem() instanceof FrameItemBlock && pipeTile.getPipeType().getThickness() < 1) { - BlockFrame frameBlock = (BlockFrame) ((FrameItemBlock) itemStack.getItem()).getBlock(); - Material material = frameBlock.getGtMaterial(itemStack.getMetadata()); - ((TileEntityPipeBase) pipeTile).setFrameMaterial(material); - SoundType type = frameBlock.getSoundType(itemStack); - world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); - if (!entityPlayer.capabilities.isCreativeMode) { - itemStack.shrink(1); + if (pipeTile.getFrameMaterial() == null && + pipeTile instanceof TileEntityPipeBase && + pipeTile.getPipeType().getThickness() < 1) { + BlockFrame frameBlock = BlockFrame.getFrameBlockFromItem(itemStack); + if (frameBlock != null) { + ((TileEntityPipeBase) pipeTile).setFrameMaterial(frameBlock.getGtMaterial(itemStack)); + SoundType type = frameBlock.getSoundType(itemStack); + world.playSound(entityPlayer, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + if (!entityPlayer.capabilities.isCreativeMode) { + itemStack.shrink(1); + } + return true; } - return true; } if (itemStack.getItem() instanceof ItemBlockPipe) { diff --git a/src/main/java/gregtech/api/recipes/crafttweaker/MetaItemBracketHandler.java b/src/main/java/gregtech/api/recipes/crafttweaker/MetaItemBracketHandler.java index bfe8496b003..9278e772893 100644 --- a/src/main/java/gregtech/api/recipes/crafttweaker/MetaItemBracketHandler.java +++ b/src/main/java/gregtech/api/recipes/crafttweaker/MetaItemBracketHandler.java @@ -41,7 +41,6 @@ public MetaItemBracketHandler() { this.method = CraftTweakerAPI.getJavaMethod(MetaItemBracketHandler.class, "getCtMetaItem", String.class); } - @SuppressWarnings("ConstantConditions") public static void rebuildComponentRegistry() { metaItemNames.clear(); for (MetaItem item : MetaItem.getMetaItems()) { diff --git a/src/main/java/gregtech/api/util/CTRecipeHelper.java b/src/main/java/gregtech/api/util/CTRecipeHelper.java index 2c0e227248d..5a757739d5c 100644 --- a/src/main/java/gregtech/api/util/CTRecipeHelper.java +++ b/src/main/java/gregtech/api/util/CTRecipeHelper.java @@ -35,10 +35,10 @@ public static String getMetaItemId(ItemStack item) { } } if (block instanceof BlockCompressed) { - return "block" + ((BlockCompressed) block).getGtMaterial(item.getMetadata()).toCamelCaseString(); + return "block" + ((BlockCompressed) block).getGtMaterial(item).toCamelCaseString(); } if (block instanceof BlockFrame) { - return "frame" + ((BlockFrame) block).getGtMaterial(item.getMetadata()).toCamelCaseString(); + return "frame" + ((BlockFrame) block).getGtMaterial(item).toCamelCaseString(); } if (block instanceof BlockMaterialPipe) { return ((BlockMaterialPipe) block).getPrefix().name + BlockMaterialPipe.getItemMaterial(item).toCamelCaseString(); diff --git a/src/main/java/gregtech/api/util/GTStringUtils.java b/src/main/java/gregtech/api/util/GTStringUtils.java index 9fd9c0d0373..1436eaa1636 100644 --- a/src/main/java/gregtech/api/util/GTStringUtils.java +++ b/src/main/java/gregtech/api/util/GTStringUtils.java @@ -50,9 +50,9 @@ public static String prettyPrintItemStack(@Nonnull ItemStack stack) { Block block = Block.getBlockFromItem(stack.getItem()); String id = null; if (block instanceof BlockCompressed) { - id = "block" + ((BlockCompressed) block).getGtMaterial(stack.getMetadata()).toCamelCaseString(); + id = "block" + ((BlockCompressed) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockFrame) { - id = "frame" + ((BlockFrame) block).getGtMaterial(stack.getMetadata()).toCamelCaseString(); + id = "frame" + ((BlockFrame) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockMaterialPipe) { id = ((BlockMaterialPipe) block).getPrefix().name + BlockMaterialPipe.getItemMaterial(stack).toCamelCaseString(); } @@ -87,7 +87,7 @@ public static String ticksToElapsedTime(int ticks) { * * @param stringToDraw The String to draw * @param fontRenderer An instance of the MC FontRenderer - * @param maxLength The maximum width of the String + * @param maxLength The maximum width of the String */ public static void drawCenteredStringWithCutoff(String stringToDraw, FontRenderer fontRenderer, int maxLength) { diff --git a/src/main/java/gregtech/client/ClientProxy.java b/src/main/java/gregtech/client/ClientProxy.java index 5c21eba367e..4405c0097e8 100644 --- a/src/main/java/gregtech/client/ClientProxy.java +++ b/src/main/java/gregtech/client/ClientProxy.java @@ -70,47 +70,6 @@ @Mod.EventBusSubscriber(Side.CLIENT) public class ClientProxy extends CommonProxy { - public static final IBlockColor COMPRESSED_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - state.getValue(((BlockCompressed) state.getBlock()).variantProperty).getMaterialRGB(); - - public static final IItemColor COMPRESSED_ITEM_COLOR = (stack, tintIndex) -> { - BlockCompressed block = (BlockCompressed) ((ItemBlock) stack.getItem()).getBlock(); - IBlockState state = block.getStateFromMeta(stack.getItemDamage()); - return state.getValue(block.variantProperty).getMaterialRGB(); - }; - - public static final IBlockColor FRAME_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - state.getValue(((BlockFrame) state.getBlock()).variantProperty).getMaterialRGB(); - - public static final IItemColor FRAME_ITEM_COLOR = (stack, tintIndex) -> { - BlockFrame block = (BlockFrame) ((ItemBlock) stack.getItem()).getBlock(); - IBlockState state = block.getStateFromMeta(stack.getItemDamage()); - return state.getValue(block.variantProperty).getMaterialRGB(); - }; - - public static final IBlockColor ORE_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - tintIndex == 1 ? ((BlockOre) state.getBlock()).material.getMaterialRGB() : 0xFFFFFF; - - public static final IItemColor ORE_ITEM_COLOR = (stack, tintIndex) -> - tintIndex == 1 ? ((BlockOre) ((ItemBlock) stack.getItem()).getBlock()).material.getMaterialRGB() : 0xFFFFFF; - - public static final IBlockColor FOAM_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - state.getValue(BlockColored.COLOR).colorValue; - - public static final IBlockColor SURFACE_ROCK_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - tintIndex == 1 ? state.getValue(((BlockSurfaceRock) state.getBlock()).variantProperty).getMaterialRGB() : -1; - - public static final IBlockColor RUBBER_LEAVES_BLOCK_COLOR = (IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) -> - 0x98de4b; - - public static final IItemColor RUBBER_LEAVES_ITEM_COLOR = (stack, tintIndex) -> 0x98de4b; - - public static final IBlockColor MACHINE_CASING_BLOCK_COLOR = (state, world, pos, tintIndex) -> - state.getBlock() instanceof BlockMachineCasing && MetaBlocks.MACHINE_CASING.getMetaFromState(state) == 0 ? 0xFFFFFF : ConfigHolder.client.defaultPaintingColor; - - public static final IItemColor MACHINE_CASING_ITEM_COLOR = (stack, tintIndex) -> - stack.getItemDamage() == 0 && ((ItemBlock) stack.getItem()).getBlock() instanceof BlockMachineCasing ? 0xFFFFFF : ConfigHolder.client.defaultPaintingColor; - public void onPreLoad() { super.onPreLoad(); diff --git a/src/main/java/gregtech/common/CommonProxy.java b/src/main/java/gregtech/common/CommonProxy.java index 200b1d433c2..75a836d92fb 100644 --- a/src/main/java/gregtech/common/CommonProxy.java +++ b/src/main/java/gregtech/common/CommonProxy.java @@ -154,10 +154,10 @@ public static void registerBlocks(RegistryEvent.Register event) { for (BlockLamp block : LAMPS.values()) registry.register(block); for (BlockLamp block : BORDERLESS_LAMPS.values()) registry.register(block); - COMPRESSED.values().stream().distinct().forEach(registry::register); - FRAMES.values().stream().distinct().forEach(registry::register); - SURFACE_ROCK.values().stream().distinct().forEach(registry::register); - ORES.forEach(registry::register); + for (BlockCompressed block : COMPRESSED_BLOCKS) registry.register(block); + for (BlockFrame block : FRAME_BLOCKS) registry.register(block); + for (BlockSurfaceRock block : SURFACE_ROCK_BLOCKS) registry.register(block); + for (BlockOre block : ORES) registry.register(block); } private static void createOreBlock(Material material) { @@ -254,17 +254,15 @@ public static void registerItems(RegistryEvent.Register event) { registry.register(createItemBlock(RUBBER_LEAVES, ItemBlock::new)); registry.register(createItemBlock(RUBBER_SAPLING, ItemBlock::new)); - COMPRESSED.values() - .stream().distinct() - .map(block -> createItemBlock(block, CompressedItemBlock::new)) - .forEach(registry::register); - FRAMES.values() - .stream().distinct() - .map(block -> createItemBlock(block, FrameItemBlock::new)) - .forEach(registry::register); - ORES.stream() - .map(block -> createItemBlock(block, OreItemBlock::new)) - .forEach(registry::register); + for (BlockCompressed block : COMPRESSED_BLOCKS) { + registry.register(createItemBlock(block, b -> new MaterialItemBlock(b, OrePrefix.block))); + } + for (BlockFrame block : FRAME_BLOCKS) { + registry.register(createItemBlock(block, b -> new MaterialItemBlock(b, OrePrefix.frameGt))); + } + for (BlockOre block : ORES) { + registry.register(createItemBlock(block, OreItemBlock::new)); + } } @SubscribeEvent(priority = EventPriority.HIGHEST) @@ -339,13 +337,11 @@ public static void modifyFuelBurnTime(FurnaceFuelBurnTimeEvent event) { event.setBurnTime(100); } else if (block == WOOD_SLAB) { event.setBurnTime(150); - } else if (stack.getItem() instanceof CompressedItemBlock) { + } else if (block instanceof BlockCompressed) { //handle material blocks burn value - CompressedItemBlock itemBlock = (CompressedItemBlock) stack.getItem(); - Material material = itemBlock.getBlockState(stack).getValue(itemBlock.compressedBlock.variantProperty); + Material material = ((BlockCompressed) block).getGtMaterial(stack); DustProperty property = material.getProperty(PropertyKey.DUST); - if (property != null && - property.getBurnTime() > 0) { + if (property != null && property.getBurnTime() > 0) { //compute burn value for block prefix, taking amount of material in block into account double materialUnitsInBlock = OrePrefix.block.getMaterialAmount(material) / (GTValues.M * 1.0); event.setBurnTime((int) (materialUnitsInBlock * property.getBurnTime())); diff --git a/src/main/java/gregtech/common/blocks/BlockCompressed.java b/src/main/java/gregtech/common/blocks/BlockCompressed.java index c6fbb040325..d4cbf7e1866 100644 --- a/src/main/java/gregtech/common/blocks/BlockCompressed.java +++ b/src/main/java/gregtech/common/blocks/BlockCompressed.java @@ -1,27 +1,21 @@ package gregtech.common.blocks; import gregtech.api.GregTechAPI; -import gregtech.api.block.DelayedStateBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.unification.material.Material; -import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.unification.material.properties.PropertyKey; -import gregtech.api.util.GTUtility; import gregtech.client.model.MaterialStateMapper; import gregtech.client.model.modelfactories.MaterialBlockModelLoader; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; import net.minecraft.block.SoundType; -import net.minecraft.block.material.MapColor; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; @@ -29,94 +23,34 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.List; -public final class BlockCompressed extends DelayedStateBlock { +public abstract class BlockCompressed extends BlockMaterialBase { - public final PropertyMaterial variantProperty; + public static BlockCompressed create(Material[] materials) { + PropertyMaterial property = PropertyMaterial.create("variant", materials); + return new BlockCompressed() { + @Nonnull + @Override + public PropertyMaterial getVariantProperty() { + return property; + } + }; + } - public BlockCompressed(Material[] materials) { + private BlockCompressed() { super(net.minecraft.block.material.Material.IRON); setTranslationKey("compressed"); setHardness(5.0f); setResistance(10.0f); setCreativeTab(GregTechAPI.TAB_GREGTECH_MATERIALS); - this.variantProperty = PropertyMaterial.create("variant", materials); - initBlockState(); - } - - @Override - public int damageDropped(@Nonnull IBlockState state) { - return getMetaFromState(state); - } - - @Override - public String getHarvestTool(IBlockState state) { - Material material = state.getValue(variantProperty); - if (material.isSolid()) { - return ToolClasses.PICKAXE; - } else if (material.hasProperty(PropertyKey.DUST)) { - return ToolClasses.SHOVEL; - } - return ToolClasses.PICKAXE; - } - - @Override - public int getHarvestLevel(IBlockState state) { - Material material = state.getValue(variantProperty); - if (material.hasProperty(PropertyKey.DUST)) { - return material.getBlockHarvestLevel(); - } - return 0; - } - - @Nonnull - @Override - @SuppressWarnings("deprecation") - public IBlockState getStateFromMeta(int meta) { - if (meta >= variantProperty.getAllowedValues().size()) { - meta = 0; - } - return getDefaultState().withProperty(variantProperty, variantProperty.getAllowedValues().get(meta)); - } - - @Override - public int getMetaFromState(IBlockState state) { - return variantProperty.getAllowedValues().indexOf(state.getValue(variantProperty)); - } - - @Override - protected BlockStateContainer createStateContainer() { - return new BlockStateContainer(this, variantProperty); - } - - public static ItemStack getItem(IBlockState blockState) { - return GTUtility.toItem(blockState); - } - - public ItemStack getItem(Material material) { - return getItem(getDefaultState().withProperty(variantProperty, material)); - } - - public Material getGtMaterial(int meta) { - return variantProperty.getAllowedValues().get(meta); - } - - public IBlockState getBlock(Material material) { - return getDefaultState().withProperty(variantProperty, material); - } - - @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { - blockState.getValidStates().stream() - .filter(blockState -> blockState.getValue(variantProperty) != Materials.NULL) - .forEach(blockState -> list.add(getItem(blockState))); } @Override @Nonnull @SuppressWarnings("deprecation") public net.minecraft.block.material.Material getMaterial(IBlockState state) { - Material material = state.getValue(variantProperty); + Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { return net.minecraft.block.material.Material.ROCK; } else if (material.hasProperty(PropertyKey.INGOT)) { @@ -127,17 +61,10 @@ public net.minecraft.block.material.Material getMaterial(IBlockState state) { return net.minecraft.block.material.Material.ROCK; } - @Nonnull - @Override - @SuppressWarnings("deprecation") - public MapColor getMapColor(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { - return getMaterial(state).getMaterialMapColor(); - } - @Nonnull @Override public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { - Material material = state.getValue(variantProperty); + Material material = getGtMaterial(state); if (material.hasProperty(PropertyKey.GEM)) { return SoundType.STONE; } else if (material.hasProperty(PropertyKey.INGOT)) { @@ -148,15 +75,42 @@ public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull return SoundType.STONE; } + @Override + public String getHarvestTool(IBlockState state) { + Material material = getGtMaterial(state); + if (material.isSolid()) { + return ToolClasses.PICKAXE; + } else if (material.hasProperty(PropertyKey.DUST)) { + return ToolClasses.SHOVEL; + } + return ToolClasses.PICKAXE; + } + + @Override + public int getHarvestLevel(IBlockState state) { + Material material = getGtMaterial(state); + if (material.hasProperty(PropertyKey.DUST)) { + return material.getBlockHarvestLevel(); + } + return 0; + } + + @Override + public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { + if (ConfigHolder.misc.debug) { + tooltip.add("MetaItem Id: block" + getGtMaterial(stack).toCamelCaseString()); + } + } + @SideOnly(Side.CLIENT) public void onModelRegister() { ModelLoader.setCustomStateMapper(this, new MaterialStateMapper( - MaterialIconType.block, s -> s.getValue(this.variantProperty).getMaterialIconSet())); + MaterialIconType.block, s -> getGtMaterial(s).getMaterialIconSet())); for (IBlockState state : this.getBlockState().getValidStates()) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), MaterialBlockModelLoader.registerItemModel( MaterialIconType.block, - state.getValue(this.variantProperty).getMaterialIconSet())); + getGtMaterial(state).getMaterialIconSet())); } } } diff --git a/src/main/java/gregtech/common/blocks/BlockFrame.java b/src/main/java/gregtech/common/blocks/BlockFrame.java index 4e284a972b9..060f806f12a 100644 --- a/src/main/java/gregtech/common/blocks/BlockFrame.java +++ b/src/main/java/gregtech/common/blocks/BlockFrame.java @@ -1,7 +1,6 @@ package gregtech.common.blocks; import gregtech.api.GregTechAPI; -import gregtech.api.block.DelayedStateBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.items.toolitem.ToolHelper; import gregtech.api.pipenet.block.BlockPipe; @@ -10,20 +9,18 @@ import gregtech.api.pipenet.tile.TileEntityPipeBase; import gregtech.api.recipes.ModHandler; import gregtech.api.unification.material.Material; -import gregtech.api.unification.material.Materials; import gregtech.api.unification.material.info.MaterialIconType; import gregtech.api.util.GTLog; -import gregtech.api.util.GTUtility; import gregtech.client.model.MaterialStateMapper; import gregtech.client.model.modelfactories.MaterialBlockModelLoader; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.properties.PropertyMaterial; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.EnumPushReaction; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving.SpawnPlacementType; import net.minecraft.entity.player.EntityPlayer; @@ -31,7 +28,10 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -43,47 +43,34 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.List; -public final class BlockFrame extends DelayedStateBlock { +public abstract class BlockFrame extends BlockMaterialBase { public static final AxisAlignedBB COLLISION_BOX = new AxisAlignedBB(0.05, 0.0, 0.05, 0.95, 1.0, 0.95); - public final PropertyMaterial variantProperty; + public static BlockFrame create(Material[] materials) { + PropertyMaterial property = PropertyMaterial.create("variant", materials); + return new BlockFrame() { + @Nonnull + @Override + public PropertyMaterial getVariantProperty() { + return property; + } + }; + } - // todo wood? - public BlockFrame(Material[] materials) { + private BlockFrame() { super(net.minecraft.block.material.Material.IRON); setTranslationKey("frame"); setHardness(3.0f); setResistance(6.0f); setCreativeTab(GregTechAPI.TAB_GREGTECH_MATERIALS); - this.variantProperty = PropertyMaterial.create("variant", materials); - initBlockState(); - } - - @Override - public int damageDropped(@Nonnull IBlockState state) { - return getMetaFromState(state); - } - - @Nonnull - @Override - @SuppressWarnings("deprecation") - public IBlockState getStateFromMeta(int meta) { - if (meta >= variantProperty.getAllowedValues().size()) { - meta = 0; - } - return getDefaultState().withProperty(variantProperty, variantProperty.getAllowedValues().get(meta)); - } - - @Override - public int getMetaFromState(IBlockState state) { - return variantProperty.getAllowedValues().indexOf(state.getValue(variantProperty)); } @Override public String getHarvestTool(IBlockState state) { - Material material = state.getValue(variantProperty); + Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return ToolClasses.AXE; } @@ -93,7 +80,7 @@ public String getHarvestTool(IBlockState state) { @Nonnull @Override public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { - Material material = state.getValue(variantProperty); + Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return SoundType.WOOD; } @@ -101,7 +88,7 @@ public SoundType getSoundType(IBlockState state, @Nonnull World world, @Nonnull } public SoundType getSoundType(ItemStack stack) { - Material material = getGtMaterial(stack.getMetadata()); + Material material = getGtMaterial(stack); if (ModHandler.isMaterialWood(material)) { return SoundType.WOOD; } @@ -113,45 +100,17 @@ public int getHarvestLevel(@Nonnull IBlockState state) { return 1; } - @Override - protected BlockStateContainer createStateContainer() { - return new BlockStateContainer(this, variantProperty); - } - @Override @Nonnull @SuppressWarnings("deprecation") public net.minecraft.block.material.Material getMaterial(IBlockState state) { - Material material = state.getValue(variantProperty); + Material material = getGtMaterial(state); if (ModHandler.isMaterialWood(material)) { return net.minecraft.block.material.Material.WOOD; } return super.getMaterial(state); } - @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { - blockState.getValidStates().stream() - .filter(blockState -> blockState.getValue(variantProperty) != Materials.NULL) - .forEach(blockState -> list.add(getItem(blockState))); - } - - public static ItemStack getItem(IBlockState blockState) { - return GTUtility.toItem(blockState); - } - - public ItemStack getItem(Material material) { - return getItem(getDefaultState().withProperty(variantProperty, material)); - } - - public IBlockState getBlock(Material material) { - return getDefaultState().withProperty(variantProperty, material); - } - - public Material getGtMaterial(int meta) { - return variantProperty.getAllowedValues().get(meta); - } - @Override public boolean canCreatureSpawn(@Nonnull IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull SpawnPlacementType type) { return false; @@ -166,7 +125,7 @@ public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState st itemBlock.placeBlockAt(stackInHand, playerIn, worldIn, pos, facing, 0, 0, 0, pipeState); IPipeTile pipeTile = blockPipe.getPipeTileEntity(worldIn, pos); if (pipeTile instanceof TileEntityPipeBase) { - ((TileEntityPipeBase) pipeTile).setFrameMaterial(getGtMaterial(getMetaFromState(state))); + ((TileEntityPipeBase) pipeTile).setFrameMaterial(getGtMaterial(state)); } else { GTLog.logger.error("Pipe was not placed!"); return false; @@ -182,67 +141,68 @@ public boolean replaceWithFramedPipe(World worldIn, BlockPos pos, IBlockState st } public boolean removeFrame(World world, BlockPos pos, EntityPlayer player, ItemStack stack) { - TileEntity te = world.getTileEntity(pos); - if (te instanceof TileEntityPipeBase && ((IPipeTile) te).getFrameMaterial() != null) { + if (te instanceof TileEntityPipeBase) { TileEntityPipeBase pipeTile = (TileEntityPipeBase) te; Material frameMaterial = pipeTile.getFrameMaterial(); - pipeTile.setFrameMaterial(null); - Block.spawnAsEntity(world, pos, this.getItem(frameMaterial)); - ToolHelper.damageItem(stack, player); - ToolHelper.playToolSound(stack, player); - return true; - + if (frameMaterial != null) { + pipeTile.setFrameMaterial(null); + Block.spawnAsEntity(world, pos, this.getItem(frameMaterial)); + ToolHelper.damageItem(stack, player); + ToolHelper.playToolSound(stack, player); + return true; + } } return false; } @Override - public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { - ItemStack stackInHand = playerIn.getHeldItem(hand); - if (stackInHand.isEmpty()) { + public boolean onBlockActivated(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull IBlockState state, + @Nonnull EntityPlayer player, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, + float hitX, float hitY, float hitZ) { + ItemStack stack = player.getHeldItem(hand); + if (stack.isEmpty()) { return false; } // replace frame with pipe and set the frame material to this frame - if (stackInHand.getItem() instanceof ItemBlockPipe) { - return replaceWithFramedPipe(worldIn, pos, state, playerIn, stackInHand, facing); + if (stack.getItem() instanceof ItemBlockPipe) { + return replaceWithFramedPipe(world, pos, state, player, stack, facing); } - if (stackInHand.getItem().getToolClasses(stackInHand).contains(ToolClasses.CROWBAR)) { - return removeFrame(worldIn, pos, playerIn, stackInHand); + if (stack.getItem().getToolClasses(stack).contains(ToolClasses.CROWBAR)) { + return removeFrame(world, pos, player, stack); } - if (!(stackInHand.getItem() instanceof FrameItemBlock)) { - return false; - } + BlockFrame frameBlock = getFrameBlockFromItem(stack); + if (frameBlock == null) return false; + BlockPos.PooledMutableBlockPos blockPos = BlockPos.PooledMutableBlockPos.retain(); blockPos.setPos(pos); for (int i = 0; i < 32; i++) { - if (worldIn.getBlockState(blockPos).getBlock() instanceof BlockFrame) { + if (world.getBlockState(blockPos).getBlock() instanceof BlockFrame) { blockPos.move(EnumFacing.UP); continue; } - TileEntity te = worldIn.getTileEntity(blockPos); + TileEntity te = world.getTileEntity(blockPos); if (te instanceof IPipeTile && ((IPipeTile) te).getFrameMaterial() != null) { blockPos.move(EnumFacing.UP); continue; } - if (canPlaceBlockAt(worldIn, blockPos)) { - worldIn.setBlockState(blockPos, ((FrameItemBlock) stackInHand.getItem()).getBlockState(stackInHand)); - SoundType type = getSoundType(stackInHand); - worldIn.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); - if (!playerIn.capabilities.isCreativeMode) { - stackInHand.shrink(1); + if (canPlaceBlockAt(world, blockPos)) { + world.setBlockState(blockPos, this.getStateFromMeta(stack.getItem().getMetadata(stack.getItemDamage()))); + SoundType type = getSoundType(stack); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + if (!player.capabilities.isCreativeMode) { + stack.shrink(1); } blockPos.release(); return true; } else if (te instanceof TileEntityPipeBase && ((TileEntityPipeBase) te).getFrameMaterial() == null) { - Material material = ((BlockFrame) ((FrameItemBlock) stackInHand.getItem()).getBlock()).getGtMaterial(stackInHand.getMetadata()); - ((TileEntityPipeBase) te).setFrameMaterial(material); - SoundType type = getSoundType(stackInHand); - worldIn.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); - if (!playerIn.capabilities.isCreativeMode) { - stackInHand.shrink(1); + ((TileEntityPipeBase) te).setFrameMaterial(frameBlock.getGtMaterial(stack)); + SoundType type = getSoundType(stack); + world.playSound(null, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume() + 1.0F) / 2.0F, type.getPitch() * 0.8F); + if (!player.capabilities.isCreativeMode) { + stack.shrink(1); } blockPos.release(); return true; @@ -303,15 +263,32 @@ public BlockFaceShape getBlockFaceShape(@Nonnull IBlockAccess worldIn, @Nonnull return BlockFaceShape.UNDEFINED; } + @Override + public void addInformation(ItemStack stack, @Nullable World world, List tooltip, ITooltipFlag flag) { + if (ConfigHolder.misc.debug) { + tooltip.add("MetaItem Id: frame" + getGtMaterial(stack).toCamelCaseString()); + } + } + @SideOnly(Side.CLIENT) public void onModelRegister() { ModelLoader.setCustomStateMapper(this, new MaterialStateMapper( - MaterialIconType.frameGt, s -> s.getValue(this.variantProperty).getMaterialIconSet())); + MaterialIconType.frameGt, s -> getGtMaterial(s).getMaterialIconSet())); for (IBlockState state : this.getBlockState().getValidStates()) { ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), this.getMetaFromState(state), MaterialBlockModelLoader.registerItemModel( MaterialIconType.frameGt, - state.getValue(this.variantProperty).getMaterialIconSet())); + getGtMaterial(state).getMaterialIconSet())); + } + } + + @Nullable + public static BlockFrame getFrameBlockFromItem(ItemStack stack) { + Item item = stack.getItem(); + if (item instanceof ItemBlock) { + Block block = ((ItemBlock) item).getBlock(); + if (block instanceof BlockFrame) return (BlockFrame) block; } + return null; } } diff --git a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java index 09417829318..46b386e4661 100644 --- a/src/main/java/gregtech/common/blocks/BlockMachineCasing.java +++ b/src/main/java/gregtech/common/blocks/BlockMachineCasing.java @@ -17,6 +17,7 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; +import java.util.Locale; @ParametersAreNonnullByDefault public class BlockMachineCasing extends VariantBlock { @@ -77,7 +78,7 @@ public String getName() { } private static String makeName(String voltageName) { - return String.join("_", voltageName.toLowerCase().split(" ")); + return voltageName.toLowerCase(Locale.ROOT).replace(' ', '_'); } } } diff --git a/src/main/java/gregtech/common/blocks/BlockMaterialBase.java b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java new file mode 100644 index 00000000000..28681f99df9 --- /dev/null +++ b/src/main/java/gregtech/common/blocks/BlockMaterialBase.java @@ -0,0 +1,94 @@ +package gregtech.common.blocks; + +import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.Materials; +import gregtech.api.util.GTUtility; +import gregtech.common.blocks.properties.PropertyMaterial; +import net.minecraft.block.Block; +import net.minecraft.block.material.MapColor; +import net.minecraft.block.state.BlockStateContainer; +import net.minecraft.block.state.IBlockState; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.util.NonNullList; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.IBlockAccess; + +import javax.annotation.Nonnull; + +public abstract class BlockMaterialBase extends Block { + + public BlockMaterialBase(net.minecraft.block.material.Material material) { + super(material); + } + + @Nonnull + public ItemStack getItem(@Nonnull Material material) { + return GTUtility.toItem(getDefaultState().withProperty(getVariantProperty(), material)); + } + + @Nonnull + public Material getGtMaterial(int meta) { + if (meta >= getVariantProperty().getAllowedValues().size()) { + meta = 0; + } + return getVariantProperty().getAllowedValues().get(meta); + } + + @Nonnull + public Material getGtMaterial(@Nonnull ItemStack stack) { + return getGtMaterial(stack.getMetadata()); + } + + @Nonnull + public Material getGtMaterial(@Nonnull IBlockState state) { + return state.getValue(getVariantProperty()); + } + + @Nonnull + public IBlockState getBlock(@Nonnull Material material) { + return getDefaultState().withProperty(getVariantProperty(), material); + } + + @Nonnull + public abstract PropertyMaterial getVariantProperty(); + + @Nonnull + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, getVariantProperty()); + } + + @Nonnull + @Override + @SuppressWarnings("deprecation") + public IBlockState getStateFromMeta(int meta) { + return getDefaultState().withProperty(getVariantProperty(), getGtMaterial(meta)); + } + + @Override + public int getMetaFromState(@Nonnull IBlockState state) { + return getVariantProperty().getAllowedValues().indexOf(state.getValue(getVariantProperty())); + } + + @Override + public int damageDropped(@Nonnull IBlockState state) { + return getMetaFromState(state); + } + + @Override + public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { + for (IBlockState state : blockState.getValidStates()) { + if (getGtMaterial(state) != Materials.NULL) { + list.add(GTUtility.toItem(state)); + } + } + } + + @Nonnull + @Override + @SuppressWarnings("deprecation") + public MapColor getMapColor(@Nonnull IBlockState state, @Nonnull IBlockAccess worldIn, @Nonnull BlockPos pos) { + return getMaterial(state).getMaterialMapColor(); + } +} diff --git a/src/main/java/gregtech/common/blocks/BlockOre.java b/src/main/java/gregtech/common/blocks/BlockOre.java index 7bc26d963a3..97a534fe677 100644 --- a/src/main/java/gregtech/common/blocks/BlockOre.java +++ b/src/main/java/gregtech/common/blocks/BlockOre.java @@ -52,6 +52,7 @@ public BlockOre(Material material, StoneType[] allowedValues) { this.material = Objects.requireNonNull(material, "Material in BlockOre can not be null!"); STONE_TYPE = PropertyStoneType.create("stone_type", allowedValues); initBlockState(); + setCreativeTab(GregTechAPI.TAB_GREGTECH_ORES); } @Nonnull @@ -139,15 +140,10 @@ public int getMetaFromState(IBlockState state) { return STONE_TYPE.getAllowedValues().indexOf(state.getValue(STONE_TYPE)); } - public static ItemStack getItem(IBlockState blockState) { - return GTUtility.toItem(blockState); - } - @Override - @SuppressWarnings("deprecation") public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { // Still get correct block even if shouldBeDroppedAsItem is false - return BlockOre.getItem(state); + return GTUtility.toItem(state); } @Override @@ -164,7 +160,7 @@ public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList state.getValue(STONE_TYPE).shouldBeDroppedAsItem) - .forEach(blockState -> list.add(getItem(blockState))); + .forEach(blockState -> list.add(GTUtility.toItem(blockState))); } } diff --git a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java index 0a10dcb23d7..bd6e4086f55 100755 --- a/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java +++ b/src/main/java/gregtech/common/blocks/BlockSurfaceRock.java @@ -1,21 +1,16 @@ package gregtech.common.blocks; import gregtech.api.GTValues; -import gregtech.api.block.DelayedStateBlock; import gregtech.api.items.toolitem.ToolClasses; import gregtech.api.unification.OreDictUnifier; import gregtech.api.unification.material.Material; -import gregtech.api.unification.material.Materials; import gregtech.api.unification.ore.OrePrefix; -import gregtech.api.util.GTUtility; import gregtech.common.blocks.properties.PropertyMaterial; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -33,18 +28,26 @@ import javax.annotation.Nullable; @SuppressWarnings("deprecation") -public class BlockSurfaceRock extends DelayedStateBlock { +public abstract class BlockSurfaceRock extends BlockMaterialBase { private static final AxisAlignedBB STONE_AABB = new AxisAlignedBB(2.0 / 16.0, 0.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0, 2.0 / 16.0, 14.0 / 16.0); public static final ModelResourceLocation MODEL_LOCATION = new ModelResourceLocation(new ResourceLocation(GTValues.MODID, "surface_rock"), "normal"); - public final PropertyMaterial variantProperty; - public BlockSurfaceRock(Material[] materials) { + public static BlockSurfaceRock create(Material[] materials) { + PropertyMaterial property = PropertyMaterial.create("variant", materials); + return new BlockSurfaceRock() { + @Nonnull + @Override + public PropertyMaterial getVariantProperty() { + return property; + } + }; + } + + private BlockSurfaceRock() { super(net.minecraft.block.material.Material.GOURD); setTranslationKey("surface_rock"); setHardness(0.25f); - this.variantProperty = PropertyMaterial.create("variant", materials); - initBlockState(); } @Nullable @@ -53,43 +56,6 @@ public String getHarvestTool(@Nonnull IBlockState state) { return ToolClasses.SHOVEL; } - @Nonnull - @Override - public IBlockState getStateFromMeta(int meta) { - Material material = variantProperty.getAllowedValues().get(meta); - return getDefaultState().withProperty(variantProperty, material); - } - - @Override - public int getMetaFromState(@Nonnull IBlockState state) { - Material material = state.getValue(variantProperty); - return variantProperty.getAllowedValues().indexOf(material); - } - - public IBlockState getBlock(Material material) { - return getDefaultState().withProperty(variantProperty, material); - } - - @Override - protected BlockStateContainer createStateContainer() { - return new BlockStateContainer(this, variantProperty); - } - - public static ItemStack getItem(IBlockState blockState) { - return GTUtility.toItem(blockState); - } - - public ItemStack getItem(Material material) { - return getItem(getDefaultState().withProperty(variantProperty, material)); - } - - @Override - public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList list) { - blockState.getValidStates().stream() - .filter(blockState -> blockState.getValue(variantProperty) != Materials.NULL) - .forEach(blockState -> list.add(getItem(blockState))); - } - @Override public boolean onBlockActivated(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull IBlockState state, EntityPlayer playerIn, @Nonnull EnumHand hand, @Nonnull EnumFacing facing, float hitX, float hitY, float hitZ) { dropBlockAsItem(worldIn, pos, state, 0); @@ -110,9 +76,8 @@ public AxisAlignedBB getBoundingBox(@Nonnull IBlockState state, @Nonnull IBlockA return STONE_AABB; } - private ItemStack getDropStack(IBlockState blockState, int amount) { - Material material = blockState.getValue(variantProperty); - return OreDictUnifier.get(OrePrefix.dustTiny, material, amount); + private ItemStack getDropStack(IBlockState state, int amount) { + return OreDictUnifier.get(OrePrefix.dustTiny, getGtMaterial(state), amount); } @Override diff --git a/src/main/java/gregtech/common/blocks/CompressedItemBlock.java b/src/main/java/gregtech/common/blocks/CompressedItemBlock.java deleted file mode 100644 index 8c1cfdb4f8d..00000000000 --- a/src/main/java/gregtech/common/blocks/CompressedItemBlock.java +++ /dev/null @@ -1,49 +0,0 @@ -package gregtech.common.blocks; - -import gregtech.api.unification.material.Material; -import gregtech.api.unification.ore.OrePrefix; -import gregtech.common.ConfigHolder; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.List; - -public class CompressedItemBlock extends ItemBlock { - - public final BlockCompressed compressedBlock; - - public CompressedItemBlock(BlockCompressed compressedBlock) { - super(compressedBlock); - this.compressedBlock = compressedBlock; - setHasSubtypes(true); - } - - @Override - public int getMetadata(int damage) { - return damage; - } - - public IBlockState getBlockState(ItemStack stack) { - return compressedBlock.getStateFromMeta(getMetadata(stack.getItemDamage())); - } - - @Nonnull - @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { - Material material = getBlockState(stack).getValue(compressedBlock.variantProperty); - return OrePrefix.block.getLocalNameForItem(material); - } - - @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { - super.addInformation(stack, worldIn, tooltip, flagIn); - if (ConfigHolder.misc.debug) { - tooltip.add("MetaItem Id: block" + compressedBlock.getGtMaterial(stack.getMetadata()).toCamelCaseString()); - } - } -} diff --git a/src/main/java/gregtech/common/blocks/FrameItemBlock.java b/src/main/java/gregtech/common/blocks/FrameItemBlock.java deleted file mode 100644 index 50e300578af..00000000000 --- a/src/main/java/gregtech/common/blocks/FrameItemBlock.java +++ /dev/null @@ -1,49 +0,0 @@ -package gregtech.common.blocks; - -import gregtech.api.unification.material.Material; -import gregtech.api.unification.ore.OrePrefix; -import gregtech.common.ConfigHolder; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.List; - -public class FrameItemBlock extends ItemBlock { - - private final BlockFrame frameBlock; - - public FrameItemBlock(BlockFrame block) { - super(block); - this.frameBlock = block; - setHasSubtypes(true); - } - - @Override - public int getMetadata(int damage) { - return damage; - } - - public IBlockState getBlockState(ItemStack stack) { - return frameBlock.getStateFromMeta(getMetadata(stack.getItemDamage())); - } - - @Nonnull - @Override - public String getItemStackDisplayName(@Nonnull ItemStack stack) { - Material material = getBlockState(stack).getValue(frameBlock.variantProperty); - return OrePrefix.frameGt.getLocalNameForItem(material); - } - - @Override - public void addInformation(@Nonnull ItemStack stack, @Nullable World worldIn, @Nonnull List tooltip, @Nonnull ITooltipFlag flagIn) { - super.addInformation(stack, worldIn, tooltip, flagIn); - if (ConfigHolder.misc.debug) { - tooltip.add("MetaItem Id: frame" + frameBlock.getGtMaterial(stack.getMetadata()).toCamelCaseString()); - } - } -} diff --git a/src/main/java/gregtech/common/blocks/MaterialItemBlock.java b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java new file mode 100644 index 00000000000..75564c3ad53 --- /dev/null +++ b/src/main/java/gregtech/common/blocks/MaterialItemBlock.java @@ -0,0 +1,36 @@ +package gregtech.common.blocks; + +import gregtech.api.unification.ore.OrePrefix; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nonnull; + +public class MaterialItemBlock extends ItemBlock { + + private final BlockMaterialBase block; + private final OrePrefix prefix; + + public MaterialItemBlock(BlockMaterialBase block, OrePrefix prefix) { + super(block); + this.block = block; + this.prefix = prefix; + setHasSubtypes(true); + } + + @Override + public BlockMaterialBase getBlock() { + return block; + } + + @Override + public int getMetadata(int damage) { + return damage; + } + + @Nonnull + @Override + public String getItemStackDisplayName(@Nonnull ItemStack stack) { + return this.prefix.getLocalNameForItem(this.block.getGtMaterial(stack)); + } +} diff --git a/src/main/java/gregtech/common/blocks/MetaBlocks.java b/src/main/java/gregtech/common/blocks/MetaBlocks.java index d0c00bfe000..ab4b7374fce 100644 --- a/src/main/java/gregtech/common/blocks/MetaBlocks.java +++ b/src/main/java/gregtech/common/blocks/MetaBlocks.java @@ -11,6 +11,7 @@ import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.ore.OrePrefix; import gregtech.api.unification.ore.StoneType; +import gregtech.api.util.GTUtility; import gregtech.client.model.SimpleStateMapper; import gregtech.client.model.modelfactories.BakedModelHandler; import gregtech.client.renderer.handler.MetaTileEntityRenderer; @@ -18,6 +19,7 @@ import gregtech.client.renderer.pipe.CableRenderer; import gregtech.client.renderer.pipe.FluidPipeRenderer; import gregtech.client.renderer.pipe.ItemPipeRenderer; +import gregtech.common.ConfigHolder; import gregtech.common.blocks.foam.BlockFoam; import gregtech.common.blocks.foam.BlockPetrifiedFoam; import gregtech.common.blocks.wood.*; @@ -34,7 +36,7 @@ import gregtech.common.pipelike.itempipe.ItemPipeType; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipe; import gregtech.common.pipelike.itempipe.tile.TileEntityItemPipeTickable; -import it.unimi.dsi.fastutil.objects.ReferenceArrayList; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.block.*; import net.minecraft.block.BlockLog.EnumAxis; import net.minecraft.block.BlockSlab.EnumBlockHalf; @@ -44,6 +46,8 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.IStateMapper; import net.minecraft.client.renderer.block.statemap.StateMapperBase; +import net.minecraft.client.renderer.color.BlockColors; +import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.init.Blocks; import net.minecraft.item.EnumDyeColor; import net.minecraft.item.Item; @@ -66,7 +70,6 @@ import static gregtech.api.unification.material.info.MaterialFlags.FORCE_GENERATE_BLOCK; import static gregtech.api.unification.material.info.MaterialFlags.GENERATE_FRAME; -import static gregtech.client.ClientProxy.*; public class MetaBlocks { @@ -121,11 +124,16 @@ private MetaBlocks() {} public static BlockBrittleCharcoal BRITTLE_CHARCOAL; - public static final Map COMPRESSED = new HashMap<>(); - public static final Map FRAMES = new HashMap<>(); - public static final Collection ORES = new ReferenceArrayList<>(); - public static final Map SURFACE_ROCK = new HashMap<>(); - public static final Collection FLUID_BLOCKS = new ReferenceArrayList<>(); + public static final Map COMPRESSED = new Object2ObjectOpenHashMap<>(); + public static final Map FRAMES = new Object2ObjectOpenHashMap<>(); + public static final Map SURFACE_ROCK = new Object2ObjectOpenHashMap<>(); + + public static final List COMPRESSED_BLOCKS = new ArrayList<>(); + public static final List FRAME_BLOCKS = new ArrayList<>(); + public static final List SURFACE_ROCK_BLOCKS = new ArrayList<>(); + + public static final List ORES = new ArrayList<>(); + public static final List FLUID_BLOCKS = new ArrayList<>(); public static void init() { GregTechAPI.MACHINE = MACHINE = new BlockMachine(); @@ -293,27 +301,30 @@ protected static void createGeneratedBlock(Predicate materialPredicate } private static void createCompressedBlock(Material[] materials, int index) { - BlockCompressed block = new BlockCompressed(materials); + BlockCompressed block = BlockCompressed.create(materials); block.setRegistryName("meta_block_compressed_" + index); - for (Material material : materials) { - COMPRESSED.put(material, block); + for (Material m : materials) { + COMPRESSED.put(m, block); } + COMPRESSED_BLOCKS.add(block); } private static void createFrameBlock(Material[] materials, int index) { - BlockFrame block = new BlockFrame(materials); + BlockFrame block = BlockFrame.create(materials); block.setRegistryName("meta_block_frame_" + index); for (Material m : materials) { FRAMES.put(m, block); } + FRAME_BLOCKS.add(block); } private static void createSurfaceRockBlock(Material[] materials, int index) { - BlockSurfaceRock block = new BlockSurfaceRock(materials); + BlockSurfaceRock block = BlockSurfaceRock.create(materials); block.setRegistryName("meta_block_surface_rock_" + index); - for (Material material : materials) { - SURFACE_ROCK.put(material, block); + for (Material m : materials) { + SURFACE_ROCK.put(m, block); } + SURFACE_ROCK_BLOCKS.add(block); } public static void registerTileEntity() { @@ -377,9 +388,9 @@ public static void registerItemModels() { for (BlockLamp lamp : LAMPS.values()) lamp.onModelRegister(); for (BlockLamp lamp : BORDERLESS_LAMPS.values()) lamp.onModelRegister(); - COMPRESSED.values().stream().distinct().forEach(BlockCompressed::onModelRegister); - FRAMES.values().stream().distinct().forEach(BlockFrame::onModelRegister); - ORES.forEach(BlockOre::onModelRegister); + for (BlockCompressed block : COMPRESSED_BLOCKS) block.onModelRegister(); + for (BlockFrame block : FRAME_BLOCKS) block.onModelRegister(); + for (BlockOre block : ORES) block.onModelRegister(); } @SideOnly(Side.CLIENT) @@ -396,7 +407,7 @@ private static void registerItemModel(Block block) { @SideOnly(Side.CLIENT) private static void registerItemModelWithOverride(Block block, Map, Comparable> stateOverrides) { for (IBlockState state : block.getBlockState().getValidStates()) { - HashMap, Comparable> stringProperties = new HashMap<>(state.getProperties()); + Map, Comparable> stringProperties = new Object2ObjectOpenHashMap<>(state.getProperties()); stringProperties.putAll(stateOverrides); //noinspection ConstantConditions ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), @@ -423,7 +434,7 @@ public static void registerStateMappers() { ModelLoader.setCustomStateMapper(pipe, normalStateMapper); } normalStateMapper = new SimpleStateMapper(BlockSurfaceRock.MODEL_LOCATION); - for (BlockSurfaceRock surfaceRock : new HashSet<>(SURFACE_ROCK.values())) { + for (BlockSurfaceRock surfaceRock : SURFACE_ROCK_BLOCKS) { ModelLoader.setCustomStateMapper(surfaceRock, normalStateMapper); } @@ -449,36 +460,57 @@ protected ModelResourceLocation getModelResourceLocation(@Nonnull IBlockState st @SideOnly(Side.CLIENT) public static void registerColors() { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler( - FOAM_BLOCK_COLOR, FOAM, REINFORCED_FOAM, PETRIFIED_FOAM, REINFORCED_PETRIFIED_FOAM); + BlockColors blockColors = Minecraft.getMinecraft().getBlockColors(); + ItemColors itemColors = Minecraft.getMinecraft().getItemColors(); - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(RUBBER_LEAVES_BLOCK_COLOR, RUBBER_LEAVES); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(RUBBER_LEAVES_ITEM_COLOR, RUBBER_LEAVES); + blockColors.registerBlockColorHandler((s, w, p, i) -> + s.getValue(BlockColored.COLOR).colorValue, + FOAM, REINFORCED_FOAM, PETRIFIED_FOAM, REINFORCED_PETRIFIED_FOAM); - MetaBlocks.COMPRESSED.values().stream().distinct().forEach(block -> { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(COMPRESSED_BLOCK_COLOR, block); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(COMPRESSED_ITEM_COLOR, block); - }); + final int rubberLeavesColor = 0x98de4b; - MetaBlocks.FRAMES.values().forEach(block -> { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(FRAME_BLOCK_COLOR, block); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(FRAME_ITEM_COLOR, block); - }); + blockColors.registerBlockColorHandler((s, w, p, i) -> + rubberLeavesColor, RUBBER_LEAVES); + itemColors.registerItemColorHandler((s, i) -> + rubberLeavesColor, RUBBER_LEAVES); - MetaBlocks.SURFACE_ROCK.values().stream().distinct().forEach(block -> { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(SURFACE_ROCK_BLOCK_COLOR, block); - }); + for (BlockCompressed block : COMPRESSED_BLOCKS) { + blockColors.registerBlockColorHandler((s, w, p, i) -> + block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> + block.getGtMaterial(s).getMaterialRGB(), block); + } - MetaBlocks.ORES.stream().distinct().forEach(block -> { - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(ORE_BLOCK_COLOR, block); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(ORE_ITEM_COLOR, block); - }); + for (BlockFrame block : FRAME_BLOCKS) { + blockColors.registerBlockColorHandler((s, w, p, i) -> + block.getGtMaterial(s).getMaterialRGB(), block); + itemColors.registerItemColorHandler((s, i) -> + block.getGtMaterial(s).getMaterialRGB(), block); + } + + for (BlockSurfaceRock block : SURFACE_ROCK_BLOCKS) { + blockColors.registerBlockColorHandler((s, w, p, i) -> + i == 1 ? block.getGtMaterial(s).getMaterialRGB() : -1, block); + } - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(MACHINE_CASING_BLOCK_COLOR, MACHINE_CASING); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(MACHINE_CASING_ITEM_COLOR, MACHINE_CASING); + for (BlockOre block : ORES) { + blockColors.registerBlockColorHandler((s, w, p, i) -> + i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); + itemColors.registerItemColorHandler((s, i) -> + i == 1 ? block.material.getMaterialRGB() : 0xFFFFFF, block); + } - Minecraft.getMinecraft().getBlockColors().registerBlockColorHandler(MACHINE_CASING_BLOCK_COLOR, HERMETIC_CASING); - Minecraft.getMinecraft().getItemColors().registerItemColorHandler(MACHINE_CASING_ITEM_COLOR, HERMETIC_CASING); + blockColors.registerBlockColorHandler((s, w, p, i) -> + MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); + itemColors.registerItemColorHandler((s, i) -> + MACHINE_CASING.getState(s) == BlockMachineCasing.MachineCasingType.ULV ? + 0xFFFFFF : ConfigHolder.client.defaultPaintingColor, MACHINE_CASING); + + blockColors.registerBlockColorHandler((s, w, p, i) -> + ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); + itemColors.registerItemColorHandler((s, i) -> + ConfigHolder.client.defaultPaintingColor, HERMETIC_CASING); } public static void registerOreDict() { @@ -510,7 +542,7 @@ public static void registerOreDict() { Material material = blockOre.material; for (StoneType stoneType : blockOre.STONE_TYPE.getAllowedValues()) { if (stoneType == null) continue; - ItemStack normalStack = BlockOre.getItem(blockOre.getDefaultState() + ItemStack normalStack = GTUtility.toItem(blockOre.getDefaultState() .withProperty(blockOre.STONE_TYPE, stoneType)); OreDictUnifier.registerOre(normalStack, stoneType.processingPrefix, material); } diff --git a/src/main/java/gregtech/common/blocks/OreItemBlock.java b/src/main/java/gregtech/common/blocks/OreItemBlock.java index 170d00112dc..8108d1f1df5 100644 --- a/src/main/java/gregtech/common/blocks/OreItemBlock.java +++ b/src/main/java/gregtech/common/blocks/OreItemBlock.java @@ -1,9 +1,7 @@ package gregtech.common.blocks; -import gregtech.api.GregTechAPI; import gregtech.api.unification.ore.StoneType; import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -24,12 +22,6 @@ public int getMetadata(int damage) { return damage; } - @Nonnull - @Override - public CreativeTabs[] getCreativeTabs() { - return new CreativeTabs[]{CreativeTabs.SEARCH, GregTechAPI.TAB_GREGTECH_ORES}; - } - protected IBlockState getBlockState(ItemStack stack) { return oreBlock.getStateFromMeta(getMetadata(stack.getItemDamage())); } diff --git a/src/main/java/gregtech/common/command/CommandRecipeCheck.java b/src/main/java/gregtech/common/command/CommandRecipeCheck.java index 88da69a66a4..0d49e5729eb 100644 --- a/src/main/java/gregtech/common/command/CommandRecipeCheck.java +++ b/src/main/java/gregtech/common/command/CommandRecipeCheck.java @@ -254,9 +254,9 @@ public static String prettyPrintItemStack(ItemStack stack) { Block block = Block.getBlockFromItem(stack.getItem()); String id = null; if (block instanceof BlockCompressed) { - id = "block" + ((BlockCompressed) block).getGtMaterial(stack.getMetadata()).toCamelCaseString(); + id = "block" + ((BlockCompressed) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockFrame) { - id = "frame" + ((BlockFrame) block).getGtMaterial(stack.getMetadata()).toCamelCaseString(); + id = "frame" + ((BlockFrame) block).getGtMaterial(stack).toCamelCaseString(); } else if (block instanceof BlockMaterialPipe) { id = ((BlockMaterialPipe) block).getPrefix().name + BlockMaterialPipe.getItemMaterial(stack).toCamelCaseString(); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java index 8d98dabf356..9073d9dd970 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityLargeBoiler.java @@ -126,7 +126,7 @@ public boolean isActive() { @Override protected BlockPattern createStructurePattern() { - return boilerType == null ? null : FactoryBlockPattern.start() + return FactoryBlockPattern.start() .aisle("XXX", "CCC", "CCC", "CCC") .aisle("XXX", "CPC", "CPC", "CCC") .aisle("XXX", "CSC", "CCC", "CCC") diff --git a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java index 5016f1997d3..6bb5b68c02f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java +++ b/src/main/java/gregtech/common/metatileentities/multi/MetaTileEntityMultiblockTank.java @@ -67,9 +67,7 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) { } @Override - protected void updateFormedValid() { - - } + protected void updateFormedValid() {} @Override @Nonnull diff --git a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java index d0e0807d024..7faf55b52f3 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java +++ b/src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java @@ -125,7 +125,7 @@ private void resetTileAbilities() { public int getEnergyTier() { if (energyContainer == null) return this.tier; - return Math.min(this.tier + 1 , Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); + return Math.min(this.tier + 1, Math.max(this.tier, GTUtility.getFloorTierByVoltage(energyContainer.getInputVoltage()))); } @Override @@ -170,7 +170,7 @@ protected void updateFormedValid() { @Override protected BlockPattern createStructurePattern() { - return material == null ? null : FactoryBlockPattern.start() + return FactoryBlockPattern.start() .aisle("XXX", "#F#", "#F#", "#F#", "###", "###", "###") .aisle("XXX", "FCF", "FCF", "FCF", "#F#", "#F#", "#F#") .aisle("XSX", "#F#", "#F#", "#F#", "###", "###", "###") @@ -250,11 +250,11 @@ else if (!this.isWorkingEnabled()) private void addDisplayText2(List textList) { if (this.isStructureFormed()) { ITextComponent mCoords = new TextComponentString(" ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())) - .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())) - .appendText("\n ") - .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minex", this.minerLogic.getMineX().get())) + .appendText("\n ") + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.miney", this.minerLogic.getMineY().get())) + .appendText("\n ") + .appendSibling(new TextComponentTranslation("gregtech.machine.miner.minez", this.minerLogic.getMineZ().get())); textList.add(mCoords); } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java index 48d9d2bcef2..179ea3b6ef4 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java +++ b/src/main/java/gregtech/common/metatileentities/multi/steam/MetaTileEntitySteamOven.java @@ -1,6 +1,5 @@ package gregtech.common.metatileentities.multi.steam; - import gregtech.api.capability.impl.SteamMultiWorkable; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.interfaces.IGregTechTileEntity; @@ -30,8 +29,6 @@ public class MetaTileEntitySteamOven extends RecipeMapSteamMultiblockController private static final int MAX_PARALLELS = 8; - private boolean isActive; - public MetaTileEntitySteamOven(ResourceLocation metaTileEntityId) { super(metaTileEntityId, RecipeMaps.FURNACE_RECIPES, CONVERSION_RATE); this.recipeMapWorkable = new SteamMultiWorkable(this, CONVERSION_RATE);