diff options
| author | Jakub <53441451+kuba6000@users.noreply.github.com> | 2023-03-17 19:31:20 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-17 19:31:20 +0100 |
| commit | b2ea15eddecd9720488bcf12a94a33558d9f3f2c (patch) | |
| tree | d63dade25e92114d75bff319ad9da526c7b6dcff /src/main | |
| parent | 45bb8439a94cd281323c30b00c0c80391bc7bebd (diff) | |
| download | GT5-Unofficial-b2ea15eddecd9720488bcf12a94a33558d9f3f2c.tar.gz GT5-Unofficial-b2ea15eddecd9720488bcf12a94a33558d9f3f2c.tar.bz2 GT5-Unofficial-b2ea15eddecd9720488bcf12a94a33558d9f3f2c.zip | |
Remove Extreme Industrial Greenhouse from BW (moved to KubaTech) (#301)
* Remove EIG from BW (moved)
* Delete patch
Former-commit-id: 240a1567f08092ca3336a5580a0170a6c75bd35d
Diffstat (limited to 'src/main')
6 files changed, 4 insertions, 1522 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_CropVisualizer.java b/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_CropVisualizer.java deleted file mode 100644 index 1bef2a4a2e..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/client/renderer/BW_CropVisualizer.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.github.bartimaeusnek.bartworks.client.renderer; - -import java.lang.reflect.Field; - -import net.minecraft.client.particle.EntityFX; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.init.Blocks; -import net.minecraft.launchwrapper.Launch; -import net.minecraft.world.World; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class BW_CropVisualizer extends EntityFX { - - int[] meta = new int[8]; - static Field tessellatorHasBrightnessField = null; - - public BW_CropVisualizer(World world, int x, int y, int z, int age) { - super(world, (double) x, ((double) y - 0.0625d), (double) z); - this.prevPosX = this.posX; - this.prevPosY = this.posY; - this.prevPosZ = this.posZ; - this.particleMaxAge = age; - for (int i = 0; i < 8; i++) this.meta[i] = this.rand.nextInt(8); - } - - @Override - public void onUpdate() { - if (this.particleAge++ >= this.particleMaxAge) this.setDead(); - } - - @Override - public void renderParticle(Tessellator p_70539_1_, float p_70539_2_, float p_70539_3_, float p_70539_4_, - float p_70539_5_, float p_70539_6_, float p_70539_7_) { - Tessellator tessellator = Tessellator.instance; - GL11.glDisable(GL11.GL_CULL_FACE); - GL11.glDepthMask(false); - try { - if (tessellatorHasBrightnessField == null) { - tessellatorHasBrightnessField = Tessellator.class.getDeclaredField( - (boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment") ? "hasBrightness" - : "field_78414_p"); - tessellatorHasBrightnessField.setAccessible(true); - } - tessellatorHasBrightnessField.set(tessellator, false); - } catch (NoSuchFieldException | IllegalAccessException e) { - throw new RuntimeException(e); - } - tessellator.setColorRGBA(255, 255, 255, 255); - double f12 = this.posY - interpPosY; - int i = 0; - for (int x = -1; x <= 1; x++) for (int z = -1; z <= 1; z++) { - if (x == 0 && z == 0) continue; - double f11 = (this.posX + (double) x) - interpPosX; - double f13 = (this.posZ + (double) z) - interpPosZ; - RenderBlocks.getInstance().renderBlockCropsImpl(Blocks.wheat, meta[i++], f11, f12, f13); - } - - GL11.glEnable(GL11.GL_CULL_FACE); - GL11.glDepthMask(true); - } - - @Override - public int getFXLayer() { - return 1; - } - - @Override - public boolean shouldRenderInPass(int pass) { - return pass == 2; - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java index cb4bd63e1d..c88438b9c0 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/ItemRegistry.java @@ -208,7 +208,6 @@ public class ItemRegistry { public static ItemStack[] voidminer = new ItemStack[3]; public static ItemStack THTR; public static ItemStack HTGR; - public static ItemStack EIG; public static ItemStack eic; public static ItemStack cal; public static ItemStack compressedHatch; @@ -270,10 +269,9 @@ public class ItemRegistry { "HTGR", "High Temperature Gas-cooled Reactor").getStackForm(1L); GT_TileEntity_HTGR.HTGRMaterials.registeraTHR_Materials(); - ItemRegistry.EIG = new GT_TileEntity_ExtremeIndustrialGreenhouse( - ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 15 + 49, - "EIG", - "Extreme Industrial Greenhouse").getStackForm(1L); + + // ID ConfigHandler.IDOffset + GT_Values.VN.length * 8 + 15 + 49 IS TAKEN !!! (12792) + GT_OreDictUnificator.add( OrePrefixes.block, Materials.BorosilicateGlass, diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java index 7c9dc72202..d3c334d5dd 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/loaders/RecipeLoader.java @@ -776,13 +776,6 @@ public class RecipeLoader { new Object[] { "BZB", "BRB", "BZB", 'B', new ItemStack(GregTech_API.sBlockCasings8, 1, 5), 'R', GT_ModHandler.getModItem("IC2", "blockGenerator", 1, 5), 'Z', "circuitSuperconductor" }); - GT_ModHandler.addCraftingRecipe( - ItemRegistry.EIG, - RecipeLoader.BITSD, - new Object[] { "AZA", "BRB", "AZA", 'B', new ItemStack(GregTech_API.sBlockCasings4, 1, 1), 'R', - GT_ModHandler.getModItem("EnderIO", "blockFarmStation", 1), 'A', - new ItemStack(GregTech_API.sBlockMachines, 1, 11104), 'Z', "circuitUltimate" }); - if (LoaderReference.galacticgreg) { GT_Values.RA.addAssemblylineRecipe( ItemList.OreDrill4.get(1L), diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java index a1d7d23c46..14dcd3006c 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/BW_Network.java @@ -54,8 +54,7 @@ public class BW_Network extends MessageToMessageCodec<FMLProxyPacket, GT_Packet> public BW_Network() { this.mChannel = NetworkRegistry.INSTANCE.newChannel("BartWorks", this, new BW_Network.HandlerShared()); this.mSubChannels = new GT_Packet[] { new RendererPacket(), new CircuitProgrammerPacket(), - new MetaBlockPacket(), new OreDictCachePacket(), new ServerJoinedPackage(), new EICPacket(), - new EIGPacket() }; + new MetaBlockPacket(), new OreDictCachePacket(), new ServerJoinedPackage(), new EICPacket() }; } protected void encode(ChannelHandlerContext aContext, GT_Packet aPacket, List<Object> aOutput) throws Exception { diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/EIGPacket.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/net/EIGPacket.java deleted file mode 100644 index f21960d65f..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/net/EIGPacket.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.github.bartimaeusnek.bartworks.common.net; - -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.IBlockAccess; - -import com.github.bartimaeusnek.bartworks.API.SideReference; -import com.github.bartimaeusnek.bartworks.common.tileentities.multis.GT_TileEntity_ExtremeIndustrialGreenhouse; -import com.github.bartimaeusnek.bartworks.util.Coords; -import com.google.common.io.ByteArrayDataInput; - -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.net.GT_Packet_New; -import io.netty.buffer.ByteBuf; - -public class EIGPacket extends GT_Packet_New { - - private Coords coords; - private int mMaxSlots; - - public EIGPacket() { - super(true); - } - - public EIGPacket(Coords coords, int mMaxSlots) { - super(false); - this.coords = coords; - this.mMaxSlots = mMaxSlots; - } - - @Override - public byte getPacketID() { - return 6; - } - - @Override - public void encode(ByteBuf aOut) { - aOut.writeInt(coords.x); - aOut.writeInt(coords.y); - aOut.writeInt(coords.z); - aOut.writeInt(mMaxSlots); - } - - @Override - public GT_Packet_New decode(ByteArrayDataInput aData) { - return new EIGPacket(new Coords(aData.readInt(), aData.readInt(), aData.readInt()), aData.readInt()); - } - - @Override - public void process(IBlockAccess aWorld) { - if (SideReference.Side.Client) { - TileEntity te = aWorld.getTileEntity(coords.x, coords.y, coords.z); - if (!(te instanceof IGregTechTileEntity)) return; - IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity(); - if (!(mte instanceof GT_TileEntity_ExtremeIndustrialGreenhouse)) return; - ((GT_TileEntity_ExtremeIndustrialGreenhouse) mte).mMaxSlots = this.mMaxSlots; - } - } -} diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ExtremeIndustrialGreenhouse.java b/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ExtremeIndustrialGreenhouse.java deleted file mode 100644 index 408342006e..0000000000 --- a/src/main/java/com/github/bartimaeusnek/bartworks/common/tileentities/multis/GT_TileEntity_ExtremeIndustrialGreenhouse.java +++ /dev/null @@ -1,1372 +0,0 @@ -/* - * Copyright (C) 2022 kuba6000 This program is free software: you can redistribute it and/or modify it under the terms - * of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. This program 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 - * General Public License for more details. You should have received a copy of the GNU General Public License along with - * this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package com.github.bartimaeusnek.bartworks.common.tileentities.multis; - -import static com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference.MULTIBLOCK_ADDED_VIA_BARTWORKS; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static gregtech.api.enums.GT_Values.AuthorKuba; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - -import java.io.IOException; -import java.util.*; -import java.util.function.Function; -import java.util.stream.Collectors; - -import net.minecraft.block.Block; -import net.minecraft.block.BlockFlower; -import net.minecraft.block.BlockStem; -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.init.Items; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.*; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.IPlantable; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; - -import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; -import com.github.bartimaeusnek.bartworks.API.LoaderReference; -import com.github.bartimaeusnek.bartworks.MainMod; -import com.github.bartimaeusnek.bartworks.client.renderer.BW_CropVisualizer; -import com.github.bartimaeusnek.bartworks.common.net.EIGPacket; -import com.github.bartimaeusnek.bartworks.util.BW_Tooltip_Reference; -import com.github.bartimaeusnek.bartworks.util.ChatColorHelper; -import com.github.bartimaeusnek.bartworks.util.Coords; -import com.gtnewhorizon.structurelib.alignment.IAlignmentLimits; -import com.gtnewhorizon.structurelib.structure.IStructureDefinition; -import com.gtnewhorizon.structurelib.structure.StructureDefinition; -import com.gtnewhorizons.modularui.api.ModularUITextures; -import com.gtnewhorizons.modularui.api.drawable.IDrawable; -import com.gtnewhorizons.modularui.api.drawable.ItemDrawable; -import com.gtnewhorizons.modularui.api.drawable.Text; -import com.gtnewhorizons.modularui.api.math.Color; -import com.gtnewhorizons.modularui.api.math.Pos2d; -import com.gtnewhorizons.modularui.api.screen.ModularWindow; -import com.gtnewhorizons.modularui.api.screen.UIBuildContext; -import com.gtnewhorizons.modularui.api.widget.Widget; -import com.gtnewhorizons.modularui.common.widget.*; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; -import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -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.*; -import gregtech.api.render.TextureFactory; -import gregtech.api.util.GT_Multiblock_Tooltip_Builder; -import gregtech.api.util.GT_Utility; -import gregtech.common.GT_DummyWorld; -import gregtech.common.blocks.GT_Block_Ores_Abstract; -import gregtech.common.blocks.GT_Item_Ores; -import gregtech.common.blocks.GT_TileEntity_Ores; -import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME; -import ic2.api.crops.CropCard; -import ic2.api.crops.Crops; -import ic2.core.Ic2Items; -import ic2.core.crop.TileEntityCrop; - -public class GT_TileEntity_ExtremeIndustrialGreenhouse - extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_TileEntity_ExtremeIndustrialGreenhouse> { - - private static final boolean debug = false; - private static final int EIG_MATH_VERSION = 0; - private static final int CONFIGURATION_WINDOW_ID = 999; - - private int oldVersion = 0; - private int mCasing = 0; - public int mMaxSlots = 0; - private int setupphase = 1; - private boolean isIC2Mode = false; - private byte glasTier = 0; - private int waterusage = 0; - private int weedexusage = 0; - private boolean isNoHumidity = false; - private static final int CASING_INDEX = 49; - private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final Item forestryfertilizer = GameRegistry.findItem("Forestry", "fertilizerCompound"); - private static final Fluid weedex = Materials.WeedEX9000.mFluid; - private static final IStructureDefinition<GT_TileEntity_ExtremeIndustrialGreenhouse> STRUCTURE_DEFINITION = StructureDefinition - .<GT_TileEntity_ExtremeIndustrialGreenhouse>builder() - .addShape( - STRUCTURE_PIECE_MAIN, - transpose( - new String[][] { { "ccccc", "ccccc", "ccccc", "ccccc", "ccccc" }, - { "ccccc", "clllc", "clllc", "clllc", "ccccc" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ggggg", "g---g", "g---g", "g---g", "ggggg" }, - { "ccccc", "cdddc", "cdwdc", "cdddc", "ccccc" }, - { "cc~cc", "cCCCc", "cCCCc", "cCCCc", "ccccc" }, })) - .addElement( - 'c', - ofChain( - onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), - ofHatchAdder( - GT_TileEntity_ExtremeIndustrialGreenhouse::addEnergyInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_TileEntity_ExtremeIndustrialGreenhouse::addMaintenanceToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_TileEntity_ExtremeIndustrialGreenhouse::addInputToMachineList, - CASING_INDEX, - 1), - ofHatchAdder( - GT_TileEntity_ExtremeIndustrialGreenhouse::addOutputToMachineList, - CASING_INDEX, - 1))) - .addElement('C', onElementPass(t -> t.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1))) - .addElement( - 'l', - LoaderReference.ProjRedIllumination - ? ofBlock(Block.getBlockFromName("ProjRed|Illumination:projectred.illumination.lamp"), 10) - : ofBlock(Blocks.redstone_lamp, 0)) - .addElement( - 'g', - debug ? ofBlock(Blocks.glass, 0) - : BorosilicateGlass.ofBoroGlass( - (byte) 0, - (byte) 1, - Byte.MAX_VALUE, - (te, t) -> te.glasTier = t, - te -> te.glasTier)) - .addElement( - 'd', - ofBlock( - LoaderReference.RandomThings ? Block.getBlockFromName("RandomThings:fertilizedDirt_tilled") - : Blocks.farmland, - 0)) - .addElement('w', ofBlock(Blocks.water, 0)).build(); - - public GT_TileEntity_ExtremeIndustrialGreenhouse(int aID, String aName, String aNameRegional) { - super(aID, aName, aNameRegional); - } - - public GT_TileEntity_ExtremeIndustrialGreenhouse(String aName) { - super(aName); - } - - @Override - public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - if (aPlayer.isSneaking()) { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(aPlayer, "You can't change IC2 mode if the machine is working!"); - return; - } - if (!mStorage.isEmpty()) { - GT_Utility.sendChatToPlayer(aPlayer, "You can't change IC2 mode if there are seeds inside!"); - return; - } - this.isIC2Mode = !this.isIC2Mode; - GT_Utility.sendChatToPlayer(aPlayer, "IC2 mode is now " + (this.isIC2Mode ? "enabled" : "disabled.")); - } else { - if (this.mMaxProgresstime > 0) { - GT_Utility.sendChatToPlayer(aPlayer, "You can't enable/disable setup if the machine is working!"); - return; - } - this.setupphase++; - if (this.setupphase == 3) this.setupphase = 0; - GT_Utility.sendChatToPlayer( - aPlayer, - "EIG is now running in " + (this.setupphase == 1 ? "setup mode (input)." - : (this.setupphase == 2 ? "setup mode (output)." : "normal operation."))); - } - } - - @Override - public boolean onWireCutterRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, - float aZ) { - isNoHumidity = !isNoHumidity; - GT_Utility.sendChatToPlayer(aPlayer, "Give incoming crops no humidity " + isNoHumidity); - return true; - } - - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity iGregTechTileEntity) { - return new GT_TileEntity_ExtremeIndustrialGreenhouse(this.mName); - } - - @Override - public IStructureDefinition<GT_TileEntity_ExtremeIndustrialGreenhouse> getStructureDefinition() { - return STRUCTURE_DEFINITION; - } - - @Override - protected IAlignmentLimits getInitialAlignmentLimits() { - return (d, r, f) -> d.offsetY == 0 && r.isNotRotated() && f.isNotFlipped(); - } - - private static String tierString(int tier) { - return GT_Values.TIER_COLORS[tier] + GT_Values.VN[tier] + ChatColorHelper.RESET + ChatColorHelper.GRAY; - } - - @Override - protected GT_Multiblock_Tooltip_Builder createTooltip() { - GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Crop Farm").addInfo("Controller block for the Extreme Industrial Greenhouse") - .addInfo(AuthorKuba).addInfo("Grow your crops like a chad !") - .addInfo("Use screwdriver to enable/change/disable setup mode") - .addInfo("Use screwdriver while sneaking to enable/disable IC2 mode") - .addInfo("Use wire cutters to give incoming IC2 crops 0 humidity") - .addInfo("Uses 1000L of water per crop per operation") - .addInfo("If there are >= 1000 crops -> Uses 1L of Weed-EX 9000 per crop per second") - .addInfo("Otherwise, around 1% of crops will die each operation") - .addInfo("You can insert fertilizer each operation to get more drops (max +400%)") - .addInfo("-------------------- SETUP MODE --------------------").addInfo("Does not take power") - .addInfo("There are two modes: input / output") - .addInfo("Input mode: machine will take seeds from input bus and plant them") - .addInfo("[IC2] You need to also input block that is required under the crop") - .addInfo("Output mode: machine will take planted seeds and output them") - .addInfo("-------------------- NORMAL CROPS --------------------") - .addInfo("Minimal tier: " + tierString(4)).addInfo("Starting with 1 slot") - .addInfo("Every slot gives 64 crops") - .addInfo("Every tier past " + tierString(4) + ", slots are multiplied by 2") - .addInfo("Base process time: 5 sec") - .addInfo("Process time is divided by number of tiers past " + tierString(3) + " (Minimum 1 sec)") - .addInfo("All crops are grown at the end of the operation") - .addInfo("Will automatically craft seeds if they are not dropped") - .addInfo("1 Fertilizer per 1 crop +200%") - .addInfo("-------------------- IC2 CROPS --------------------") - .addInfo("Minimal tier: " + tierString(6)).addInfo("Need " + tierString(6) + " glass tier") - .addInfo("Starting with 4 slots").addInfo("Every slot gives 1 crop") - .addInfo("Every tier past " + tierString(6) + ", slots are multiplied by 4") - .addInfo("Process time: 5 sec").addInfo("All crops are accelerated by x32 times") - .addInfo("1 Fertilizer per 1 crop +10%").addInfo(BW_Tooltip_Reference.TT_BLUEPRINT).addSeparator() - .beginStructureBlock(5, 6, 5, false).addController("Front bottom center") - .addCasingInfo("Clean Stainless Steel Casings", 70) - .addOtherStructurePart("Borosilicate Glass", "Hollow two middle layers") - .addStructureInfo("The glass tier limits the Energy Input tier") - .addStructureInfo("The dirt is from RandomThings, must be tilled") - .addStructureInfo("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted") - .addMaintenanceHatch("Any casing (Except inner bottom ones)", 1) - .addInputBus("Any casing (Except inner bottom ones)", 1) - .addOutputBus("Any casing (Except inner bottom ones)", 1) - .addInputHatch("Any casing (Except inner bottom ones)", 1) - .addEnergyHatch("Any casing (Except inner bottom ones)", 1) - .toolTipFinisher(MULTIBLOCK_ADDED_VIA_BARTWORKS.apply(ChatColorHelper.GOLD + "kuba6000")); - return tt; - } - - @Override - public String[] getStructureDescription(ItemStack stackSize) { - List<String> info = new ArrayList<>(Arrays.asList(super.getStructureDescription(stackSize))); - info.add("The dirt is from RandomThings, must be tilled"); - info.add("Purple lamps are from ProjectRedIllumination. They can be powered and/or inverted"); - return info.toArray(new String[] {}); - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - aNBT.setInteger("EIG_MATH_VERSION", EIG_MATH_VERSION); - aNBT.setByte("glasTier", glasTier); - aNBT.setInteger("setupphase", setupphase); - aNBT.setBoolean("isIC2Mode", isIC2Mode); - aNBT.setBoolean("isNoHumidity", isNoHumidity); - aNBT.setInteger("mStorageSize", mStorage.size()); - for (int i = 0; i < mStorage.size(); i++) aNBT.setTag("mStorage." + i, mStorage.get(i).toNBTTagCompound()); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - oldVersion = aNBT.hasKey("EIG_MATH_VERSION") ? aNBT.getInteger("EIG_MATH_VERSION") : -1; - glasTier = aNBT.getByte("glasTier"); - setupphase = aNBT.getInteger("setupphase"); - isIC2Mode = aNBT.getBoolean("isIC2Mode"); - isNoHumidity = aNBT.getBoolean("isNoHumidity"); - for (int i = 0; i < aNBT.getInteger("mStorageSize"); i++) - mStorage.add(new GreenHouseSlot(aNBT.getCompoundTag("mStorage." + i))); - } - - @SideOnly(Side.CLIENT) - public void spawnVisualCrops(World world, int x, int y, int z, int age) { - BW_CropVisualizer crop = new BW_CropVisualizer(world, x, y, z, age); - Minecraft.getMinecraft().effectRenderer.addEffect(crop); - } - - @Override - public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - if (aBaseMetaTileEntity.isClientSide()) { - if (aBaseMetaTileEntity.isActive() && aTick % 40 == 0) { - int[] abc = new int[] { 0, -2, 2 }; - int[] xyz = new int[] { 0, 0, 0 }; - this.getExtendedFacing().getWorldOffset(abc, xyz); - xyz[0] += aBaseMetaTileEntity.getXCoord(); - xyz[1] += aBaseMetaTileEntity.getYCoord(); - xyz[2] += aBaseMetaTileEntity.getZCoord(); - spawnVisualCrops(aBaseMetaTileEntity.getWorld(), xyz[0], xyz[1], xyz[2], 40); - } - } - if (aBaseMetaTileEntity.isServerSide()) { - MainMod.BW_Network_instance.sendPacketToAllPlayersInRange( - aBaseMetaTileEntity.getWorld(), - new EIGPacket( - new Coords( - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getYCoord(), - aBaseMetaTileEntity.getZCoord()), - mMaxSlots), - aBaseMetaTileEntity.getXCoord(), - aBaseMetaTileEntity.getZCoord()); - } - } - - @Override - public void construct(ItemStack itemStack, boolean b) { - buildPiece(STRUCTURE_PIECE_MAIN, itemStack, b, 2, 5, 0); - } - - @Override - public boolean isCorrectMachinePart(ItemStack itemStack) { - return true; - } - - private void updateMaxSlots() { - long v = this.getMaxInputVoltage(); - int tier = GT_Utility.getTier(v); - if (tier < (isIC2Mode ? 6 : 4)) mMaxSlots = 0; - else if (isIC2Mode) mMaxSlots = 4 << (2 * (tier - 6)); - else mMaxSlots = 1 << (tier - 4); - } - - @Override - public boolean checkRecipe(ItemStack itemStack) { - long v = this.getMaxInputVoltage(); - int tier = GT_Utility.getTier(v); - updateMaxSlots(); - - if (oldVersion != EIG_MATH_VERSION) { - for (GreenHouseSlot slot : mStorage) slot.recalculate(this, getBaseMetaTileEntity().getWorld()); - oldVersion = EIG_MATH_VERSION; - } - - if (setupphase > 0) { - if ((mStorage.size() >= mMaxSlots && setupphase == 1) || (mStorage.size() == 0 && setupphase == 2)) - return false; - - if (setupphase == 1) { - List<ItemStack> inputs = getStoredInputs(); - for (ItemStack input : inputs) { - addCrop(input); - if (mStorage.size() >= mMaxSlots) break; - } - } else if (setupphase == 2) { - int emptySlots = 0; - boolean ignoreEmptiness = false; - for (GT_MetaTileEntity_Hatch_OutputBus i : mOutputBusses) { - if (i instanceof GT_MetaTileEntity_Hatch_OutputBus_ME) { - ignoreEmptiness = true; - break; - } - for (int j = 0; j < i.getSizeInventory(); j++) - if (i.isValidSlot(j)) if (i.getStackInSlot(j) == null) emptySlots++; - } - while (mStorage.size() > 0) { - if (!ignoreEmptiness && (emptySlots -= 2) < 0) break; - this.addOutput(this.mStorage.get(0).input.copy()); - if (this.mStorage.get(0).undercrop != null) this.addOutput(this.mStorage.get(0).undercrop.copy()); - this.mStorage.remove(0); - } - } - - this.updateSlots(); - this.mMaxProgresstime = 5; - this.mEUt = 0; - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - return true; - } - if (mStorage.size() > mMaxSlots) return false; - if (mStorage.isEmpty()) return false; - - waterusage = 0; - weedexusage = 0; - for (GreenHouseSlot s : mStorage) waterusage += s.input.stackSize; - if (waterusage >= 1000) weedexusage = waterusage; - waterusage *= 1000; - - List<GT_MetaTileEntity_Hatch_Input> fluids = mInputHatches; - List<GT_MetaTileEntity_Hatch_Input> fluidsToUse = new ArrayList<>(fluids.size()); - int watercheck = waterusage; - FluidStack waterStack = new FluidStack(FluidRegistry.WATER, 1); - for (GT_MetaTileEntity_Hatch_Input i : fluids) { - if (!isValidMetaTileEntity(i)) continue; - if (i instanceof GT_MetaTileEntity_Hatch_MultiInput) { - int amount = ((GT_MetaTileEntity_Hatch_MultiInput) i).getFluidAmount(waterStack); - if (amount == 0) continue; - watercheck -= amount; - } else { - FluidStack stack = i.getDrainableStack(); - if (stack == null) continue; - if (!stack.isFluidEqual(waterStack)) continue; - if (stack.amount <= 0) continue; - watercheck -= stack.amount; - } - fluidsToUse.add(i); - if (watercheck <= 0) break; - } - if (watercheck > 0 && !debug) return false; - watercheck = waterusage; - for (GT_MetaTileEntity_Hatch_Input i : fluidsToUse) { - int used = i.drain(watercheck, true).amount; - watercheck -= used; - } - - // weedex - if (weedexusage > 0 && !this.depleteInput(new FluidStack(weedex, isIC2Mode ? weedexusage * 5 : weedexusage))) { - IGregTechTileEntity baseMTE = this.getBaseMetaTileEntity(); - int tokill = baseMTE.getRandomNumber((int) ((double) weedexusage * 0.02d) + 1); - for (int i = 0; i < tokill;) { - GreenHouseSlot removed = mStorage.remove(baseMTE.getRandomNumber(mStorage.size())); - i -= removed.input.stackSize; - } - } - - // OVERCLOCK - // FERTILIZER IDEA: - // IC2 +10% per fertilizer per crop per operation - // NORMAL +200% per fertilizer per crop per operation - - int boost = 0; - int maxboost = 0; - for (GreenHouseSlot s : mStorage) maxboost += s.input.stackSize * (isIC2Mode ? 40 : 2); - - ArrayList<ItemStack> inputs = getStoredInputs(); - for (ItemStack i : inputs) { - if ((i.getItem() == Items.dye && i.getItemDamage() == 15) - || (forestryfertilizer != null && (i.getItem() == forestryfertilizer)) - || (GT_Utility.areStacksEqual(i, Ic2Items.fertilizer))) { - int used = Math.min(i.stackSize, maxboost - boost); - i.stackSize -= used; - boost += used; - } - if (boost == maxboost) break; - } - - double multiplier = 1.d + (((double) boost / (double) maxboost) * 4d); - - if (isIC2Mode) { - if (glasTier < 6) return false; - this.mMaxProgresstime = 100; - List<ItemStack> outputs = new ArrayList<>(); - for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) - outputs.addAll(mStorage.get(i).getIC2Drops(((double) this.mMaxProgresstime * 32d) * multiplier)); - this.mOutputItems = outputs.toArray(new ItemStack[0]); - } else { - this.mMaxProgresstime = Math.max(20, 100 / (tier - 3)); // Min 1 s - List<ItemStack> outputs = new ArrayList<>(); - for (int i = 0; i < Math.min(mMaxSlots, mStorage.size()); i++) { - for (ItemStack drop : mStorage.get(i).getDrops()) { - ItemStack s = drop.copy(); - s.stackSize = (int) ((double) s.stackSize * multiplier); - outputs.add(s); - } - } - this.mOutputItems = outputs.toArray(new ItemStack[0]); - } - this.mEUt = -(int) ((double) GT_Values.V[tier] * 0.99d); - this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); - this.mEfficiencyIncrease = 10000; - this.updateSlots(); - return true; - } - - @Override - public boolean checkMachine(IGregTechTileEntity iGregTechTileEntity, ItemStack itemStack) { - mCasing = 0; - glasTier = 0; - if (debug) glasTier = 8; - - if (!checkPiece(STRUCTURE_PIECE_MAIN, 2, 5, 0)) return false; - - if (this.glasTier < 8 && !this.mEnergyHatches.isEmpty()) - for (GT_MetaTileEntity_Hatch_Energy hatchEnergy : this.mEnergyHatches) - if (this.glasTier < hatchEnergy.mTier) return false; - - boolean valid = this.mMaintenanceHatches.size() == 1 && this.mEnergyHatches.size() >= 1 && this.mCasing >= 70; - - if (valid) updateMaxSlots(); - - return valid; - } - - @Override - public int getMaxEfficiency(ItemStack itemStack) { - return 10000; - } - - @Override - public int getDamageToComponent(ItemStack itemStack) { - return 0; - } - - @Override - public boolean explodesOnComponentBreak(ItemStack itemStack) { - return false; - } - - @Override - public boolean useModularUI() { - return true; - } - - private final Function<Widget, Boolean> isFixed = widget -> getIdealStatus() == getRepairStatus() && mMachine; - - private static final Function<Integer, IDrawable[]> toggleButtonBackgroundGetter = val -> { - if (val == 0) return new IDrawable[] { GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CROSS }; - else return new IDrawable[] { GT_UITextures.BUTTON_STANDARD, GT_UITextures.OVERLAY_BUTTON_CHECKMARK }; - }; - - @Override - public int getGUIHeight() { - return 166; - } - - @Override - public int getGUIWidth() { - return 176; - } - - @Override - public void bindPlayerInventoryUI(ModularWindow.Builder builder, UIBuildContext buildContext) { - builder.bindPlayerInventory(buildContext.getPlayer(), new Pos2d(7, 83), this.getGUITextureSet().getItemSlot()); - } - - @Override - public void addUIWidgets(ModularWindow.B |
