From b230d17992013dcb5f3df142788f0cb51a72d1e0 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:48:48 +0000 Subject: Added Advanced Air Intake Hatch. Added Reservoir Hatch. Refactored Air Intake Hatch into a base class. --- .../GT_MetaTileEntity_Hatch_AirIntake.java | 251 +++----------------- .../GT_MetaTileEntity_Hatch_AirIntake_Extreme.java | 110 +++++++++ .../GT_MetaTileEntity_Hatch_FluidGenerator.java | 254 +++++++++++++++++++++ .../GT_MetaTileEntity_Hatch_Reservoir.java | 81 +++++++ 4 files changed, 474 insertions(+), 222 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java create mode 100644 src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 5fb3b11d08..4716d8038a 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -1,165 +1,65 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import java.lang.reflect.Field; - -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; -import gregtech.api.objects.GT_RenderedTexture; -import gtPlusPlus.api.objects.random.XSTR; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_Input { - - private static XSTR floatGen; - public int mProgresstime = 0, mMaxProgresstime = 0; +public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_FluidGenerator { - public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, - final int aTier) { + public GT_MetaTileEntity_Hatch_AirIntake(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier); } - public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String aDescription, - final ITexture[][][] aTextures) { + public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { super(aName, aTier, aDescription, aTextures); } - /*public GT_MetaTileEntity_Hatch_AirIntake(final String aName, final int aTier, final String[] aDescription, - final ITexture[][][] aTextures) { - super(aName, aTier, aDescription, aTextures); - }*/ - - private static String[] S; - private static Field F; - - public synchronized String[] getDescription() { - try { - if (F == null || S == null) { - Field t = ReflectionUtils.getField(this.getClass(), "mDescriptionArray"); - if (t != null) { - F = t; - } - else { - F = ReflectionUtils.getField(this.getClass(), "mDescription"); - } - if (S == null && F != null) { - Object o = F.get(this); - if (o instanceof String[]) { - S = (String[]) o; - } - else if (o instanceof String) { - S = new String[] {(String) o}; - } - } - - } - } - catch (Throwable t) { - - } - if (S != null) { - final String[] desc = new String[S.length + 4]; - System.arraycopy(S, 0, desc, 0, S.length); - desc[S.length] = "DO NOT OBSTRUCT THE INPUT!"; - desc[S.length + 1] = "Draws in Air from the surrounding environment"; - desc[S.length + 2] = "Creates 1000L of Air every 4 ticks"; - desc[S.length + 3] = CORE.GT_Tooltip; - return desc; - } - else { - return new String[] {"DO NOT OBSTRUCT THE INPUT!", "Draws in Air from the surrounding environment", "Creates 1000L of Air every 4 ticks", CORE.GT_Tooltip}; - } - - } - - public ITexture[] getTexturesActive(final ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; - } - - public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { - return new ITexture[]{aBaseTexture, - new GT_RenderedTexture((IIconContainer) Textures.BlockIcons.OVERLAY_MUFFLER)}; - } - - public boolean isSimpleMachine() { - return true; - } - - public boolean isFacingValid(final byte aFacing) { - return true; + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_AirIntake(this.mName, this.mTier, this.mDescription, this.mTextures); } - public boolean isAccessAllowed(final EntityPlayer aPlayer) { - return true; + @Override + public String[] getCustomTooltip() { + String[] aTooltip = new String[3]; + aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; + aTooltip[1] = "Draws in Air from the surrounding environment"; + aTooltip[2] = "Creates 1000L of Air every 4 ticks"; + return aTooltip; } - public boolean isValidSlot(final int aIndex) { - return false; + @Override + public Fluid getFluidToGenerate() { + return FluidUtils.getAir(1).getFluid(); } - public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { - return new GT_MetaTileEntity_Hatch_AirIntake(this.mName, this.mTier, this.mDescription, this.mTextures); + @Override + public int getAmountOfFluidToGenerate() { + return 1000; } - public boolean allowPullStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { - return false; + @Override + public int getMaxTickTime() { + return 4; } - public boolean allowPutStack(final IGregTechTileEntity aBaseMetaTileEntity, final int aIndex, final byte aSide, - final ItemStack aStack) { - return false; + @Override + public int getCapacity() { + return 128000; } - public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) { - super.onPostTick(aBaseMetaTileEntity, aTick); - - if (!aBaseMetaTileEntity.isAllowedToWork()) { - aBaseMetaTileEntity.setActive(false); - mProgresstime = 0; - mMaxProgresstime = 0; - } - else { - aBaseMetaTileEntity.setActive(true); - mMaxProgresstime = 4; - if (++mProgresstime >= mMaxProgresstime) { - addAirToHatch(aTick); - mProgresstime = 0; - } - } + @Override + public boolean doesHatchMeetConditionsToGenerate() { + return this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); } - - @Override - public int getProgresstime() { - return mProgresstime; - } - - @Override - public int maxProgresstime() { - return mMaxProgresstime; - } - @Override - public int increaseProgress(int aProgress) { - mProgresstime += aProgress; - return mMaxProgresstime - mProgresstime; - } - - public void pollutionParticles(final World aWorld, final String name) { + @Override + public void generateParticles(World aWorld, String name) { if (this.getBaseMetaTileEntity().isServerSide()) { return; } @@ -207,97 +107,4 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_I (double) -ySpd, (double) zSpd); } - static { - GT_MetaTileEntity_Hatch_AirIntake.floatGen = new XSTR(); - } - - public int getTankPressure() { - return 100; - } - - public int getCapacity() { - return 128000; - } - - @Override - public boolean canTankBeEmptied() { - return true; - } - - private static Fluid AIR; - - public boolean isAirInHatch() { - if (this.mFluid != null) { - if (AIR == null) { - AIR = FluidUtils.getAir(1).getFluid(); - } - if (AIR == this.mFluid.getFluid()) { - return true; - } - } - return false; - } - - public boolean addAirToHatch(long aTick) { - if (!this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing())) { - return false; - } - boolean didFill = this.fill(FluidUtils.getAir(1000), true) > 0; - if (didFill) { - this.pollutionParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); - } - return didFill; - } - - @Override - public boolean canTankBeFilled() { - if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { - return true; - } - return false; - } - - @Override - public boolean doesEmptyContainers() { - return false; - } - - @Override - public boolean doesFillContainers() { - return true; - } - - @Override - public int fill(FluidStack aFluid, boolean doFill) { - return super.fill(aFluid, doFill); - } - - @Override - public boolean canFill(ForgeDirection aSide, Fluid aFluid) { - return false; - } - - @Override - public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { - return 0; - } - - @Override - public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { - return 0; - } - - @Override - public void saveNBTData(NBTTagCompound aNBT) { - aNBT.setInteger("mProgresstime", mProgresstime); - aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - mProgresstime = aNBT.getInteger("mProgresstime"); - mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); - super.loadNBTData(aNBT); - } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java new file mode 100644 index 0000000000..5ebb2da8d4 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -0,0 +1,110 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; + +public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_FluidGenerator { + + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_AirIntake_Extreme(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public String[] getCustomTooltip() { + String[] aTooltip = new String[3]; + aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; + aTooltip[1] = "Draws in Air from the surrounding environment"; + aTooltip[2] = "Creates 5000L of Air every 4 ticks"; + return aTooltip; + } + + @Override + public Fluid getFluidToGenerate() { + return FluidUtils.getAir(1).getFluid(); + } + + @Override + public int getAmountOfFluidToGenerate() { + return 5000; + } + + @Override + public int getMaxTickTime() { + return 4; + } + + @Override + public int getCapacity() { + return 256000; + } + + @Override + public boolean doesHatchMeetConditionsToGenerate() { + return this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); + } + + @Override + public void generateParticles(World aWorld, String name) { + if (this.getBaseMetaTileEntity().isServerSide()) { + return; + } + final float ran1 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); + float ran2 = 0.0f; + float ran3 = 0.0f; + ran2 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); + ran3 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); + + final IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); + final ForgeDirection aDir = ForgeDirection.getOrientation((int) aMuffler.getFrontFacing()); + final float xPos = aDir.offsetX * 0.76f + aMuffler.getXCoord() + 0.25f; + float yPos = aDir.offsetY * 0.76f + aMuffler.getYCoord() + 0.65f; + final float zPos = aDir.offsetZ * 0.76f + aMuffler.getZCoord() + 0.25f; + float ySpd = aDir.offsetY * 0.1f + 0.2f + 0.1f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); + float xSpd; + float zSpd; + if (aDir.offsetY == -1) { + //Logger.INFO("Y = -1"); + final float temp = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 2.0f * CORE.PI; + xSpd = (float) Math.sin(temp) * 0.1f; + zSpd = (float) Math.cos(temp) * 0.1f; + ySpd = -ySpd; + yPos = yPos - 0.8f; + } + else { + xSpd = aDir.offsetX * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat()); + zSpd = aDir.offsetZ * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat()); + + xSpd = -xSpd; + zSpd = -zSpd; + } + + aWorld.spawnParticle(name, (double) (xPos + ran1 * 0.5f), + (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), + (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, + (double) -ySpd, (double) zSpd); + aWorld.spawnParticle(name, (double) (xPos + ran2 * 0.5f), + (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), + (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, + (double) -ySpd, (double) zSpd); + aWorld.spawnParticle(name, (double) (xPos + ran3 * 0.5f), + (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), + (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, + (double) -ySpd, (double) zSpd); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java new file mode 100644 index 0000000000..7579c8ec5a --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -0,0 +1,254 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import java.lang.reflect.Field; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.random.XSTR; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTileEntity_Hatch_Input { + + protected static XSTR floatGen = new XSTR(); + public int mProgresstime = 0, mMaxProgresstime = 0; + + public GT_MetaTileEntity_Hatch_FluidGenerator(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_FluidGenerator(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + private static String[] S; + private static Field F; + + public abstract String[] getCustomTooltip(); + + public abstract Fluid getFluidToGenerate(); + + public abstract int getAmountOfFluidToGenerate(); + + public abstract int getMaxTickTime(); + + public synchronized String[] getDescription() { + try { + if (F == null || S == null) { + Field t = ReflectionUtils.getField(this.getClass(), "mDescriptionArray"); + if (t != null) { + F = t; + } + else { + F = ReflectionUtils.getField(this.getClass(), "mDescription"); + } + if (S == null && F != null) { + Object o = F.get(this); + if (o instanceof String[]) { + S = (String[]) o; + } + else if (o instanceof String) { + S = new String[] {(String) o}; + } + } + + } + } + catch (Throwable t) { + Logger.INFO("1"); + t.printStackTrace(); + } + try { + if (S != null) { + String[] aCustomTips = getCustomTooltip(); + final String[] desc = new String[S.length + aCustomTips.length + 1]; + System.arraycopy(S, 0, desc, 0, S.length); + for (int i=0;i= mMaxProgresstime) { + addFluidToHatch(aTick); + mProgresstime = 0; + } + } + } + + @Override + public int getProgresstime() { + return mProgresstime; + } + + @Override + public int maxProgresstime() { + return mMaxProgresstime; + } + + @Override + public int increaseProgress(int aProgress) { + mProgresstime += aProgress; + return mMaxProgresstime - mProgresstime; + } + + public abstract void generateParticles(final World aWorld, final String name); + + public int getTankPressure() { + return 100; + } + + public abstract int getCapacity(); + + @Override + public boolean canTankBeEmptied() { + return true; + } + + public boolean isAirInHatch() { + if (this.mFluid != null) { + if (getFluidToGenerate() == this.mFluid.getFluid()) { + return true; + } + } + return false; + } + + public abstract boolean doesHatchMeetConditionsToGenerate(); + + public boolean addFluidToHatch(long aTick) { + if (!doesHatchMeetConditionsToGenerate()) { + return false; + } + boolean didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; + if (didFill) { + this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } + return didFill; + } + + @Override + public boolean canTankBeFilled() { + if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { + return true; + } + return false; + } + + @Override + public boolean doesEmptyContainers() { + return false; + } + + @Override + public boolean doesFillContainers() { + return true; + } + + @Override + public int fill(FluidStack aFluid, boolean doFill) { + return super.fill(aFluid, doFill); + } + + @Override + public boolean canFill(ForgeDirection aSide, Fluid aFluid) { + return false; + } + + @Override + public int fill(ForgeDirection arg0, FluidStack arg1, boolean arg2) { + return 0; + } + + @Override + public int fill_default(ForgeDirection aSide, FluidStack aFluid, boolean doFill) { + return 0; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("mProgresstime", mProgresstime); + aNBT.setInteger("mMaxProgresstime", mMaxProgresstime); + super.saveNBTData(aNBT); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mProgresstime = aNBT.getInteger("mProgresstime"); + mMaxProgresstime = aNBT.getInteger("mMaxProgresstime"); + super.loadNBTData(aNBT); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java new file mode 100644 index 0000000000..5cd57e9e92 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -0,0 +1,81 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { + + public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, final int aTier) { + super(aID, aName, aNameRegional, aTier); + } + + public GT_MetaTileEntity_Hatch_Reservoir(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + + public MetaTileEntity newMetaEntity(final IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Hatch_Reservoir(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public String[] getCustomTooltip() { + String[] aTooltip = new String[3]; + aTooltip[0] = "Requires a Block of water facing the intake"; + aTooltip[1] = "Infinite water supply hatch"; + aTooltip[2] = "Creates 2000L of Water every 4 ticks"; + return aTooltip; + } + + @Override + public Fluid getFluidToGenerate() { + return FluidRegistry.WATER; + } + + @Override + public int getAmountOfFluidToGenerate() { + return 2000; + } + + @Override + public int getMaxTickTime() { + return 4; + } + + @Override + public int getCapacity() { + return 128000; + } + + @Override + public boolean doesHatchMeetConditionsToGenerate() { + Block aWater = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); + return aWater == Blocks.water || aWater == Blocks.flowing_water; + } + + @Override + public void generateParticles(World aWorld, String name) { + + } + + public ITexture[] getTexturesActive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + } + + public ITexture[] getTexturesInactive(final ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, + new GT_RenderedTexture(TexturesGtBlock.Overlay_Water)}; + } + +} -- cgit From 849ae606a186ff5c1b7e9411bd2ed3589dcb06b5 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 20 Dec 2021 18:00:48 +0000 Subject: Add RemoteIO and EnderIO support to Reservoir Hatch. Changed Extreme Airtake from 5k/4t to 8k/4t. Clean up some reflection. Cleaned up GT_MetaTileEntity_Hatch_FluidGenerator.java. --- src/main/java/gtPlusPlus/core/lib/LoadedMods.java | 6 +++ .../gtPlusPlus/core/recipe/RECIPES_Machines.java | 10 ++-- .../core/util/minecraft/HazmatUtils.java | 4 +- .../core/util/reflect/ReflectionUtils.java | 6 +-- .../preloader/asm/Preloader_FMLLoadingPlugin.java | 4 +- .../ClassTransformer_TT_ThaumicRestorer.java | 2 +- .../preloader/keyboard/BetterKeyboard.java | 6 +-- .../gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java | 26 +++++----- .../GT_MetaTileEntity_Hatch_AirIntake_Extreme.java | 4 +- .../GT_MetaTileEntity_Hatch_FluidGenerator.java | 26 +++++----- .../GT_MetaTileEntity_Hatch_Reservoir.java | 58 ++++++++++++++++++++-- 11 files changed, 104 insertions(+), 48 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java index 1eb8351d65..4f7a10be78 100644 --- a/src/main/java/gtPlusPlus/core/lib/LoadedMods.java +++ b/src/main/java/gtPlusPlus/core/lib/LoadedMods.java @@ -60,6 +60,7 @@ public class LoadedMods { public static boolean CropsPlusPlus = false; //Barts Crop Mod public static boolean Reliquary = false; public static boolean SpiceOfLife = false; + public static boolean RemoteIO = false; @@ -322,6 +323,11 @@ public class LoadedMods { Witchery = true; Logger.INFO("Components enabled for: Witchery"); totalMods++; + } + if (isModLoaded("RIO")){ + RemoteIO = true; + Logger.INFO("Components enabled for: RemoteIO"); + totalMods++; } Logger.INFO("Content found for "+totalMods+" mods"); diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 985e783430..f708a99af0 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -2764,11 +2764,11 @@ public class RECIPES_Machines { return; } Class ModBlocksClass = ReflectionUtils.getClass("com.riciJak.Ztones.init.ModBlocks"); - Block agon = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); - Block korp = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); - Block jelt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); - Block bitt = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); - Block iszm = (Block) ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); + Block agon = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "agonBlock")); + Block korp = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "korpBlock")); + Block jelt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "jeltBlock")); + Block bitt = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "bittBlock")); + Block iszm = ReflectionUtils.getFieldValue( ReflectionUtils.getField(ModBlocksClass, "iszmBlock")); // "agon", "iszm", "korp", "jelt", "bitt" diff --git a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java index b322036ef7..0e2fff3f35 100644 --- a/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java +++ b/src/main/java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -254,7 +254,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsGravisuite, "graviChestPlate")); AutoMap aGravisuite = new AutoMap(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aGravisuite.add(ItemUtils.getSimpleStack(aItemObject)); } @@ -274,7 +274,7 @@ public class HazmatUtils { aItemFields.add(ReflectionUtils.getField(aItemsEMT, "ultimateSolarHelmet")); AutoMap aASP = new AutoMap(); for (Field aItemField : aItemFields) { - Item aItemObject = (Item) ReflectionUtils.getFieldValue(aItemField); + Item aItemObject = ReflectionUtils.getFieldValue(aItemField); if (aItemObject != null) { aASP.add(ItemUtils.getSimpleStack(aItemObject)); } diff --git a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java index 1ef925f793..92804d72ec 100644 --- a/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java +++ b/src/main/java/gtPlusPlus/core/util/reflect/ReflectionUtils.java @@ -1060,13 +1060,13 @@ public class ReflectionUtils { return false; } - public static Object getFieldValue(Field field) { + public static T getFieldValue(Field field) { return getFieldValue(field, null); } - public static Object getFieldValue(Field field, Object instance) { + public static T getFieldValue(Field field, Object instance) { try { - return field.get(instance); + return (T) field.get(instance); } catch (IllegalArgumentException | IllegalAccessException e) { } return null; diff --git a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java index 22568e6de7..b52f4eb67e 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java +++ b/src/main/java/gtPlusPlus/preloader/asm/Preloader_FMLLoadingPlugin.java @@ -76,8 +76,8 @@ public class Preloader_FMLLoadingPlugin implements IFMLLoadingPlugin { Preloader_Logger.INFO("Running on "+gtPlusPlus.preloader.CORE_Preloader.JAVA_VERSION+" | Development Environment: "+CORE_Preloader.DEV_ENVIRONMENT); Locale aDefaultLocale = Locale.getDefault(); NumberFormat aFormat = NumberFormat.getInstance(); - Locale aDisplayLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); - Locale aFormatLocale = (Locale) ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); + Locale aDisplayLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultDisplayLocale")); + Locale aFormatLocale = ReflectionUtils.getFieldValue(ReflectionUtils.getField(Locale.class, "defaultFormatLocale")); Preloader_Logger.INFO("Locale: "+aDefaultLocale+" | Test: "+aFormat.format(1000000000)+" | Display: "+aDisplayLocale+" | Format: "+aFormatLocale); } diff --git a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java index 05b8054ff8..86a22ce4b9 100644 --- a/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java +++ b/src/main/java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_TT_ThaumicRestorer.java @@ -82,7 +82,7 @@ public class ClassTransformer_TT_ThaumicRestorer { mTookLastTick = ReflectionUtils.getField(mTileRepairerClass, "tookLastTick"); mDamageLastTick = ReflectionUtils.getField(mTileRepairerClass, "dmgLastTick"); mProxyTC = ReflectionUtils.getField(mThaumicTinkerer, "tcProxy"); - repairTConTools = (boolean) ReflectionUtils.getFieldValue(mRepairTiconTools); + repairTConTools = ReflectionUtils.getFieldValue(mRepairTiconTools); mInit = true; } if (mInit) { diff --git a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java index e25c06653c..532d20f1b2 100644 --- a/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java +++ b/src/main/java/gtPlusPlus/preloader/keyboard/BetterKeyboard.java @@ -68,7 +68,7 @@ public class BetterKeyboard { Field aKeyNameSize = ReflectionUtils.getField(Keyboard.class, "keyName"); Field aKeyMapSize = ReflectionUtils.getField(Keyboard.class, "keyMap"); Field aKeyDownBuffer = ReflectionUtils.getField(Keyboard.class, "keyDownBuffer"); - String[] aOldKeyNameArray = (String[]) ReflectionUtils.getFieldValue(aKeyNameSize); + String[] aOldKeyNameArray = ReflectionUtils.getFieldValue(aKeyNameSize); if (aOldKeyNameArray != null && aOldKeyNameArray.length < Short.MAX_VALUE) { String[] aNewKeyNameArray = new String[Short.MAX_VALUE]; for (int i=0;i aOldKeyMapArray = (Map) ReflectionUtils.getFieldValue(aKeyMapSize); + Map aOldKeyMapArray = ReflectionUtils.getFieldValue(aKeyMapSize); if (aOldKeyNameArray != null && aOldKeyMapArray.size() < Short.MAX_VALUE) { Map aNewKeyMapArray = new HashMap(Short.MAX_VALUE); aNewKeyMapArray.putAll(aOldKeyMapArray); @@ -94,7 +94,7 @@ public class BetterKeyboard { FMLRelaunchLog.log("[GT++ ASM] LWJGL Keybinding index out of bounds fix", Level.INFO, "Failed Patching Field: "+aKeyDownBuffer.getName()); } } - ByteBuffer aOldByteBuffer = (ByteBuffer) ReflectionUtils.getFieldValue(aKeyDownBuffer); + ByteBuffer aOldByteBuffer = ReflectionUtils.getFieldValue(aKeyDownBuffer); if (aOldByteBuffer != null && aOldByteBuffer.capacity() == Keyboard.KEYBOARD_SIZE) { ByteBuffer aNewByteBuffer = BufferUtils.createByteBuffer(Short.MAX_VALUE); try { diff --git a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java index 95067300c8..52f498988c 100644 --- a/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java +++ b/src/main/java/gtPlusPlus/xmod/bop/HANDLER_BiomesOPlenty.java @@ -91,7 +91,7 @@ public class HANDLER_BiomesOPlenty { Field aBopColouredSapling = ReflectionUtils.getField(ReflectionUtils.getClass("biomesoplenty.api.content.BOPCBlocks"), "colorizedSaplings"); if (aBopMiscItem != null) { - Item aMiscItem = (Item) ReflectionUtils.getFieldValue(aBopMiscItem); + Item aMiscItem = ReflectionUtils.getFieldValue(aBopMiscItem); if (aMiscItem != null) { mPineCone = aMiscItem; } @@ -99,25 +99,25 @@ public class HANDLER_BiomesOPlenty { if (aBopBlock1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock1); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock1); if (aBlock != null) { logs1 = aBlock; } } if (aBopBlock2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock2); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock2); if (aBlock != null) { logs2 = aBlock; } } if (aBopBlock3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock3); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock3); if (aBlock != null) { logs3 = aBlock; } } if (aBopBlock4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopBlock4); + Block aBlock = ReflectionUtils.getFieldValue(aBopBlock4); if (aBlock != null) { logs4 = aBlock; } @@ -125,25 +125,25 @@ public class HANDLER_BiomesOPlenty { if (aBopLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves1); if (aBlock != null) { leaves1 = aBlock; } } if (aBopLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves2); if (aBlock != null) { leaves2 = aBlock; } } if (aBopLeaves3 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves3); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves3); if (aBlock != null) { leaves3 = aBlock; } } if (aBopLeaves4 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopLeaves4); + Block aBlock = ReflectionUtils.getFieldValue(aBopLeaves4); if (aBlock != null) { leaves4 = aBlock; } @@ -151,13 +151,13 @@ public class HANDLER_BiomesOPlenty { if (aBopColouredLeaves1 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves1); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves1); if (aBlock != null) { colorizedLeaves1 = aBlock; } } if (aBopColouredLeaves2 != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredLeaves2); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredLeaves2); if (aBlock != null) { colorizedLeaves2 = aBlock; } @@ -165,13 +165,13 @@ public class HANDLER_BiomesOPlenty { if (aBopSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopSapling); if (aBlock != null) { saplings = aBlock; } } if (aBopColouredSapling != null) { - Block aBlock = (Block) ReflectionUtils.getFieldValue(aBopColouredSapling); + Block aBlock = ReflectionUtils.getFieldValue(aBopColouredSapling); if (aBlock != null) { colorizedSaplings = aBlock; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java index 5ebb2da8d4..d70afcb433 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity String[] aTooltip = new String[3]; aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; aTooltip[1] = "Draws in Air from the surrounding environment"; - aTooltip[2] = "Creates 5000L of Air every 4 ticks"; + aTooltip[2] = "Creates 8000L of Air every 4 ticks"; return aTooltip; } @@ -40,7 +40,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity @Override public int getAmountOfFluidToGenerate() { - return 5000; + return 8000; } @Override diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java index 7579c8ec5a..d4b8b3a064 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_FluidGenerator.java @@ -178,31 +178,29 @@ public abstract class GT_MetaTileEntity_Hatch_FluidGenerator extends GT_MetaTile return true; } - public boolean isAirInHatch() { - if (this.mFluid != null) { - if (getFluidToGenerate() == this.mFluid.getFluid()) { - return true; - } - } - return false; - } - public abstract boolean doesHatchMeetConditionsToGenerate(); public boolean addFluidToHatch(long aTick) { if (!doesHatchMeetConditionsToGenerate()) { return false; - } - boolean didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; - if (didFill) { - this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } + boolean didFill = false; + if (canTankBeFilled()) { + didFill = this.fill(FluidUtils.getFluidStack(getFluidToGenerate(), getAmountOfFluidToGenerate()), true) > 0; + if (didFill) { + this.generateParticles(this.getBaseMetaTileEntity().getWorld(), "cloud"); + } } return didFill; } @Override public boolean canTankBeFilled() { - if (this.mFluid == null || (this.mFluid != null && (this.mFluid.amount <= this.getCapacity()))) { + //Logger.INFO("Total Space: "+this.getCapacity()); + //Logger.INFO("Current capacity: "+this.getFluidAmount()); + //Logger.INFO("To add: "+this.getAmountOfFluidToGenerate()); + //Logger.INFO("Space Free: "+(this.getCapacity()-this.getFluidAmount())); + if (this.mFluid == null || (this.mFluid != null && (this.getCapacity() - this.getFluidAmount() >= this.getAmountOfFluidToGenerate()))) { return true; } return false; diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java index 5cd57e9e92..a2aa4d266c 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -1,20 +1,32 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.IIconContainer; +import java.lang.reflect.Field; + import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { + private static Class sClass_EIO; + private static Class sClass_RIO; + private static Field sField_EIO; + private static Field sField_RIO; + private static Block sBlock_EIO; + private static Block sBlock_RIO; + public GT_MetaTileEntity_Hatch_Reservoir(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier); } @@ -56,11 +68,51 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F public int getCapacity() { return 128000; } + + private static void setCrossModData() { + if (LoadedMods.EnderIO && sClass_EIO == null) { + sClass_EIO = ReflectionUtils.getClass("crazypants.enderio.EnderIO"); + sField_EIO = ReflectionUtils.getField(sClass_EIO, "blockReservoir"); + sBlock_EIO = ReflectionUtils.getFieldValue(sField_EIO, null); + } + if (LoadedMods.RemoteIO && sClass_RIO == null) { + sClass_RIO = ReflectionUtils.getClass("remoteio.common.lib.ModBlocks"); + sField_RIO = ReflectionUtils.getField(sClass_RIO, "machine"); + sBlock_RIO = ReflectionUtils.getFieldValue(sField_RIO, null); + } + } + + public static boolean isTileValid(TileEntity aTile) { + if (aTile != null) { + if (aTile instanceof IFluidHandler) { + IFluidHandler aFluidHandler = (IFluidHandler) aTile; + return aFluidHandler.canDrain(ForgeDirection.UNKNOWN, FluidRegistry.WATER); + } + } + return false; + } @Override public boolean doesHatchMeetConditionsToGenerate() { Block aWater = this.getBaseMetaTileEntity().getBlockAtSide(this.getBaseMetaTileEntity().getFrontFacing()); - return aWater == Blocks.water || aWater == Blocks.flowing_water; + if (aWater != null && aWater != Blocks.air) { + if (!this.canTankBeFilled()) { + return false; + } + setCrossModData(); + if (LoadedMods.EnderIO) { + if (aWater == sBlock_EIO) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + if (LoadedMods.RemoteIO) { + if (aWater == sBlock_RIO && this.getBaseMetaTileEntity().getMetaIDAtSide(this.getBaseMetaTileEntity().getFrontFacing()) == 0) { + return isTileValid(this.getBaseMetaTileEntity().getTileEntityAtSide(this.getBaseMetaTileEntity().getFrontFacing())); + } + } + return aWater == Blocks.water || aWater == Blocks.flowing_water; + } + return false; } @Override -- cgit From aadb1b8f7f0f909feb747c05548351fcfe271de5 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Mon, 20 Dec 2021 20:52:41 +0000 Subject: Refactored GT_MetaTileEntity_Hatch_AirIntake_Extreme to extend GT_MetaTileEntity_Hatch_AirIntake. Refactored GT_MetaTileEntity_Hatch_Reservoir. Refactored Chisel singles/multi to utilise a cache. --- .../GT_MetaTileEntity_Hatch_AirIntake.java | 2 +- .../GT_MetaTileEntity_Hatch_AirIntake_Extreme.java | 80 +--------------------- .../GT_MetaTileEntity_Hatch_Reservoir.java | 20 ++---- .../basic/GregtechMetaTileEntity_AutoChisel.java | 62 +++++++++++------ .../GregtechMetaTileEntity_IndustrialChisel.java | 57 +++++++++++---- 5 files changed, 93 insertions(+), 128 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java index 4716d8038a..02b7a03f3b 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake.java @@ -29,7 +29,7 @@ public class GT_MetaTileEntity_Hatch_AirIntake extends GT_MetaTileEntity_Hatch_F String[] aTooltip = new String[3]; aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; aTooltip[1] = "Draws in Air from the surrounding environment"; - aTooltip[2] = "Creates 1000L of Air every 4 ticks"; + aTooltip[2] = "Creates "+getAmountOfFluidToGenerate()+"L of Air every "+getMaxTickTime()+" ticks"; return aTooltip; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java index d70afcb433..45611d9e05 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_AirIntake_Extreme.java @@ -3,13 +3,8 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.Fluid; -public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_FluidGenerator { +public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity_Hatch_AirIntake { public GT_MetaTileEntity_Hatch_AirIntake_Extreme(final int aID, final String aName, final String aNameRegional, final int aTier) { super(aID, aName, aNameRegional, aTier); @@ -24,87 +19,14 @@ public class GT_MetaTileEntity_Hatch_AirIntake_Extreme extends GT_MetaTileEntity return new GT_MetaTileEntity_Hatch_AirIntake_Extreme(this.mName, this.mTier, this.mDescription, this.mTextures); } - @Override - public String[] getCustomTooltip() { - String[] aTooltip = new String[3]; - aTooltip[0] = "DO NOT OBSTRUCT THE INPUT!"; - aTooltip[1] = "Draws in Air from the surrounding environment"; - aTooltip[2] = "Creates 8000L of Air every 4 ticks"; - return aTooltip; - } - - @Override - public Fluid getFluidToGenerate() { - return FluidUtils.getAir(1).getFluid(); - } - @Override public int getAmountOfFluidToGenerate() { return 8000; } - @Override - public int getMaxTickTime() { - return 4; - } - @Override public int getCapacity() { return 256000; } - @Override - public boolean doesHatchMeetConditionsToGenerate() { - return this.getBaseMetaTileEntity().getAirAtSide(this.getBaseMetaTileEntity().getFrontFacing()); - } - - @Override - public void generateParticles(World aWorld, String name) { - if (this.getBaseMetaTileEntity().isServerSide()) { - return; - } - final float ran1 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); - float ran2 = 0.0f; - float ran3 = 0.0f; - ran2 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); - ran3 = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); - - final IGregTechTileEntity aMuffler = this.getBaseMetaTileEntity(); - final ForgeDirection aDir = ForgeDirection.getOrientation((int) aMuffler.getFrontFacing()); - final float xPos = aDir.offsetX * 0.76f + aMuffler.getXCoord() + 0.25f; - float yPos = aDir.offsetY * 0.76f + aMuffler.getYCoord() + 0.65f; - final float zPos = aDir.offsetZ * 0.76f + aMuffler.getZCoord() + 0.25f; - float ySpd = aDir.offsetY * 0.1f + 0.2f + 0.1f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat(); - float xSpd; - float zSpd; - if (aDir.offsetY == -1) { - //Logger.INFO("Y = -1"); - final float temp = GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 2.0f * CORE.PI; - xSpd = (float) Math.sin(temp) * 0.1f; - zSpd = (float) Math.cos(temp) * 0.1f; - ySpd = -ySpd; - yPos = yPos - 0.8f; - } - else { - xSpd = aDir.offsetX * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat()); - zSpd = aDir.offsetZ * (0.1f + 0.2f * GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat()); - - xSpd = -xSpd; - zSpd = -zSpd; - } - - aWorld.spawnParticle(name, (double) (xPos + ran1 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, - (double) -ySpd, (double) zSpd); - aWorld.spawnParticle(name, (double) (xPos + ran2 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, - (double) -ySpd, (double) zSpd); - aWorld.spawnParticle(name, (double) (xPos + ran3 * 0.5f), - (double) (yPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), - (double) (zPos + GT_MetaTileEntity_Hatch_AirIntake_Extreme.floatGen.nextFloat() * 0.5f), (double) xSpd, - (double) -ySpd, (double) zSpd); - } - } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java index a2aa4d266c..716251ecf0 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -1,13 +1,11 @@ package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; -import java.lang.reflect.Field; - +import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -20,10 +18,6 @@ import net.minecraftforge.fluids.IFluidHandler; public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_FluidGenerator { - private static Class sClass_EIO; - private static Class sClass_RIO; - private static Field sField_EIO; - private static Field sField_RIO; private static Block sBlock_EIO; private static Block sBlock_RIO; @@ -70,15 +64,11 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F } private static void setCrossModData() { - if (LoadedMods.EnderIO && sClass_EIO == null) { - sClass_EIO = ReflectionUtils.getClass("crazypants.enderio.EnderIO"); - sField_EIO = ReflectionUtils.getField(sClass_EIO, "blockReservoir"); - sBlock_EIO = ReflectionUtils.getFieldValue(sField_EIO, null); + if (LoadedMods.EnderIO && sBlock_EIO == null) { + sBlock_EIO = GameRegistry.findBlock("EnderIO", "blockReservoir"); } - if (LoadedMods.RemoteIO && sClass_RIO == null) { - sClass_RIO = ReflectionUtils.getClass("remoteio.common.lib.ModBlocks"); - sField_RIO = ReflectionUtils.getField(sClass_RIO, "machine"); - sBlock_RIO = ReflectionUtils.getFieldValue(sField_RIO, null); + if (LoadedMods.RemoteIO && sBlock_RIO == null) { + sBlock_RIO = GameRegistry.findBlock("RIO", "machine"); } } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java index ea99f8d52a..3cdd43c24e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_AutoChisel.java @@ -9,13 +9,15 @@ import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.item.ItemStack; import team.chisel.carving.Carving; public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMachine { + private ItemStack mInputCache; + private ItemStack mOutputCache; + public GregtechMetaTileEntity_AutoChisel(int aID, String aName, String aNameRegional, int aTier) { super(aID, aName, aNameRegional, aTier, 1, "Chisels things, Gregtech style", 1, 1, "Compressor.png", "", new ITexture[]{ @@ -54,10 +56,30 @@ public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMa public GT_Recipe.GT_Recipe_Map getRecipeList() { return null; } + + private boolean hasValidCache(ItemStack mItem, boolean mClearOnFailure) { + if (mInputCache != null + && mOutputCache != null + && mInputCache.isItemEqual(mItem) + && ItemStack.areItemStackTagsEqual(mItem, mInputCache)) { + return true; + } + // clear cache if it was invalid + if (mClearOnFailure) { + mInputCache = null; + mOutputCache = null; + } + return false; + } + + private void cacheItem(ItemStack mInputItem, ItemStack mOutputItem) { + mOutputCache = mOutputItem.copy(); + mInputCache = mInputItem.copy(); + } @Override protected boolean allowPutStackValidated(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { - return super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && hasChiselResults(aStack); + return hasValidCache(aStack, false) ? true : super.allowPutStackValidated(aBaseMetaTileEntity, aIndex, aSide, aStack) && hasChiselResults(aStack); } // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target @@ -81,48 +103,46 @@ public class GregtechMetaTileEntity_AutoChisel extends GT_MetaTileEntity_BasicMa return Carving.chisel.getItemsForChiseling(aStack); } + private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { + ItemStack tOutput = null; + if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { + tOutput = aTarget; + } + else { + tOutput = getItemsForChiseling(aInput).get(0); + } + return tOutput; + } + @Override public int checkRecipe() { ItemStack tOutput = null; ItemStack aInput = getInputAt(0); ItemStack aTarget = getSpecialSlot(); + boolean tIsCached = hasValidCache(aInput, true); if (aInput != null && hasChiselResults(aInput) && aInput.stackSize > 0) { - Logger.INFO("Has Valid Input."); - if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { - tOutput = aTarget; - Logger.INFO("Has Valid Target."); - } - else { - tOutput = getItemsForChiseling(aInput).get(0); - Logger.INFO("Using target(0)"); - } + tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget); if (tOutput != null) { - Logger.INFO("Has Valid Output. "+tOutput.getDisplayName()); // We can chisel this if (canOutput(tOutput)) { - Logger.INFO("Can Output"); getInputAt(0).stackSize -= 1; - Logger.INFO("Consuming 1 input"); calculateOverclockedNess(16, 20); - Logger.INFO("Did Overclock"); //In case recipe is too OP for that machine if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1) { - Logger.INFO("Brrrrr"); return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } - Logger.INFO("Setting Output"); - this.mOutputItems[0] = tOutput; - Logger.INFO("Recipe good."); + if (!tIsCached) { + cacheItem(aInput, tOutput); + } + this.mOutputItems[0] = tOutput.copy(); return FOUND_AND_SUCCESSFULLY_USED_RECIPE; } else { - Logger.INFO("Cannot Output"); mOutputBlocked++; return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS; } } } - Logger.INFO("Recipe bad."); return DID_NOT_FIND_RECIPE; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java index 77cc19d5d4..290a36c052 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialChisel.java @@ -29,7 +29,6 @@ import gregtech.api.util.GTPP_Recipe; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; @@ -44,6 +43,9 @@ public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiB private int mCasing; private IStructureDefinition STRUCTURE_DEFINITION = null; + private ItemStack mInputCache; + private ItemStack mOutputCache; + private GTPP_Recipe mCachedRecipe; public GregtechMetaTileEntity_IndustrialChisel(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); @@ -173,6 +175,27 @@ public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiB return true; } + private boolean hasValidCache(ItemStack aStack, ItemStack aSpecialSlot, boolean aClearOnFailure) { + if (mInputCache != null && mOutputCache != null && mCachedRecipe != null) { + if (GT_Utility.areStacksEqual(aStack, mInputCache) && GT_Utility.areStacksEqual(aSpecialSlot, mOutputCache)) { + return true; + } + } + // clear cache if it was invalid + if (aClearOnFailure) { + mInputCache = null; + mOutputCache = null; + mCachedRecipe = null; + } + return false; + } + + private void cacheItem(ItemStack aInputItem, ItemStack aOutputItem, GTPP_Recipe aRecipe) { + mInputCache = aInputItem.copy(); + mOutputCache = aOutputItem.copy(); + mCachedRecipe = aRecipe; + } + // lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target private static boolean canBeMadeFrom(ItemStack from, ItemStack to) { List results = getItemsForChiseling(from); @@ -194,18 +217,26 @@ public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiB return Carving.chisel.getItemsForChiseling(aStack); } + private static ItemStack getChiselOutput(ItemStack aInput, ItemStack aTarget) { + ItemStack tOutput = null; + if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { + tOutput = aTarget; + } + else { + tOutput = getItemsForChiseling(aInput).get(0); + } + return tOutput; + } + private GTPP_Recipe generateChiselRecipe(ItemStack aInput, ItemStack aTarget) { - if (aInput != null && hasChiselResults(aInput) && aInput.stackSize > 0) { - ItemStack tOutput = null; - if (aTarget != null && canBeMadeFrom(aInput, aTarget)) { - tOutput = aTarget; - } - else { - tOutput = getItemsForChiseling(aInput).get(0); - } - if (tOutput != null) { + boolean tIsCached = hasValidCache(aInput, aTarget, true); + if (tIsCached || aInput != null && hasChiselResults(aInput)) { + ItemStack tOutput = tIsCached ? mOutputCache.copy() : getChiselOutput(aInput, aTarget); + if (tOutput != null) { + if (mCachedRecipe != null && GT_Utility.areStacksEqual(aInput, mInputCache) && GT_Utility.areStacksEqual(tOutput, mOutputCache)) { + return mCachedRecipe; + } // We can chisel this - log("Generated Chisel recipe good."); GTPP_Recipe aRecipe = new GTPP_Recipe( false, new ItemStack[] {ItemUtils.getSimpleStack(aInput, 1)}, @@ -217,10 +248,12 @@ public class GregtechMetaTileEntity_IndustrialChisel extends GregtechMeta_MultiB 20, 16, 0); + + // Cache it + cacheItem(aInput, tOutput, aRecipe); return aRecipe; } } - Logger.INFO("Recipe bad."); return null; } -- cgit From 06c8eb6bf1e2c634033d21e1d50ff7a8d8474550 Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Tue, 21 Dec 2021 17:22:05 +0000 Subject: Changed I/O and recipe for Reservoir Hatch. --- src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java | 6 +++--- .../implementations/GT_MetaTileEntity_Hatch_Reservoir.java | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity') diff --git a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java index f708a99af0..6e042a71b1 100644 --- a/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/main/java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -1414,9 +1414,9 @@ public class RECIPES_Machines { RecipeUtils.addShapedGregtechRecipe( - CI.getPlate(6, 1), ItemList.Casing_Grate.get(1), CI.getPlate(6, 1), - CI.getPlate(6, 1), CI.getFluidRegulator(6, 1), CI.getPlate(6, 1), - CI.getTieredCircuit(6), ItemList.Hatch_Input_LuV.get(1), CI.getTieredCircuit(6), + CI.getPlate(6, 1), ItemList.Casing_Gearbox_Titanium, CI.getPlate(6, 1), + CI.getPlate(6, 1), CI.getFluidRegulator(5, 1), CI.getPlate(6, 1), + CI.getTieredCircuit(6), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(6), GregtechItemList.Hatch_Reservoir.get(1)); RecipeUtils.addShapedGregtechRecipe( diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java index 716251ecf0..75c5dbb9ee 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Reservoir.java @@ -39,7 +39,7 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F String[] aTooltip = new String[3]; aTooltip[0] = "Requires a Block of water facing the intake"; aTooltip[1] = "Infinite water supply hatch"; - aTooltip[2] = "Creates 2000L of Water every 4 ticks"; + aTooltip[2] = "Creates 8000L of Water every 4 ticks"; return aTooltip; } @@ -50,7 +50,7 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F @Override public int getAmountOfFluidToGenerate() { - return 2000; + return 8000; } @Override @@ -60,7 +60,7 @@ public class GT_MetaTileEntity_Hatch_Reservoir extends GT_MetaTileEntity_Hatch_F @Override public int getCapacity() { - return 128000; + return 256000; } private static void setCrossModData() { -- cgit