diff options
author | kuba6000 <kuba.123123.6000@gmail.com> | 2023-04-10 21:03:52 +0200 |
---|---|---|
committer | kuba6000 <kuba.123123.6000@gmail.com> | 2023-04-10 21:03:52 +0200 |
commit | 74a9bcc5a0b7e179a71932e7dba88794deeb4c99 (patch) | |
tree | a80901824606cae422be00d026605da912054c06 /src/main/java/kubatech/tileentity | |
parent | 0ecb697d75b25206daf921ecec1c910d6ab77491 (diff) | |
download | GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.tar.gz GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.tar.bz2 GT5-Unofficial-74a9bcc5a0b7e179a71932e7dba88794deeb4c99.zip |
Update spotless formatting
Diffstat (limited to 'src/main/java/kubatech/tileentity')
4 files changed, 1143 insertions, 950 deletions
diff --git a/src/main/java/kubatech/tileentity/TeaAcceptorTile.java b/src/main/java/kubatech/tileentity/TeaAcceptorTile.java index 73bfd46d65..dd7f56f91a 100644 --- a/src/main/java/kubatech/tileentity/TeaAcceptorTile.java +++ b/src/main/java/kubatech/tileentity/TeaAcceptorTile.java @@ -46,7 +46,7 @@ import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget; import com.gtnewhorizons.modularui.common.widget.TextWidget; public class TeaAcceptorTile extends TileEntity - implements IInventory, ITileWithModularUI, KubaBlock.IModularUIProvider { + implements IInventory, ITileWithModularUI, KubaBlock.IModularUIProvider { public TeaAcceptorTile() { super(); @@ -135,7 +135,8 @@ public class TeaAcceptorTile extends TileEntity @Override public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { - return p_70300_1_.getPersistentID().equals(tileOwner); + return p_70300_1_.getPersistentID() + .equals(tileOwner); } @Override @@ -144,15 +145,17 @@ public class TeaAcceptorTile extends TileEntity @Override public void closeInventory() {} - private static final int minDamage = ItemList.BlackTea.get(1).getItemDamage(); - private static final int maxDamage = ItemList.YellowTea.get(1).getItemDamage(); + private static final int minDamage = ItemList.BlackTea.get(1) + .getItemDamage(); + private static final int maxDamage = ItemList.YellowTea.get(1) + .getItemDamage(); @Override public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { if (teaNetwork == null) return false; if (!teaNetwork.canAdd(p_94041_2_.stackSize)) return false; return p_94041_2_.getItem() == ItemLoader.kubaitems && p_94041_2_.getItemDamage() >= minDamage - && p_94041_2_.getItemDamage() <= maxDamage; + && p_94041_2_.getItemDamage() <= maxDamage; } private static final UIInfo<?, ?> UI = KubaBlock.TileEntityUIFactory.apply(ModularUIContainer::new); @@ -167,8 +170,8 @@ public class TeaAcceptorTile extends TileEntity } private static final BiFunction<TextWidget, Integer, Widget.PosProvider> posCenteredHorizontallyProvider = ( - TextWidget widget, Integer y) -> (Widget.PosProvider) (screenSize, window, - parent) -> new Pos2d((window.getSize().width / 2) - (widget.getSize().width / 2), y); + TextWidget widget, Integer y) -> (Widget.PosProvider) (screenSize, window, + parent) -> new Pos2d((window.getSize().width / 2) - (widget.getSize().width / 2), y); @Override public ModularWindow createWindow(UIBuildContext buildContext) { @@ -177,35 +180,33 @@ public class TeaAcceptorTile extends TileEntity EntityPlayer player = buildContext.getPlayer(); AtomicReference<BigInteger> teaAmount = new AtomicReference<>(BigInteger.ZERO); builder.widgets( - posCenteredHorizontally( - 10, - new TextWidget( - new Text("Tea Acceptor").format(EnumChatFormatting.BOLD) - .format(EnumChatFormatting.DARK_RED))), - posCenteredHorizontally(30, new DynamicTextWidget(() -> { - if (player.getPersistentID().equals(tileOwner)) return new Text("[Tea]").color(Color.GREEN.normal); - else return new Text("This is not your block").color(Color.RED.normal); - })), - posCenteredHorizontally( - 40, - (TextWidget) new DynamicTextWidget( - () -> new Text( - StringUtils.applyRainbow( - NEIClientUtils.shiftKey() ? numberFormat.format(teaAmount.get()) - : numberFormatScientific.format(teaAmount.get()), - (int) ((teaAmount.get().longValue() / Math.max(1, averageInput * 10)) - % Integer.MAX_VALUE), - EnumChatFormatting.BOLD.toString())).shadow()).setSynced(false) - .attachSyncer( - new FakeSyncWidget.BigIntegerSyncer( - () -> teaNetwork.teaAmount, - teaAmount::set), - builder)), - posCenteredHorizontally( - 50, - new DynamicTextWidget(() -> new Text("IN: " + averageInput + "/t").color(Color.BLACK.normal))) - .addTooltip( - new Text("Average input from the last 5 seconds").color(Color.GRAY.normal))); + posCenteredHorizontally( + 10, + new TextWidget( + new Text("Tea Acceptor").format(EnumChatFormatting.BOLD) + .format(EnumChatFormatting.DARK_RED))), + posCenteredHorizontally(30, new DynamicTextWidget(() -> { + if (player.getPersistentID() + .equals(tileOwner)) return new Text("[Tea]").color(Color.GREEN.normal); + else return new Text("This is not your block").color(Color.RED.normal); + })), + posCenteredHorizontally( + 40, + (TextWidget) new DynamicTextWidget( + () -> new Text( + StringUtils.applyRainbow( + NEIClientUtils.shiftKey() ? numberFormat.format(teaAmount.get()) + : numberFormatScientific.format(teaAmount.get()), + (int) ((teaAmount.get() + .longValue() / Math.max(1, averageInput * 10)) % Integer.MAX_VALUE), + EnumChatFormatting.BOLD.toString())).shadow()).setSynced(false) + .attachSyncer( + new FakeSyncWidget.BigIntegerSyncer(() -> teaNetwork.teaAmount, teaAmount::set), + builder)), + posCenteredHorizontally( + 50, + new DynamicTextWidget(() -> new Text("IN: " + averageInput + "/t").color(Color.BLACK.normal))) + .addTooltip(new Text("Average input from the last 5 seconds").color(Color.GRAY.normal))); return builder.build(); } } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java index a35c275bcd..8060382053 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java @@ -99,8 +99,8 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_ExtremeExterminationChamber - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeExterminationChamber> - implements CustomTileEntityPacketHandler, ISurvivalConstructable { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeExterminationChamber> + implements CustomTileEntityPacketHandler, ISurvivalConstructable { public static final HashMap<String, MobRecipeLoader.MobRecipe> MobNameToRecipeMap = new HashMap<>(); public static final double DIAMOND_SPIKES_DAMAGE = 9d; @@ -132,36 +132,34 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private static final int CASING_INDEX = 16; private static final String STRUCTURE_PIECE_MAIN = "main"; private static final IStructureDefinition<GT_MetaTileEntity_ExtremeExterminationChamber> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_ExtremeExterminationChamber>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, - { "fgggf", "gsssg", "gsssg", "gsssg", "fgggf" }, - { "CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) - .addElement('c', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0))) - .addElement( - 'C', - buildHatchAdder(GT_MetaTileEntity_ExtremeExterminationChamber.class) - .atLeast(InputBus, OutputBus, OutputHatch, Energy, Maintenance).casingIndex(CASING_INDEX) - .dot(1) - .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0)))) - .addElement( - 'g', - LoaderReference.Bartworks - ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) - : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) - .addElement('f', ofFrame(Materials.Steel)) - .addElement( - 's', - LoaderReference.ExtraUtilities - ? ofBlock(Block.getBlockFromName("ExtraUtilities:spike_base_diamond"), 0) - : isAir()) - .build(); + .<GT_MetaTileEntity_ExtremeExterminationChamber>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, + { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, + { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, { "fgggf", "g---g", "g---g", "g---g", "fgggf" }, + { "fgggf", "gsssg", "gsssg", "gsssg", "fgggf" }, + { "CC~CC", "CCCCC", "CCCCC", "CCCCC", "CCCCC" }, })) + .addElement('c', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0))) + .addElement( + 'C', + buildHatchAdder(GT_MetaTileEntity_ExtremeExterminationChamber.class) + .atLeast(InputBus, OutputBus, OutputHatch, Energy, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings2, 0)))) + .addElement( + 'g', + LoaderReference.Bartworks + ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) + : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) + .addElement('f', ofFrame(Materials.Steel)) + .addElement( + 's', + LoaderReference.ExtraUtilities ? ofBlock(Block.getBlockFromName("ExtraUtilities:spike_base_diamond"), 0) + : isAir()) + .build(); private TileEntity masterStoneRitual = null; private TileEntity tileAltar = null; @@ -191,7 +189,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber mAnimationEnabled = !aNBT.hasKey("mAnimationEnabled") || aNBT.getBoolean("mAnimationEnabled"); mGlassTier = aNBT.getByte("mGlassTier"); mIsProducingInfernalDrops = !aNBT.hasKey("mIsProducingInfernalDrops") - || aNBT.getBoolean("mIsProducingInfernalDrops"); + || aNBT.getBoolean("mIsProducingInfernalDrops"); } @Override @@ -217,35 +215,44 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Powered Spawner").addInfo("Controller block for Extreme Extermination Chamber") - .addInfo(Author).addInfo("Spawns and Exterminates monsters for you") - .addInfo("You have to insert the powered spawner in controller") - .addInfo("Base energy usage: 2,000 EU/t") - .addInfo("Supports perfect OC, minimum time: 20 ticks, after that multiplies the outputs") - .addInfo("Recipe time is based on mob health") - .addInfo("You can additionally put a weapon to the ULV input bus") - .addInfo("It will speed up the process and apply looting level from the weapon (maximum 4 levels)") - .addInfo(EnumChatFormatting.RED + "Enchanting the spikes inside does nothing!") - .addInfo("Also produces 120 Liquid XP per operation").addInfo("If the mob spawns infernal") - .addInfo("it will drain 8 times more power") - .addInfo("You can prevent infernal spawns by shift clicking with a screwdriver") - .addInfo("Note: If the mob has forced infernal spawn, it will do it anyway") - .addInfo("You can enable ritual mode with a screwdriver") - .addInfo("When in ritual mode and Well Of Suffering ritual is built directly on the machine in center") - .addInfo("The mobs will start to buffer and die very slowly by a ritual") - .addInfo("You can disable mob animation with a soldering iron").addInfo(StructureHologram) - .addSeparator().beginStructureBlock(5, 7, 5, true).addController("Front Bottom Center") - .addCasingInfoMin("Solid Steel Machine Casing", 10, false) - .addOtherStructurePart("Borosilicate Glass", "All walls without corners") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addOtherStructurePart("Steel Frame Box", "All vertical corners (except top and bottom)") - .addOtherStructurePart("Diamond spikes", "Inside second layer").addOutputBus("Any bottom casing", 1) - .addOtherStructurePart( - "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), - "Any bottom casing", - 1) - .addOutputHatch("Any bottom casing", 1).addEnergyHatch("Any bottom casing", 1) - .addMaintenanceHatch("Any bottom casing", 1).toolTipFinisher(Tags.MODNAME); + tt.addMachineType("Powered Spawner") + .addInfo("Controller block for Extreme Extermination Chamber") + .addInfo(Author) + .addInfo("Spawns and Exterminates monsters for you") + .addInfo("You have to insert the powered spawner in controller") + .addInfo("Base energy usage: 2,000 EU/t") + .addInfo("Supports perfect OC, minimum time: 20 ticks, after that multiplies the outputs") + .addInfo("Recipe time is based on mob health") + .addInfo("You can additionally put a weapon to the ULV input bus") + .addInfo("It will speed up the process and apply looting level from the weapon (maximum 4 levels)") + .addInfo(EnumChatFormatting.RED + "Enchanting the spikes inside does nothing!") + .addInfo("Also produces 120 Liquid XP per operation") + .addInfo("If the mob spawns infernal") + .addInfo("it will drain 8 times more power") + .addInfo("You can prevent infernal spawns by shift clicking with a screwdriver") + .addInfo("Note: If the mob has forced infernal spawn, it will do it anyway") + .addInfo("You can enable ritual mode with a screwdriver") + .addInfo("When in ritual mode and Well Of Suffering ritual is built directly on the machine in center") + .addInfo("The mobs will start to buffer and die very slowly by a ritual") + .addInfo("You can disable mob animation with a soldering iron") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(5, 7, 5, true) + .addController("Front Bottom Center") + .addCasingInfoMin("Solid Steel Machine Casing", 10, false) + .addOtherStructurePart("Borosilicate Glass", "All walls without corners") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addOtherStructurePart("Steel Frame Box", "All vertical corners (except top and bottom)") + .addOtherStructurePart("Diamond spikes", "Inside second layer") + .addOutputBus("Any bottom casing", 1) + .addOtherStructurePart( + "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), + "Any bottom casing", + 1) + .addOutputHatch("Any bottom casing", 1) + .addEnergyHatch("Any bottom casing", 1) + .addMaintenanceHatch("Any bottom casing", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -266,16 +273,27 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -283,10 +301,12 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @SideOnly(Side.CLIENT) private void setupEntityRenderer(IGregTechTileEntity aBaseMetaTileEntity, int time) { if (entityRenderer == null) { - ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); + ChunkCoordinates coords = this.getBaseMetaTileEntity() + .getCoords(); int[] abc = new int[] { 0, -2, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; xyz[2] += coords.posZ; @@ -355,7 +375,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true; mAnimationEnabled = !mAnimationEnabled; GT_Utility.sendChatToPlayer(aPlayer, "Animations are " + (mAnimationEnabled ? "enabled" : "disabled")); @@ -396,18 +416,18 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } ((IBloodAltar) tileAltar).sacrificialDaggerCall( - 100 * RitualEffectWellOfSuffering.amount - * (effect.canDrainReagent( - event.mrs, - ReagentRegistry.offensaReagent, - ReflectionHelper.getField(effect, "offensaDrain", 3), - true) ? 2 : 1) - * (effect.canDrainReagent( - event.mrs, - ReagentRegistry.tenebraeReagent, - ReflectionHelper.getField(effect, "tennebraeDrain", 5), - true) ? 2 : 1), - true); + 100 * RitualEffectWellOfSuffering.amount + * (effect.canDrainReagent( + event.mrs, + ReagentRegistry.offensaReagent, + ReflectionHelper.getField(effect, "offensaDrain", 3), + true) ? 2 : 1) + * (effect.canDrainReagent( + event.mrs, + ReagentRegistry.tenebraeReagent, + ReflectionHelper.getField(effect, "tennebraeDrain", 5), + true) ? 2 : 1), + true); SoulNetworkHandler.syphonFromNetwork(owner, effect.getCostPerRefresh() * 100); } @@ -434,19 +454,18 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (aStack.getItem() != poweredSpawnerItem) return false; if (aStack.getTagCompound() == null) return false; - String mobType = aStack.getTagCompound().getString("mobType"); + String mobType = aStack.getTagCompound() + .getString("mobType"); if (mobType.isEmpty()) return false; if (mobType.equals("Skeleton") && getBaseMetaTileEntity().getWorld().provider instanceof WorldProviderHell - && rand.nextInt(5) > 0) - mobType = "witherSkeleton"; + && rand.nextInt(5) > 0) mobType = "witherSkeleton"; MobRecipeLoader.MobRecipe recipe = MobNameToRecipeMap.get(mobType); if (recipe == null) return false; - if (!recipe.isPeacefulAllowed - && this.getBaseMetaTileEntity().getWorld().difficultySetting == EnumDifficulty.PEACEFUL) - return false; + if (!recipe.isPeacefulAllowed && this.getBaseMetaTileEntity() + .getWorld().difficultySetting == EnumDifficulty.PEACEFUL) return false; if (isInRitualMode && isRitualValid()) { if (getMaxInputEu() < recipe.mEUt / 4) return false; @@ -471,28 +490,29 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber try { // noinspection unchecked weaponCache.attackDamage = ((Multimap<String, AttributeModifier>) lootingHolder - .getAttributeModifiers()) - .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()).stream() - .mapToDouble( - attr -> attr.getAmount() + (double) EnchantmentHelper - .func_152377_a(lootingHolder, EnumCreatureAttribute.UNDEFINED)) - .sum(); + .getAttributeModifiers()) + .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()) + .stream() + .mapToDouble( + attr -> attr.getAmount() + (double) EnchantmentHelper + .func_152377_a(lootingHolder, EnumCreatureAttribute.UNDEFINED)) + .sum(); } catch (Exception ex) { ex.printStackTrace(); } weaponCache.isValid = true; weaponCache.looting = Math - .min(4, EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingHolder)); + .min(4, EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingHolder)); weaponCache.id = ItemID.create_NoCopy(lootingHolder, true, true); } if (weaponCache.isValid) attackDamage += weaponCache.attackDamage; this.mOutputItems = recipe.generateOutputs( - rand, - this, - attackDamage, - weaponCache.isValid ? weaponCache.looting : 0, - mIsProducingInfernalDrops); + rand, + this, + attackDamage, + weaponCache.isValid ? weaponCache.looting : 0, + mIsProducingInfernalDrops); this.mOutputFluids = new FluidStack[] { FluidRegistry.getFluidStack("xpjuice", 120) }; int times = this.calculatePerfectOverclock(this.lEUt, this.mMaxProgresstime); // noinspection ConstantConditions @@ -529,8 +549,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private boolean isRitualValid() { if (!isInRitualMode) return false; if (masterStoneRitual == null) return false; - if (masterStoneRitual.isInvalid() - || !(((TEMasterStone) masterStoneRitual).getCurrentRitual().equals(WellOfSufferingRitualName))) { + if (masterStoneRitual.isInvalid() || !(((TEMasterStone) masterStoneRitual).getCurrentRitual() + .equals(WellOfSufferingRitualName))) { masterStoneRitual = null; return false; } @@ -539,16 +559,20 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private boolean connectToRitual() { if (!LoaderReference.BloodMagic) return false; - ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); + ChunkCoordinates coords = this.getBaseMetaTileEntity() + .getCoords(); int[] abc = new int[] { 0, -8, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; xyz[2] += coords.posZ; - TileEntity te = this.getBaseMetaTileEntity().getTileEntity(xyz[0], xyz[1], xyz[2]); + TileEntity te = this.getBaseMetaTileEntity() + .getTileEntity(xyz[0], xyz[1], xyz[2]); if (te instanceof TEMasterStone) { - if (((TEMasterStone) te).getCurrentRitual().equals(WellOfSufferingRitualName)) { + if (((TEMasterStone) te).getCurrentRitual() + .equals(WellOfSufferingRitualName)) { masterStoneRitual = te; return true; } @@ -561,8 +585,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber mGlassTier = 0; if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 6, 0)) return false; if (mCasing < 10 || mMaintenanceHatches.size() != 1 - || mEnergyHatches.size() == 0 - || !(mInputBusses.size() == 0 || (mInputBusses.size() == 1 && mInputBusses.get(0).mTier == 0))) + || mEnergyHatches.size() == 0 + || !(mInputBusses.size() == 0 || (mInputBusses.size() == 1 && mInputBusses.get(0).mTier == 0))) return false; if (mGlassTier < 8) for (GT_MetaTileEntity_Hatch_Energy hatch : mEnergyHatches) if (hatch.mTier > mGlassTier) return false; @@ -575,20 +599,20 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); info.add("Animations: " + EnumChatFormatting.YELLOW + (mAnimationEnabled ? "Enabled" : "Disabled")); info.add( - "Is allowed to produce infernal drops: " + EnumChatFormatting.YELLOW - + (mIsProducingInfernalDrops ? "Yes" : "No")); + "Is allowed to produce infernal drops: " + EnumChatFormatting.YELLOW + + (mIsProducingInfernalDrops ? "Yes" : "No")); info.add("Is in ritual mode: " + EnumChatFormatting.YELLOW + (isInRitualMode ? "Yes" : "No")); if (isInRitualMode) info.add( - "Is connected to ritual: " - + (isRitualValid() ? EnumChatFormatting.GREEN + "Yes" : EnumChatFormatting.RED + "No")); + "Is connected to ritual: " + + (isRitualValid() ? EnumChatFormatting.GREEN + "Yes" : EnumChatFormatting.RED + "No")); else { info.add("Inserted weapon: " + EnumChatFormatting.YELLOW + (weaponCache.isValid ? "Yes" : "No")); if (weaponCache.isValid) { info.add("Weapon attack damage: " + EnumChatFormatting.YELLOW + weaponCache.attackDamage); info.add("Weapon looting level: " + EnumChatFormatting.YELLOW + weaponCache.looting); info.add( - "Total attack damage: " + EnumChatFormatting.YELLOW - + (DIAMOND_SPIKES_DAMAGE + weaponCache.attackDamage)); + "Total attack damage: " + EnumChatFormatting.YELLOW + + (DIAMOND_SPIKES_DAMAGE + weaponCache.attackDamage)); } else info.add("Total attack damage: " + EnumChatFormatting.YELLOW + DIAMOND_SPIKES_DAMAGE); } return info.toArray(new String[0]); @@ -611,44 +635,51 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1) - .setFilter(stack -> stack.getItem() == poweredSpawnerItem); + .setFilter(stack -> stack.getItem() == poweredSpawnerItem); DynamicPositionedColumn configurationElements = new DynamicPositionedColumn(); addConfigurationWidgets(configurationElements, buildContext, inventorySlot); builder.widget( - new DynamicPositionedColumn().setSynced(false).widget(inventorySlot).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); - - if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget(configurationElements.setEnabled(widget -> !getBaseMetaTileEntity().isActive())) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .addTooltip( - new Text("Please stop the machine to configure it") - .color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())) - .setPos(151, 4)); + new DynamicPositionedColumn().setSynced(false) + .widget(inventorySlot) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); + + if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget(configurationElements.setEnabled(widget -> !getBaseMetaTileEntity().isActive())) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .addTooltip(new Text("Please stop the machine to configure it").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())) + .setPos(151, 4)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); drawTexts(screenElements, inventorySlot); @@ -656,7 +687,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } private void addConfigurationWidgets(DynamicPositionedColumn configurationElements, UIBuildContext buildContext, - SlotWidget inventorySlot) { + SlotWidget inventorySlot) { configurationElements.setSynced(false); configurationElements.widget(new CycleButtonWidget().setToggle(() -> isInRitualMode, v -> { if (this.mMaxProgresstime > 0) { @@ -675,7 +706,10 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Successfully connected to the ritual"); else GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't connect to the ritual"); } - }).setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18).addTooltip("Ritual mode")); + }) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Ritual mode")); configurationElements.widget(new CycleButtonWidget().setToggle(() -> mIsProducingInfernalDrops, v -> { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); @@ -686,29 +720,33 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; if (!mIsProducingInfernalDrops) GT_Utility - .sendChatToPlayer(buildContext.getPlayer(), "Mobs will now be prevented from spawning infernal"); + .sendChatToPlayer(buildContext.getPlayer(), "Mobs will now be prevented from spawning infernal"); else GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Mobs can spawn infernal now"); - }).setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Is allowed to spawn infernal mobs") - .addTooltip(new Text("Does not affect mobs that are always infernal !").color(Color.GRAY.normal))); + }) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Is allowed to spawn infernal mobs") + .addTooltip(new Text("Does not affect mobs that are always infernal !").color(Color.GRAY.normal))); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements.widget(new DynamicTextWidget(() -> { ItemStack aStack = mInventory[1]; if (aStack == null) return new Text("Insert Powered Spawner").color(Color.RED.dark(3)); @@ -717,51 +755,53 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (aStack.getItem() != poweredSpawnerItem) return invalid; if (aStack.getTagCompound() == null) return invalid; - String mobType = aStack.getTagCompound().getString("mobType"); + String mobType = aStack.getTagCompound() + .getString("mobType"); if (mobType.isEmpty()) return invalid; if (!MobNameToRecipeMap.containsKey(mobType)) return invalid; return new Text(StatCollector.translateToLocal("entity." + mobType + ".name")) - .color(Color.GREEN.dark(3)); + .color(Color.GREEN.dark(3)); } }).setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } private static class EECFakePlayer extends FakePlayer { @@ -771,10 +811,11 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber public EECFakePlayer(GT_MetaTileEntity_ExtremeExterminationChamber mte) { super( - (WorldServer) mte.getBaseMetaTileEntity().getWorld(), - new GameProfile( - UUID.nameUUIDFromBytes("[EEC Fake Player]".getBytes(StandardCharsets.UTF_8)), - "[EEC Fake Player]")); + (WorldServer) mte.getBaseMetaTileEntity() + .getWorld(), + new GameProfile( + UUID.nameUUIDFromBytes("[EEC Fake Player]".getBytes(StandardCharsets.UTF_8)), + "[EEC Fake Player]")); this.mte = mte; } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java index 00cfd2f0cc..10ba6ce88e 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java @@ -97,7 +97,7 @@ import ic2.core.crop.TileEntityCrop; @SuppressWarnings("unused") public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> { private static final boolean debug = false; private static final int EIG_MATH_VERSION = 0; @@ -117,57 +117,48 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse private static final Item forestryfertilizer = GameRegistry.findItem("Forestry", "fertilizerCompound"); private static final Fluid weedex = Materials.WeedEX9000.mFluid; private static final IStructureDefinition<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_ExtremeIndustrialGreenhouse>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, - { "ccccc", "clllc", "clllc", "clllc", "ccccc" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ccccc", "cdddc", "cdwdc", "cdddc", "ccccc" }, - { "cc~cc", "cCCCc", "cCCCc", "cCCCc", "ccccc" }, })) - .addElement( - 'c', - ofChain( - onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addEnergyInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addMaintenanceToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addOutputToMachineList, - CASING_INDEX, - 1))) - .addElement('C', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1))) - .addElement( - 'l', - LoaderReference.ProjRedIllumination - ? ofBlock(Block.getBlockFromName("ProjRed|Illumination:projectred.illumination.lamp"), 10) - : ofChain(ofBlock(Blocks.redstone_lamp, 0), ofBlock(Blocks.lit_redstone_lamp, 0))) - .addElement( - 'g', - LoaderReference.Bartworks ? BorosilicateGlass.ofBoroGlass( - (byte) 0, - (byte) 1, - Byte.MAX_VALUE, - (te, t) -> te.glasTier = t, - te -> te.glasTier) : onElementPass(t -> t.glasTier = 100, ofBlock(Blocks.glass, 0))) - .addElement( - 'd', - ofBlock( - LoaderReference.RandomThings ? Block.getBlockFromName("RandomThings:fertilizedDirt_tilled") - : Blocks.farmland, - 0)) - .addElement('w', ofBlock(Blocks.water, 0)).build(); + .<GT_MetaTileEntity_ExtremeIndustrialGreenhouse>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, + { "ccccc", "clllc", "clllc", "clllc", "ccccc" }, { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, + { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, { "ccccc", "cdddc", "cdwdc", "cdddc", "ccccc" }, + { "cc~cc", "cCCCc", "cCCCc", "cCCCc", "ccccc" }, })) + .addElement( + 'c', + ofChain( + onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), + ofHatchAdder( + GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addEnergyInputToMachineList, + CASING_INDEX, + 1), + ofHatchAdder( + GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addMaintenanceToMachineList, + CASING_INDEX, + 1), + ofHatchAdder(GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addInputToMachineList, CASING_INDEX, 1), + ofHatchAdder(GT_MetaTileEntity_ExtremeIndustrialGreenhouse::addOutputToMachineList, CASING_INDEX, 1))) + .addElement('C', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1))) + .addElement( + 'l', + LoaderReference.ProjRedIllumination + ? ofBlock(Block.getBlockFromName("ProjRed|Illumination:projectred.illumination.lamp"), 10) + : ofChain(ofBlock(Blocks.redstone_lamp, 0), ofBlock(Blocks.lit_redstone_lamp, 0))) + .addElement( + 'g', + LoaderReference.Bartworks + ? BorosilicateGlass + .ofBoroGlass((byte) 0, (byte) 1, Byte.MAX_VALUE, (te, t) -> te.glasTier = t, te -> te.glasTier) + : onElementPass(t -> t.glasTier = 100, ofBlock(Blocks.glass, 0))) + .addElement( + 'd', + ofBlock( + LoaderReference.RandomThings ? Block.getBlockFromName("RandomThings:fertilizedDirt_tilled") + : Blocks.farmland, + 0)) + .addElement('w', ofBlock(Blocks.water, 0)) + .build(); public GT_MetaTileEntity_ExtremeIndustrialGreenhouse(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -198,15 +189,15 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse this.setupphase++; if (this.setupphase == 3) this.setupphase = 0; GT_Utility.sendChatToPlayer( - aPlayer, - "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." - : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); + aPlayer, + "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." + : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); } } @Override public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { + float aZ) { isNoHumidity = !isNoHumidity; GT_Utility.sendChatToPlayer(aPlayer, "Give incoming crops no humidity " + isNoHumidity); return true; @@ -230,48 +221,58 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Crop Farm").addInfo("Controller block for the Extreme Industrial Greenhouse").addInfo(Author) - .addInfo("Grow your crops like a chad !").addInfo("Use screwdriver to enable/change/disable setup mode") - .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") - .addInfo("Use wire cutters to give incoming IC2 crops 0 humidity") - .addInfo("Uses 1000L of water per crop per operation") - .addInfo("If there are >= 1000 crops -> Uses 1L of Weed-EX 9000 per crop per second") - .addInfo("Otherwise, around 1% of crops will die each operation") - .addInfo("You can insert fertilizer each operation to get more drops (max +400%)") - .addInfo("-------------------- SETUP MODE --------------------").addInfo("Does not take power") - .addInfo("There are two modes: input / output") - .addInfo("Input mode: machine will take seeds from input bus and plant them") - .addInfo("[IC2] You need to also input block that is required under the crop") - .addInfo("Output mode: machine will take planted seeds and output them") - .addInfo("-------------------- NORMAL CROPS --------------------") - .addInfo("Minimal tier: " + voltageTooltipFormatted(4)).addInfo("Starting with 1 slot") - .addInfo("Every slot gives 64 crops") - .addInfo("Every tier past " + voltageTooltipFormatted(4) + ", slots are multiplied by 2") - .addInfo("Base process time: 5 sec") - .addInfo( - "Process time is divided by number of tiers past " + voltageTooltipFormatted(3) - + " (Minimum 1 sec)") - .addInfo("All crops are grown at the end of the operation") - .addInfo("Will automatically craft seeds if they are not dropped") - .addInfo("1 Fertilizer per 1 crop +200%") - .addInfo("-------------------- IC2 CROPS --------------------") - .addInfo("Minimal tier: " + voltageTooltipFormatted(6)) - .addInfo("Need " + voltageTooltipFormatted(6) + " glass tier").addInfo("Starting with 4 slots") - .addInfo("Every slot gives 1 crop") - .addInfo("Every tier past " + voltageTooltipFormatted(6) + ", slots are multiplied by 4") - .addInfo("Process time: 5 sec").addInfo("All crops are accelerated by x32 times") - .addInfo("1 Fertilizer per 1 crop +10%").addInfo(StructureHologram).addSeparator() - .beginStructureBlock(5, 6, 5, false).addController("Front bottom center") - .addCasingInfoMin("Clean Stainless Steel Casings", 70, false) - .addOtherStructurePart("Borosilicate Glass", "Hollow two middle layers") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addStructureInfo("The dirt is from RandomThings, must be tilled") - .addStructureInfo("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted") - .addMaintenanceHatch("Any casing (Except inner bottom ones)", 1) - .addInputBus("Any casing (Except inner bottom ones)", 1) - .addOutputBus("Any casing (Except inner bottom ones)", 1) - .addInputHatch("Any casing (Except inner bottom ones)", 1) - .addEnergyHatch("Any casing (Except inner bottom ones)", 1).toolTipFinisher(Tags.MODNAME); + tt.addMachineType("Crop Farm") + .addInfo("Controller block for the Extreme Industrial Greenhouse") + .addInfo(Author) + .addInfo("Grow your crops like a chad !") + .addInfo("Use screwdriver to enable/change/disable setup mode") + .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") + .addInfo("Use wire cutters to give incoming IC2 crops 0 humidity") + .addInfo("Uses 1000L of water per crop per operation") + .addInfo("If there are >= 1000 crops -> Uses 1L of Weed-EX 9000 per crop per second") + .addInfo("Otherwise, around 1% of crops will die each operation") + .addInfo("You can insert fertilizer each operation to get more drops (max +400%)") + .addInfo("-------------------- SETUP MODE --------------------") + .addInfo("Does not take power") + .addInfo("There are two modes: input / output") + .addInfo("Input mode: machine will take seeds from input bus and plant them") + .addInfo("[IC2] You need to also input block that is required under the crop") + .addInfo("Output mode: machine will take planted seeds and output them") + .addInfo("-------------------- NORMAL CROPS --------------------") + .addInfo("Minimal tier: " + voltageTooltipFormatted(4)) + .addInfo("Starting with 1 slot") + .addInfo("Every slot gives 64 crops") + .addInfo("Every tier past " + voltageTooltipFormatted(4) + ", slots are multiplied by 2") + .addInfo("Base process time: 5 sec") + .addInfo( + "Process time is divided by number of tiers past " + voltageTooltipFormatted(3) + " (Minimum 1 sec)") + .addInfo("All crops are grown at the end of the operation") + .addInfo("Will automatically craft seeds if they are not dropped") + .addInfo("1 Fertilizer per 1 crop +200%") + .addInfo("-------------------- IC2 CROPS --------------------") + .addInfo("Minimal tier: " + voltageTooltipFormatted(6)) + .addInfo("Need " + voltageTooltipFormatted(6) + " glass tier") + .addInfo("Starting with 4 slots") + .addInfo("Every slot gives 1 crop") + .addInfo("Every tier past " + voltageTooltipFormatted(6) + ", slots are multiplied by 4") + .addInfo("Process time: 5 sec") + .addInfo("All crops are accelerated by x32 times") + .addInfo("1 Fertilizer per 1 crop +10%") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(5, 6, 5, false) + .addController("Front bottom center") + .addCasingInfoMin("Clean Stainless Steel Casings", 70, false) + .addOtherStructurePart("Borosilicate Glass", "Hollow two middle layers") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addStructureInfo("The dirt is from RandomThings, must be tilled") + .addStructureInfo("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted") + .addMaintenanceHatch("Any casing (Except inner bottom ones)", 1) + .addInputBus("Any casing (Except inner bottom ones)", 1) + .addOutputBus("Any casing (Except inner bottom ones)", 1) + .addInputHatch("Any casing (Except inner bottom ones)", 1) + .addEnergyHatch("Any casing (Except inner bottom ones)", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -292,7 +293,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse aNBT.setBoolean("isIC2Mode", isIC2Mode); aNBT.setBoolean("isNoHumidity", isNoHumidity); aNBT.setInteger("mStorageSize", mStorage.size()); - for (int i = 0; i < mStorage.size(); i++) aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound()); + for (int i = 0; i < mStorage.size(); i++) aNBT.setTag( + "mStorage." + i, + mStorage.get(i) + .toNBTTagCompound()); } @Override @@ -320,7 +324,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (aBaseMetaTileEntity.isActive() && aTick % 40 == 0) { int[] abc = new int[] { 0, -2, 2 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += aBaseMetaTileEntity.getXCoord(); xyz[1] += aBaseMetaTileEntity.getYCoord(); xyz[2] += aBaseMetaTileEntity.getZCoord(); @@ -445,8 +450,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse ArrayList<ItemStack> inputs = getStoredInputs(); for (ItemStack i : inputs) { if ((i.getItem() == Items.dye && i.getItemDamage() == 15) - || (forestryfertilizer != null && (i.getItem() == forestryfertilizer)) - || (GT_Utility.areStacksEqual(i, Ic2Items.fertilizer))) { + || (forestryfertilizer != null && (i.getItem() == forestryfertilizer)) + || (GT_Utility.areStacksEqual(i, Ic2Items.fertilizer))) { int used = Math.min(i.stackSize, maxboost - boost); i.stackSize -= used; boost += used; @@ -460,14 +465,16 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (glasTier < 6) return false; this.mMaxProgresstime = 100; List<ItemStack> outputs = new ArrayList<>(); - for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) - outputs.addAll(mStorage.get(i).getIC2Drops(((double) this.mMaxProgresstime * 32d) * multiplier)); + for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) outputs.addAll( + mStorage.get(i) + .getIC2Drops(((double) this.mMaxProgresstime * 32d) * multiplier)); this.mOutputItems = outputs.toArray(new ItemStack[0]); } else { this.mMaxProgresstime = Math.max(20, 100 / (tier - 3)); // Min 1 s List<ItemStack> outputs = new ArrayList<>(); for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) { - for (ItemStack drop : mStorage.get(i).getDrops()) { + for (ItemStack drop : mStorage.get(i) + .getDrops()) { ItemStack s = drop.copy(); s.stackSize = (int) ((double) s.stackSize * multiplier); outputs.add(s); @@ -518,21 +525,25 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } private static final UIInfo<?, ?> GreenhouseUI = createKTMetaTileEntityUI( - KT_ModulaUIContainer_ExtremeIndustrialGreenhouse::new); + KT_ModulaUIContainer_ExtremeIndustrialGreenhouse::new); @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; GreenhouseUI.open( - aPlayer, - aBaseMetaTileEntity.getWorld(), - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + aPlayer, + aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); return true; } @@ -541,7 +552,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse final WeakReference<GT_MetaTileEntity_ExtremeIndustrialGreenhouse> parent; public KT_ModulaUIContainer_ExtremeIndustrialGreenhouse(ModularUIContext context, ModularWindow mainWindow, - GT_MetaTileEntity_ExtremeIndustrialGreenhouse mte) { + GT_MetaTileEntity_ExtremeIndustrialGreenhouse mte) { super(context, mainWindow); parent = new WeakReference<>(mte); } @@ -576,8 +587,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); buildContext.addSyncedWindow(CONFIGURATION_WINDOW_ID, this::createConfigurationWindow); EntityPlayer player = buildContext.getPlayer(); @@ -585,33 +598,32 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse // Slot is not needed builder.widget( - new DynamicPositionedColumn().setSynced(false).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); + new DynamicPositionedColumn().setSynced(false) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); - if (!(player instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(player, tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget( - new ButtonWidget() - .setOnClick( - (clickData, widget) -> { - if (!widget.isClient()) - widget.getContext().openSyncedWindow(CONFIGURATION_WINDOW_ID); - }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_CYCLIC) - .addTooltip("Configuration").setSize(18, 18)) - .setPos(151, 4)); + if (!(player instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(player, tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> { + if (!widget.isClient()) widget.getContext() + .openSyncedWindow(CONFIGURATION_WINDOW_ID); + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .addTooltip("Configuration") + .setSize(18, 18)) + .setPos(151, 4)); ChangeableWidget cropsContainer = new ChangeableWidget(() -> createCropsContainerWidget(player)); @@ -627,30 +639,36 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse mMaxSlots = i; cropsContainer.notifyChangeNoSync(); } - }), builder).attachSyncer( + }), builder) + .attachSyncer( new FakeSyncWidget.ListSyncer<>( - () -> mStorage.stream().map(s -> s.input).collect(Collectors.toList()), - l -> { - drawables.clear(); - drawables.addAll(l); - if (cropsContainer.getChildren().size() > 0) IWidgetParent.forEachByLayer( - (IWidgetParent) cropsContainer.getChildren().get(0), - Widget::notifyTooltipChange); - }, - (buffer, i) -> { - try { - buffer.writeItemStackToBuffer(i); - } catch (IOException e) { - throw new RuntimeException(e); - } - }, - buffer -> { - try { - return buffer.readItemStackFromBuffer(); - } catch (IOException e) { - throw new RuntimeException(e); - } - }), + () -> mStorage.stream() + .map(s -> s.input) + .collect(Collectors.toList()), + l -> { + drawables.clear(); + drawables.addAll(l); + if (cropsContainer.getChildren() + .size() > 0) + IWidgetParent.forEachByLayer( + (IWidgetParent) cropsContainer.getChildren() + .get(0), + Widget::notifyTooltipChange); + }, + (buffer, i) -> { + try { + buffer.writeItemStackToBuffer(i); + } catch (IOException e) { + throw new RuntimeException(e); + } + }, + buffer -> { + try { + return buffer.readItemStackFromBuffer(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }), builder)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); @@ -674,8 +692,8 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (input != null) { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - EnumChatFormatting.RED + "Can't replace/insert while running !"); + player, + EnumChatFormatting.RED + "Can't replace/insert while running !"); return; } if (addCrop(input, -1, true)) { @@ -718,231 +736,262 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse addOutput(removed.input); GT_Utility.sendChatToPlayer(player, "Crop ejected !"); - }).setBackground( - () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet().getItemSlot(), - new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) - .withFixedSize(16, 16, 1, 1), - new Text(drawables.size() > ID ? String.valueOf(drawables.get(ID).stackSize) : "") - .color(Color.WHITE.normal).shadow().alignment(Alignment.BottomRight) }) - .dynamicTooltip(() -> { - if (drawables.size() > ID) return Arrays.asList( - drawables.get(ID).getDisplayName(), - EnumChatFormatting.GRAY + "Left click to eject into input bus", - EnumChatFormatting.GRAY + "Right click to get into mouse", - EnumChatFormatting.GRAY + "Shift click to get into inventory", - EnumChatFormatting.GRAY + "Click with other crop in mouse to replace"); - return Collections.emptyList(); - }).setSize(18, 18)); + }) + .setBackground( + () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet() + .getItemSlot(), + new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) + .withFixedSize(16, 16, 1, 1), + new Text(drawables.size() > ID ? String.valueOf(drawables.get(ID).stackSize) : "") + .color(Color.WHITE.normal) + .shadow() + .alignment(Alignment.BottomRight) }) + .dynamicTooltip(() -> { + if (drawables.size() > ID) return Arrays.asList( + drawables.get(ID) + .getDisplayName(), + EnumChatFormatting.GRAY + "Left click to eject into input bus", + EnumChatFormatting.GRAY + "Right click to get into mouse", + EnumChatFormatting.GRAY + "Shift click to get into inventory", + EnumChatFormatting.GRAY + "Click with other crop in mouse to replace"); + return Collections.emptyList(); + }) + .setSize(18, 18)); } cropsContainer.widget(row.setPos(0, i * 18)); } - return cropsContainer.setPos(10, 16).setSize(128, 60); + return cropsContainer.setPos(10, 16) + .setSize(128, 60); } protected ModularWindow createConfigurationWindow(final EntityPlayer player) { ModularWindow.Builder builder = ModularWindow.builder(200, 100); builder.setBackground(ModularUITextures.VANILLA_BACKGROUND); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC).setPos(5, 5).setSize(16, 16)) - .widget(new TextWidget("Configuration").setPos(25, 9)) - .widget(ButtonWidget.closeWindowButton(true).setPos(185, 3)) - .widget( - new Column().widget( - new CycleButtonWidget().setLength(3).setGetter(() -> setupphase).setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "You can't enable/disable setup if the machine is working!"); - return; - } - this.setupphase = val; + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setPos(5, 5) + .setSize(16, 16)) + .widget(new TextWidget("Configuration").setPos(25, 9)) + .widget( + ButtonWidget.closeWindowButton(true) + .setPos(185, 3)) + .widget( + new Column().widget( + new CycleButtonWidget().setLength(3) + .setGetter(() -> setupphase) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer( + player, + "You can't enable/disable setup if the machine is working!"); + return; + } + this.setupphase = val; + GT_Utility.sendChatToPlayer( + player, + "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." + : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); + }) + .addTooltip(0, new Text("Operating").color(Color.GREEN.dark(3))) + .addTooltip(1, new Text("Input").color(Color.YELLOW.dark(3))) + .addTooltip(2, new Text("Output").color(Color.YELLOW.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Operating").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : i == 1 ? new Text("Input").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Output").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Setup mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> isIC2Mode ? 1 : 0) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." - : (this.setupphase == 2 ? "setup mode (output)." - : "normal operation."))); - }).addTooltip(0, new Text("Operating").color(Color.GREEN.dark(3))) - .addTooltip(1, new Text("Input").color(Color.YELLOW.dark(3))) - .addTooltip(2, new Text("Output").color(Color.YELLOW.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), - i == 0 ? new Text("Operating").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : i == 1 ? new Text("Input").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Output").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Setup mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> isIC2Mode ? 1 : 0) - .setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "You can't change IC2 mode if the machine is working!"); - return; - } - if (!mStorage.isEmpty()) { - GT_Utility.sendChatToPlayer( - player, - "You can't change IC2 mode if there are seeds inside!"); - return; - } - this.isIC2Mode = val == 1; - GT_Utility.sendChatToPlayer( - player, - "IC2 mode is now " - + (this.isIC2Mode ? "enabled" : "disabled.")); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Disabled").color(Color.RED.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Enabled").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("IC2 mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> isNoHumidity ? 1 : 0) - .setSetter(val -> { - if (!(player instanceof EntityPlayerMP)) return; - isNoHumidity = val == 1; - GT_Utility.sendChatToPlayer( - player, - "Give incoming crops no humidity " + isNoHumidity); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Disabled").color(Color.RED.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Enabled").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("No Humidity mode")) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(10, 30)) - .widget( - new Column().widget(new TextWidget("Setup mode").setSize(100, 18)) - .widget(new TextWidget("IC2 mode").setSize(100, 18)) - .widget(new TextWidget("No Humidity mode").setSize(100, 18)) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(80, 30)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .setPos(10, 30) - .addTooltip( - new Text("Can't change configuration when running !").color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())); + player, + "You can't change IC2 mode if the machine is working!"); + return; + } + if (!mStorage.isEmpty()) { + GT_Utility.sendChatToPlayer( + player, + "You can't change IC2 mode if there are seeds inside!"); + return; + } + this.isIC2Mode = val == 1; + GT_Utility.sendChatToPlayer( + player, + "IC2 mode is now " + (this.isIC2Mode ? "enabled" : "disabled.")); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Disabled").color(Color.RED.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Enabled").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("IC2 mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> isNoHumidity ? 1 : 0) + .setSetter(val -> { + if (!(player instanceof EntityPlayerMP)) return; + isNoHumidity = val == 1; + GT_Utility.sendChatToPlayer(player, "Give incoming crops no humidity " + isNoHumidity); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Disabled").color(Color.RED.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Enabled").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("No Humidity mode")) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(10, 30)) + .widget( + new Column().widget(new TextWidget("Setup mode").setSize(100, 18)) + .widget(new TextWidget("IC2 mode").setSize(100, 18)) + .widget(new TextWidget("No Humidity mode").setSize(100, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(80, 30)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .setPos(10, 30) + .addTooltip(new Text("Can't change configuration when running !").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())); return builder.build(); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } @Override public String[] getInfoData() { List<String> info = new ArrayList<>( - Arrays.asList( - "Running in mode: " + EnumChatFormatting.GREEN - + (setupphase == 0 ? (isIC2Mode ? "IC2 crops" : "Normal crops") - : ("Setup mode " + (setupphase == 1 ? "(input)" : "(output)"))) - + EnumChatFormatting.RESET, - "Uses " + waterusage + "L/operation of water", - "Uses " + weedexusage + "L/second of Weed-EX 9000", - "Max slots: " + EnumChatFormatting.GREEN + this.mMaxSlots + EnumChatFormatting.RESET, - "Used slots: " - + ((mStorage.size() > mMaxSlots) ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) - + this.mStorage.size() - + EnumChatFormatting.RESET)); + Arrays.asList( + "Running in mode: " + EnumChatFormatting.GREEN + + (setupphase == 0 ? (isIC2Mode ? "IC2 crops" : "Normal crops") + : ("Setup mode " + (setupphase == 1 ? "(input)" : "(output)"))) + + EnumChatFormatting.RESET, + "Uses " + waterusage + "L/operation of water", + "Uses " + weedexusage + "L/second of Weed-EX 9000", + "Max slots: " + EnumChatFormatting.GREEN + this.mMaxSlots + EnumChatFormatting.RESET, + "Used slots: " + ((mStorage.size() > mMaxSlots) ? EnumChatFormatting.RED : EnumChatFormatting.GREEN) + + this.mStorage.size() + + EnumChatFormatting.RESET)); HashMap<String, Integer> storageList = new HashMap<>(); for (GreenHouseSlot greenHouseSlot : mStorage) { if (!greenHouseSlot.isValid) continue; StringBuilder a = new StringBuilder( - EnumChatFormatting.GREEN + "x" - + greenHouseSlot.input.stackSize - + " " - + greenHouseSlot.input.getDisplayName()); + EnumChatFormatting.GREEN + "x" + + greenHouseSlot.input.stackSize + + " " + + greenHouseSlot.input.getDisplayName()); if (this.isIC2Mode) { - a.append(" | Humidity: ").append(greenHouseSlot.noHumidity ? 0 : 12); + a.append(" | Humidity: ") + .append(greenHouseSlot.noHumidity ? 0 : 12); } a.append(EnumChatFormatting.RESET); storageList.merge(a.toString(), 1, Integer::sum); } storageList.forEach((k, v) -> info.add("x" + v + " " + k)); - if (mStorage.size() > mMaxSlots) info.add( - EnumChatFormatting.DARK_RED + "There are too many crops inside to run !" + EnumChatFormatting.RESET); + if (mStorage.size() > mMaxSlots) info + .add(EnumChatFormatting.DARK_RED + "There are too many crops inside to run !" + EnumChatFormatting.RESET); info.addAll(Arrays.asList(super.getInfoData())); return info.toArray(new String[0]); } @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -952,7 +1001,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse private boolean addCrop(ItemStack input, int slot, boolean simulate) { if (!isIC2Mode && !simulate) for (GreenHouseSlot g : mStorage) if (g.input.stackSize < 64 && GT_Utility.areStacksEqual(g.input, input)) { - g.addAll(this.getBaseMetaTileEntity().getWorld(), input); + g.addAll( + this.getBaseMetaTileEntity() + .getWorld(), + input); if (input.stackSize == 0) return true; } GreenHouseSlot h = new GreenHouseSlot(this, simulate ? input.copy() : input, isIC2Mode, isNoHumidity); @@ -1002,22 +1054,33 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse aNBT.setInteger("crop", Block.getIdFromBlock(crop)); if (customDrops != null && customDrops.size() > 0) { aNBT.setInteger("customDropsCount", customDrops.size()); - for (int i = 0; i < customDrops.size(); i++) - aNBT.setTag("customDrop." + i, customDrops.get(i).writeToNBT(new NBTTagCompound())); + for (int i = 0; i < customDrops.size(); i++) aNBT.setTag( + "customDrop." + i, + customDrops.get(i) + .writeToNBT(new NBTTagCompound())); } aNBT.setInteger("dropscount", drops.size()); - for (int i = 0; i < drops.size(); i++) - aNBT.setTag("drop." + i, drops.get(i).writeToNBT(new NBTTagCompound())); + for (int i = 0; i < drops.size(); i++) aNBT.setTag( + "drop." + i, + drops.get(i) + .writeToNBT(new NBTTagCompound())); aNBT.setInteger("optimalgrowth", optimalgrowth); aNBT.setBoolean("needsreplanting", needsreplanting); } else { if (undercrop != null) aNBT.setTag("undercrop", undercrop.writeToNBT(new NBTTagCompound())); aNBT.setInteger("generationscount", generations.size()); for (int i = 0; i < generations.size(); i++) { - aNBT.setInteger("generation." + i + ".count", generations.get(i).size()); - for (int j = 0; j < generations.get(i).size(); j++) aNBT.setTag( + aNBT.setInteger( + "generation." + i + ".count", + generations.get(i) + .size()); + for (int j = 0; j < generations.get(i) + .size(); j++) + aNBT.setTag( "generation." + i + "." + j, - generations.get(i).get(j).writeToNBT(new NBTTagCompound())); + generations.get(i) + .get(j) + .writeToNBT(new NBTTagCompound())); } aNBT.setInteger("growthticks", growthticks); aNBT.setBoolean("noHumidity", noHumidity); @@ -1051,7 +1114,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse for (int i = 0; i < aNBT.getInteger("generationscount"); i++) { generations.add(new ArrayList<>()); for (int j = 0; j < aNBT.getInteger("generation." + i + ".count"); j++) generations.get(i) - .add(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("generation." + i + "." + j))); + .add(ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("generation." + i + "." + j))); } growthticks = aNBT.getInteger("growthticks"); noHumidity = aNBT.getBoolean("noHumidity"); @@ -1073,10 +1136,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse if (recipe != null) return true; out: for (ItemStack drop : drops) { recipeInput = drop; - for (int j = 0; j < CraftingManager.getInstance().getRecipeList().size(); j++) { - recipe = (IRecipe) CraftingManager.getInstance().getRecipeList().get(j); + for (int j = 0; j < CraftingManager.getInstance() + .getRecipeList() + .size(); j++) { + recipe = (IRecipe) CraftingManager.getInstance() + .getRecipeList() + .get(j); if (recipe.matches(this, world) - && GT_Utility.areStacksEqual(recipe.getCraftingResult(this), input)) { + && GT_Utility.areStacksEqual(recipe.getCraftingResult(this), input)) { break out; } else recipe = null; } @@ -1105,9 +1172,10 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {} public GreenHouseSlot(GT_MetaTileEntity_ExtremeIndustrialGreenhouse tileEntity, ItemStack input, boolean IC2, - boolean noHumidity) { + boolean noHumidity) { super(null, 3, 3); - World world = tileEntity.getBaseMetaTileEntity().getWorld(); + World world = tileEntity.getBaseMetaTileEntity() + .getWorld(); this.input = input.copy(); this.isValid = false; if (IC2) { @@ -1166,7 +1234,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } public void GreenHouseSlotIC2(GT_MetaTileEntity_ExtremeIndustrialGreenhouse tileEntity, World world, - ItemStack input, boolean noHumidity) { + ItemStack input, boolean noHumidity) { if (!ItemList.IC2_Crop_Seeds.isStackEqual(input, true, true)) return; this.isIC2Crop = true; this.noHumidity = noHumidity; @@ -1181,14 +1249,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse short tDamage = (short) item.getDamage(a); if (item instanceof GT_Item_Ores && tDamage > 0) { if (!world.setBlock( - x, - y, - z, - b, - GT_TileEntity_Ores.getHarvestData( - tDamage, - ((GT_Block_Ores_Abstract) b).getBaseBlockHarvestLevel(tDamage % 16000 / 1000)), - 0)) { + x, + y, + z, + b, + GT_TileEntity_Ores.getHarvestData( + tDamage, + ((GT_Block_Ores_Abstract) b).getBaseBlockHarvestLevel(tDamage % 16000 / 1000)), + 0)) { return false; } GT_TileEntity_Ores tTileEntity = (GT_TileEntity_Ores) world.getTileEntity(x, y, z); @@ -1208,14 +1276,18 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse byte re = nbt.getByte("resistance"); int[] abc = new int[] { 0, -2, 3 }; int[] xyz = new int[] { 0, 0, 0 }; - tileEntity.getExtendedFacing().getWorldOffset(abc, xyz); - xyz[0] += tileEntity.getBaseMetaTileEntity().getXCoord(); - xyz[1] += tileEntity.getBaseMetaTileEntity().getYCoord(); - xyz[2] += tileEntity.getBaseMetaTileEntity().getZCoord(); + tileEntity.getExtendedFacing() + .getWorldOffset(abc, xyz); + xyz[0] += tileEntity.getBaseMetaTileEntity() + .getXCoord(); + xyz[1] += tileEntity.getBaseMetaTileEntity() + .getYCoord(); + xyz[2] += tileEntity.getBaseMetaTileEntity() + .getZCoord(); boolean cheating = false; try { if (world.getBlock(xyz[0], xyz[1] - 2, xyz[2]) != GregTech_API.sBlockCasings4 - || world.getBlockMetadata(xyz[0], xyz[1] - 2, xyz[2]) != 1) { + || world.getBlockMetadata(xyz[0], xyz[1] - 2, xyz[2]) != 1) { // no cheating = true; return; @@ -1287,7 +1359,7 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse int rate = te.calcGrowthRate(); if (rate == 0) return; // should not be possible with those stats growthticks = (int) Math.ceil( - ((double) dur / (double) rate) * (double) cc.maxSize() * (double) TileEntityCrop.tickRate); + ((double) dur / (double) rate) * (double) cc.maxSize() * (double) TileEntityCrop.tickRate); if (growthticks < 1) growthticks = 1; if (tobeused != null) tobeused.stackSize--; @@ -1329,9 +1401,14 @@ public class GT_MetaTileEntity_ExtremeIndustrialGreenhouse } copied.clear(); for (Map.Entry<String, Double> entry : dropprogress.entrySet()) if (entry.getValue() >= 1d) { - copied.add(dropstacks.get(entry.getKey()).copy()); - copied.get(copied.size() - 1).stackSize = entry.getValue().intValue(); - entry.setValue(entry.getValue() - (double) entry.getValue().intValue()); + copied.add( + dropstacks.get(entry.getKey()) + .copy()); + copied.get(copied.size() - 1).stackSize = entry.getValue() + .intValue(); + entry.setValue( + entry.getValue() - (double) entry.getValue() + .intValue()); } return copied; } diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java index a17af113c0..d9e368af89 100644 --- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java +++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java @@ -82,7 +82,7 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; public class GT_MetaTileEntity_MegaIndustrialApiary - extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_MegaIndustrialApiary> implements ISurvivalConstructable { + extends KubaTechGTMultiBlockBase<GT_MetaTileEntity_MegaIndustrialApiary> implements ISurvivalConstructable { private byte mGlassTier = 0; private int mCasing = 0; @@ -99,7 +99,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary private static final int MEGA_APIARY_STORAGE_VERSION = 2; private static final String[][] struct = transpose( - new String[][] { // spotless:off + new String[][] { // spotless:off {" "," "," "," HHH "," HHAAAHH "," HAPLPAH "," HAPAAAPAH "," HALAAALAH "," HAPAAAPAH "," HAPLPAH "," HHAAAHH "," HHH "," "," "," "}, {" "," "," GGG "," GGG GG "," G G "," G G "," G G "," G G "," G G "," G G "," G G "," GG GG "," GGG "," "," "}, {" "," HHH "," HHH HHH "," H GH "," H H "," H H "," H H "," H H "," H H "," H H "," H H "," HG GH "," HHH HHH "," HHH "," "}, @@ -120,63 +120,74 @@ public class GT_MetaTileEntity_MegaIndustrialApiary });// spotless:on private static final IStructureDefinition<GT_MetaTileEntity_MegaIndustrialApiary> STRUCTURE_DEFINITION = StructureDefinition - .<GT_MetaTileEntity_MegaIndustrialApiary>builder().addShape(STRUCTURE_PIECE_MAIN, struct) - .addShape( - STRUCTURE_PIECE_MAIN_SURVIVAL, - Arrays.stream(struct) - .map( - sa -> Arrays.stream(sa).map(s -> s.replaceAll("W", " ").replaceAll("F", " ")) - .toArray(String[]::new)) - .toArray(String[][]::new)) - .addElement( - 'A', - LoaderReference.Bartworks - ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) - : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) - .addElement('B', ofChain(ofBlockAnyMeta(Blocks.dirt, 0), ofBlock(Blocks.grass, 0))) - .addElement( - 'G', - buildHatchAdder(GT_MetaTileEntity_MegaIndustrialApiary.class) - .atLeast(InputBus, OutputBus, Energy, Maintenance).casingIndex(CASING_INDEX).dot(1) - .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings1, 10)))) - .addElement( - 'H', - ofBlocksMap( - Collections.singletonMap( - Blocks.planks, - IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), - Blocks.planks, - 5)) - .addElement( - 'I', - ofBlocksMap( - Collections.singletonMap( - Blocks.wooden_slab, - IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), - Blocks.wooden_slab, - 5)) - .addElement('J', ofBlock(PluginApiculture.blocks.apiculture, BlockApicultureType.APIARY.getMeta())) - .addElement('K', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.PLAIN.ordinal())) - .addElement('L', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HYGRO.ordinal())) - .addElement('N', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.STABILIZER.ordinal())) - .addElement('O', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HEATER.ordinal())) - .addElement('P', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.FAN.ordinal())) - .addElement('W', ofBlock(Blocks.water, 0)) - .addElement('F', new IStructureElementNoPlacement<GT_MetaTileEntity_MegaIndustrialApiary>() { - - @Override - public boolean check(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z) { - mte.flowerCheck(world, x, y, z); - return true; - } + .<GT_MetaTileEntity_MegaIndustrialApiary>builder() + .addShape(STRUCTURE_PIECE_MAIN, struct) + .addShape( + STRUCTURE_PIECE_MAIN_SURVIVAL, + Arrays.stream(struct) + .map( + sa -> Arrays.stream(sa) + .map( + s -> s.replaceAll("W", " ") + .replaceAll("F", " ")) + .toArray(String[]::new)) + .toArray(String[][]::new)) + .addElement( + 'A', + LoaderReference.Bartworks + ? BorosilicateGlass.ofBoroGlass((byte) 0, (t, v) -> t.mGlassTier = v, t -> t.mGlassTier) + : onElementPass(t -> t.mGlassTier = 100, ofBlock(Blocks.glass, 0))) + .addElement('B', ofChain(ofBlockAnyMeta(Blocks.dirt, 0), ofBlock(Blocks.grass, 0))) + .addElement( + 'G', + buildHatchAdder(GT_MetaTileEntity_MegaIndustrialApiary.class) + .atLeast(InputBus, OutputBus, Energy, Maintenance) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings1, 10)))) + .addElement( + 'H', + ofBlocksMap( + Collections.singletonMap( + Blocks.planks, + IntStream.rangeClosed(0, 5) + .boxed() + .collect(Collectors.toList())), + Blocks.planks, + 5)) + .addElement( + 'I', + ofBlocksMap( + Collections.singletonMap( + Blocks.wooden_slab, + IntStream.rangeClosed(0, 5) + .boxed() + .collect(Collectors.toList())), + Blocks.wooden_slab, + 5)) + .addElement('J', ofBlock(PluginApiculture.blocks.apiculture, BlockApicultureType.APIARY.getMeta())) + .addElement('K', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.PLAIN.ordinal())) + .addElement('L', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HYGRO.ordinal())) + .addElement('N', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.STABILIZER.ordinal())) + .addElement('O', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.HEATER.ordinal())) + .addElement('P', ofBlock(PluginApiculture.blocks.alveary, BlockAlveary.Type.FAN.ordinal())) + .addElement('W', ofBlock(Blocks.water, 0)) + .addElement('F', new IStructureElementNoPlacement<GT_MetaTileEntity_MegaIndustrialApiary>() { - @Override - public boolean spawnHint(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z, - ItemStack trigger) { - StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 2 - 1); - return true; - } - }).build(); + @Override + public boolean check(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z) { + mte.flowerCheck(world, x, y, z); + return true; + } + + @Override + public boolean spawnHint(GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z, + ItemStack trigger) { + StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 2 - 1); + return true; + } + }) + .build(); @SuppressWarnings("unused") public GT_MetaTileEntity_MegaIndustrialApiary(int aID, String aName, String aNameRegional) { @@ -209,8 +220,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary int built = survivialBuildPiece(STRUCTURE_PIECE_MAIN_SURVIVAL, stackSize, 7, 8, 0, elementBudget, env, true); if (built == -1) { GT_Utility.sendChatToPlayer( - env.getActor(), - EnumChatFormatting.GREEN + "Auto placing done ! Now go place the water and flowers yourself !"); + env.getActor(), + EnumChatFormatting.GREEN + "Auto placing done ! Now go place the water and flowers yourself !"); return 0; } return built; @@ -230,36 +241,52 @@ public class GT_MetaTileEntity_MegaIndustrialApiary protected GT_Multiblock_Tooltip_Builder createTooltip() { GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Apiary") - .addInfo("Controller block for Industrial Apicultural Acclimatiser and Drone Domestication Station") - .addInfo(buildAuthorList("kuba6000", "Runakai")).addInfo("The ideal home for your bees") - .addInfo("AKA. Mega Apiary").addInfo("Use screwdriver to change primary mode (INPUT/OUTPUT/OPERATING)") - .addInfo("Use screwdriver + shift to change operation mode (NORMAL/SWARMER)") - .addInfo("--------------------- INPUT MODE ---------------------").addInfo("- Does not take power") - .addInfo("- Put your queens in the input bus to put them in the internal buffer") - .addInfo("-------------------- OUTPUT MODE ---------------------").addInfo("- Does not take power") - .addInfo("- Will give your bees back to output bus") - .addInfo("------------------- OPERATING MODE -------------------").addInfo("- NORMAL:") - .addInfo(" - For each " + voltageTooltipFormatted(6) + " amp you can insert 1 bee") - .addInfo(" - Processing time: 5 seconds") - .addInfo(" - Uses 1 " + voltageTooltipFormatted(6) + " amp per queen") - .addInfo(" - All bees are accelerated 64 times").addInfo(" - 8 production upgrades are applied") - .addInfo(" - Genetic Stabilizer upgrade applied") - .addInfo(" - Simulates perfect environment for your bees") - .addInfo(" - Additionally you can provide royal jelly to increase the outputs:") - .addInfo(" - 1 royal jelly grants 5% bonus per bee") - .addInfo(" - They will be consumed on each start of operation") - .addInfo(" - and be applied to that operation only").addInfo(" - Max bonus: 200%") - .addInfo("- SWARMER:").addInfo(" - You can only insert 1 queen") - .addInfo(" - It will slowly produce ignoble princesses") - .addInfo(" - Consumes 100 royal jelly per operation").addInfo(" - Base processing time: 1 minute") - .addInfo(" - Uses 1 amp " + voltageTooltipFormatted(5)).addInfo(" - Can overclock") - .addInfo(StructureHologram).addSeparator().beginStructureBlock(15, 17, 15, false) - .addController("Front Bottom Center").addCasingInfoMin("Bronze Plated Bricks", 190, false) - .addOtherStructurePart("Borosilicate Glass", "Look at the hologram") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addOtherStructurePart("Flowers", "On dirt/grass", 2).addInputBus("Any casing", 1) - .addOutputBus("Any casing", 1).addEnergyHatch("Any casing", 1).addMaintenanceHatch("Any casing", 1) - .toolTipFinisher(Tags.MODNAME); + .addInfo("Controller block for Industrial Apicultural Acclimatiser and Drone Domestication Station") + .addInfo(buildAuthorList("kuba6000", "Runakai")) + .addInfo("The ideal home for your bees") + .addInfo("AKA. Mega Apiary") + .addInfo("Use screwdriver to change primary mode (INPUT/OUTPUT/OPERATING)") + .addInfo("Use screwdriver + shift to change operation mode (NORMAL/SWARMER)") + .addInfo("--------------------- INPUT MODE ---------------------") + .addInfo("- Does not take power") + .addInfo("- Put your queens in the input bus to put them in the internal buffer") + .addInfo("-------------------- OUTPUT MODE ---------------------") + .addInfo("- Does not take power") + .addInfo("- Will give your bees back to output bus") + .addInfo("------------------- OPERATING MODE -------------------") + .addInfo("- NORMAL:") + .addInfo(" - For each " + voltageTooltipFormatted(6) + " amp you can insert 1 bee") + .addInfo(" - Processing time: 5 seconds") + .addInfo(" - Uses 1 " + voltageTooltipFormatted(6) + " amp per queen") + .addInfo(" - All bees are accelerated 64 times") + .addInfo(" - 8 production upgrades are applied") + .addInfo(" - Genetic Stabilizer upgrade applied") + .addInfo(" - Simulates perfect environment for your bees") + .addInfo(" - Additionally you can provide royal jelly to increase the outputs:") + .addInfo(" - 1 royal jelly grants 5% bonus per bee") + .addInfo(" - They will be consumed on each start of operation") + .addInfo(" - and be applied to that operation only") + .addInfo(" - Max bonus: 200%") + .addInfo("- SWARMER:") + .addInfo(" - You can only insert 1 queen") + .addInfo(" - It will slowly produce ignoble princesses") + .addInfo(" - Consumes 100 royal jelly per operation") + .addInfo(" - Base processing time: 1 minute") + .addInfo(" - Uses 1 amp " + voltageTooltipFormatted(5)) + .addInfo(" - Can overclock") + .addInfo(StructureHologram) + .addSeparator() + .beginStructureBlock(15, 17, 15, false) + .addController("Front Bottom Center") + .addCasingInfoMin("Bronze Plated Bricks", 190, false) + .addOtherStructurePart("Borosilicate Glass", "Look at the hologram") + .addStructureInfo("The glass tier limits the Energy Input tier") + .addOtherStructurePart("Flowers", "On dirt/grass", 2) + .addInputBus("Any casing", 1) + .addOutputBus("Any casing", 1) + .addEnergyHatch("Any casing", 1) + .addMaintenanceHatch("Any casing", 1) + .toolTipFinisher(Tags.MODNAME); return tt; } @@ -270,7 +297,10 @@ public class GT_MetaTileEntity_MegaIndustrialApiary aNBT.setInteger("mPrimaryMode", mPrimaryMode); aNBT.setInteger("mSecondaryMode", mSecondaryMode); aNBT.setInteger("mStorageSize", mStorage.size()); - for (int i = 0; i < mStorage.size(); i++) aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound()); + for (int i = 0; i < mStorage.size(); i++) aNBT.setTag( + "mStorage." + i, + mStorage.get(i) + .toNBTTagCompound()); aNBT.setInteger("MEGA_APIARY_STORAGE_VERSION", MEGA_APIARY_STORAGE_VERSION); } @@ -348,7 +378,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (aBaseMetaTileEntity.isActive() && aTick % 100 == 0) { int[] abc = new int[] { 0, -2, 7 }; int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); + this.getExtendedFacing() + .getWorldOffset(abc, xyz); xyz[0] += aBaseMetaTileEntity.getXCoord(); xyz[1] += aBaseMetaTileEntity.getYCoord(); xyz[2] += aBaseMetaTileEntity.getZCoord(); @@ -444,7 +475,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary this.mOutputItems = stacks.toArray(new ItemStack[0]); } else { if (!depleteInput(PluginApiculture.items.royalJelly.getItemStack(64)) - || !depleteInput(PluginApiculture.items.royalJelly.getItemStack(36))) { + || !depleteInput(PluginApiculture.items.royalJelly.getItemStack(36))) { this.updateSlots(); return false; } @@ -452,7 +483,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (this.lEUt > 0) this.lEUt = -this.lEUt; this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - this.mOutputItems = new ItemStack[] { this.mStorage.get(0).createIgnobleCopy() }; + this.mOutputItems = new ItemStack[] { this.mStorage.get(0) + .createIgnobleCopy() }; this.updateSlots(); } return true; @@ -466,21 +498,20 @@ public class GT_MetaTileEntity_MegaIndustrialApiary public String[] getInfoData() { ArrayList<String> info = new ArrayList<>(Arrays.asList(super.getInfoData())); info.add( - "Running in mode: " + EnumChatFormatting.GOLD - + (mPrimaryMode == 0 ? "Input mode" - : (mPrimaryMode == 1 ? "Output mode" - : (mSecondaryMode == 0 ? "Operating mode (NORMAL)" - : "Operating mode (SWARMER)")))); + "Running in mode: " + EnumChatFormatting.GOLD + + (mPrimaryMode == 0 ? "Input mode" + : (mPrimaryMode == 1 ? "Output mode" + : (mSecondaryMode == 0 ? "Operating mode (NORMAL)" : "Operating mode (SWARMER)")))); info.add( - "Bee storage (" + EnumChatFormatting.GOLD - + mStorage.size() - + EnumChatFormatting.RESET - + "/" - + (mStorage.size() > mMaxSlots ? EnumChatFormatting.DARK_RED.toString() - : EnumChatFormatting.GOLD.toString()) - + mMaxSlots - + EnumChatFormatting.RESET - + "):"); + "Bee storage (" + EnumChatFormatting.GOLD + + mStorage.size() + + EnumChatFormatting.RESET + + "/" + + (mStorage.size() > mMaxSlots ? EnumChatFormatting.DARK_RED.toString() + : EnumChatFormatting.GOLD.toString()) + + mMaxSlots + + EnumChatFormatting.RESET + + "):"); HashMap<String, Integer> infos = new HashMap<>(); for (int i = 0; i < mStorage.size(); i++) { StringBuilder builder = new StringBuilder(); @@ -522,16 +553,27 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, - boolean aActive, boolean aRedstone) { + boolean aActive, boolean aRedstone) { if (aSide == aFacing) { if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW).extFacing().glow() - .build() }; - return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER).extFacing().build(), - TextureFactory.builder().addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW).extFacing().glow() - .build() }; + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_DISTILLATION_TOWER_GLOW) + .extFacing() + .glow() + .build() }; } return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @@ -553,21 +595,25 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); + builder.bindPlayerInventory( + buildContext.getPlayer(), + new Pos2d(7, 83), + this.getGUITextureSet() + .getItemSlot()); } private static final UIInfo<?, ?> MegaApiaryUI = createKTMetaTileEntityUI( - KT_ModulaUIContainer_MegaIndustrialApiary::new); + KT_ModulaUIContainer_MegaIndustrialApiary::new); @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { if (aBaseMetaTileEntity.isClientSide()) return true; MegaApiaryUI.open( - aPlayer, - aBaseMetaTileEntity.getWorld(), - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()); + aPlayer, + aBaseMetaTileEntity.getWorld(), + aBaseMetaTileEntity.getXCoord(), + aBaseMetaTileEntity.getYCoord(), + aBaseMetaTileEntity.getZCoord()); return true; } @@ -576,7 +622,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary final WeakReference<GT_MetaTileEntity_MegaIndustrialApiary> parent; public KT_ModulaUIContainer_MegaIndustrialApiary(ModularUIContext context, ModularWindow mainWindow, - GT_MetaTileEntity_MegaIndustrialApiary mte) { + GT_MetaTileEntity_MegaIndustrialApiary mte) { super(context, mainWindow); parent = new WeakReference<>(mte); } @@ -597,7 +643,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary GT_Utility.sendChatToPlayer(aPlayer, EnumChatFormatting.RED + "Can't insert while running !"); return super.transferStackInSlot(aPlayer, aSlotIndex); } - World w = mte.getBaseMetaTileEntity().getWorld(); + World w = mte.getBaseMetaTileEntity() + .getWorld(); float t = (float) mte.getVoltageTierExact(); BeeSimulator bs = new BeeSimulator(aStack, w, t); if (bs.isValid) { @@ -618,8 +665,10 @@ public class GT_MetaTileEntity_MegaIndustrialApiary @Override public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) { builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK).setPos(7, 4).setSize(143, 75) - .setEnabled(widget -> !isFixed.apply(widget))); + new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK) + .setPos(7, 4) + .setSize(143, 75) + .setEnabled(widget -> !isFixed.apply(widget))); buildContext.addSyncedWindow(CONFIGURATION_WINDOW_ID, this::createConfigurationWindow); EntityPlayer player = buildContext.getPlayer(); @@ -627,33 +676,32 @@ public class GT_MetaTileEntity_MegaIndustrialApiary // Slot is not needed builder.widget( - new DynamicPositionedColumn().setSynced(false).widget( - new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { - if (works) getBaseMetaTileEntity().enableWorking(); - else getBaseMetaTileEntity().disableWorking(); + new DynamicPositionedColumn().setSynced(false) + .widget(new CycleButtonWidget().setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + if (works) getBaseMetaTileEntity().enableWorking(); + else getBaseMetaTileEntity().disableWorking(); - if (!(player instanceof EntityPlayerMP)) return; - String tChat = GT_Utility.trans("090", "Machine Processing: ") - + (works ? GT_Utility.trans("088", "Enabled") - : GT_Utility.trans("087", "Disabled")); - if (hasAlternativeModeText()) tChat = getAlternativeModeText(); - GT_Utility.sendChatToPlayer(player, tChat); - }).addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) - .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter(toggleButtonBackgroundGetter).setSize(18, 18) - .addTooltip("Working status")) - .widget( - new ButtonWidget() - .setOnClick( - (clickData, widget) -> { - if (!widget.isClient()) - widget.getContext().openSyncedWindow(CONFIGURATION_WINDOW_ID); - }) - .setBackground( - GT_UITextures.BUTTON_STANDARD, - GT_UITextures.OVERLAY_BUTTON_CYCLIC) - .addTooltip("Configuration").setSize(18, 18)) - .setPos(151, 4)); + if (!(player instanceof EntityPlayerMP)) return; + String tChat = GT_Utility.trans("090", "Machine Processing: ") + + (works ? GT_Utility.trans("088", "Enabled") : GT_Utility.trans("087", "Disabled")); + if (hasAlternativeModeText()) tChat = getAlternativeModeText(); + GT_Utility.sendChatToPlayer(player, tChat); + }) + .addTooltip(0, new Text("Disabled").color(Color.RED.dark(3))) + .addTooltip(1, new Text("Enabled").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter(toggleButtonBackgroundGetter) + .setSize(18, 18) + .addTooltip("Working status")) + .widget( + new ButtonWidget().setOnClick( + (clickData, widget) -> { + if (!widget.isClient()) widget.getContext() + .openSyncedWindow(CONFIGURATION_WINDOW_ID); + }) + .setBackground(GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .addTooltip("Configuration") + .setSize(18, 18)) + .setPos(151, 4)); ChangeableWidget beesContainer = new ChangeableWidget(() -> createBeesContainerWidget(player)); @@ -669,30 +717,36 @@ public class GT_MetaTileEntity_MegaIndustrialApiary mMaxSlots = i; beesContainer.notifyChangeNoSync(); } - }), builder).attachSyncer( + }), builder) + .attachSyncer( new FakeSyncWidget.ListSyncer<>( - () -> mStorage.stream().map(s -> s.queenStack).collect(Collectors.toList()), - l -> { - drawables.clear(); - drawables.addAll(l); - if (beesContainer.getChildren().size() > 0) IWidgetParent.forEachByLayer( - (IWidgetParent) beesContainer.getChildren().get(0), - Widget::notifyTooltipChange); - }, - (buffer, i) -> { - try { - buffer.writeItemStackToBuffer(i); - } catch (IOException e) { - throw new RuntimeException(e); - } - }, - buffer -> { - try { - return buffer.readItemStackFromBuffer(); - } catch (IOException e) { - throw new RuntimeException(e); - } - }), + () -> mStorage.stream() + .map(s -> s.queenStack) + .collect(Collectors.toList()), + l -> { + drawables.clear(); + drawables.addAll(l); + if (beesContainer.getChildren() + .size() > 0) + IWidgetParent.forEachByLayer( + (IWidgetParent) beesContainer.getChildren() + .get(0), + Widget::notifyTooltipChange); + }, + (buffer, i) -> { + try { + buffer.writeItemStackToBuffer(i); + } catch (IOException e) { + throw new RuntimeException(e); + } + }, + buffer -> { + try { + return buffer.readItemStackFromBuffer(); + } catch (IOException e) { + throw new RuntimeException(e); + } + }), builder)); final DynamicPositionedColumn screenElements = new DynamicPositionedColumn(); @@ -716,8 +770,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary if (input != null) { if (this.mMaxProgresstime > 0) { GT_Utility.sendChatToPlayer( - player, - EnumChatFormatting.RED + "Can't replace/insert while running !"); + player, + EnumChatFormatting.RED + "Can't replace/insert while running !"); return; } if (beeRoot.getType(input) == EnumBeeType.QUEEN) { @@ -768,25 +822,29 @@ public class GT_MetaTileEntity_MegaIndustrialApiary addOutput(removed.queenStack); GT_Utility.sendChatToPlayer(player, "Queen ejected !"); - }).setBackground( - () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet().getItemSlot(), - GT_UITextures.OVERLAY_SLOT_BEE_QUEEN, - new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) - .withFixedSize(16, 16, 1, 1) }) - .dynamicTooltip(() -> { - if (drawables.size() > ID) return Arrays.asList( - drawables.get(ID).getDisplayName(), - EnumChatFormatting.GRAY + "Left click to eject into input bus", - EnumChatFormatting.GRAY + "Right click to get into mouse", - EnumChatFormatting.GRAY + "Shift click to get into inventory", - EnumChatFormatting.GRAY + "Click with other queen in mouse to replace"); - return Collections - .singletonList(EnumChatFormatting.GRAY + "Click with queen in mouse to insert"); - }).setSize(18, 18)); + }) + .setBackground( + () -> new IDrawable[] { getBaseMetaTileEntity().getGUITextureSet() + .getItemSlot(), GT_UITextures.OVERLAY_SLOT_BEE_QUEEN, + new ItemDrawable(drawables.size() > ID ? drawables.get(ID) : null) + .withFixedSize(16, 16, 1, 1) }) + .dynamicTooltip(() -> { + if (drawables.size() > ID) return Arrays.asList( + drawables.get(ID) + .getDisplayName(), + EnumChatFormatting.GRAY + "Left click to eject into input bus", + EnumChatFormatting.GRAY + "Right click to get into mouse", + EnumChatFormatting.GRAY + "Shift click to get into inventory", + EnumChatFormatting.GRAY + "Click with other queen in mouse to replace"); + return Collections + .singletonList(EnumChatFormatting.GRAY + "Click with queen in mouse to insert"); + }) + .setSize(18, 18)); } beesContainer.widget(row.setPos(0, i * 18)); } - beesContainer.setPos(10, 16).setSize(128, 60); + beesContainer.setPos(10, 16) + .setSize(128, 60); return beesContainer; } @@ -794,151 +852,155 @@ public class GT_MetaTileEntity_MegaIndustrialApiary ModularWindow.Builder builder = ModularWindow.builder(200, 100); builder.setBackground(ModularUITextures.VANILLA_BACKGROUND); builder.widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC).setPos(5, 5).setSize(16, 16)) - .widget(new TextWidget("Configuration").setPos(25, 9)) - .widget(ButtonWidget.closeWindowButton(true).setPos(185, 3)) - .widget( - new Column().widget( - new CycleButtonWidget().setLength(3).setGetter(() -> mPrimaryMode).setSetter(val -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); - return; - } - mPrimaryMode = val; - - if (!(player instanceof EntityPlayerMP)) return; - switch (mPrimaryMode) { - case 0: - GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Input mode"); - break; - case 1: - GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Output mode"); - break; - case 2: - GT_Utility.sendChatToPlayer( - player, - "Changed primary mode to: Operating mode"); - break; - } - }).addTooltip(0, new Text("Input").color(Color.YELLOW.dark(3))) - .addTooltip(1, new Text("Output").color(Color.YELLOW.dark(3))) - .addTooltip(2, new Text("Operating").color(Color.GREEN.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), - i == 0 ? new Text("Input").color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : i == 1 ? new Text("Output") - .color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Operating") - .color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Primary mode")) - .widget( - new CycleButtonWidget().setLength(2).setGetter(() -> mSecondaryMode) - .setSetter(val -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer( - player, - "Can't change mode when running !"); - return; - } - - mSecondaryMode = val; - - if (!(player instanceof EntityPlayerMP)) return; - switch (mSecondaryMode) { - case 0: - GT_Utility.sendChatToPlayer( - player, - "Changed secondary mode to: Normal mode"); - break; - case 1: - GT_Utility.sendChatToPlayer( - player, - "Changed secondary mode to: Swarmer mode"); - break; - } - }).addTooltip(0, new Text("Normal").color(Color.GREEN.dark(3))) - .addTooltip(1, new Text("Swarmer").color(Color.YELLOW.dark(3))) - .setVariableBackgroundGetter( - i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, - GT_UITextures.OVERLAY_BUTTON_CYCLIC - .withFixedSize(18, 18), - i == 0 ? new Text("Normal").color(Color.GREEN.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) - : new Text("Swarmer") - .color(Color.YELLOW.dark(3)) - .withFixedSize(70 - 18, 18, 15, 0) }) - .setSize(70, 18).addTooltip("Secondary mode")) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(10, 30)) - .widget( - new Column().widget(new TextWidget("Primary mode").setSize(100, 18)) - .widget(new TextWidget("Secondary mode").setSize(100, 18)) - .setEnabled(widget -> !getBaseMetaTileEntity().isActive()).setPos(80, 30)) - .widget( - new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS).setSize(18, 18) - .setPos(10, 30) - .addTooltip( - new Text("Can't change configuration when running !").color(Color.RED.dark(3))) - .setEnabled(widget -> getBaseMetaTileEntity().isActive())); + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CYCLIC) + .setPos(5, 5) + .setSize(16, 16)) + .widget(new TextWidget("Configuration").setPos(25, 9)) + .widget( + ButtonWidget.closeWindowButton(true) + .setPos(185, 3)) + .widget( + new Column().widget( + new CycleButtonWidget().setLength(3) + .setGetter(() -> mPrimaryMode) + .setSetter(val -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); + return; + } + mPrimaryMode = val; + + if (!(player instanceof EntityPlayerMP)) return; + switch (mPrimaryMode) { + case 0: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Input mode"); + break; + case 1: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Output mode"); + break; + case 2: + GT_Utility.sendChatToPlayer(player, "Changed primary mode to: Operating mode"); + break; + } + }) + .addTooltip(0, new Text("Input").color(Color.YELLOW.dark(3))) + .addTooltip(1, new Text("Output").color(Color.YELLOW.dark(3))) + .addTooltip(2, new Text("Operating").color(Color.GREEN.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Input").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : i == 1 ? new Text("Output").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Operating").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Primary mode")) + .widget( + new CycleButtonWidget().setLength(2) + .setGetter(() -> mSecondaryMode) + .setSetter(val -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(player, "Can't change mode when running !"); + return; + } + + mSecondaryMode = val; + + if (!(player instanceof EntityPlayerMP)) return; + switch (mSecondaryMode) { + case 0: + GT_Utility.sendChatToPlayer(player, "Changed secondary mode to: Normal mode"); + break; + case 1: + GT_Utility.sendChatToPlayer(player, "Changed secondary mode to: Swarmer mode"); + break; + } + }) + .addTooltip(0, new Text("Normal").color(Color.GREEN.dark(3))) + .addTooltip(1, new Text("Swarmer").color(Color.YELLOW.dark(3))) + .setVariableBackgroundGetter( + i -> new IDrawable[] { ModularUITextures.VANILLA_BACKGROUND, + GT_UITextures.OVERLAY_BUTTON_CYCLIC.withFixedSize(18, 18), i + == 0 ? new Text("Normal").color(Color.GREEN.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) + : new Text("Swarmer").color(Color.YELLOW.dark(3)) + .withFixedSize(70 - 18, 18, 15, 0) }) + .setSize(70, 18) + .addTooltip("Secondary mode")) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(10, 30)) + .widget( + new Column().widget(new TextWidget("Primary mode").setSize(100, 18)) + .widget(new TextWidget("Secondary mode").setSize(100, 18)) + .setEnabled(widget -> !getBaseMetaTileEntity().isActive()) + .setPos(80, 30)) + .widget( + new DrawableWidget().setDrawable(GT_UITextures.OVERLAY_BUTTON_CROSS) + .setSize(18, 18) + .setPos(10, 30) + .addTooltip(new Text("Can't change configuration when running !").color(Color.RED.dark(3))) + .setEnabled(widget -> getBaseMetaTileEntity().isActive())); return builder.build(); } @Override protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { - screenElements.setSynced(false).setSpace(0).setPos(10, 7); + screenElements.setSynced(false) + .setSpace(0) + .setPos(10, 7); screenElements.widget( - new DynamicPositionedRow().setSynced(false) - .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) - .widget(new DynamicTextWidget(() -> { - if (flowersError) return new Text("No flowers !").color(Color.RED.dark(3)); - if (getBaseMetaTileEntity().isActive()) - return new Text("Working !").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().isAllowedToWork()) - return new Text("Enabled").color(Color.GREEN.dark(3)); - else if (getBaseMetaTileEntity().wasShutdown()) - return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); - else return new Text("Disabled").color(Color.RED.dark(3)); - })).setEnabled(isFixed)); + new DynamicPositionedRow().setSynced(false) + .widget(new TextWidget("Status: ").setDefaultColor(COLOR_TEXT_GRAY.get())) + .widget(new DynamicTextWidget(() -> { + if (flowersError) return new Text("No flowers !").color(Color.RED.dark(3)); + if (getBaseMetaTileEntity().isActive()) return new Text("Working !").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().isAllowedToWork()) + return new Text("Enabled").color(Color.GREEN.dark(3)); + else if (getBaseMetaTileEntity().wasShutdown()) + return new Text("Shutdown (CRITICAL)").color(Color.RED.dark(3)); + else return new Text("Disabled").color(Color.RED.dark(3)); + })) + .setEnabled(isFixed)); screenElements - .widget( - new TextWidget(GT_Utility.trans("132", "Pipe is loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mWrench)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); + .widget( + new TextWidget(GT_Utility.trans("132", "Pipe is loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mWrench)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mWrench, val -> mWrench = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("133", "Screws are loose.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mScrewdriver)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); + .widget( + new TextWidget(GT_Utility.trans("133", "Screws are loose.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mScrewdriver)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mScrewdriver, val -> mScrewdriver = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("134", "Something is stuck.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSoftHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("134", "Something is stuck.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSoftHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSoftHammer, val -> mSoftHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("135", "Platings are dented.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mHardHammer)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); + .widget( + new TextWidget(GT_Utility.trans("135", "Platings are dented.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mHardHammer)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mHardHammer, val -> mHardHammer = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mSolderingTool)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); + .widget( + new TextWidget(GT_Utility.trans("136", "Circuitry burned out.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mSolderingTool)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mSolderingTool, val -> mSolderingTool = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mCrowbar)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); + .widget( + new TextWidget(GT_Utility.trans("137", "That doesn't belong there.")) + .setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mCrowbar)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mCrowbar, val -> mCrowbar = val)); screenElements - .widget( - new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")) - .setDefaultColor(COLOR_TEXT_WHITE.get()).setEnabled(widget -> !mMachine)) - .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); + .widget( + new TextWidget(GT_Utility.trans("138", "Incomplete Structure.")).setDefaultColor(COLOR_TEXT_WHITE.get()) + .setEnabled(widget -> !mMachine)) + .widget(new FakeSyncWidget.BooleanSyncer(() -> mMachine, val -> mMachine = val)); } private static class BeeSimulator { @@ -971,15 +1033,18 @@ public class GT_MetaTileEntity_MegaIndustrialApiary int h = queen.getMaxHealth(); maxBeeCycles = (float) h / (1.f / mod); IBeeGenome genome = queen.getGenome(); - this.flowerType = genome.getFlowerProvider().getFlowerType(); + this.flowerType = genome.getFlowerProvider() + .getFlowerType(); IAlleleBeeSpecies primary = genome.getPrimary(); beeSpeed = genome.getSpeed() * beeModifier.getProductionModifier(null, 1.f); - genome.getPrimary().getProductChances() - .forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed, t))); - genome.getSecondary().getProductChances() - .forEach((key, value) -> drops.add(new BeeDrop(key, value / 2.f, beeSpeed, t))); + genome.getPrimary() + .getProductChances() + .forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed, t))); + genome.getSecondary() + .getProductChances() + .forEach((key, value) -> drops.add(new BeeDrop(key, value / 2.f, beeSpeed, t))); primary.getSpecialtyChances() - .forEach((key, value) -> specialDrops.add(new BeeDrop(key, value, beeSpeed, t))); + .forEach((key, value) -> specialDrops.add(new BeeDrop(key, value, beeSpeed, t))); } public BeeSimulator(NBTTagCompound tag) { @@ -997,7 +1062,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary else { IBee queen = beeRoot.getMember(this.queenStack); IBeeGenome genome = queen.getGenome(); - this.flowerType = genome.getFlowerProvider().getFlowerType(); + this.flowerType = genome.getFlowerProvider() + .getFlowerType(); } } @@ -1006,10 +1072,15 @@ public class GT_MetaTileEntity_MegaIndustrialApiary tag.setTag("queenStack", queenStack.writeToNBT(new NBTTagCompound())); tag.setBoolean("isValid", isValid); tag.setInteger("dropssize", drops.size()); - for (int i = 0; i < drops.size(); i++) tag.setTag("drops" + i, drops.get(i).toNBTTagCompound()); + for (int i = 0; i < drops.size(); i++) tag.setTag( + "drops" + i, + drops.get(i) + .toNBTTagCompound()); tag.setInteger("specialDropssize", specialDrops.size()); - for (int i = 0; i < specialDrops.size(); i++) - tag.setTag("specialDrops" + i, specialDrops.get(i).toNBTTagCompound()); + for (int i = 0; i < specialDrops.size(); i++) tag.setTag( + "specialDrops" + i, + specialDrops.get(i) + .toNBTTagCompound()); tag.setFloat("beeSpeed", beeSpeed); tag.setFloat("maxBeeCycles", maxBeeCycles); tag.setString("flowerType", flowerType); @@ -1022,15 +1093,18 @@ public class GT_MetaTileEntity_MegaIndustrialApiary drops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum)); specialDrops.forEach(d -> dropProgress.merge(d, d.getAmount(timePassed / 550d), Double::sum)); List<ItemStack> currentDrops = new ArrayList<>(); - dropProgress.entrySet().forEach(e -> { - double v = e.getValue(); - while (v > 1.f) { - int size = Math.min((int) v, 64); - currentDrops.add(e.getKey().get(size)); - v -= size; - e.setValue(v); - } - }); + dropProgress.entrySet() + .forEach(e -> { + double v = e.getValue(); + while (v > 1.f) { + int size = Math.min((int) v, 64); + currentDrops.add( + e.getKey() + .get(size)); + v -= size; + e.setValue(v); + } + }); return currentDrops; } |