aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/kubatech/tileentity/gregtech/multiblock
diff options
context:
space:
mode:
authorJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
committerJason Mitchell <mitchej@gmail.com>2023-01-28 19:03:53 -0800
commitf51616bda220887fdd45c4bc951ff59e3398213a (patch)
tree35fdbb15b4c7ea0282773a388eff517a1d09d941 /src/main/java/kubatech/tileentity/gregtech/multiblock
parent11216d666cbc30fc1e1dfc84e1e0c2f4252b1fc2 (diff)
downloadGT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.gz
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.tar.bz2
GT5-Unofficial-f51616bda220887fdd45c4bc951ff59e3398213a.zip
[ci skip] spotlessApply with the new settings
Diffstat (limited to 'src/main/java/kubatech/tileentity/gregtech/multiblock')
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeExterminationChamber.java571
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java664
2 files changed, 556 insertions, 679 deletions
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 <https://www.gnu.org/licenses/>.
- *
+ * 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
+ * <https://www.gnu.org/licenses/>.
*/
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<GT_MetaTileEntity_ExtremeExterminationChamber>
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<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();
+ 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();
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<String, AttributeModifier>)
- lootingHolder.getAttributeModifiers())
- .get(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName()).stream()
- .mapToDouble(attr -> attr.getAmount()
- + (double) EnchantmentHelper.func_152377_a(
- lootingHolder, EnumCreatureAttribute.UNDEFINED))
+ // 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();
} 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<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"));
+ 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 <https://www.gnu.org/licenses/>.
- *
+ * 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
+ * <https://www.gnu.org/licenses/>.
*/
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<GT_MetaTileEntity_MegaIndustrialApiary>
@@ -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<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", " "))
+ 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())),
+ .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<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;
- }
+ 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;
+ }
- @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", "Runakai"))
- .addInfo("The ideal home for your bees")
- .addInfo("AKA. Mega Apiary")
- .addInfo("Use screwdriver to change primary mode (INPUT/OUTPUT/OPERATING)")
+ .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("--------------------- 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("-------------------- OUTPUT MODE ---------------------").addInfo("- Does not take power")
.addInfo("- Will give your bees back to output bus")
- .addInfo("------------------- OPERATING MODE -------------------")
- .addInfo("- NORMAL:")
+ .addInfo("------------------- OPERATING MODE -------------------").addInfo("- NORMAL:")
.addInfo(" - For each " + voltageFormatted(6) + " amp you can insert 1 bee")
.addInfo(" - Processing time: 5 seconds")
.addInfo(" - Uses 1 " + voltageFormatted(6) + " amp per queen")
- .addInfo(" - All bees are accelerated 64 times")
- .addInfo(" - 8 production upgrades are applied")
+ .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(" - 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 " + voltageFormatted(5))
- .addInfo(" - Can overclock")
- .addInfo(StructureHologram)
- .addSeparator()
- .beginStructureBlock(15, 17, 15, false)
- .addController("Front Bottom Center")
- .addCasingInfo("Bronze Plated Bricks", 190)
+ .addInfo(" - Consumes 100 royal jelly per operation").addInfo(" - Base processing time: 1 minute")
+ .addInfo(" - Uses 1 amp " + voltageFormatted(5)).addInfo(" - Can overclock")
+ .addInfo(StructureHologram).addSeparator().beginStructureBlock(15, 17, 15, false)
+ .addController("Front Bottom Center").addCasingInfo("Bronze Plated Bricks", 190)
.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)
+ .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;
}
@@ -302,8 +271,7 @@ 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);
}
@@ -385,8 +353,8 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
packet.sendToAllAround(20);
} else {
if (aBaseMetaTileEntity.isActive() && aTick % 100 == 0) {
- int[] abc = new int[] {0, -2, 7};
- int[] xyz = new int[] {0, 0, 0};
+ int[] abc = new int[] { 0, -2, 7 };
+ int[] xyz = new int[] { 0, 0, 0 };
this.getExtendedFacing().getWorldOffset(abc, xyz);
xyz[0] += aBaseMetaTileEntity.getXCoord();
xyz[1] += aBaseMetaTileEntity.getYCoord();
@@ -492,7 +460,7 @@ 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;
}
@@ -505,17 +473,22 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
@Override
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)"))));
- info.add("Bee storage (" + EnumChatFormatting.GOLD + mStorage.size() + EnumChatFormatting.RESET + "/"
- + (mStorage.size() > mMaxSlots
- ? EnumChatFormatting.DARK_RED.toString()
- : EnumChatFormatting.GOLD.toString())
- + mMaxSlots + EnumChatFormatting.RESET + "):");
+ info.add(
+ "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
+ + "):");
HashMap<String, Integer> infos = new HashMap<>();
for (int i = 0; i < mStorage.size(); i++) {
StringBuilder builder = new StringBuilder();
@@ -556,41 +529,19 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
}
@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) };
}
@Override
@@ -605,93 +556,85 @@ 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)));
+ builder.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();
// Slot is not needed
- builder.widget(new DynamicPositionedColumn()
- .setSynced(false)
- .widget(new CycleButtonWidget()
- .setToggle(() -> getBaseMetaTileEntity().isAllowedToWork(), works -> {
+ builder.widget(
+ 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")
+ + (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));
+ }).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));
final List<ItemStack> drawables = new ArrayList<>(mMaxSlots);
final int perRow = 7;
Scrollable beesContainer = new Scrollable().setVerticalScroll();
- if (mMaxSlots > 0)
- for (int i = 0, imax = ((mMaxSlots - 1) / perRow); i <= imax; i++) {
- DynamicPositionedRow row = new DynamicPositionedRow().setSynced(false);
- for (int j = 0, jmax = (i == imax ? (mMaxSlots - 1) % perRow : (perRow - 1)); j <= jmax; j++) {
- final int finalI = i * perRow;
- final int finalJ = j;
- final int ID = finalI + finalJ;
- row.widget(new ButtonWidget()
- .setOnClick((clickData, widget) -> {
- if (!(player instanceof EntityPlayerMP)) return;
- if (mStorage.size() <= ID) return;
- if (this.mMaxProgresstime > 0) {
- GT_Utility.sendChatToPlayer(player, "Can't eject while running !");
- return;
- }
- BeeSimulator removed = mStorage.remove(ID);
- addOutput(removed.queenStack);
- isCacheDirty = true;
- GT_Utility.sendChatToPlayer(player, "Queen ejected !");
- })
- .setBackground(() -> new IDrawable[] {
- getBaseMetaTileEntity().getGUITextureSet().getItemSlot(),
+ if (mMaxSlots > 0) for (int i = 0, imax = ((mMaxSlots - 1) / perRow); i <= imax; i++) {
+ DynamicPositionedRow row = new DynamicPositionedRow().setSynced(false);
+ for (int j = 0, jmax = (i == imax ? (mMaxSlots - 1) % perRow : (perRow - 1)); j <= jmax; j++) {
+ final int finalI = i * perRow;
+ final int finalJ = j;
+ final int ID = finalI + finalJ;
+ row.widget(new ButtonWidget().setOnClick((clickData, widget) -> {
+ if (!(player instanceof EntityPlayerMP)) return;
+ if (mStorage.size() <= ID) return;
+ if (this.mMaxProgresstime > 0) {
+ GT_Utility.sendChatToPlayer(player, "Can't eject while running !");
+ return;
+ }
+ BeeSimulator removed = mStorage.remove(ID);
+ addOutput(removed.queenStack);
+ isCacheDirty = true;
+ 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");
- return Collections.emptyList();
- })
- .setSize(18, 18));
- }
- beesContainer.widget(row.setPos(0, i * 18).setEnabled(widget -> {
- int y = widget.getPos().y;
- int cy = beesContainer.getVerticalScrollOffset();
- int ch = beesContainer.getVisibleHeight();
- return y >= cy - ch && y <= cy + ch;
- }));
+ .withFixedSize(16, 16, 1, 1) })
+ .dynamicTooltip(() -> {
+ if (drawables.size() > ID) return Arrays.asList(
+ drawables.get(ID).getDisplayName(),
+ EnumChatFormatting.GRAY + "Left click to eject");
+ return Collections.emptyList();
+ }).setSize(18, 18));
}
+ beesContainer.widget(row.setPos(0, i * 18).setEnabled(widget -> {
+ int y = widget.getPos().y;
+ int cy = beesContainer.getVerticalScrollOffset();
+ int ch = beesContainer.getVisibleHeight();
+ return y >= cy - ch && y <= cy + ch;
+ }));
+ }
beesContainer.attachSyncer(
new FakeSyncWidget.ListSyncer<>(
() -> mStorage.stream().map(s -> s.queenStack).collect(Collectors.toList()),
@@ -725,17 +668,13 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
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))
+ 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 -> {
+ .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;
@@ -752,81 +691,73 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
break;
case 2:
GT_Utility.sendChatToPlayer(
- player, "Changed primary mode to: Operating mode");
+ 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()));
+ }).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();
}
@@ -834,58 +765,59 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
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 (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 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 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 BeeSimulator {
+
ItemStack queenStack;
boolean isValid;
// boolean isBreadingMode;
@@ -919,11 +851,9 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
this.flowerType = genome.getFlowerProvider().getFlowerType();
IAlleleBeeSpecies primary = genome.getPrimary();
beeSpeed = genome.getSpeed() * beeModifier.getProductionModifier(null, 1.f);
- genome.getPrimary()
- .getProductChances()
+ genome.getPrimary().getProductChances()
.forEach((key, value) -> drops.add(new BeeDrop(key, value, beeSpeed, t)));
- genome.getSecondary()
- .getProductChances()
+ 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)));
@@ -953,8 +883,7 @@ 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());
@@ -994,6 +923,7 @@ public class GT_MetaTileEntity_MegaIndustrialApiary
}
private static class BeeDrop {
+
ItemStack stack;
double amount;
GT_Utility.ItemId id;