diff options
Diffstat (limited to 'src/main/java')
8 files changed, 556 insertions, 6 deletions
diff --git a/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java b/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java index 64b0e8af66..084d56b32a 100644 --- a/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java +++ b/src/main/java/GoodGenerator/Blocks/TEs/LargeEssentiaGenerator.java @@ -267,7 +267,7 @@ public class LargeEssentiaGenerator extends GT_MetaTileEntity_MultiblockBase_EM for (EssentiaHatch hatch: this.mEssentiaHatch){ AspectList aspects = hatch.getAspects(); for (Aspect aspect: aspects.aspects.keySet()) { - while (EUt + getPerAspectEnergy(aspect) <= (voltageLimit * ampLimit) && aspects.getAmount(aspect) > 0) { + while (EUt <= (voltageLimit * ampLimit) && aspects.getAmount(aspect) > 0) { EUt += getPerAspectEnergy(aspect); aspects.reduce(aspect, 1); if (aspects.getAmount(aspect) == 0) diff --git a/src/main/java/GoodGenerator/Blocks/TEs/MetaTE/YottaFluidTankOutputHatch.java b/src/main/java/GoodGenerator/Blocks/TEs/MetaTE/YottaFluidTankOutputHatch.java new file mode 100644 index 0000000000..d53a01408e --- /dev/null +++ b/src/main/java/GoodGenerator/Blocks/TEs/MetaTE/YottaFluidTankOutputHatch.java @@ -0,0 +1,133 @@ +package GoodGenerator.Blocks.TEs.MetaTE; + +import GoodGenerator.Blocks.TEs.YottaFluidTank; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.render.TextureFactory; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidHandler; + +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_PIPE_OUT; + +public class YottaFluidTankOutputHatch extends GT_MetaTileEntity_Hatch { + + private String mFluidName = ""; + private int mOutputSpeed = 0; + private int mX, mZ, mY; + private boolean isBound = false; + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + mFluidName = aNBT.getString("mFluidName"); + mOutputSpeed = aNBT.getInteger("mOutputSpeed"); + mX = aNBT.getInteger("mX"); + mZ = aNBT.getInteger("mZ"); + mY = aNBT.getInteger("mY"); + isBound = aNBT.getBoolean("isBound"); + super.loadNBTData(aNBT); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setString("mFluidName", mFluidName); + aNBT.setInteger("mOutputSpeed", mOutputSpeed); + aNBT.setInteger("mX", mX); + aNBT.setInteger("mZ", mZ); + aNBT.setInteger("mY", mY); + aNBT.setBoolean("isBound", isBound); + super.saveNBTData(aNBT); + } + + public YottaFluidTankOutputHatch(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 0, "Output Fluid From YOTTank."); + } + + public YottaFluidTankOutputHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + public void setFluid(FluidStack output) { + if (output == null) { + mFluidName = ""; + mOutputSpeed = 0; + return; + } + mFluidName = output.getFluid().getName(); + mOutputSpeed = output.amount; + } + + public void setControl(int x, int y, int z) { + mX = x; + mY = y; + mZ = z; + isBound = true; + } + + public void unBounded() { + isBound = false; + } + + public boolean isBounded() { + return isBound; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + + @Override + public boolean isLiquidInput(byte aSide) { + return false; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide()) { + IFluidHandler tTileEntity = aBaseMetaTileEntity.getITankContainerAtSide(aBaseMetaTileEntity.getFrontFacing()); + FluidStack tOutput = FluidRegistry.getFluidStack(mFluidName, mOutputSpeed); + IGregTechTileEntity tController = aBaseMetaTileEntity.getIGregTechTileEntity(mX, mY, mZ); + if (tTileEntity != null && tOutput != null && tController.getMetaTileEntity() instanceof YottaFluidTank && isBound) { + int tAmount = Math.min(tTileEntity.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tOutput, false), mOutputSpeed); + if (tAmount > 0) { + tOutput.amount = tAmount; + if (((YottaFluidTank) tController).reduceFluid(tAmount)) + tTileEntity.fill(ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()), tOutput, true); + } + } + if (tController == null || !(tController.getMetaTileEntity() instanceof YottaFluidTank)) isBound = false; + } + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[]{aBaseTexture, TextureFactory.of(OVERLAY_PIPE_OUT)}; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new YottaFluidTankOutputHatch(mName, mTier, mDescriptionArray, mTextures); + } +} diff --git a/src/main/java/GoodGenerator/Blocks/TEs/YottaFluidTank.java b/src/main/java/GoodGenerator/Blocks/TEs/YottaFluidTank.java index aaceba9c04..e5adbe6f34 100644 --- a/src/main/java/GoodGenerator/Blocks/TEs/YottaFluidTank.java +++ b/src/main/java/GoodGenerator/Blocks/TEs/YottaFluidTank.java @@ -1,4 +1,334 @@ package GoodGenerator.Blocks.TEs; -public class YottaFluidTank { +import GoodGenerator.Blocks.TEs.MetaTE.YottaFluidTankOutputHatch; +import GoodGenerator.Loader.Loaders; +import com.github.bartimaeusnek.bartworks.common.loaders.ItemRegistry; +import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; +import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.IStructureElement; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.render.TextureFactory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + +import static GoodGenerator.util.StructureHelper.addFrame; +import static GoodGenerator.util.StructureHelper.addTieredBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static gregtech.api.util.GT_StructureUtility.*; + +public class YottaFluidTank extends GT_MetaTileEntity_MultiblockBase_EM implements IConstructable { + + private static final IIconContainer textureFontOn = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_QTANK"); + private static final IIconContainer textureFontOn_Glow = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_QTANK_GLOW"); + private static final IIconContainer textureFontOff = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_QCHEST"); + private static final IIconContainer textureFontOff_Glow = new Textures.BlockIcons.CustomIcon("iconsets/OVERLAY_QCHEST_GLOW"); + + protected IStructureDefinition<YottaFluidTank> multiDefinition = null; + + protected BigInteger mStorage = new BigInteger("0", 10); + protected BigInteger mStorageCurrent = new BigInteger("0", 10); + protected String mFluidName = ""; + protected int glassMeta; + protected final String YOTTANK_BOTTOM = mName + "buttom"; + protected final String YOTTANK_MID = mName + "mid"; + protected final String YOTTANK_TOP = mName + "top"; + protected List<YottaFluidTankOutputHatch> mYottaOutput = new ArrayList<>(); + + public YottaFluidTank(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + public YottaFluidTank(String name) { + super(name); + } + + public int getMeta() { + return glassMeta; + } + + public void setMeta(int meta) { + glassMeta = meta; + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + String tAmount = aNBT.getString("mStorage"); + String tAmountCurrent = aNBT.getString("mStorageCurrent"); + if (tAmount == null || tAmount.equals("")) tAmount = "0"; + if (tAmountCurrent == null || tAmountCurrent.equals("")) tAmountCurrent = "0"; + mStorage = new BigInteger(tAmount, 10); + mStorageCurrent = new BigInteger(tAmountCurrent, 10); + mFluidName = aNBT.getString("mFluidName"); + glassMeta = aNBT.getInteger("glassMeta"); + super.loadNBTData(aNBT); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setString("mStorage", mStorage.toString(10)); + aNBT.setString("mStorageCurrent", mStorageCurrent.toString(10)); + aNBT.setString("mFluidName", mFluidName); + aNBT.setInteger("glassMeta", glassMeta); + super.saveNBTData(aNBT); + } + + @Override + public boolean checkRecipe_EM(ItemStack aStack) { + return true; + } + + public boolean reduceFluid(int amount) { + BigInteger tmp = new BigInteger(amount + ""); + if (mStorageCurrent.compareTo(tmp) < 0) { + return false; + } + else { + mStorageCurrent = mStorageCurrent.subtract(tmp); + return true; + } + } + + @Override + public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + for (YottaFluidTankOutputHatch tHatch : mYottaOutput) tHatch.unBounded(); + mYottaOutput.clear(); + if (!structureCheck_EM(YOTTANK_BOTTOM, 2, 0, 0)) return false; + int cnt = 0; + while (structureCheck_EM(YOTTANK_MID, 2, cnt + 1, 0)) { + cnt ++; + } + if (cnt > 15 || cnt < 1) return false; + if (!structureCheck_EM(YOTTANK_TOP, 2, cnt + 2, 0)) return false; + return mMaintenanceHatches.size() == 1; + } + + @Override + public IStructureDefinition<YottaFluidTank> getStructure_EM() { + if(multiDefinition == null) { + multiDefinition = StructureDefinition + .<YottaFluidTank>builder() + .addShape(YOTTANK_BOTTOM, transpose(new String[][]{ + {"MM~MM","MCCCM","MCCCM","MCCCM","MMMMM"}, + {" "," CCC "," COC "," CCC "," "} + })) + .addShape(YOTTANK_MID, transpose(new String[][]{ + {"GGGGG","GRRRG","GRRRG","GRRRG","GGGGG"} + })) + .addShape(YOTTANK_TOP, transpose(new String[][]{ + {"FFFFF","F F","F F","F F","FFFFF"}, + {"CCCCC","CIIIC","CIIIC","CIIIC","CCCCC"} + })) + .addElement( + 'C', + ofBlock( + Loaders.yottaFluidTankCasing, 0 + ) + ) + .addElement( + 'G', + addTieredBlock( + ItemRegistry.bw_realglas, YottaFluidTank::setMeta, YottaFluidTank::getMeta, 12 + ) + ) + .addElement( + 'R', + ofChain( + cells(10) + ) + ) + .addElement( + 'F', + addFrame(Materials.Steel) + ) + .addElement( + 'I', + ofHatchAdderOptional( + YottaFluidTank::addInput, + 1537, + 1, + Loaders.yottaFluidTankCasing, + 0 + ) + ) + .addElement( + 'M', + ofHatchAdderOptional( + YottaFluidTank::addClassicMaintenanceToMachineList, + 1537, + 2, + Loaders.yottaFluidTankCasing, + 0 + ) + ) + .addElement( + 'O', + ofHatchAdder( + YottaFluidTank::addOutput, + 1537, + 3 + ) + ) + .build(); + } + return multiDefinition; + } + + public List<IStructureElement<YottaFluidTank>> cells(int num) { + List<IStructureElement<YottaFluidTank>> out = new ArrayList<>(); + for (int i = 0; i < num; ++i) { + int finalI = i; + out.add( + onElementPass( + x -> x.mStorage = x.mStorage.add(calStorage(finalI)), + ofBlock(Loaders.yottaFluidTankCell, i) + ) + ); + } + return out; + } + + public final boolean addInput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else { + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch)aMetaTileEntity).updateTexture(aBaseCasingIndex); + return this.mInputHatches.add((GT_MetaTileEntity_Hatch_Input)aMetaTileEntity); + } + } + } + return false; + } + + public final boolean addOutput(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } else { + if ((aMetaTileEntity instanceof YottaFluidTankOutputHatch) && boundOutput(aTileEntity)) { + ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); + return true; + } + } + } + return false; + } + + public boolean boundOutput(IGregTechTileEntity output) { + IMetaTileEntity tHatch = output.getMetaTileEntity(); + if (tHatch instanceof YottaFluidTankOutputHatch) { + YottaFluidTankOutputHatch Hatch = (YottaFluidTankOutputHatch) tHatch; + if (!Hatch.isBounded()) { + Hatch.setControl(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()); + mYottaOutput.add(Hatch); + return true; + } + } + return false; + } + + public BigInteger calStorage(int meta) { + StringBuilder cap = new StringBuilder(); + cap.append("1000000"); + for (int i = 0; i < meta; ++i) + cap.append("00"); + return new BigInteger(cap.toString()); + } + + @Override + public boolean onRunningTick(ItemStack aStack) { + super.onRunningTick(aStack); + List<FluidStack> tStore = getStoredFluids(); + for (FluidStack tFluid : tStore) { + if (tFluid == null) continue; + if (mFluidName == null || mFluidName.equals("") || tFluid.getFluid().getName().equals(mFluidName)) { + if (mFluidName == null || mFluidName.equals("")) { + mFluidName = tFluid.getFluid().getName(); + } + if (mStorageCurrent.add(new BigInteger(tFluid.amount + "")).compareTo(mStorage) < 0) { + mStorageCurrent = mStorageCurrent.add(new BigInteger(tFluid.amount + "")); + tFluid.amount = 0; + } else { + BigInteger delta = mStorage.subtract(mStorageCurrent); + mStorageCurrent = mStorageCurrent.add(delta); + tFluid.amount -= delta.intValue(); + } + } + } + BigInteger outputAmount = mStorageCurrent.divide(new BigInteger("100", 10)); + if (outputAmount.compareTo(new BigInteger(Integer.MAX_VALUE + "", 10)) > 0) outputAmount = new BigInteger(Integer.MAX_VALUE + ""); + if (outputAmount.compareTo(BigInteger.ONE) <= 0) outputAmount = new BigInteger("1", 10); + + if (mStorageCurrent.compareTo(BigInteger.ZERO) <= 0) mFluidName = ""; + + if (mFluidName != null && !mFluidName.equals("")) { + if (mYottaOutput.size() > 0) { + mYottaOutput.get(0).setFluid(FluidRegistry.getFluidStack(mFluidName, outputAmount.intValue())); + return true; + } + } + mYottaOutput.get(0).setFluid(null); + return true; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + structureBuild_EM(YOTTANK_BOTTOM, 2, 0, 0, hintsOnly, stackSize); + int height = stackSize.stackSize; + if (height > 15) height = 15; + structureBuild_EM(YOTTANK_TOP, 2, height + 2, 0, hintsOnly, stackSize); + while (height > 0) { + structureBuild_EM(YOTTANK_MID, 2, height, 0, hintsOnly, stackSize); + height --; + } + } + + @Override + public String[] getStructureDescription(ItemStack stackSize) { + return new String[0]; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new YottaFluidTank(this.mName); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone){ + if (aSide == aFacing) { + if (aActive) return new ITexture[] { + Textures.BlockIcons.getCasingTextureForId(1537), + TextureFactory.of(textureFontOn), + TextureFactory.builder().addIcon(textureFontOn_Glow).glow().build() + }; + else return new ITexture[] { + Textures.BlockIcons.getCasingTextureForId(1537), + TextureFactory.of(textureFontOff), + TextureFactory.builder().addIcon(textureFontOff_Glow).glow().build() + }; + } + else return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(1537)}; + } } diff --git a/src/main/java/GoodGenerator/Items/MyItemBlocks.java b/src/main/java/GoodGenerator/Items/MyItemBlocks.java index 15014099d1..1ecee2031f 100644 --- a/src/main/java/GoodGenerator/Items/MyItemBlocks.java +++ b/src/main/java/GoodGenerator/Items/MyItemBlocks.java @@ -13,8 +13,11 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.Arrays; +import java.util.Collections; import java.util.List; +import static GoodGenerator.Loader.Loaders.yottaFluidTankCell; + public class MyItemBlocks extends ItemBlock { private final String mNoMobsToolTip = GT_LanguageManager.addStringLocalization("gt.nomobspawnsonthisblock", "Mobs cannot Spawn on this Block"); private final String mNoTileEntityToolTip = GT_LanguageManager.addStringLocalization("gt.notileentityinthisblock", "This is NOT a TileEntity!"); @@ -67,5 +70,13 @@ public class MyItemBlocks extends ItemBlock { p_77624_3_.addAll(Arrays.asList(DescTextLocalization.addText("EssentiaHatch.tooltip", 2))); } else p_77624_3_.add(mNoTileEntityToolTip); + + if (Block.getBlockFromItem(p_77624_1_.getItem()).equals(yottaFluidTankCell)) { + StringBuilder cap = new StringBuilder(); + cap.append(" 1000000"); + for (int i = 0; i < p_77624_1_.getItemDamage(); i++) cap.append("00"); + cap.append(" L"); + p_77624_3_.add(DescTextLocalization.addText("YOTTankCell.tooltip", 1)[0] + cap.toString()); + } } } diff --git a/src/main/java/GoodGenerator/Loader/Loaders.java b/src/main/java/GoodGenerator/Loader/Loaders.java index 87a5220fa2..1236fd8254 100644 --- a/src/main/java/GoodGenerator/Loader/Loaders.java +++ b/src/main/java/GoodGenerator/Loader/Loaders.java @@ -8,6 +8,7 @@ import GoodGenerator.Blocks.RegularBlock.TEBlock; import GoodGenerator.Blocks.TEs.*; import GoodGenerator.Blocks.TEs.MetaTE.NeutronAccelerator; import GoodGenerator.Blocks.TEs.MetaTE.NeutronSensor; +import GoodGenerator.Blocks.TEs.MetaTE.YottaFluidTankOutputHatch; import GoodGenerator.CrossMod.NEI.IMCForNEI; import GoodGenerator.Items.MyItemBlocks; import GoodGenerator.Items.MyItems; @@ -70,7 +71,9 @@ public class Loaders { public static final Block magicCasing = new Casing("magicCasing", new String[]{GoodGenerator.MOD_ID+":MagicCasing"}); public static final Block essentiaCell = new Casing("essentiaCell", new String[]{GoodGenerator.MOD_ID+":essentiaCell/1",GoodGenerator.MOD_ID+":essentiaCell/2",GoodGenerator.MOD_ID+":essentiaCell/3"}); public static final Block speedingPipe = new ComplexTextureCasing("speedingPipe", new String[]{GoodGenerator.MOD_ID+":speedingPipe_SIDE"}, new String[]{GoodGenerator.MOD_ID+":speedingPipe_TOP"}); - public static final Block[] essentiaCells = new Block[]{essentiaCell}; + public static final Block yottaFluidTankCell = new Casing("yottaFluidTankCell", new String[]{GoodGenerator.MOD_ID+":yottaFluidTankCell/1", GoodGenerator.MOD_ID+":yottaFluidTankCell/2", GoodGenerator.MOD_ID+":yottaFluidTankCell/3", GoodGenerator.MOD_ID+":yottaFluidTankCell/4", GoodGenerator.MOD_ID+":yottaFluidTankCell/5", + GoodGenerator.MOD_ID+":yottaFluidTankCell/6", GoodGenerator.MOD_ID+":yottaFluidTankCell/7", GoodGenerator.MOD_ID+":yottaFluidTankCell/8", GoodGenerator.MOD_ID+":yottaFluidTankCell/9", GoodGenerator.MOD_ID+":yottaFluidTankCell/10",}); + public static final Block yottaFluidTankCasing = new ComplexTextureCasing("yottaFluidTankCasing", new String[]{GoodGenerator.MOD_ID+":yottaFluidTankCasing_SIDE"}, new String[]{GoodGenerator.MOD_ID+":yottaFluidTankCasing_TOP"}); public static Block essentiaHatch; @@ -80,6 +83,8 @@ public class Loaders { public static ItemStack LEG; public static ItemStack NS; public static ItemStack NA; + public static ItemStack YFT; + public static ItemStack YFTOutput; public static ItemStack[] NeutronAccelerators = new ItemStack[9]; @@ -92,6 +97,8 @@ public class Loaders { } Loaders.NS = new NeutronSensor(IDOffset + 11, "Neutron Sensor", "Neutron Sensor", 5).getStackForm(1L); Loaders.NA = new NeutronActivator(IDOffset + 12, "NeutronActivator", "Neutron Activator").getStackForm(1L); + Loaders.YFT = new YottaFluidTank(IDOffset + 13, "YottaFluidTank", "YOTTank").getStackForm(1L); + Loaders.YFTOutput = new YottaFluidTankOutputHatch(IDOffset + 14, "YottaFluidTankOutput", "YOTTank Output Hatch", 5).getStackForm(1L); } public static void Register(){ @@ -105,6 +112,8 @@ public class Loaders { GameRegistry.registerBlock(rawCylinder, MyItemBlocks.class, "rawCylinder"); GameRegistry.registerBlock(titaniumPlatedCylinder, MyItemBlocks.class, "titaniumPlatedCylinder"); GameRegistry.registerBlock(speedingPipe, MyItemBlocks.class, "speedingPipe"); + GameRegistry.registerBlock(yottaFluidTankCell, MyItemBlocks.class, "yottaFluidTankCells"); + GameRegistry.registerBlock(yottaFluidTankCasing, MyItemBlocks.class, "yottaFluidTankCasing"); GameRegistry.registerItem(radiationProtectionPlate, "radiationProtectionPlate", GoodGenerator.MOD_ID); GameRegistry.registerItem(wrappedUraniumIngot, "wrappedUraniumIngot", GoodGenerator.MOD_ID); GameRegistry.registerItem(highDensityUraniumNugget, "highDensityUraniumNugget", GoodGenerator.MOD_ID); @@ -139,7 +148,7 @@ public class Loaders { Loaders.LEG = new LargeEssentiaGenerator(IDOffset + 1, "LargeEssentiaGenerator", "Large Essentia Generator").getStackForm(1L); essentiaHatch = new TEBlock("essentiaHatch", new String[]{GoodGenerator.MOD_ID + ":essentiaHatch"}, 1); GameRegistry.registerBlock(magicCasing, MyItemBlocks.class, "magicCasing"); - GameRegistry.registerBlock(essentiaCells[0], MyItemBlocks.class, "essentiaCell"); + GameRegistry.registerBlock(essentiaCell, MyItemBlocks.class, "essentiaCell"); GameRegistry.registerBlock(essentiaHatch, MyItemBlocks.class, "essentiaHatch"); } } @@ -154,6 +163,7 @@ public class Loaders { if (Textures.BlockIcons.casingTexturePages[GoodGeneratorTexturePage] == null){ Textures.BlockIcons.casingTexturePages[GoodGeneratorTexturePage] = new ITexture[128]; Textures.BlockIcons.casingTexturePages[GoodGeneratorTexturePage][0] = TextureFactory.of(magicCasing); + Textures.BlockIcons.casingTexturePages[GoodGeneratorTexturePage][1] = TextureFactory.of(yottaFluidTankCasing); } } @@ -165,10 +175,10 @@ public class Loaders { compactMod(); FluidsBuilder.Register(); FuelRodLoader.RegisterRod(); + IMCForNEI.IMCSender(); } public static void initLoad(){ - IMCForNEI.IMCSender(); initLoadRecipes(); } diff --git a/src/main/java/GoodGenerator/Loader/NaquadahReworkRecipeLoader.java b/src/main/java/GoodGenerator/Loader/NaquadahReworkRecipeLoader.java index 679512096e..5d7017b088 100644 --- a/src/main/java/GoodGenerator/Loader/NaquadahReworkRecipeLoader.java +++ b/src/main/java/GoodGenerator/Loader/NaquadahReworkRecipeLoader.java @@ -544,7 +544,8 @@ public class NaquadahReworkRecipeLoader { null, false, 1 << 30, new FluidStack[]{Materials.Polybenzimidazole.getMolten(36)}, GT_OreDictUnificator.get(OrePrefixes.foil, Materials.Polybenzimidazole, 2), - GT_OreDictUnificator.get(OrePrefixes.foil, Materials.HSSS, 1) + GT_OreDictUnificator.get(OrePrefixes.foil, Materials.HSSS, 1), + GT_Utility.getIntegratedCircuit(1) ); if (tRecipe != null) { GT_Recipe.GT_Recipe_Map.sAssemblerRecipes.mRecipeList.remove(tRecipe); diff --git a/src/main/java/GoodGenerator/util/ItemRefer.java b/src/main/java/GoodGenerator/util/ItemRefer.java index f7a2dde83a..b28416e7d1 100644 --- a/src/main/java/GoodGenerator/util/ItemRefer.java +++ b/src/main/java/GoodGenerator/util/ItemRefer.java @@ -66,6 +66,20 @@ public final class ItemRefer { public static ItemRefer Essentia_Cell_T2 = getItemStack(essentiaCell, 1); public static ItemRefer Essentia_Cell_T3 = getItemStack(essentiaCell, 2); public static ItemRefer Essentia_Hatch = getItemStack(essentiaHatch); + public static ItemRefer YOTTank_Casing = getItemStack(yottaFluidTankCasing); + public static ItemRefer YOTTank_Cell_T1 = getItemStack(yottaFluidTankCell, 0); + public static ItemRefer YOTTank_Cell_T2 = getItemStack(yottaFluidTankCell, 1); + public static ItemRefer YOTTank_Cell_T3 = getItemStack(yottaFluidTankCell, 2); + public static ItemRefer YOTTank_Cell_T4 = getItemStack(yottaFluidTankCell, 3); + public static ItemRefer YOTTank_Cell_T5 = getItemStack(yottaFluidTankCell, 4); + public static ItemRefer YOTTank_Cell_T6 = getItemStack(yottaFluidTankCell, 5); + public static ItemRefer YOTTank_Cell_T7 = getItemStack(yottaFluidTankCell, 6); + public static ItemRefer YOTTank_Cell_T8 = getItemStack(yottaFluidTankCell, 7); + public static ItemRefer YOTTank_Cell_T9 = getItemStack(yottaFluidTankCell, 8); + public static ItemRefer YOTTank_Cell_T10 = getItemStack(yottaFluidTankCell, 9); + public static ItemRefer YOTTank = getItemStack(YFT); + public static ItemRefer YOTTank_Output_Hatch = getItemStack(YFTOutput); + public static ItemRefer Large_Naquadah_Reactor = getItemStack(MAR.copy()); public static ItemRefer Naquadah_Fuel_Refinery = getItemStack(FRF.copy()); diff --git a/src/main/java/GoodGenerator/util/StructureHelper.java b/src/main/java/GoodGenerator/util/StructureHelper.java index ea3b10eeae..d499921319 100644 --- a/src/main/java/GoodGenerator/util/StructureHelper.java +++ b/src/main/java/GoodGenerator/util/StructureHelper.java @@ -1,12 +1,14 @@ package GoodGenerator.util; import com.github.technus.tectech.TecTech; +import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.structure.IStructureElement; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.metatileentity.BaseMetaPipeEntity; import gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Frame; import gregtech.api.util.GT_OreDictUnificator; +import net.minecraft.block.Block; import net.minecraft.init.Items; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; @@ -15,6 +17,9 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; import java.util.Arrays; +import java.util.function.BiConsumer; +import java.util.function.BiPredicate; +import java.util.function.Function; public class StructureHelper { @@ -58,4 +63,50 @@ public class StructureHelper { }; } + //Only support to use meta to tier + public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiConsumer<T, Integer> aSetTheFuckingMeta, Function<T, Integer> aGetTheFuckingMeta, int maxMeta) { + return addTieredBlock(aBlock, (t, i) -> { + aSetTheFuckingMeta.accept(t, i); + return true; + }, aGetTheFuckingMeta, maxMeta + ); + } + + public static <T> IStructureElement<T> addTieredBlock(Block aBlock, BiPredicate<T, Integer> aSetTheFuckingMeta, Function<T, Integer> aGetTheFuckingMeta, int maxMeta) { + + return new IStructureElement<T>() { + @Override + public boolean check(T t, World world, int x, int y, int z) { + Block tBlock = world.getBlock(x, y, z); + if (aBlock == tBlock) { + Integer currentMeta = aGetTheFuckingMeta.apply(t); + int newMeta = tBlock.getDamageValue(world, x, y, z) + 1; + if (currentMeta == 0) { + return aSetTheFuckingMeta.test(t, newMeta); + } else { + return currentMeta == newMeta; + } + } + return false; + } + + @Override + public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) { + StructureLibAPI.hintParticle(world, x, y, z, aBlock, getMeta(trigger)); + return true; + } + + @Override + public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) { + return world.setBlock(x, y, z, aBlock, getMeta(trigger), 3); + } + + private int getMeta(ItemStack trigger) { + int meta = trigger.stackSize; + if (meta <= 0) meta = 0; + if (meta > maxMeta) meta = maxMeta; + return meta; + } + }; + } } |