From f51616bda220887fdd45c4bc951ff59e3398213a Mon Sep 17 00:00:00 2001 From: Jason Mitchell Date: Sat, 28 Jan 2023 19:03:53 -0800 Subject: [ci skip] spotlessApply with the new settings --- ...MetaTileEntity_ExtremeExterminationChamber.java | 571 ++++++++---------- .../GT_MetaTileEntity_MegaIndustrialApiary.java | 664 +++++++++------------ 2 files changed, 556 insertions(+), 679 deletions(-) (limited to 'src/main/java/kubatech/tileentity/gregtech') 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 b7ef34d6ed..632661a3c7 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 @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.tileentity.gregtech.multiblock; @@ -26,45 +17,9 @@ import static gregtech.api.util.GT_StructureUtility.*; import static kubatech.api.Variables.Author; import static kubatech.api.Variables.StructureHologram; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; -import WayofTime.alchemicalWizardry.api.rituals.Rituals; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; -import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWellOfSuffering; -import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; -import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; -import com.google.common.collect.Multimap; -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizons.modularui.api.drawable.Text; -import com.gtnewhorizons.modularui.api.math.Color; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.common.widget.*; -import com.mojang.authlib.GameProfile; -import cpw.mods.fml.common.eventhandler.EventPriority; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import crazypants.enderio.EnderIO; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Materials; -import gregtech.api.enums.Textures; -import gregtech.api.gui.modularui.GT_UITextures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; import java.nio.charset.StandardCharsets; import java.util.*; + import kubatech.Tags; import kubatech.api.LoaderReference; import kubatech.api.helpers.ReflectionHelper; @@ -75,6 +30,7 @@ import kubatech.api.utils.FastRandom; import kubatech.api.utils.ItemID; import kubatech.client.effect.EntityRenderer; import kubatech.loaders.MobRecipeLoader; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.enchantment.Enchantment; @@ -101,6 +57,46 @@ import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fluids.FluidRegistry; import net.minecraftforge.fluids.FluidStack; +import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; +import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; +import WayofTime.alchemicalWizardry.api.rituals.Rituals; +import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; +import WayofTime.alchemicalWizardry.api.tile.IBloodAltar; +import WayofTime.alchemicalWizardry.common.rituals.RitualEffectWellOfSuffering; +import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; + +import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; +import com.google.common.collect.Multimap; +import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import com.gtnewhorizons.modularui.api.drawable.Text; +import com.gtnewhorizons.modularui.api.math.Color; +import com.gtnewhorizons.modularui.api.screen.ModularWindow; +import com.gtnewhorizons.modularui.api.screen.UIBuildContext; +import com.gtnewhorizons.modularui.common.widget.*; +import com.mojang.authlib.GameProfile; + +import cpw.mods.fml.common.eventhandler.EventPriority; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import crazypants.enderio.EnderIO; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures; +import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Utility; + public class GT_MetaTileEntity_ExtremeExterminationChamber extends KubaTechGTMultiBlockBase implements CustomTileEntityPacketHandler, ISurvivalConstructable { @@ -134,39 +130,37 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private static final Item poweredSpawnerItem = Item.getItemFromBlock(EnderIO.blockPoweredSpawner); private static final int CASING_INDEX = 16; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.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 static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .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; @@ -195,8 +189,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber isInRitualMode = aNBT.getBoolean("isInRitualMode"); mAnimationEnabled = !aNBT.hasKey("mAnimationEnabled") || aNBT.getBoolean("mAnimationEnabled"); mGlassTier = aNBT.getByte("mGlassTier"); - mIsProducingInfernalDrops = - !aNBT.hasKey("mIsProducingInfernalDrops") || aNBT.getBoolean("mIsProducingInfernalDrops"); + mIsProducingInfernalDrops = !aNBT.hasKey("mIsProducingInfernalDrops") + || aNBT.getBoolean("mIsProducingInfernalDrops"); } @Override @@ -222,40 +216,33 @@ 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") + 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 and past 1 tick (multiplies 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") - .addInfo("Also produces 120 Liquid XP per operation") - .addInfo("If the mob spawns infernal") + .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") + .addInfo("You can disable mob animation with a soldering iron").addInfo(StructureHologram) + .addSeparator().beginStructureBlock(5, 7, 5, true).addController("Front Bottom Center") .addCasingInfo("Solid Steel Machine Casing", 10) .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 casing", 1) + .addOtherStructurePart("Diamond spikes", "Inside second layer").addOutputBus("Any casing", 1) .addOtherStructurePart( - "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), "Any casing", 1) - .addOutputHatch("Any casing", 1) - .addEnergyHatch("Any casing", 1) - .addMaintenanceHatch("Any casing", 1) + "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"), + "Any casing", + 1) + .addOutputHatch("Any casing", 1).addEnergyHatch("Any casing", 1).addMaintenanceHatch("Any casing", 1) .toolTipFinisher(Tags.MODNAME); return tt; } @@ -276,49 +263,27 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + 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() - }; + 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() }; } - return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)}; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) }; } @SideOnly(Side.CLIENT) private void setupEntityRenderer(IGregTechTileEntity aBaseMetaTileEntity, int time) { if (entityRenderer == null) { ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); - int[] abc = new int[] {0, -2, 2}; - int[] xyz = new int[] {0, 0, 0}; + int[] abc = new int[] { 0, -2, 2 }; + int[] xyz = new int[] { 0, 0, 0 }; this.getExtendedFacing().getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; @@ -387,8 +352,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber } @Override - public boolean onSolderingToolRightClick( - byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + public boolean onSolderingToolRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { if (super.onSolderingToolRightClick(aSide, aWrenchingSide, aPlayer, aX, aY, aZ)) return true; mAnimationEnabled = !mAnimationEnabled; GT_Utility.sendChatToPlayer(aPlayer, "Animations are " + (mAnimationEnabled ? "enabled" : "disabled")); @@ -417,11 +382,9 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber if (tileAltar == null || tileAltar.isInvalid()) { tileAltar = null; - for (int i = -5; i <= 5; i++) - for (int j = -5; j <= 5; j++) - for (int k = -10; k <= 10; k++) - if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) - tileAltar = world.getTileEntity(x + i, y + k, z + j); + for (int i = -5; i <= 5; i++) for (int j = -5; j <= 5; j++) for (int k = -10; k <= 10; k++) + if (world.getTileEntity(x + i, y + k, z + j) instanceof IBloodAltar) + tileAltar = world.getTileEntity(x + i, y + k, z + j); } if (tileAltar == null) return; @@ -430,25 +393,19 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber return; } - ((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); + ((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); SoulNetworkHandler.syphonFromNetwork(owner, effect.getCostPerRefresh() * 100); } @@ -458,6 +415,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private CustomTileEntityPacket mobPacket = null; private static class WeaponCache { + boolean isValid = false; ItemID id = null; int looting = 0; @@ -477,19 +435,20 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber 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"; + if (mobType.equals("Skeleton") && getBaseMetaTileEntity().getWorld().provider instanceof WorldProviderHell + && 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; + && this.getBaseMetaTileEntity().getWorld().difficultySetting == EnumDifficulty.PEACEFUL) + return false; if (isInRitualMode && isRitualValid()) { if (getMaxInputVoltage() < recipe.mEUt / 4) return false; - this.mOutputFluids = new FluidStack[] {FluidRegistry.getFluidStack("xpjuice", 5000)}; + this.mOutputFluids = new FluidStack[] { FluidRegistry.getFluidStack("xpjuice", 5000) }; this.mOutputItems = recipe.generateOutputs(rand, this, 3, 0, mIsProducingInfernalDrops); this.lEUt /= 4L; this.mMaxProgresstime = 400; @@ -500,38 +459,41 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber GT_MetaTileEntity_Hatch_InputBus inputbus = this.mInputBusses.size() == 0 ? null : this.mInputBusses.get(0); if (inputbus != null && !isValidMetaTileEntity(inputbus)) inputbus = null; ItemStack lootingHolder = inputbus == null ? null : inputbus.getStackInSlot(0); - weaponCheck: - { - //noinspection EqualsBetweenInconvertibleTypes + weaponCheck: { + // noinspection EqualsBetweenInconvertibleTypes if (weaponCache.isValid && weaponCache.id.equals(lootingHolder)) break weaponCheck; if (lootingHolder == null || !Enchantment.looting.canApply(lootingHolder)) { weaponCache.isValid = false; break weaponCheck; } try { - //noinspection unchecked - weaponCache.attackDamage = ((Multimap) - lootingHolder.getAttributeModifiers()) - .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()).stream() - .mapToDouble(attr -> attr.getAmount() - + (double) EnchantmentHelper.func_152377_a( - lootingHolder, EnumCreatureAttribute.UNDEFINED)) + // noinspection unchecked + weaponCache.attackDamage = ((Multimap) lootingHolder + .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 = - EnchantmentHelper.getEnchantmentLevel(Enchantment.looting.effectId, lootingHolder); + weaponCache.looting = 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); - this.mOutputFluids = new FluidStack[] {FluidRegistry.getFluidStack("xpjuice", 120)}; + 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 + // noinspection ConstantConditions if (weaponCache.isValid && lootingHolder.isItemStackDamageable()) { if (EECPlayer == null) EECPlayer = new EECFakePlayer(this); EECPlayer.currentWeapon = lootingHolder; @@ -539,7 +501,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber for (int i = 0; i < times + 1; i++) { if (!lootingHolderItem.hitEntity(lootingHolder, recipe.entity, EECPlayer)) break; if (lootingHolder.stackSize == 0) { - //noinspection ConstantConditions + // noinspection ConstantConditions inputbus.setInventorySlotContents(0, null); break; } @@ -575,8 +537,8 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber private boolean connectToRitual() { if (!LoaderReference.BloodMagic) return false; ChunkCoordinates coords = this.getBaseMetaTileEntity().getCoords(); - int[] abc = new int[] {0, -8, 2}; - int[] xyz = new int[] {0, 0, 0}; + int[] abc = new int[] { 0, -8, 2 }; + int[] xyz = new int[] { 0, 0, 0 }; this.getExtendedFacing().getWorldOffset(abc, xyz); xyz[0] += coords.posX; xyz[1] += coords.posY; @@ -595,8 +557,7 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { mGlassTier = 0; if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 6, 0)) return false; - if (mCasing < 10 - || mMaintenanceHatches.size() != 1 + if (mCasing < 10 || mMaintenanceHatches.size() != 1 || mEnergyHatches.size() == 0 || !(mInputBusses.size() == 0 || (mInputBusses.size() == 1 && mInputBusses.get(0).mTier == 0))) return false; @@ -610,19 +571,21 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber public String[] getInfoData() { ArrayList 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")); + info.add( + "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")); + if (isInRitualMode) info.add( + "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)); + info.add( + "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]); @@ -635,95 +598,79 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber @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))); - final SlotWidget inventorySlot = - new SlotWidget(inventoryHandler, 1).setFilter(stack -> stack.getItem() == poweredSpawnerItem); + builder.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); DynamicPositionedColumn configurationElements = new DynamicPositionedColumn(); addConfigurationWidgets(configurationElements, buildContext, inventorySlot); - builder.widget(new DynamicPositionedColumn() - .setSynced(false) - .widget(inventorySlot) - .widget(new CycleButtonWidget() - .setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> { + 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") + + (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)); + }).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); builder.widget(screenElements); } - private void addConfigurationWidgets( - DynamicPositionedColumn configurationElements, UIBuildContext buildContext, SlotWidget inventorySlot) { + private void addConfigurationWidgets(DynamicPositionedColumn configurationElements, UIBuildContext buildContext, + SlotWidget inventorySlot) { configurationElements.setSynced(false); - configurationElements.widget(new CycleButtonWidget() - .setToggle(() -> isInRitualMode, v -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); - return; - } + configurationElements.widget(new CycleButtonWidget().setToggle(() -> isInRitualMode, v -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); + return; + } - isInRitualMode = v; - - if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; - if (!isInRitualMode) { - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Ritual mode disabled"); - } else { - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Ritual mode enabled"); - if (connectToRitual()) - 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")); - configurationElements.widget(new CycleButtonWidget() - .setToggle(() -> mIsProducingInfernalDrops, v -> { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); - return; - } + isInRitualMode = v; - mIsProducingInfernalDrops = v; + if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; + if (!isInRitualMode) { + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Ritual mode disabled"); + } else { + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Ritual mode enabled"); + if (connectToRitual()) + 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")); + configurationElements.widget(new CycleButtonWidget().setToggle(() -> mIsProducingInfernalDrops, v -> { + if (this.mMaxProgresstime > 0) { + GT_Utility.sendChatToPlayer(buildContext.getPlayer(), "Can't change mode when running !"); + return; + } + + mIsProducingInfernalDrops = v; - if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; - if (!mIsProducingInfernalDrops) - GT_Utility.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) + if (!(buildContext.getPlayer() instanceof EntityPlayerMP)) return; + if (!mIsProducingInfernalDrops) GT_Utility + .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))); } @@ -732,75 +679,75 @@ public class GT_MetaTileEntity_ExtremeExterminationChamber protected void drawTexts(DynamicPositionedColumn screenElements, SlotWidget inventorySlot) { 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)); + 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)); screenElements.widget(new DynamicTextWidget(() -> { - ItemStack aStack = mInventory[1]; - if (aStack == null) return new Text("Insert Powered Spawner").color(Color.RED.dark(3)); - else { - Text invalid = new Text("Invalid Spawner").color(Color.RED.dark(3)); - if (aStack.getItem() != poweredSpawnerItem) return invalid; + ItemStack aStack = mInventory[1]; + if (aStack == null) return new Text("Insert Powered Spawner").color(Color.RED.dark(3)); + else { + Text invalid = new Text("Invalid Spawner").color(Color.RED.dark(3)); + if (aStack.getItem() != poweredSpawnerItem) return invalid; - if (aStack.getTagCompound() == null) return invalid; - String mobType = aStack.getTagCompound().getString("mobType"); - if (mobType.isEmpty()) return invalid; + if (aStack.getTagCompound() == null) return invalid; + String mobType = aStack.getTagCompound().getString("mobType"); + if (mobType.isEmpty()) return invalid; - if (!MobNameToRecipeMap.containsKey(mobType)) return invalid; + if (!MobNameToRecipeMap.containsKey(mobType)) return invalid; - return new Text(StatCollector.translateToLocal("entity." + mobType + ".name")) - .color(Color.GREEN.dark(3)); - } - }) - .setEnabled(isFixed)); + return new Text(StatCollector.translateToLocal("entity." + mobType + ".name")) + .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 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 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 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 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 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 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 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 { + GT_MetaTileEntity_ExtremeExterminationChamber mte; ItemStack currentWeapon; 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 3a79f69275..bee5f1a5f4 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 @@ -1,20 +1,11 @@ /* - * KubaTech - Gregtech Addon - * Copyright (C) 2022 - 2023 kuba6000 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this library. If not, see . - * + * KubaTech - Gregtech Addon Copyright (C) 2022 - 2023 kuba6000 This library is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software + * Foundation; either version 3 of the License, or (at your option) any later version. This library is distributed in + * the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have + * received a copy of the GNU Lesser General Public License along with this library. If not, see + * . */ package kubatech.tileentity.gregtech.multiblock; @@ -27,6 +18,29 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_ import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static kubatech.api.Variables.*; +import java.io.IOException; +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import kubatech.Tags; +import kubatech.api.LoaderReference; +import kubatech.api.helpers.GTHelper; +import kubatech.api.implementations.KubaTechGTMultiBlockBase; +import kubatech.api.network.CustomTileEntityPacket; +import kubatech.api.tileentity.CustomTileEntityPacketHandler; +import kubatech.client.effect.MegaApiaryBeesRenderer; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; + import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; @@ -43,6 +57,7 @@ import com.gtnewhorizons.modularui.api.math.Color; import com.gtnewhorizons.modularui.api.screen.ModularWindow; import com.gtnewhorizons.modularui.api.screen.UIBuildContext; import com.gtnewhorizons.modularui.common.widget.*; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import forestry.api.apiculture.*; @@ -61,26 +76,6 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; -import java.io.IOException; -import java.util.*; -import java.util.stream.Collectors; -import java.util.stream.IntStream; -import kubatech.Tags; -import kubatech.api.LoaderReference; -import kubatech.api.helpers.GTHelper; -import kubatech.api.implementations.KubaTechGTMultiBlockBase; -import kubatech.api.network.CustomTileEntityPacket; -import kubatech.api.tileentity.CustomTileEntityPacketHandler; -import kubatech.client.effect.MegaApiaryBeesRenderer; -import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; public class GT_MetaTileEntity_MegaIndustrialApiary extends KubaTechGTMultiBlockBase @@ -100,7 +95,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary private static final int CONFIGURATION_WINDOW_ID = 999; private static final int MEGA_APIARY_STORAGE_VERSION = 1; - private static final String[][] struct = transpose(new String[][] { // spotless:off + private static final String[][] struct = transpose( + 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,75 +116,64 @@ public class GT_MetaTileEntity_MegaIndustrialApiary {" "," "," "," "," "," "," GGG "," GHG "," GGG "," "," "," "," "," "," "} });// spotless:on - private static final IStructureDefinition STRUCTURE_DEFINITION = - StructureDefinition.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", " ")) + private static final IStructureDefinition STRUCTURE_DEFINITION = StructureDefinition + .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())), + .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, - 5)) - .addElement( - 'I', - ofBlocksMap( - Collections.singletonMap( - Blocks.wooden_slab, - IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), + IntStream.rangeClosed(0, 5).boxed().collect(Collectors.toList())), + Blocks.planks, + 5)) + .addElement( + 'I', + ofBlocksMap( + Collections.singletonMap( 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() { - @Override - public boolean check( - GT_MetaTileEntity_MegaIndustrialApiary mte, World world, int x, int y, int z) { - mte.flowerCheck(world, x, y, z); - return true; - } + 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() { + + @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(); + @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) { @@ -247,50 +232,34 @@ public class GT_MetaTileEntity_MegaIndustrialApiary 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", "Runak