diff options
Diffstat (limited to 'src/main/java/gtnhlanth/common')
33 files changed, 7583 insertions, 0 deletions
diff --git a/src/main/java/gtnhlanth/common/CommonProxy.java b/src/main/java/gtnhlanth/common/CommonProxy.java new file mode 100644 index 0000000000..6613e03a23 --- /dev/null +++ b/src/main/java/gtnhlanth/common/CommonProxy.java @@ -0,0 +1,14 @@ +package gtnhlanth.common; + +import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLPostInitializationEvent; +import cpw.mods.fml.common.event.FMLPreInitializationEvent; + +public class CommonProxy { + + public void preInit(FMLPreInitializationEvent e) {} + + public void init(FMLInitializationEvent e) {} + + public void postInit(FMLPostInitializationEvent e) {} +} diff --git a/src/main/java/gtnhlanth/common/beamline/BeamInformation.java b/src/main/java/gtnhlanth/common/beamline/BeamInformation.java new file mode 100644 index 0000000000..3d2ff841c4 --- /dev/null +++ b/src/main/java/gtnhlanth/common/beamline/BeamInformation.java @@ -0,0 +1,51 @@ +package gtnhlanth.common.beamline; + +public class BeamInformation { + + private float energy; // in keV + private int rate; + + private Particle particle; + private int particleId; + + private float focus; + + public BeamInformation(float energy, int rate, int particleId, float focus) { + this.energy = energy; + this.rate = rate; + this.particleId = particleId; + this.particle = Particle.values()[particleId]; + this.focus = focus; + } + + public float getEnergy() { + return this.energy; + } + + public int getRate() { + return this.rate; + } + + public Particle getParticle() { + return this.particle; + } + + public int getParticleId() { + return this.particleId; + } + + public float getFocus() { + return this.focus; + } + + @Override + public String toString() { + return "Energy=" + this.getEnergy() + + ",Rate=" + + this.getRate() + + ",Particle=" + + this.getParticleId() + + ",Focus=" + + this.getFocus(); + } +} diff --git a/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java b/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java new file mode 100644 index 0000000000..7137c6ab7d --- /dev/null +++ b/src/main/java/gtnhlanth/common/beamline/BeamLinePacket.java @@ -0,0 +1,51 @@ +package gtnhlanth.common.beamline; + +import net.minecraft.nbt.NBTTagCompound; + +import tectech.mechanics.dataTransport.DataPacket; + +public class BeamLinePacket extends DataPacket<BeamInformation> { + + public BeamLinePacket(BeamInformation content) { + super(content); + } + + public BeamLinePacket(NBTTagCompound compound) { + super(compound); + } + + @Override + protected BeamInformation contentFromNBT(NBTTagCompound nbt) { + /* + * NBTTagCompound compound = nbt.getCompoundTag("beamline"); + */ + return new BeamInformation( + nbt.getFloat("energy"), + nbt.getInteger("rate"), + nbt.getInteger("particleId"), + nbt.getInteger("focus")); + } + + @Override + protected NBTTagCompound contentToNBT() { + + NBTTagCompound compound = new NBTTagCompound(); + + compound.setFloat("energy", content.getEnergy()); + compound.setInteger("rate", content.getRate()); + compound.setInteger("particleId", content.getParticleId()); + compound.setFloat("focus", content.getFocus()); + + return compound; + } + + @Override + public boolean extraCheck() { + return true; + } + + @Override + protected BeamInformation unifyContentWith(BeamInformation arg0) { + throw new NoSuchMethodError("Unavailable to unify beam info data packet"); + } +} diff --git a/src/main/java/gtnhlanth/common/beamline/IConnectsToBeamline.java b/src/main/java/gtnhlanth/common/beamline/IConnectsToBeamline.java new file mode 100644 index 0000000000..6b9c9785f1 --- /dev/null +++ b/src/main/java/gtnhlanth/common/beamline/IConnectsToBeamline.java @@ -0,0 +1,14 @@ +package gtnhlanth.common.beamline; + +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; + +public interface IConnectsToBeamline extends IMetaTileEntity { + + boolean canConnect(ForgeDirection side); + + IConnectsToBeamline getNext(IConnectsToBeamline source); + + boolean isDataInputFacing(ForgeDirection side); +} diff --git a/src/main/java/gtnhlanth/common/beamline/MTEBeamlinePipe.java b/src/main/java/gtnhlanth/common/beamline/MTEBeamlinePipe.java new file mode 100644 index 0000000000..fbfb0eb9c6 --- /dev/null +++ b/src/main/java/gtnhlanth/common/beamline/MTEBeamlinePipe.java @@ -0,0 +1,256 @@ +package gtnhlanth.common.beamline; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.GTMod; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.common.GTClient; +import gregtech.common.render.GTTextureBuilder; + +public class MTEBeamlinePipe extends MetaPipeEntity implements IConnectsToBeamline { + + private static Textures.BlockIcons.CustomIcon pipe; + + private byte connectionCount = 0; + + private boolean active; + + public MTEBeamlinePipe(int id, String name, String nameRegional) { + super(id, name, nameRegional, 0); + } + + public MTEBeamlinePipe(String name) { + super(name, 0); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if ((aTick & 31) == 31) { + mConnections = 0; + connectionCount = 0; + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + ForgeDirection d1 = dir.getOpposite(); + TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(dir); + if (tTileEntity instanceof IConnectsToBeamline) { + if (((IConnectsToBeamline) tTileEntity).canConnect(d1)) { + mConnections |= 1 << dir.ordinal(); + connectionCount++; + } + } else if (tTileEntity instanceof IGregTechTileEntity) { + IMetaTileEntity meta = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity(); + if (meta instanceof IConnectsToBeamline) { + if (((IConnectsToBeamline) meta).canConnect(d1)) { + mConnections |= 1 << dir.ordinal(); + connectionCount++; + } + } + } + } + } + } else if (aBaseMetaTileEntity.isClientSide() && GTClient.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + } + + @Override + public byte getTileEntityBaseType() { + return 7; + } + + @Override + public void loadNBTData(NBTTagCompound arg0) {} + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { + return new MTEBeamlinePipe(mName); + } + + @Override + public void saveNBTData(NBTTagCompound arg0) {} + + @Override + public float getThickNess() { + if (GTMod.instance.isClientSide() && GTClient.hideValue == 1) { + return 0.0625F; + } + return 0.5f; + } + + @Override + public boolean renderInside(ForgeDirection arg0) { + return false; + } + + @Override + public boolean canConnect(ForgeDirection side) { + return true; + } + + // Largely taken from Tec's DataPipe + + @Override + public IConnectsToBeamline getNext(IConnectsToBeamline source) { + + for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) { + + if ((mConnections & 1 << dir.ordinal()) == 0) { + continue; + } + + TileEntity next = this.getBaseMetaTileEntity() + .getTileEntityAtSide(dir); + if (next instanceof IConnectsToBeamline && next != source) { + + if (((IConnectsToBeamline) next).isDataInputFacing(dir.getOpposite())) { + return (IConnectsToBeamline) next; + } + + } else if (next instanceof IGregTechTileEntity) { + + IMetaTileEntity meta = ((IGregTechTileEntity) next).getMetaTileEntity(); + if (meta instanceof IConnectsToBeamline && meta != source) { + + if (meta instanceof MTEBeamlinePipe && (((MTEBeamlinePipe) meta).connectionCount == 2)) { + + ((MTEBeamlinePipe) meta).markUsed(); + return (IConnectsToBeamline) meta; + } + + if (((IConnectsToBeamline) meta).isDataInputFacing(dir.getOpposite())) { + + return (IConnectsToBeamline) meta; + } + } + } + } + + return null; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister aBlockIconRegister) { + pipe = new Textures.BlockIcons.CustomIcon("iconsets/pipe"); + super.registerIcons(aBlockIconRegister); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection aSide, int aConnections, + int aColorIndex, boolean aConnected, boolean aRedstone) { + return new ITexture[] { new GTTextureBuilder().addIcon(pipe) + .build(), + new GTTextureBuilder().addIcon(pipe) + .setRGBA(Dyes.getModulation((byte) aColorIndex, MACHINE_METAL.getRGBA())) + .build() }; + } + + public void markUsed() { + this.active = true; + } + + @Override + public boolean isDataInputFacing(ForgeDirection side) { + return true; + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + float tSpace = (1f - 0.375f) / 2; + float tSide0 = tSpace; + float tSide1 = 1f - tSpace; + float tSide2 = tSpace; + float tSide3 = 1f - tSpace; + float tSide4 = tSpace; + float tSide5 = 1f - tSpace; + + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.DOWN) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.UP) != 0) { + tSide2 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.NORTH) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.SOUTH) != 0) { + tSide0 = tSide4 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.WEST) != 0) { + tSide0 = tSide2 = tSide4 = 0; + tSide1 = tSide3 = 1; + } + if (getBaseMetaTileEntity().getCoverIDAtSide(ForgeDirection.EAST) != 0) { + tSide0 = tSide2 = 0; + tSide1 = tSide3 = tSide5 = 1; + } + + byte tConn = ((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections; + if ((tConn & 1 << ForgeDirection.DOWN.ordinal()) != 0) { + tSide0 = 0f; + } + if ((tConn & 1 << ForgeDirection.UP.ordinal()) != 0) { + tSide1 = 1f; + } + if ((tConn & 1 << ForgeDirection.NORTH.ordinal()) != 0) { + tSide2 = 0f; + } + if ((tConn & 1 << ForgeDirection.SOUTH.ordinal()) != 0) { + tSide3 = 1f; + } + if ((tConn & 1 << ForgeDirection.WEST.ordinal()) != 0) { + tSide4 = 0f; + } + if ((tConn & 1 << ForgeDirection.EAST.ordinal()) != 0) { + tSide5 = 1f; + } + + return AxisAlignedBB + .getBoundingBox(aX + tSide4, aY + tSide0, aZ + tSide2, aX + tSide5, aY + tSide1, aZ + tSide3); + } + + @Override + public String[] getDescription() { + return new String[] { StatCollector.translateToLocal("beamline.pipe.desc.0"), // Beamline pipe + EnumChatFormatting.AQUA + StatCollector.translateToLocal("beamline.pipe.desc.1"), // Does not cross, split + // or turn + "Added by " + EnumChatFormatting.GREEN + "GTNH: Lanthanides" + + }; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, ForgeDirection side, + ItemStack aStack) { + return false; + } +} diff --git a/src/main/java/gtnhlanth/common/beamline/Particle.java b/src/main/java/gtnhlanth/common/beamline/Particle.java new file mode 100644 index 0000000000..856bb383db --- /dev/null +++ b/src/main/java/gtnhlanth/common/beamline/Particle.java @@ -0,0 +1,71 @@ +package gtnhlanth.common.beamline; + +import net.minecraft.util.StatCollector; + +public enum Particle { + + ELECTRON(true, 0, 0.511f, 5000, "electron", "e\u207B", -1, null), + PHOTON(false, 1, 0, 0, "photon", "\u03B3", 0, null), + NEUTRON(false, 2, 939.57f, 15000, "neutron", "n\u2070", 0, null), + PROTON(true, 3, 938.27f, 15000, "proton", "p\u207A", 1, null), + ALPHA(true, 4, 3727.38f, 8000, "alpha", "\u03B1", 2, null); + + private boolean canAcc; + + private float restMass; // in MeV + + private float maxSourceEnergy; // in keV + + private String name; + private String shortName; + + private float charge; // in multiples of elemental charge + + private String chargeSpecial; + + private Particle(boolean canAcc, int id, float restMass, float maxSourceEnergy, String name, String shortName, + float charge, String chargeSpecial) { // ID + // is + // symbolic + // only + this.canAcc = canAcc; + this.restMass = restMass; + this.maxSourceEnergy = maxSourceEnergy; + this.name = name; + this.shortName = shortName; + this.charge = charge; + this.chargeSpecial = chargeSpecial; + } + + public float getMass() { + return this.restMass; + } + + public float getCharge() { + return this.charge; + } + + public String getChargeSpecial() { + return this.chargeSpecial; + } + + public boolean canAccelerate() { + return this.canAcc; + } + + public float maxSourceEnergy() { + return this.maxSourceEnergy; + } + + public String getName() { + return this.name; + } + + public String getLocalisedName() { + return StatCollector.translateToLocal("particle." + this.name) + " (" + this.shortName + ")"; + } + + public static Particle getParticleFromId(int id) { + return Particle.values()[id]; + } +} diff --git a/src/main/java/gtnhlanth/common/block/BlockAntennaCasing.java b/src/main/java/gtnhlanth/common/block/BlockAntennaCasing.java new file mode 100644 index 0000000000..d93d6a3494 --- /dev/null +++ b/src/main/java/gtnhlanth/common/block/BlockAntennaCasing.java @@ -0,0 +1,15 @@ +package gtnhlanth.common.block; + +public class BlockAntennaCasing extends BlockCasing { + + private int antennaTier; + + public BlockAntennaCasing(int tier) { + super("antenna_t" + tier); + this.antennaTier = tier; + } + + public int getTier() { + return this.antennaTier; + } +} diff --git a/src/main/java/gtnhlanth/common/block/BlockCasing.java b/src/main/java/gtnhlanth/common/block/BlockCasing.java new file mode 100644 index 0000000000..d51a4e79f5 --- /dev/null +++ b/src/main/java/gtnhlanth/common/block/BlockCasing.java @@ -0,0 +1,79 @@ +package gtnhlanth.common.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTechAPI; +import gtnhlanth.Tags; + +public class BlockCasing extends Block { + + @SideOnly(Side.CLIENT) + protected IIcon[] texture; + + private String name; + + public BlockCasing(String name) { + super(Material.iron); + this.name = name; + this.setBlockTextureName(Tags.MODID + ":casing." + name); + GregTechAPI.registerMachineBlock(this, -1); + } + + public BlockCasing(String name, Material material) { + super(material); + this.name = name; + this.setBlockTextureName(Tags.MODID + ":casing." + name); + GregTechAPI.registerMachineBlock(this, -1); + } + + @Override + public int damageDropped(int meta) { + return meta; + } + + @Override + public String getHarvestTool(int aMeta) { + return "wrench"; + } + + @Override + public int getHarvestLevel(int aMeta) { + return 2; + } + + @Override + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return Blocks.iron_block.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + super.breakBlock(aWorld, aX, aY, aZ, aBlock, aMetaData); + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + super.onBlockAdded(aWorld, aX, aY, aZ); + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + } + + @Override + public String getUnlocalizedName() { + return "casing." + this.name; + } + + @Override + public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { + return false; + } + +} diff --git a/src/main/java/gtnhlanth/common/block/BlockShieldedAccGlass.java b/src/main/java/gtnhlanth/common/block/BlockShieldedAccGlass.java new file mode 100644 index 0000000000..e5dba84d52 --- /dev/null +++ b/src/main/java/gtnhlanth/common/block/BlockShieldedAccGlass.java @@ -0,0 +1,73 @@ +package gtnhlanth.common.block; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.init.Blocks; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.GregTechAPI; +import gtnhlanth.Tags; + +public class BlockShieldedAccGlass extends Block { + + private static final String name = "shielded_accelerator_glass"; + + public BlockShieldedAccGlass() { + super(Material.glass); + this.setBlockName("casing." + name); + this.setBlockTextureName(Tags.MODID + ":casing." + name); + GregTechAPI.registerMachineBlock(this, -1); + } + + @Override + public boolean isOpaqueCube() { + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderBlockPass() { + return 1; + } + + @Override + public boolean renderAsNormalBlock() { + return false; + } + + @Override + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + if (GregTechAPI.isMachineBlock(this, aWorld.getBlockMetadata(aX, aY, aZ))) { + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public void breakBlock(World aWorld, int aX, int aY, int aZ, Block aBlock, int aMetaData) { + if (GregTechAPI.isMachineBlock(this, aMetaData)) { + GregTechAPI.causeMachineUpdate(aWorld, aX, aY, aZ); + } + } + + @Override + public float getBlockHardness(World aWorld, int aX, int aY, int aZ) { + return Blocks.glass.getBlockHardness(aWorld, aX, aY, aZ); + } + + @Override + @SideOnly(Side.CLIENT) + public boolean shouldSideBeRendered(IBlockAccess worldClient, int xCoord, int yCoord, int zCoord, int aSide) { + if (worldClient.getBlock(xCoord, yCoord, zCoord) instanceof BlockShieldedAccGlass) return false; + return super.shouldSideBeRendered(worldClient, xCoord, yCoord, zCoord, aSide); + } + + @Override + public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { + return false; + } + +} diff --git a/src/main/java/gtnhlanth/common/hatch/MTEBusInputFocus.java b/src/main/java/gtnhlanth/common/hatch/MTEBusInputFocus.java new file mode 100644 index 0000000000..1d8840295b --- /dev/null +++ b/src/main/java/gtnhlanth/common/hatch/MTEBusInputFocus.java @@ -0,0 +1,84 @@ +package gtnhlanth.common.hatch; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GTRenderedTexture; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.nbthandlers.MTEHatchNbtConsumable; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtnhlanth.common.item.ICanFocus; +import gtnhlanth.util.Util; + +public class MTEBusInputFocus extends MTEHatchNbtConsumable { + + private static final int INPUT_SLOTS = 4; + + public MTEBusInputFocus(int id, String name, String nameRegional) { + super(id, name, nameRegional, 0, INPUT_SLOTS, "Input Bus for Foci", false); + } + + public MTEBusInputFocus(String name, String[] descriptionArray, ITexture[][][] textures) { + super(name, 0, INPUT_SLOTS, descriptionArray, false, textures); + } + + @Override + public int getInputSlotCount() { + return INPUT_SLOTS; + } + + @Override + public boolean isFacingValid(ForgeDirection facing) { + return true; + } + + @Override + public AutoMap<ItemStack> getItemsValidForUsageSlots() { + return new AutoMap<>(); + } + + @Override + public boolean isItemValidForUsageSlot(ItemStack aStack) { + + if (this.getContentUsageSlots() + .size() == 0) { + return aStack.getItem() instanceof ICanFocus; + } else { + return false; + } + + } + + @Override + public String getNameGUI() { + return "Focus Input Bus"; + } + + public void depleteFocusDurability(int damage) { + + ItemStack stack = this.getContentUsageSlots() + .toArray()[0]; + + Util.depleteDurabilityOfStack(stack, damage); + + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, new GTRenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, new GTRenderedTexture(TexturesGtBlock.Overlay_Bus_Catalyst) }; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new MTEBusInputFocus(mName, mDescriptionArray, mTextures); + } + +} diff --git a/src/main/java/gtnhlanth/common/hatch/MTEHatchBeamlineConnector.java b/src/main/java/gtnhlanth/common/hatch/MTEHatchBeamlineConnector.java new file mode 100644 index 0000000000..9e223ee9a1 --- /dev/null +++ b/src/main/java/gtnhlanth/common/hatch/MTEHatchBeamlineConnector.java @@ -0,0 +1,134 @@ +package gtnhlanth.common.hatch; + +import static net.minecraft.util.StatCollector.translateToLocalFormatted; +import static tectech.util.CommonValues.MOVE_AT; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.reflect.FieldUtils; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTEHatch; +import gtnhlanth.common.beamline.IConnectsToBeamline; +import tectech.mechanics.dataTransport.DataPacket; +import tectech.util.TTUtility; + +public abstract class MTEHatchBeamlineConnector<T extends DataPacket> extends MTEHatch implements IConnectsToBeamline { + + private String clientLocale = "en_US"; + + public T q; + + public short id = -1; + + protected MTEHatchBeamlineConnector(int aID, String aName, String aNameRegional, int aTier, String descr) { + super(aID, aName, aNameRegional, aTier, 0, descr); + TTUtility.setTier(aTier, this); + } + + protected MTEHatchBeamlineConnector(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 0, aDescription, aTextures); + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setShort("eID", id); + if (q != null) { + aNBT.setTag("eDATA", q.toNbt()); + } + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + id = aNBT.getShort("eID"); + if (aNBT.hasKey("eDATA")) { + q = loadPacketFromNBT(aNBT.getCompoundTag("eDATA")); + } + } + + protected abstract T loadPacketFromNBT(NBTTagCompound nbt); + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + if (MOVE_AT == aTick % 20) { + if (q == null) { + getBaseMetaTileEntity().setActive(false); + } else { + getBaseMetaTileEntity().setActive(true); + moveAround(aBaseMetaTileEntity); + } + } + } + } + + public abstract void moveAround(IGregTechTileEntity aBaseMetaTileEntity); + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + try { + EntityPlayerMP player = (EntityPlayerMP) aPlayer; + clientLocale = (String) FieldUtils.readField(player, "translator", true); + } catch (Exception e) { + clientLocale = "en_US"; + } + return true; + } + + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return false; + } + + @Override + public boolean isGivingInformation() { + return true; + } + + @Override + public String[] getInfoData() { + if (id > 0) { + return new String[] { + translateToLocalFormatted("tt.keyword.ID", clientLocale) + ": " + EnumChatFormatting.AQUA + id, + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + + EnumChatFormatting.AQUA + + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + + EnumChatFormatting.RED + + (q != null ? q.getTraceSize() : 0), }; + } + return new String[] { + translateToLocalFormatted("tt.keyword.Content", clientLocale) + ": " + + EnumChatFormatting.AQUA + + (q != null ? q.getContentString() : 0), + translateToLocalFormatted("tt.keyword.PacketHistory", clientLocale) + ": " + + EnumChatFormatting.RED + + (q != null ? q.getTraceSize() : 0), }; + } + + @Override + public String[] getDescription() { + return new String[] { "Text description shouldn't be seen, report to Tec", "High speed fibre optics connector.", + EnumChatFormatting.AQUA + "Must be painted to work" }; + } +} diff --git a/src/main/java/gtnhlanth/common/hatch/MTEHatchInputBeamline.java b/src/main/java/gtnhlanth/common/hatch/MTEHatchInputBeamline.java new file mode 100644 index 0000000000..1d13270e31 --- /dev/null +++ b/src/main/java/gtnhlanth/common/hatch/MTEHatchInputBeamline.java @@ -0,0 +1,130 @@ +package gtnhlanth.common.hatch; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GTRenderedTexture; +import gtnhlanth.common.beamline.BeamLinePacket; +import gtnhlanth.common.beamline.IConnectsToBeamline; +import tectech.util.TTUtility; + +public class MTEHatchInputBeamline extends MTEHatchBeamlineConnector<BeamLinePacket> { + + private boolean delay = true; + + private static final String activeIconPath = "iconsets/OVERLAY_BI_ACTIVE"; + private static final String sideIconPath = "iconsets/OVERLAY_BI_SIDES"; + private static final String connIconPath = "iconsets/BI_CONN"; + + private static final Textures.BlockIcons.CustomIcon activeIcon = new Textures.BlockIcons.CustomIcon(activeIconPath); + private static final Textures.BlockIcons.CustomIcon sideIcon = new Textures.BlockIcons.CustomIcon(sideIconPath); + private static final Textures.BlockIcons.CustomIcon connIcon = new Textures.BlockIcons.CustomIcon(connIconPath); + + public MTEHatchInputBeamline(int id, String name, String nameRegional, int tier) { + + super(id, name, nameRegional, tier, ""); + TTUtility.setTier(tier, this); + } + + public MTEHatchInputBeamline(String name, int tier, String[] desc, ITexture[][][] textures) { + super(name, tier, desc, textures); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + new GTRenderedTexture( + activeIcon, + Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), + new GTRenderedTexture(connIcon) }; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + new GTRenderedTexture( + sideIcon, + Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), + new GTRenderedTexture(connIcon) }; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity tile) { + return new MTEHatchInputBeamline(mName, mTier, mDescriptionArray, mTextures); + } + + @Override + protected BeamLinePacket loadPacketFromNBT(NBTTagCompound tag) { + return new BeamLinePacket(tag); + } + + @Override + public boolean isInputFacing(ForgeDirection side) { + return side == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public boolean isDataInputFacing(ForgeDirection side) { + return isInputFacing(side); + } + + @Override + public boolean isOutputFacing(ForgeDirection aSide) { + return false; + } + + @Override + public boolean isFacingValid(ForgeDirection facing) { + return true; + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean canConnect(ForgeDirection side) { + return isInputFacing(side); + } + + @Override + public IConnectsToBeamline getNext(IConnectsToBeamline source) { + return null; + } + + @Override + public String[] getDescription() { + return null; + } + + public void setContents(BeamLinePacket in) { + if (in == null) { + this.q = null; + } else { + if (in.getContent() + .getRate() > 0) { + this.q = in; + delay = true; + } else { + this.q = null; + } + } + } + + @Override + public void moveAround(IGregTechTileEntity tile) { + if (delay) { + delay = false; + } else { + this.setContents(null); + } + } +} diff --git a/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java b/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java new file mode 100644 index 0000000000..dfb210d725 --- /dev/null +++ b/src/main/java/gtnhlanth/common/hatch/MTEHatchOutputBeamline.java @@ -0,0 +1,137 @@ +package gtnhlanth.common.hatch; + +import static gregtech.api.enums.Dyes.MACHINE_METAL; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraftforge.common.util.ForgeDirection; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GTRenderedTexture; +import gtnhlanth.common.beamline.BeamLinePacket; +import gtnhlanth.common.beamline.IConnectsToBeamline; +import gtnhlanth.common.beamline.MTEBeamlinePipe; +import tectech.util.TTUtility; + +public class MTEHatchOutputBeamline extends MTEHatchBeamlineConnector<BeamLinePacket> implements IConnectsToBeamline { + + private static final String activeIconPath = "iconsets/OVERLAY_BO_ACTIVE"; + private static final String sideIconPath = "iconsets/OVERLAY_BO_SIDES"; + private static final String connIconPath = "iconsets/BO_CONN"; + + private static final Textures.BlockIcons.CustomIcon activeIcon = new Textures.BlockIcons.CustomIcon(activeIconPath); + private static final Textures.BlockIcons.CustomIcon sideIcon = new Textures.BlockIcons.CustomIcon(sideIconPath); + private static final Textures.BlockIcons.CustomIcon connIcon = new Textures.BlockIcons.CustomIcon(connIconPath); + + public MTEHatchOutputBeamline(int id, String name, String nameRegional, int tier) { + super(id, name, nameRegional, tier, ""); + TTUtility.setTier(tier, this); + } + + public MTEHatchOutputBeamline(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + new GTRenderedTexture( + activeIcon, + Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), + new GTRenderedTexture(connIcon) }; + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { aBaseTexture, + new GTRenderedTexture( + sideIcon, + Dyes.getModulation(getBaseMetaTileEntity().getColorization(), MACHINE_METAL.getRGBA())), + new GTRenderedTexture(connIcon) }; + } + + @Override + public IConnectsToBeamline getNext(IConnectsToBeamline source) { + + IGregTechTileEntity base = this.getBaseMetaTileEntity(); + IGregTechTileEntity next = base.getIGregTechTileEntityAtSide(base.getFrontFacing()); + + if (next == null) { + return null; + } + + IMetaTileEntity meta = next.getMetaTileEntity(); + if (meta instanceof MTEBeamlinePipe) { + + ((MTEBeamlinePipe) meta).markUsed(); + return (IConnectsToBeamline) meta; + + } else if (meta instanceof MTEHatchInputBeamline && ((MTEHatchInputBeamline) meta).canConnect( + base.getFrontFacing() + .getOpposite())) { + + return (IConnectsToBeamline) meta; + } + + return null; + } + + @Override + public void moveAround(IGregTechTileEntity aBaseMetaTileEntity) { + IConnectsToBeamline current = this, source = this, next; + int range = 0; + while ((next = current.getNext(source)) != null && range++ < 100) { + if (next instanceof MTEHatchInputBeamline) { + ((MTEHatchInputBeamline) next).setContents(q); + break; + } + source = current; + current = next; + } + q = null; + } + + @Override + protected BeamLinePacket loadPacketFromNBT(NBTTagCompound nbt) { + return new BeamLinePacket(nbt); + } + + @Override + public boolean canConnect(ForgeDirection side) { + return this.isOutputFacing(side); + } + + @Override + public boolean isDataInputFacing(ForgeDirection side) { + return this.isInputFacing(side); + } + + @Override + public boolean isFacingValid(ForgeDirection facing) { + return true; + } + + @Override + public boolean isInputFacing(ForgeDirection aSide) { + return false; + } + + @Override + public boolean isOutputFacing(ForgeDirection side) { + return side == this.getBaseMetaTileEntity() + .getFrontFacing(); + } + + @Override + public String[] getDescription() { + return null; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { + return new MTEHatchOutputBeamline(mName, mTier, mDescriptionArray, mTextures); + } +} diff --git a/src/main/java/gtnhlanth/common/item/ICanFocus.java b/src/main/java/gtnhlanth/common/item/ICanFocus.java new file mode 100644 index 0000000000..7b372ee1c9 --- /dev/null +++ b/src/main/java/gtnhlanth/common/item/ICanFocus.java @@ -0,0 +1,5 @@ +package gtnhlanth.common.item; + +public interface ICanFocus { + +} diff --git a/src/main/java/gtnhlanth/common/item/ItemLanth.java b/src/main/java/gtnhlanth/common/item/ItemLanth.java new file mode 100644 index 0000000000..74f863a24a --- /dev/null +++ b/src/main/java/gtnhlanth/common/item/ItemLanth.java @@ -0,0 +1,15 @@ +package gtnhlanth.common.item; + +import net.minecraft.item.Item; + +import gtnhlanth.Tags; + +public class ItemLanth extends Item { + + public ItemLanth(String name) { + super(); + this.setUnlocalizedName(name); + this.setTextureName(Tags.MODID + ":" + name); + } + +} diff --git a/src/main/java/gtnhlanth/common/item/ItemParticle.java b/src/main/java/gtnhlanth/common/item/ItemParticle.java new file mode 100644 index 0000000000..07286e8f45 --- /dev/null +++ b/src/main/java/gtnhlanth/common/item/ItemParticle.java @@ -0,0 +1,123 @@ +package gtnhlanth.common.item; + +import java.util.List; + +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.util.MathHelper; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtnhlanth.Tags; +import gtnhlanth.common.beamline.Particle; + +public class ItemParticle extends Item { + + public static final int NUMBER_OF_SUBTYPES = Particle.values().length; + + private static String[] names = new String[NUMBER_OF_SUBTYPES]; + + static { + populateNamesArray(); + } + + @SideOnly(Side.CLIENT) + private IIcon[] iconArray; + + public ItemParticle() { + + this.setHasSubtypes(true); + this.setMaxDamage(0); + + } + + @SideOnly(Side.CLIENT) + @Override + public IIcon getIconFromDamage(int damage) { + int j = MathHelper.clamp_int(damage, 0, NUMBER_OF_SUBTYPES - 1); + return this.iconArray[j]; + } + + public String getUnlocalizedName(ItemStack stack) { + int i = MathHelper.clamp_int(stack.getItemDamage(), 0, NUMBER_OF_SUBTYPES - 1); + return super.getUnlocalizedName() + "." + names[i]; + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < NUMBER_OF_SUBTYPES; ++i) { + list.add(new ItemStack(item, 1, i)); + } + } + + @SideOnly(Side.CLIENT) + @Override + public void registerIcons(IIconRegister register) { + this.iconArray = new IIcon[NUMBER_OF_SUBTYPES]; + + for (int i = 0; i < NUMBER_OF_SUBTYPES; ++i) { + this.iconArray[i] = register.registerIcon(Tags.MODID + ":" + "particle/" + names[i]); + } + } + + @SideOnly(Side.CLIENT) + @Override + public String getItemStackDisplayName(ItemStack stack) { + + int i = MathHelper.clamp_int(stack.getItemDamage(), 0, NUMBER_OF_SUBTYPES - 1); + + Particle particle = Particle.values()[i]; + + return particle.getLocalisedName(); + + } + + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + + int i = MathHelper.clamp_int(stack.getItemDamage(), 0, NUMBER_OF_SUBTYPES - 1); + + Particle particle = Particle.values()[i]; + + float restMass = particle.getMass(); + + float charge = particle.getCharge(); + + String chargeSpecial = particle.getChargeSpecial(); + + String chargeStringToAppend; + if (chargeSpecial != null) { + + chargeStringToAppend = chargeSpecial; + + } else { + + if (charge > 0) chargeStringToAppend = "+" + charge; + else chargeStringToAppend = "" + charge; + } + + list.add("Rest Mass: " + restMass + " MeV"); + list.add("Charge: " + chargeStringToAppend + "e"); + + } + + private static void populateNamesArray() { + + for (int i = 0; i < NUMBER_OF_SUBTYPES; i++) { + + Particle particle = Particle.values()[i]; + + names[i] = particle.getName(); + + } + + } + +} diff --git a/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java b/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java new file mode 100644 index 0000000000..d39c74b602 --- /dev/null +++ b/src/main/java/gtnhlanth/common/item/ItemPhotolithographicMask.java @@ -0,0 +1,42 @@ +package gtnhlanth.common.item; + +import java.util.List; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import gtnhlanth.Tags; + +public class ItemPhotolithographicMask extends Item implements ICanFocus { + + private String name; + private String descSpectrum; + + public ItemPhotolithographicMask(String name, int maxDamage, String descSpectrum) { + super(); + this.name = name; + this.descSpectrum = descSpectrum; + this.setUnlocalizedName("photomask." + name); + this.setMaxStackSize(1); + this.setMaxDamage(maxDamage); + this.setTextureName(Tags.MODID + ":photomask/" + name); + } + + /* + * @Override public String getUnlocalizedName() { return "item.photomask." + this.name; } + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + @Override + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + + if (!this.descSpectrum.isEmpty()) + list.add("Suitable for the " + this.descSpectrum + " segment of the electromagnetic spectrum and lower"); + + } + + public String getDescSpectrum() { + return descSpectrum; + } + +} diff --git a/src/main/java/gtnhlanth/common/item/MaskList.java b/src/main/java/gtnhlanth/common/item/MaskList.java new file mode 100644 index 0000000000..b41e2cb886 --- /dev/null +++ b/src/main/java/gtnhlanth/common/item/MaskList.java @@ -0,0 +1,162 @@ +package gtnhlanth.common.item; + +import net.minecraft.item.ItemStack; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.TierEU; + +public enum MaskList { + + // There are absolutely better ways of doing this than a GT Materials-esque Enum, some method of automatically + // scraping the wafer types would be preferable in particular + // Use Dyes._NULL to indicate a wafer's lack of a dedicated lens instead of null, if the wafer's mask is to be + // generated + // Ignore last argument if using all wafers + ERROR("error", "ERROR", 0, "", null, null, 0, 0, 0, 0, 0, null), + BLANK1("blank1", "T1 Blank", 0, "VISIBLE", null, null, 0, 0, 0, 0, 0, null), + BLANK2("blank2", "T2 Blank", 0, "UV", null, null, 0, 0, 0, 0, 0, null), + BLANK3("blank3", "T3 Blank", 0, "X-RAY", null, null, 0, 0, 0, 0, 0, null), + ILC("ilc", "Integrated Logic Circuit", 100, "", BLANK1, Dyes.dyeRed, TierEU.RECIPE_MV, 0.5e-3f, 4e-3f, 35, 1, + ItemList.Circuit_Wafer_ILC.get(1)), + RAM("ram", "Random Access Memory", 200, "", BLANK1, Dyes.dyeCyan, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 40, 2, + ItemList.Circuit_Wafer_Ram.get(1), ItemList.Circuit_Silicon_Wafer), + NAND("nand", "NAND", 200, "", BLANK2, Dyes._NULL, TierEU.RECIPE_HV, 7e-3f, 12e-3f, 40, 1, + ItemList.Circuit_Wafer_NAND.get(1), ItemList.Circuit_Silicon_Wafer), // NAND uses only Ender Pearl lens, don't + // ask me why + NOR("nor", "NOR", 100, "", BLANK2, Dyes._NULL, TierEU.RECIPE_LuV, 8e-3f, 10e-3f, 40, 1, + ItemList.Circuit_Wafer_NOR.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), // Same as + // above, + // but with + // ender + // eye + CPU("cpu", "Central Processing Unit", 10, "", BLANK2, Dyes.dyeWhite, TierEU.RECIPE_MV, 6e-3f, 12e-3f, 45, 2, + ItemList.Circuit_Wafer_CPU.get(1)), + SOC("soc", "SoC", 150, "", BLANK2, Dyes.dyeYellow, TierEU.RECIPE_EV, 3e-3f, 10e-3f, 45, 2, + ItemList.Circuit_Wafer_SoC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), + ASOC("asoc", "Advanced SoC", 120, "", BLANK2, Dyes.dyeGreen, TierEU.RECIPE_EV, 100e-3f, 200e-3f, 50, 2, + ItemList.Circuit_Wafer_SoC2.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), + PIC("pic", "Power IC", 100, "", BLANK2, Dyes.dyeBlue, TierEU.RECIPE_HV, 5e-3f, 10e-3f, 50, 4, + ItemList.Circuit_Wafer_PIC.get(1), ItemList.Circuit_Silicon_Wafer), + HPIC("hpic", "High Power IC", 80, "", BLANK3, null, TierEU.RECIPE_IV, 100e-3f, 200e-3f, 50, 6, + ItemList.Circuit_Wafer_HPIC.get(1), ItemList.Circuit_Silicon_Wafer), // Different, made in chemical reactor. + // Figure out something for + // this later? + NCPU("ncpu", "NanoCPU", 60, "", BLANK2, null, TierEU.RECIPE_EV, 5e-3f, 10e-3f, 50, 4, + ItemList.Circuit_Wafer_NanoCPU.get(1), ItemList.Circuit_Silicon_Wafer), // Same as above + QBIT("qbit", "QBit", 50, "", BLANK2, null, TierEU.RECIPE_EV, 3e-3f, 10e-3f, 50, 4, + ItemList.Circuit_Wafer_QuantumCPU.get(1), ItemList.Circuit_Silicon_Wafer), // ^ + UHPIC("uhpic", "Ultra High Power IC", 60, "", BLANK3, null, TierEU.RECIPE_LuV, 200e-3f, 400e-3f, 50, 8, + ItemList.Circuit_Wafer_UHPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2), // You + // get + // the + // gist + SSOC("ssoc", "Simple SoC", 150, "", BLANK1, Dyes.dyeOrange, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 25, 1, + ItemList.Circuit_Wafer_Simple_SoC.get(1)), + ULPIC("ulpic", "Ultra Low Power IC", 200, "", BLANK1, Dyes.dyeGreen, TierEU.RECIPE_LV, 2e-3f, 4e-3f, 30, 1, + ItemList.Circuit_Wafer_ULPIC.get(1)), // Can use green for this as well as asoc, given + // the latter uses a different base mask + LPIC("lpic", "Low Power IC", 150, "", BLANK1, Dyes.dyeYellow, TierEU.RECIPE_MV, 2e-3f, 4e-3f, 30, 2, + ItemList.Circuit_Wafer_LPIC.get(1)), // Same as above, except for yellow + NPIC("npic", "Nano Power IC", 70, "", BLANK3, Dyes.dyeRed, TierEU.RECIPE_LuV, 1, 100000, 50, 4, + ItemList.Circuit_Wafer_NPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, + ItemList.Circuit_Silicon_Wafer3), // Same + PPIC("ppic", "PPIC", 50, "", BLANK3, null, TierEU.RECIPE_ZPM, 10, 15, 50, 6, ItemList.Circuit_Wafer_PPIC.get(1), + ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, ItemList.Circuit_Silicon_Wafer3), // CR + // recipe + QPIC("qpic", "QPIC", 50, "", BLANK3, Dyes.dyeBlue, TierEU.RECIPE_UV, 5, 9, 50, 6, + ItemList.Circuit_Wafer_QPIC.get(1), ItemList.Circuit_Silicon_Wafer, ItemList.Circuit_Silicon_Wafer2, + ItemList.Circuit_Silicon_Wafer3, ItemList.Circuit_Silicon_Wafer4); // Different base mask to PIC + + String name; + String englishName; + String spectrum; + + int maxDamage; + + MaskList precursor; + Dyes lensColour; + + long engraverEUt; + + float minEnergy; + float maxEnergy; + + float minFocus; + int baselineAmount; + + ItemStack producedItem; + + ItemList[] forbiddenWafers; + + MaskList(String name, String englishName, int maxDamage, String spectrum, MaskList precursor, Dyes lensColour, + long engraverEUt, float minEnergy, float maxEnergy, float minFocus, int baselineAmount, ItemStack producedItem, + ItemList... forbiddenWafers) { + this.name = name; + this.englishName = englishName; + this.spectrum = spectrum; + this.maxDamage = maxDamage; + this.precursor = precursor; + this.lensColour = lensColour; + this.engraverEUt = engraverEUt; + this.minFocus = minFocus; + this.minEnergy = minEnergy; + this.maxEnergy = maxEnergy; + this.baselineAmount = baselineAmount; + this.producedItem = producedItem; + this.forbiddenWafers = forbiddenWafers; + } + + public String getName() { + return this.name; + } + + public String getEnglishName() { + return this.englishName; + } + + public String getSpectrum() { + return this.spectrum; + } + + public int getDamage() { + return this.maxDamage; + } + + public MaskList getPrecursor() { + return this.precursor; + } + + public Dyes getLensColour() { + return this.lensColour; + } + + public long getEngraverEUt() { + return this.engraverEUt; + } + + public float getMinEnergy() { + return this.minEnergy; + } + + public float getMaxEnergy() { + return this.maxEnergy; + } + + public float getMinFocus() { + return this.minFocus; + } + + public int getBaselineAmount() { + return this.baselineAmount; + } + + public ItemStack getProducedItem() { + return this.producedItem; + } + + public ItemList[] getForbiddenWafers() { + return this.forbiddenWafers; + } + +} diff --git a/src/main/java/gtnhlanth/common/register/BotWerkstoffMaterialPool.java b/src/main/java/gtnhlanth/common/register/BotWerkstoffMaterialPool.java new file mode 100644 index 0000000000..0172b90655 --- /dev/null +++ b/src/main/java/gtnhlanth/common/register/BotWerkstoffMaterialPool.java @@ -0,0 +1,88 @@ +package gtnhlanth.common.register; + +import static bartworks.system.material.Werkstoff.Types.*; +import static bartworks.util.BWUtil.subscriptNumbers; +import static gregtech.api.enums.Materials.*; +import static gregtech.api.enums.TextureSet.*; + +import bartworks.system.material.Werkstoff; +import bartworks.util.Pair; + +/* + * Originally authored by botn365 under the MIT License. See BotdustriesLICENSE + */ +@SuppressWarnings("unchecked") +public class BotWerkstoffMaterialPool implements Runnable { + + public static final Werkstoff TungsticAcid = new Werkstoff( + new short[] { 0xf5, 0xf1, 0x16 }, + "Tungstic Acid", + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust() + .enforceUnification(), + 29900, + SET_SHINY, + new Pair<>(Hydrogen, 2), + new Pair<>(Tungsten, 1), + new Pair<>(Oxygen, 4)); + public static final Werkstoff TungstenTrioxide = new Werkstoff( + new short[] { 0x0f, 0x5, 0x16 }, + "Tungsten Trioxide", + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust() + .enforceUnification(), + 29901, + SET_SHINY, + new Pair<>(Tungsten, 1), + new Pair<>(Oxygen, 3)); + public static final Werkstoff AmmoniumNitrate = new Werkstoff( + new short[] { 0x81, 0xcc, 0x00 }, + "Ammonium Nitrate", + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().onlyDust(), + 29903, + SET_FINE, + new Pair<>(Nitrogen, 1), + new Pair<>(Hydrogen, 4), + new Pair<>(Nitrogen, 1), + new Pair<>(Oxygen, 3)); + public static final Werkstoff SodiumTungstate = new Werkstoff( + new short[] { 0xc, 0xed, 0xd7, 0 }, + "Sodium Tungstate", + subscriptNumbers("Na2WO4"), + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 29904, + SET_FINE); + public static final Werkstoff Phosgene = new Werkstoff( + new short[] { 0x15, 0xa1, 0x1a }, + "Phosgene", + subscriptNumbers("COCl2"), + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 29905, + SET_FINE); + public static final Werkstoff Nitromethane = new Werkstoff( + new short[] { 0x87, 0x7d, 0x60 }, + "Nitromethane", + subscriptNumbers("CH3NO2"), + new Werkstoff.Stats(), + COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + 29914, + SET_METALLIC); + + @Override + public void run() { + // TODO Auto-generated method stub + + } +} diff --git a/src/main/java/gtnhlanth/common/register/LanthItemList.java b/src/main/java/gtnhlanth/common/register/LanthItemList.java new file mode 100644 index 0000000000..50069131d6 --- /dev/null +++ b/src/main/java/gtnhlanth/common/register/LanthItemList.java @@ -0,0 +1,174 @@ +package gtnhlanth.common.register; + +import java.util.HashMap; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +import cpw.mods.fml.common.registry.GameRegistry; +import gregtech.api.util.GTLanguageManager; +import gtnhlanth.common.beamline.MTEBeamlinePipe; +import gtnhlanth.common.block.BlockAntennaCasing; +import gtnhlanth.common.block.BlockCasing; +import gtnhlanth.common.block.BlockShieldedAccGlass; +import gtnhlanth.common.hatch.MTEBusInputFocus; +import gtnhlanth.common.hatch.MTEHatchInputBeamline; +import gtnhlanth.common.hatch.MTEHatchOutputBeamline; +import gtnhlanth.common.item.ItemLanth; +import gtnhlanth.common.item.ItemParticle; +import gtnhlanth.common.item.ItemPhotolithographicMask; +import gtnhlanth.common.item.MaskList; +import gtnhlanth.common.tileentity.MTEDigester; +import gtnhlanth.common.tileentity.MTEDissolutionTank; +import gtnhlanth.common.tileentity.MTELINAC; +import gtnhlanth.common.tileentity.MTESourceChamber; +import gtnhlanth.common.tileentity.MTESynchrotron; +import gtnhlanth.common.tileentity.MTETargetChamber; + +public final class LanthItemList { + + public static ItemStack DIGESTER; + public static ItemStack DISSOLUTION_TANK; + + public static ItemStack LINAC; + public static ItemStack SOURCE_CHAMBER; + + public static ItemStack SYNCHROTRON; + + public static ItemStack TARGET_CHAMBER; + + public static ItemStack BEAMLINE_PIPE; + + public static ItemStack LUV_BEAMLINE_INPUT_HATCH; + public static ItemStack LUV_BEAMLINE_OUTPUT_HATCH; + + public static ItemStack BEAMLINE_FOCUS_INPUT_BUS; + + public static Item CAPILLARY_EXCHANGE = new ItemLanth("capillary_exchange"); + + public static Item MM_LATTICE = new ItemLanth("mm_lattice"); + + public static Item IRON_COATED_QUARTZ = new ItemLanth("iron_quartz_plate"); + + public static Item SUBSTRATE_PRECURSOR = new ItemLanth("substrate_precursor"); + + public static Item MASK_SUBSTRATE = new ItemLanth("mask_substrate"); + + public static Item MASKED_MASK = new ItemLanth("masked_mask_substrate"); + + public static Item ETCHED_MASK_1 = new ItemLanth("etched_mask1"); + + public static Item SILICON_NITRIDE_MEMBRANE = new ItemLanth("nitride_gold_membrane"); + + public static Item PARTICLE_ITEM = new ItemParticle().setUnlocalizedName("particle"); + + public static final Block SHIELDED_ACCELERATOR_CASING = new BlockCasing("shielded_accelerator"); + public static final Block SHIELDED_ACCELERATOR_GLASS = new BlockShieldedAccGlass(); + + public static final Block ELECTRODE_CASING = new BlockCasing("electrode"); + + public static final Block COOLANT_DELIVERY_CASING = new BlockCasing("coolant_delivery"); + + // public static final Block ANTENNA_CASING_T1 = new Casing("antenna_t1"); + public static final Block ANTENNA_CASING_T1 = new BlockAntennaCasing(1); + public static final Block ANTENNA_CASING_T2 = new BlockAntennaCasing(2); + + public static final Block NIOBIUM_CAVITY_CASING = new BlockCasing("niobium_cavity"); + + public static final Block FOCUS_MANIPULATION_CASING = new BlockCasing("focus_manipulator"); + public static final Block FOCUS_HOLDER = new BlockCasing("focus_holder"); + + public static final Block TARGET_RECEPTACLE_CASING = new BlockCasing("target_receptacle"); + public static final Block TARGET_HOLDER = new BlockCasing("target_holder"); + + public static HashMap<MaskList, Item> maskMap = new HashMap<>(); + + public static void registerGTMTE() { + + DIGESTER = new MTEDigester(10500, "Digester", "Digester").getStackForm(1L); + DISSOLUTION_TANK = new MTEDissolutionTank(10501, "Dissolution Tank", "Dissolution Tank").getStackForm(1L); + + BEAMLINE_PIPE = new MTEBeamlinePipe(10502, "Beamline Pipe", "Beamline Pipe").getStackForm(1L); + LUV_BEAMLINE_INPUT_HATCH = new MTEHatchInputBeamline( + 10503, + "LuV Beamline Input Hatch", + "LuV Beamline Input Hatch", + 6).getStackForm(1L); + LUV_BEAMLINE_OUTPUT_HATCH = new MTEHatchOutputBeamline( + 10504, + "LuV Beamline Output Hatch", + "LuV Beamline Output Hatch", + 6).getStackForm(1L); + + BEAMLINE_FOCUS_INPUT_BUS = new MTEBusInputFocus(10509, "Focus Input Bus", "Focus Input Bus").getStackForm(1L); + + LINAC = new MTELINAC(10505, "Linear Accelerator", "Linear Accelerator").getStackForm(1L); + + SOURCE_CHAMBER = new MTESourceChamber(10506, "Source Chamber", "Source Chamber").getStackForm(1L); + + SYNCHROTRON = new MTESynchrotron(10507, "Synchrotron", "Synchrotron").getStackForm(1L); + + TARGET_CHAMBER = new MTETargetChamber(10508, "Target Chamber", "Target Chamber").getStackForm(1L); + } + + public static void registerTypical() { + + GameRegistry.registerItem(CAPILLARY_EXCHANGE, CAPILLARY_EXCHANGE.getUnlocalizedName()); + + GameRegistry.registerItem(MM_LATTICE, MM_LATTICE.getUnlocalizedName()); + + GameRegistry.registerItem(IRON_COATED_QUARTZ, IRON_COATED_QUARTZ.getUnlocalizedName()); + + GameRegistry.registerItem(MASK_SUBSTRATE, MASK_SUBSTRATE.getUnlocalizedName()); + + GameRegistry.registerItem(ETCHED_MASK_1, ETCHED_MASK_1.getUnlocalizedName()); + + GameRegistry.registerItem(SUBSTRATE_PRECURSOR, SUBSTRATE_PRECURSOR.getUnlocalizedName()); + + GameRegistry.registerItem(MASKED_MASK, MASKED_MASK.getUnlocalizedName()); + + GameRegistry.registerItem(PARTICLE_ITEM, "particle"); + + GameRegistry.registerBlock(SHIELDED_ACCELERATOR_CASING, SHIELDED_ACCELERATOR_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(ELECTRODE_CASING, ELECTRODE_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(COOLANT_DELIVERY_CASING, COOLANT_DELIVERY_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(SHIELDED_ACCELERATOR_GLASS, SHIELDED_ACCELERATOR_GLASS.getUnlocalizedName()); + + GameRegistry.registerBlock(ANTENNA_CASING_T1, ANTENNA_CASING_T1.getUnlocalizedName()); + + GameRegistry.registerBlock(ANTENNA_CASING_T2, ANTENNA_CASING_T2.getUnlocalizedName()); + + GameRegistry.registerBlock(NIOBIUM_CAVITY_CASING, NIOBIUM_CAVITY_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(FOCUS_MANIPULATION_CASING, FOCUS_MANIPULATION_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(FOCUS_HOLDER, FOCUS_HOLDER.getUnlocalizedName()); + + GameRegistry.registerBlock(TARGET_RECEPTACLE_CASING, TARGET_RECEPTACLE_CASING.getUnlocalizedName()); + + GameRegistry.registerBlock(TARGET_HOLDER, TARGET_HOLDER.getUnlocalizedName()); + + for (MaskList mask : MaskList.values()) { + + String english = mask.getEnglishName(); + + String descSpectrum = mask.getSpectrum(); + + ItemPhotolithographicMask maskItem = new ItemPhotolithographicMask( + mask.getName(), + mask.getDamage(), + descSpectrum); + GameRegistry.registerItem(maskItem, maskItem.getUnlocalizedName()); + + GTLanguageManager.addStringLocalization(maskItem.getUnlocalizedName() + ".name", "Mask (" + english + ")"); + + maskMap.put(mask, maskItem); + + } + + } +} diff --git a/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java b/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java new file mode 100644 index 0000000000..70bc2a1cf8 --- /dev/null +++ b/src/main/java/gtnhlanth/common/register/WerkstoffMaterialPool.java @@ -0,0 +1,2032 @@ +package gtnhlanth.common.register; + +import static bartworks.util.BWUtil.subscriptNumbers; +import static bartworks.util.BWUtil.superscriptNumbers; + +import java.util.Arrays; + +import bartworks.system.material.Werkstoff; +import bartworks.util.Pair; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.TextureSet; + +@SuppressWarnings({ "unchecked" }) +public class WerkstoffMaterialPool implements Runnable { + + // Current highest ID = 11_499 + + private static final int offsetID = 11_000; + private static final int offsetID2 = 11_100; + private static final int offsetID3 = 11_300; + private static final int offsetID3b = 11_350; + private static final int offsetID4 = 11_400; + private static final int offsetID5 = 11_460; + + /* + * public static final Werkstoff __ = new Werkstoff( new short[] {_, _, _}, "__", new Werkstoff.Stats(), + * Werkstoff.Types.MIXTURE, new Werkstoff.GenerationFeatures().disable(), offsetID_, TextureSet.SET_DULL ); + */ + + // Misc. + public static final Werkstoff Hafnium = new Werkstoff( + new short[] { 232, 224, 219 }, + "Hafnium", + subscriptNumbers("Hf"), + new Werkstoff.Stats(), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .enforceUnification(), // Perhaps use + // hafnia + // liquid in + // elemental + // hafnium + // synthesis + offsetID, + TextureSet.SET_METALLIC); + + public static final Werkstoff LowPurityHafnium = new Werkstoff( + new short[] { 240, 223, 208 }, + "Low-Purity Hafnium", + subscriptNumbers("??Hf??"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 1, + TextureSet.SET_DULL); + + public static final Werkstoff Hafnia = new Werkstoff( + new short[] { 247, 223, 203 }, + "Hafnia", + subscriptNumbers("HfO2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 2, + TextureSet.SET_DULL); + + public static final Werkstoff HafniumTetrachloride = new Werkstoff( + new short[] { 238, 247, 249 }, + "Hafnium Tetrachloride", + subscriptNumbers("HfCl4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 3, + TextureSet.SET_DULL); + + public static final Werkstoff HafniumTetrachlorideSolution = new Werkstoff( + new short[] { 238, 247, 249 }, + "Hafnium Tetrachloride Solution", + subscriptNumbers("HfCl4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 4, + TextureSet.SET_FLUID); + + public static final Werkstoff HafniumIodide = new Werkstoff( + new short[] { 216, 60, 1 }, + "Hafnium Iodide", + subscriptNumbers("HfI4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 5, + TextureSet.SET_DULL); + + public static final Werkstoff HafniumRunoff = new Werkstoff( + new short[] { 74, 65, 42 }, // Literally the statistically ugliest colour + "Hafnium Runoff", + subscriptNumbers("??????"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 6, + TextureSet.SET_DULL); + + public static final Werkstoff Zirconium = new Werkstoff( + new short[] { 225, 230, 225 }, + "Zirconium", + subscriptNumbers("Zr"), + new Werkstoff.Stats().setBlastFurnace(true), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems(), + // .enforceUnification(), + offsetID + 7, + TextureSet.SET_METALLIC); + + public static final Werkstoff Zirconia = new Werkstoff( + new short[] { 177, 152, 101 }, + "Zirconia", + subscriptNumbers("ZrO2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 8, + TextureSet.SET_SHINY); + + public static final Werkstoff ZirconiumTetrachloride = new Werkstoff( + new short[] { 179, 164, 151 }, + "Zirconium Tetrachloride", + subscriptNumbers("ZrCl4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 9, + TextureSet.SET_DULL); + + public static final Werkstoff ZirconiumTetrachlorideSolution = new Werkstoff( + new short[] { 179, 164, 151 }, + "Zirconium Tetrachloride Solution", + subscriptNumbers("ZrCl4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), // Blast Furnace needs liquid input because it + // can't do 3 item inputs so have a shitty + // material + offsetID + 10, + TextureSet.SET_FLUID); + + public static final Werkstoff HafniaZirconiaBlend = new Werkstoff( + new short[] { 247, 223, 203 }, + "Hafnia-Zirconia Blend", // Maybe Hafnon?? + subscriptNumbers("??HfZr??"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 11, + TextureSet.SET_DULL); + + public static final Werkstoff Iodine = new Werkstoff( + new short[] { 171, 40, 175 }, + "Iodine", + subscriptNumbers("I"), + new Werkstoff.Stats().setProtons(53) + .setMass(127) + .setSublimation(true) + .setBoilingPoint(484) + .setGas(true), + Werkstoff.Types.ELEMENT, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addCells() + .enforceUnification(), + offsetID + 12, + TextureSet.SET_FLUID); + + // Lanthanide Line + public static final Werkstoff MuddyRareEarthMonaziteSolution = new Werkstoff( + new short[] { 111, 78, 55 }, + "Muddy Monazite Rare Earth Solution", + subscriptNumbers("??LaNdZr??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 14, + TextureSet.SET_FLUID); + + public static final Werkstoff DilutedRareEarthMonaziteMud = new Werkstoff( + new short[] { 160, 120, 90 }, + "Diluted Monazite Rare Earth Mud", + subscriptNumbers("??LaNdHf??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 15, + TextureSet.SET_FLUID); + + public static final Werkstoff DilutedMonaziteSulfate = new Werkstoff( + new short[] { 237, 201, 175 }, + "Diluted Monazite Sulfate", + subscriptNumbers("??LaNd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 16, + TextureSet.SET_FLUID); + + public static final Werkstoff NitratedRareEarthMonaziteConcentrate = new Werkstoff( + new short[] { 250, 223, 173 }, + "Nitrogenated Monazite Rare Earth Concentrate", + subscriptNumbers("??LaNd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 17, + TextureSet.SET_FLUID); + + public static final Werkstoff NitricMonaziteLeachedConcentrate = new Werkstoff( + new short[] { 244, 202, 22 }, + "Nitric Monazite Leached Concentrate", + subscriptNumbers("??LaNd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 18, + TextureSet.SET_FLUID); + + public static final Werkstoff MonaziteSulfate = new Werkstoff( + new short[] { 152, 118, 84 }, + "Monazite Sulfate", + subscriptNumbers("??CeEu??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 19, + TextureSet.SET_DULL); + + public static final Werkstoff AcidicMonazitePowder = new Werkstoff( + new short[] { 50, 23, 77 }, + "Acidic Monazite Powder", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 20, + TextureSet.SET_DULL); + + public static final Werkstoff MonaziteRareEarthFiltrate = new Werkstoff( + new short[] { 72, 60, 50 }, + "Monazite Rare Earth Filtrate", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 21, + TextureSet.SET_DULL); + + public static final Werkstoff NeutralizedMonaziteRareEarthFiltrate = new Werkstoff( + new short[] { 50, 23, 77 }, + "Neutralized Monazite Rare Earth Filtrate", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 22, + TextureSet.SET_DULL); + + public static final Werkstoff MonaziteRareEarthHydroxideConcentrate = new Werkstoff( + new short[] { 193, 154, 107 }, + "Monazite Rare Earth Hydroxide Concentrate", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 23, + TextureSet.SET_DULL); + + public static final Werkstoff DriedMonaziteRareEarthConcentrate = new Werkstoff( + new short[] { 250, 214, 165 }, + "Dried Monazite Rare Earth Concentrate", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 24, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumDioxide = new Werkstoff( + new short[] { 255, 255, 255 }, + "Cerium Dioxide", + subscriptNumbers("CeO2"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .enforceUnification(), + offsetID + 25, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumChloride = new Werkstoff( + new short[] { 255, 255, 255 }, + "Cerium Chloride", + subscriptNumbers("CeCl3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 26, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumOxalate = new Werkstoff( + new short[] { 255, 255, 224 }, + "Cerium Oxalate", + subscriptNumbers("Ce2(C2O4)3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 27, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumIIIOxide = new Werkstoff( + new short[] { 255, 255, 102 }, + "Cerium (III) Oxide", + subscriptNumbers("Ce2O3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 28, + TextureSet.SET_DULL, + Arrays.asList(Materials.Cerium, Materials.Oxygen), + new Pair<>(Materials.Cerium, 2), + new Pair<>(Materials.Oxygen, 3)); + + public static final Werkstoff CeriumRichMixture = new Werkstoff( + new short[] { 244, 164, 96 }, + "Cerium-Rich Mixture", + subscriptNumbers("??Ce??"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 29, + TextureSet.SET_DULL); + + public static final Werkstoff CooledMonaziteRareEarthConcentrate = new Werkstoff( + new short[] { 250, 214, 165 }, + "Cooled Monazite Rare Earth Concentrate", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 30, + TextureSet.SET_DULL); + + public static final Werkstoff MonaziteRarerEarthSediment = new Werkstoff( + new short[] { 250, 214, 165 }, + "MonaziteRarer Earth Sediment", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 31, + TextureSet.SET_DULL); + + public static final Werkstoff MonaziteHeterogenousHalogenicRareEarthMixture = new Werkstoff( + new short[] { 250, 214, 165 }, + "Heterogenous Halogenic Monazite Rare Earth Mixture", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 32, + TextureSet.SET_DULL); + + public static final Werkstoff SaturatedMonaziteRareEarthMixture = new Werkstoff( + new short[] { 250, 214, 165 }, + "Saturated Monazite Rare Earth", + subscriptNumbers("????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 33, + TextureSet.SET_DULL); + + public static final Werkstoff SamaricResidue = new Werkstoff( + new short[] { 248, 243, 231 }, + "Samaric Residue", + subscriptNumbers("??SmGd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 34, + TextureSet.SET_DULL); + + public static final Werkstoff AmmoniumNitrate = new Werkstoff( + new short[] { 255, 255, 255 }, + "Ammonium Nitrate Solution", + subscriptNumbers("NH4NO3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 36, + TextureSet.SET_FLUID); + + public static final Werkstoff ThoriumPhosphateCake = new Werkstoff( + new short[] { 188, 143, 143 }, + "Thorium-Phosphate Cake", + subscriptNumbers("??ThP??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 37, + TextureSet.SET_DULL); + + public static final Werkstoff ThoriumPhosphateConcentrate = new Werkstoff( + new short[] { 217, 144, 88 }, + "Thorium-Phosphate Concentrate", + subscriptNumbers("??ThP??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 38, + TextureSet.SET_DULL); + + public static final Werkstoff UraniumFiltrate = new Werkstoff( + new short[] { 190, 240, 94 }, + "Uranium Filtrate", + subscriptNumbers("??U??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 39, + TextureSet.SET_DULL); + + public static final Werkstoff NeutralizedUraniumFiltrate = new Werkstoff( + new short[] { 217, 120, 88 }, + "Neutralized Uranium Filtrate", + subscriptNumbers("??U??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 40, + TextureSet.SET_DULL); + + public static final Werkstoff SeaweedAsh = new Werkstoff( + new short[] { 70, 75, 71 }, + "Seaweed Ash", + new Werkstoff.Stats(), + Werkstoff.Types.BIOLOGICAL, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 41, + TextureSet.SET_DULL); + + public static final Werkstoff SeaweedConcentrate = new Werkstoff( + new short[] { 70, 100, 71 }, + "Seaweed Concentrate", + subscriptNumbers("??I??"), + new Werkstoff.Stats(), + Werkstoff.Types.BIOLOGICAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 42, + TextureSet.SET_FLUID); + + public static final Werkstoff PotassiumPermanganate = new Werkstoff( + new short[] { 165, 50, 138 }, + "Potassium Permanganate", + subscriptNumbers("KMnO4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 43, + TextureSet.SET_DULL); + + public static final Werkstoff PotassiumPermanganateSolution = new Werkstoff( + new short[] { 165, 50, 138 }, + "Potassium Permanganate Solution", + subscriptNumbers("KMnO4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 44, + TextureSet.SET_FLUID); + + public static final Werkstoff SeaweedByproducts = new Werkstoff( + new short[] { 125, 50, 138 }, + "Seaweed Byproducts", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 45, + TextureSet.SET_FLUID); + + public static final Werkstoff NitricLeachedMonaziteMixture = new Werkstoff( + new short[] { 125, 50, 138 }, + "Nitric-Leached Monazite Mixture", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID + 46, + TextureSet.SET_FLUID); + + public static final Werkstoff EuropiumOxide = new Werkstoff( + new short[] { 255, 255, 255 }, + "Europium Oxide", + subscriptNumbers("EuO"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 47, + TextureSet.SET_DULL); + + public static final Werkstoff EuropiumSulfide = new Werkstoff( + new short[] { 5, 0, 5 }, + "Europium Sulfide", + subscriptNumbers("EuS"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 48, + TextureSet.SET_DULL); + + public static final Werkstoff UnknownBlend = new Werkstoff( + new short[] { 0, 0, 5 }, + "UnknownBlend", + subscriptNumbers("?????"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 49, + TextureSet.SET_DULL); + + public static final Werkstoff EuropiumIIIOxide = new Werkstoff( + new short[] { 255, 230, 255 }, + "Europium III Oxide", + subscriptNumbers("Eu2O3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID + 50, + TextureSet.SET_DULL); + + // TODO + + // BASTNASITE + public static final Werkstoff MuddyRareEarthBastnasiteSolution = new Werkstoff( + new short[] { 205, 133, 63 }, + "Muddy Bastnasite Rare Earth Solution", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2, + TextureSet.SET_FLUID); + /* + * public static final Werkstoff FluorosilicicAcid = new Werkstoff( new short[] {205, 133, 63}, + * "Hexafluorosilicic Acid", subscriptNumbers("H2SiF6"), new Werkstoff.Stats(), Werkstoff.Types.COMPOUND, new + * Werkstoff.GenerationFeatures().disable().addCells(), offsetID2 + 1, TextureSet.SET_FLUID ); + */ + public static final Werkstoff SodiumFluorosilicate = new Werkstoff( + new short[] { 205, 133, 63 }, + "Sodiumfluorosilicate", + subscriptNumbers("Na2SiF6"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 2, + TextureSet.SET_FLUID); + + public static final Werkstoff SteamCrackedBasnasiteSolution = new Werkstoff( + new short[] { 205, 133, 63 }, + "Steam-Cracked Bastnasite Mud", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 3, + TextureSet.SET_FLUID); + + public static final Werkstoff ConditionedBastnasiteMud = new Werkstoff( + new short[] { 205, 133, 63 }, + "Conditioned Bastnasite Mud", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 4, + TextureSet.SET_FLUID); + + public static final Werkstoff DiltedRareEarthBastnasiteMud = new Werkstoff( + new short[] { 205, 133, 63 }, + "Diluted Bastnasite Mud", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 5, + TextureSet.SET_FLUID); + + public static final Werkstoff FilteredBastnasiteMud = new Werkstoff( + new short[] { 205, 133, 63 }, + "Filtered Bastnasite Mud", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 6, + TextureSet.SET_FLUID); + + public static final Werkstoff BastnasiteRareEarthOxidePowder = new Werkstoff( + new short[] { 205, 133, 63 }, + "Bastnasite Rare Earth Oxides", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 7, + TextureSet.SET_DULL); + + public static final Werkstoff LeachedBastnasiteRareEarthOxides = new Werkstoff( + new short[] { 205, 133, 63 }, + "Acid-Leached Bastnasite Rare Earth Oxides", + subscriptNumbers("??LaCeY??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 8, + TextureSet.SET_DULL); + + public static final Werkstoff Gangue = new Werkstoff( + new short[] { 0, 0, 0 }, + "Gangue", + subscriptNumbers("Useless..."), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addPrefix(OrePrefixes.block) + .removePrefix(OrePrefixes.ingot) + .removePrefix(OrePrefixes.gem), + offsetID2 + 9, + TextureSet.SET_DULL); + // TODO: Deal with colouring + public static final Werkstoff RoastedRareEarthOxides = new Werkstoff( + new short[] { 160, 82, 45 }, + "Roasted Rare Earth Oxides", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 10, + TextureSet.SET_DULL); + + public static final Werkstoff WetRareEarthOxides = new Werkstoff( + new short[] { 160, 82, 49 }, + "Wet Rare Earth Oxides", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 11, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumOxidisedRareEarthOxides = new Werkstoff( + new short[] { 160, 82, 49 }, + "Cerium-Oxidised Rare Earth Oxides", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 12, + TextureSet.SET_DULL); + + public static final Werkstoff BastnasiteRarerEarthOxides = new Werkstoff( + new short[] { 160, 82, 49 }, + "Bastnasite Rarer Earth Oxides", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 13, + TextureSet.SET_DULL); + + public static final Werkstoff NitratedBastnasiteRarerEarthOxides = new Werkstoff( + new short[] { 160, 90, 60 }, + "Nitrogenated Bastnasite Rarer Earth Oxides", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 14, + TextureSet.SET_DULL); + + public static final Werkstoff SaturatedBastnasiteRarerEarthOxides = new Werkstoff( + new short[] { 170, 90, 60 }, + "Bastnasite Rarer Earth Oxide Suspension", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID2 + 15, + TextureSet.SET_DULL); + + public static final Werkstoff SamaricRareEarthConcentrate = new Werkstoff( + new short[] { 170, 90, 60 }, + "Samaric Rare Earth Concentrate", + subscriptNumbers("??SmHoTb??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 16, + TextureSet.SET_DULL); + + public static final Werkstoff NeodymicRareEarthConcentrate = new Werkstoff( + new short[] { 170, 90, 60 }, + "Neodymium Rare Earth Concentrate", + subscriptNumbers("??LaNdPr??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 17, + TextureSet.SET_DULL); + public static final Werkstoff LanthaniumChloride = new Werkstoff( + new short[] { 82, 112, 102 }, + "Lanthanium Chloride", + subscriptNumbers("LaCl3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 21, + TextureSet.SET_DULL, + Arrays.asList(Materials.Lanthanum, Materials.Chlorine), + new Pair<>(Materials.Lanthanum, 1), + new Pair<>(Materials.Chlorine, 3)); + + public static final Werkstoff NeodymiumOxide = new Werkstoff( + new short[] { 82, 112, 102 }, + "Neodymium Oxide", + subscriptNumbers("Nd2O3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 22, + TextureSet.SET_DULL, + Arrays.asList(Materials.Neodymium, Materials.Oxygen), + new Pair<>(Materials.Neodymium, 2), + new Pair<>(Materials.Oxygen, 3)); + + public static final Werkstoff FluorinatedSamaricConcentrate = new Werkstoff( + new short[] { 255, 182, 193 }, + "Fluorinated Samaric Concentrate", + subscriptNumbers("??SmHo??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 23, + TextureSet.SET_DULL); + + public static final Werkstoff CalciumFluoride = new Werkstoff( + new short[] { 255, 250, 250 }, + "Calcium Fluoride", + subscriptNumbers("CaF2"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .addCells(), + offsetID2 + 24, + TextureSet.SET_DULL, + Arrays.asList(Materials.Calcium, Materials.Fluorine), + new Pair<>(Materials.Calcium, 1), + new Pair<>(Materials.Fluorine, 2)); + + public static final Werkstoff SamariumTerbiumMixture = new Werkstoff( + new short[] { 223, 182, 193 }, + "Samarium-Terbium Mixture", + subscriptNumbers("??SmTb??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 25, + TextureSet.SET_DULL); + + public static final Werkstoff NitratedSamariumTerbiumMixture = new Werkstoff( + new short[] { 223, 182, 193 }, + "Nitrogenated Samarium-Terbium Mixture", + subscriptNumbers("??SmTb??NH4NO3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 26, + TextureSet.SET_DULL); + + public static final Werkstoff TerbiumNitrate = new Werkstoff( + new short[] { 167, 252, 0 }, + "Terbium Nitrate", + subscriptNumbers("TbNO3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 27, + TextureSet.SET_DULL, + Arrays.asList(Materials.Terbium, Materials.Nitrogen, Materials.Oxygen), + new Pair<>(Materials.Terbium, 1), + new Pair<>(Materials.Nitrogen, 1), + new Pair<>(Materials.Oxygen, 3)); + + public static final Werkstoff SamariumOreConcentrate = new Werkstoff( + new short[] { 255, 200, 230 }, + "Samarium Ore Concentrate", + subscriptNumbers("??Sm??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 28, + TextureSet.SET_DULL); + + public static final Werkstoff DephosphatedSamariumConcentrate = new Werkstoff( + new short[] { 255, 170, 220 }, + "Dephosphated Samarium Concentrate", + subscriptNumbers("??Sm??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID2 + 29, + TextureSet.SET_DULL); + + // Weird/Exciting Chemicals + public static final Werkstoff Tetrahydrofuran = new Werkstoff( + new short[] { 222, 165, 164 }, + "Tetrahydrofuran", + subscriptNumbers("(CH2)4O"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3, + TextureSet.SET_FLUID); + + // 1,4-Butanediol + public static final Werkstoff Butanediol = new Werkstoff( + new short[] { 185, 78, 72 }, + "1,4-Butanediol", + subscriptNumbers("HO(CH2)4OH"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 1, + TextureSet.SET_FLUID); + + // Acidicised 1,4-Butanediol + public static final Werkstoff AcidicButanediol = new Werkstoff( + new short[] { 255, 239, 213 }, + "Acidicised 1,4-Butanediol", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 2, + TextureSet.SET_FLUID); + + // Tellurium-Molybdenum-Oxide Catalyst + public static final Werkstoff MoTeOCatalyst = new Werkstoff( + new short[] { 238, 131, 238 }, + "Tellurium-Molybdenum-Oxide Catalyst", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3 + 3, + TextureSet.SET_DULL); + + // Tellurium Oxide + public static final Werkstoff TelluriumIVOxide = new Werkstoff( + new short[] { 229, 199, 187 }, + "Tellurium (IV) Oxide", + subscriptNumbers("TeO2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3 + 4, + TextureSet.SET_DULL); + + public static final Werkstoff MolybdenumIVOxide = new Werkstoff( + new short[] { 52, 53, 57 }, + "Molybdenum (IV) Oxide", + subscriptNumbers("MoO2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3 + 5, + TextureSet.SET_DULL); + + public static final Werkstoff Polytetrahydrofuran = new Werkstoff( + new short[] { 192, 128, 129 }, + "Polytetrahydrofuran", + subscriptNumbers("(C4H8O)OH2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addCells(), + offsetID3 + 6, + TextureSet.SET_DULL); + + public static final Werkstoff TungstophosphoricAcid = new Werkstoff( + new short[] { 223, 255, 0 }, + "Tungstophosphoric Acid", + subscriptNumbers("H3PW12O40"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 7, + TextureSet.SET_FLUID); + + public static final Werkstoff TolueneDiisocyanate = new Werkstoff( + new short[] { 255, 255, 102 }, + "Toluene Diisocyanate", + subscriptNumbers("CH3C6H3(NCO)2"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 8, + TextureSet.SET_FLUID); + + public static final Werkstoff Dinitrotoluene = new Werkstoff( + new short[] { 216, 191, 216 }, + "Dinitrotoluene", + subscriptNumbers("C7H6N2O4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 9, + TextureSet.SET_FLUID); + + public static final Werkstoff Diaminotoluene = new Werkstoff( + new short[] { 227, 218, 201 }, + "Diaminotoluene", + subscriptNumbers("C6H3(NH2)2CH3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 10, + TextureSet.SET_FLUID); + + public static final Werkstoff TolueneTetramethylDiisocyanate = new Werkstoff( + new short[] { 255, 255, 255 }, + "Toluene Tetramethyl Diisocyanate", + subscriptNumbers("(CONH)2(C6H4)2CH2(C4O)"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 11, + TextureSet.SET_FLUID); + + public static final Werkstoff PTMEGElastomer = new Werkstoff( + new short[] { 248, 248, 255 }, + "PTMEG Elastomer", + new Werkstoff.Stats().setMeltingPoint(600) + .setMeltingVoltage(64), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten() + .addMetalItems(), + offsetID3 + 12, + TextureSet.SET_DULL); + + public static final Werkstoff PotassiumChlorate = new Werkstoff( + new short[] { 240, 255, 255 }, + "Potassium Chlorate", + subscriptNumbers("KClO3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten(), + offsetID3 + 14, + TextureSet.SET_DULL); + + public static final Werkstoff DilutedAcetone = new Werkstoff( + new short[] { 254, 254, 250 }, + "Diluted Acetone", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3 + 16, + TextureSet.SET_FLUID); + + public static final Werkstoff MolybdenumTrioxide = new Werkstoff( + new short[] { 236, 255, 248 }, + "Molybdenum Trioxide", + subscriptNumbers("MoO3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3 + 17, + TextureSet.SET_DULL); + + // TODO Samarium Processing Line Material regist + + public static final Werkstoff MuddySamariumRareEarthSolution = new Werkstoff( + new short[] { 226, 180, 108 }, + "Muddy Samarium Rare Earth Solution", + subscriptNumbers("???Sm???"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 1, + TextureSet.SET_FLUID); + + public static final Werkstoff SamariumRareEarthMud = new Werkstoff( + new short[] { 226, 180, 128 }, + "Samarium Rare Earth Mud", + subscriptNumbers("??Sm??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 2, + TextureSet.SET_FLUID); + + public static final Werkstoff DilutedSamariumRareEarthSolution = new Werkstoff( + new short[] { 226, 180, 148 }, + "Diluted Samarium Rare Earth Solution", + subscriptNumbers("?Sm?"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 3, + TextureSet.SET_FLUID); + + public static final Werkstoff SamariumOxalate = new Werkstoff( + new short[] { 248, 248, 180 }, + "Samarium(III) Oxalate", + subscriptNumbers("?Sm2(C2O4)3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID5 + 4, + TextureSet.SET_DULL); + + public static final Werkstoff SamariumChloride = new Werkstoff( + new short[] { 248, 248, 120 }, + "Samarium(III)-Chloride", + subscriptNumbers("?SmCl3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten(), + offsetID5 + 5, + TextureSet.SET_DULL); + + public static final Werkstoff SamariumChlorideSodiumChlorideBlend = new Werkstoff( + new short[] { 255, 200, 230 }, + "Samarium Chloride-Sodium Chloride Blend", + subscriptNumbers("?SmCl3NaCl"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID5 + 6, + TextureSet.SET_DULL); + + public static final Werkstoff ImpureLanthanumChloride = new Werkstoff( + new short[] { 90, 100, 30 }, + "Impure Lanthanum Chloride", + subscriptNumbers("?LaCl3"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID5 + 7, + TextureSet.SET_DULL); + + public static final Werkstoff SamariumOxide = new Werkstoff( + new short[] { 223, 182, 193 }, + "Samarium Oxide", + subscriptNumbers("Sm2O3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID5 + 8, + TextureSet.SET_DULL, + Arrays.asList(Materials.Samarium, Materials.Oxygen), + new Pair<>(Materials.Samarium, 2), + new Pair<>(Materials.Oxygen, 3)); + + public static final Werkstoff ChlorinatedRareEarthConcentrate = new Werkstoff( + new short[] { 130, 80, 60 }, + "Chlorinated Rare Earth Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 9, + TextureSet.SET_FLUID); + + public static final Werkstoff ChlorinatedRareEarthEnrichedSolution = new Werkstoff( + new short[] { 130, 90, 60 }, + "Chlorinated Rare Earth Enriched Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 10, + TextureSet.SET_FLUID); + + public static final Werkstoff ChlorinatedRareEarthDilutedSolution = new Werkstoff( + new short[] { 216, 180, 100 }, + "Chlorinated Rare Earth Diluted Solution", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID5 + 11, + TextureSet.SET_FLUID); + + public static final Werkstoff RarestEarthResidue = new Werkstoff( + new short[] { 224, 211, 211 }, + "Rarest Earth Residue", + subscriptNumbers("???"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID5 + 12, + TextureSet.SET_DULL); + + // TODO reg Lanth Ore Concentrate + /** + * Extracted Nano Resin Lanthanum1.2 Praseodymium3.4 Cerium5.6 Neodymium7.8 Promethium9.10 Samarium11.12 √ + * Europium13.14 Gadolinium15.16 Terbium17.18 Dysprosium19.20 Holmium21.22 Erbium23.24 Thulium25.26 Ytterbium27.28 + * Lutetium29.30 + */ + + public static final Werkstoff LanthanumExtractingNanoResin = new Werkstoff( + new short[] { 50, 80, 40 }, + "Lanthanum Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 1, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledLanthanumExtractingNanoResin = new Werkstoff( + new short[] { 128, 128, 80 }, + "Filled Lanthanum Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 2, + TextureSet.SET_FLUID); + + public static final Werkstoff PraseodymiumExtractingNanoResin = new Werkstoff( + new short[] { 80, 192, 130 }, + "Praseodymium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 3, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledPraseodymiumExtractingNanoResin = new Werkstoff( + new short[] { 140, 192, 130 }, + "Filled Praseodymium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 4, + TextureSet.SET_FLUID); + + public static final Werkstoff CeriumExtractingNanoResin = new Werkstoff( + new short[] { 80, 240, 160 }, + "Cerium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 5, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledCeriumExtractingNanoResin = new Werkstoff( + new short[] { 160, 240, 180 }, + "Filled Cerium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 6, + TextureSet.SET_FLUID); + + public static final Werkstoff NeodymiumExtractingNanoResin = new Werkstoff( + new short[] { 128, 140, 128 }, + "Neodymium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 7, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledNeodymiumExtractingNanoResin = new Werkstoff( + new short[] { 150, 150, 150 }, + "Filled Neodymium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 8, + TextureSet.SET_FLUID); + + public static final Werkstoff PromethiumExtractingNanoResin = new Werkstoff( + new short[] { 110, 255, 60 }, + "Promethium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 9, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledPromethiumExtractingNanoResin = new Werkstoff( + new short[] { 150, 255, 140 }, + "Filled Promethium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 10, + TextureSet.SET_FLUID); + + public static final Werkstoff SamariumExtractingNanoResin = new Werkstoff( + new short[] { 255, 240, 100 }, + "Samarium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 11, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledSamariumExtractingNanoResin = new Werkstoff( + new short[] { 255, 240, 196 }, + "Filled Samarium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 12, + TextureSet.SET_FLUID); + + public static final Werkstoff EuropiumExtractingNanoResin = new Werkstoff( + new short[] { 240, 160, 240 }, + "Europium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 13, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledEuropiumExtractingNanoResin = new Werkstoff( + new short[] { 240, 200, 240 }, + "Filled Europium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 14, + TextureSet.SET_FLUID); + + public static final Werkstoff GadoliniumExtractingNanoResin = new Werkstoff( + new short[] { 120, 255, 80 }, + "Gadolinium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 15, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledGadoliniumExtractingNanoResin = new Werkstoff( + new short[] { 160, 255, 140 }, + "Filled Gadolinium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 16, + TextureSet.SET_FLUID); + + public static final Werkstoff TerbiumExtractingNanoResin = new Werkstoff( + new short[] { 200, 200, 200 }, + "Terbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 17, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledTerbiumExtractingNanoResin = new Werkstoff( + new short[] { 255, 255, 255 }, + "Filled Terbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 18, + TextureSet.SET_FLUID); + + public static final Werkstoff DysprosiumExtractingNanoResin = new Werkstoff( + new short[] { 110, 240, 180 }, + "Dysprosium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 19, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledDysprosiumExtractingNanoResin = new Werkstoff( + new short[] { 150, 240, 180 }, + "Filled Dysprosium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 20, + TextureSet.SET_FLUID); + + public static final Werkstoff HolmiumExtractingNanoResin = new Werkstoff( + new short[] { 16, 16, 216 }, + "Holmium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 21, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledHolmiumExtractingNanoResin = new Werkstoff( + new short[] { 60, 90, 255 }, + "Filled Holmium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 22, + TextureSet.SET_FLUID); + + public static final Werkstoff ErbiumExtractingNanoResin = new Werkstoff( + new short[] { 200, 160, 80 }, + "Erbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 23, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledErbiumExtractingNanoResin = new Werkstoff( + new short[] { 233, 170, 100 }, + "Filled Erbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 24, + TextureSet.SET_FLUID); + + public static final Werkstoff ThuliumExtractingNanoResin = new Werkstoff( + new short[] { 128, 178, 255 }, + "Thulium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 25, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledThuliumExtractingNanoResin = new Werkstoff( + new short[] { 160, 200, 255 }, + "Filled Thulium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 26, + TextureSet.SET_FLUID); + + public static final Werkstoff YtterbiumExtractingNanoResin = new Werkstoff( + new short[] { 0, 255, 0 }, + "Ytterbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 27, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledYtterbiumExtractingNanoResin = new Werkstoff( + new short[] { 100, 255, 100 }, + "Filled Ytterbium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 28, + TextureSet.SET_FLUID); + + public static final Werkstoff LutetiumExtractingNanoResin = new Werkstoff( + new short[] { 230, 16, 230 }, + "Lutetium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 29, + TextureSet.SET_FLUID); + + public static final Werkstoff FilledLutetiumExtractingNanoResin = new Werkstoff( + new short[] { 240, 100, 240 }, + "Filled Lutetium Extracting Nano Resin", + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 30, + TextureSet.SET_FLUID); + + // Lanthanides Chloride Concentrate + // Lanthanum + public static final Werkstoff LanthanumChlorideConcentrate = new Werkstoff( + new short[] { 128, 128, 80 }, + "Lanthanum Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 31, + TextureSet.SET_FLUID); + + // Praseodymium + public static final Werkstoff PraseodymiumChlorideConcentrate = new Werkstoff( + new short[] { 140, 192, 130 }, + "Praseodymium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 32, + TextureSet.SET_FLUID); + + // Cerium + public static final Werkstoff CeriumChlorideConcentrate = new Werkstoff( + new short[] { 160, 240, 180 }, + "Cerium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 33, + TextureSet.SET_FLUID); + + // Neodymium + public static final Werkstoff NeodymiumChlorideConcentrate = new Werkstoff( + new short[] { 150, 150, 150 }, + "Neodymium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 34, + TextureSet.SET_FLUID); + + // + public static final Werkstoff PromethiumChlorideConcentrate = new Werkstoff( + new short[] { 150, 255, 140 }, + "Promethium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 35, + TextureSet.SET_FLUID); + + // + public static final Werkstoff SamariumChlorideConcentrate = new Werkstoff( + new short[] { 255, 240, 196 }, + "Samarium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 36, + TextureSet.SET_FLUID); + + // + public static final Werkstoff EuropiumChlorideConcentrate = new Werkstoff( + new short[] { 240, 200, 240 }, + "Europium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 37, + TextureSet.SET_FLUID); + + // + public static final Werkstoff GadoliniumChlorideConcentrate = new Werkstoff( + new short[] { 160, 255, 140 }, + "Gadolinium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 38, + TextureSet.SET_FLUID); + + // + public static final Werkstoff TerbiumChlorideConcentrate = new Werkstoff( + new short[] { 255, 255, 255 }, + "Terbium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 39, + TextureSet.SET_FLUID); + + // + public static final Werkstoff DysprosiumChlorideConcentrate = new Werkstoff( + new short[] { 150, 240, 180 }, + "Dysprosium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 40, + TextureSet.SET_FLUID); + + // + public static final Werkstoff HolmiumChlorideConcentrate = new Werkstoff( + new short[] { 60, 90, 255 }, + "Holmium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 41, + TextureSet.SET_FLUID); + + // + public static final Werkstoff ErbiumChlorideConcentrate = new Werkstoff( + new short[] { 233, 170, 100 }, + "Erbium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 42, + TextureSet.SET_FLUID); + + // + public static final Werkstoff ThuliumChlorideConcentrate = new Werkstoff( + new short[] { 160, 200, 255 }, + "Thulium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 43, + TextureSet.SET_FLUID); + + // + public static final Werkstoff YtterbiumChlorideConcentrate = new Werkstoff( + new short[] { 100, 255, 100 }, + "Ytterbium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 44, + TextureSet.SET_FLUID); + + // + public static final Werkstoff LutetiumChlorideConcentrate = new Werkstoff( + new short[] { 240, 100, 240 }, + "Lutetium Chloride Concentrate", + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID4 + 45, + TextureSet.SET_FLUID); + + // Lanthanides Ore Concentrate + + // Lanthanum + public static final Werkstoff LanthanumOreConcentrate = new Werkstoff( + new short[] { 128, 128, 96 }, + "Lanthanum Ore Concentrate", + subscriptNumbers("??La??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 46, + TextureSet.SET_DULL); + + // Praseodymium + public static final Werkstoff PraseodymiumOreConcentrate = new Werkstoff( + new short[] { 140, 192, 130 }, + "Praseodymium Ore Concentrate", + subscriptNumbers("??Pr??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 47, + TextureSet.SET_DULL); + + // Cerium + public static final Werkstoff CeriumOreConcentrate = CeriumRichMixture; + + // Neodymium + public static final Werkstoff NeodymiumOreConcentrate = new Werkstoff( + new short[] { 128, 128, 128 }, + "Neodymium Ore Concentrate", + subscriptNumbers("??Nd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 49, + TextureSet.SET_DULL); + + // Promethium + public static final Werkstoff PromethiumOreConcentrate = new Werkstoff( + new short[] { 150, 255, 140 }, + "Promethium Ore Concentrate", + subscriptNumbers("??Po??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 50, + TextureSet.SET_DULL); + + // Europium + public static final Werkstoff EuropiumOreConcentrate = new Werkstoff( + new short[] { 240, 200, 240 }, + "Europium Ore Concentrate", + subscriptNumbers("??Eu??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 51, + TextureSet.SET_DULL); + + // Gadolinium + public static final Werkstoff GadoliniumOreConcentrate = new Werkstoff( + new short[] { 160, 255, 140 }, + "Gadolinium Ore Concentrate", + subscriptNumbers("??Gd??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 52, + TextureSet.SET_DULL); + + // Terbium + public static final Werkstoff TerbiumOreConcentrate = new Werkstoff( + new short[] { 255, 255, 255 }, + "Terbium Ore Concentrate", + subscriptNumbers("??Tb??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 53, + TextureSet.SET_DULL); + + // Dysprosium + public static final Werkstoff DysprosiumOreConcentrate = new Werkstoff( + new short[] { 150, 240, 180 }, + "Dysprosium Ore Concentrate", + subscriptNumbers("??Dy??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 54, + TextureSet.SET_DULL); + + // Holmium + public static final Werkstoff HolmiumOreConcentrate = new Werkstoff( + new short[] { 60, 90, 255 }, + "Holmium Ore Concentrate", + subscriptNumbers("??Ho??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 55, + TextureSet.SET_DULL); + + // Erbium + public static final Werkstoff ErbiumOreConcentrate = new Werkstoff( + new short[] { 233, 170, 100 }, + "Erbium Ore Concentrate", + subscriptNumbers("??Er??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 56, + TextureSet.SET_DULL); + + // Thulium + public static final Werkstoff ThuliumOreConcentrate = new Werkstoff( + new short[] { 160, 200, 255 }, + "Thulium Ore Concentrate", + subscriptNumbers("??Tm??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 57, + TextureSet.SET_DULL); + + // Ytterbium + public static final Werkstoff YtterbiumOreConcentrate = new Werkstoff( + new short[] { 100, 255, 100 }, + "Ytterbium Ore Concentrate", + subscriptNumbers("??Yb??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 58, + TextureSet.SET_DULL); + + // Lutetium + public static final Werkstoff LutetiumOreConcentrate = new Werkstoff( + new short[] { 240, 100, 240 }, + "Lutetium Ore Concentrate", + subscriptNumbers("??Lu??"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID4 + 59, + TextureSet.SET_DULL); + + // LuAG + public static final Werkstoff CeriumDopedLutetiumAluminiumOxygenBlend = new Werkstoff( + new short[] { 128, 192, 80 }, + "Cerium-doped Lutetium Aluminium Oxygen Blend", + subscriptNumbers("(Ce)Lu3Al5O12"), + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMolten(), + offsetID5 + 38, + TextureSet.SET_DULL); + + public static final Werkstoff CeriumDopedLutetiumAluminiumGarnet = new Werkstoff( + new short[] { 144, 255, 63 }, + "Cerium-doped Lutetium Aluminium Garnet (Ce:LuAG)", + subscriptNumbers("(Ce)Lu3Al5O12"), + new Werkstoff.Stats(), + Werkstoff.Types.MATERIAL, + new Werkstoff.GenerationFeatures().disable() + .addGems(), + offsetID5 + 39, + TextureSet.SET_GEM_VERTICAL); + + public static final Werkstoff Permalloy = new Werkstoff( + new short[] { 195, 230, 225 }, + "Permalloy", + subscriptNumbers("Ni4FeMo"), + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .addMixerRecipes((short) 3) + .enforceUnification(), + offsetID3b, + TextureSet.SET_DULL, + new Pair<>(Materials.Nickel, 4), + new Pair<>(Materials.Iron, 1), + new Pair<>(Materials.Molybdenum, 1)); + + public static final Werkstoff MuMetal = new Werkstoff( + new short[] { 210, 230, 225 }, + "Mu-metal", + subscriptNumbers("?NiFeCuCrMo?"), + new Werkstoff.Stats().setBlastFurnace(true) + .setCentrifuge(true) + .setMass(180) + .setSpeedOverride(3), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .addMultipleIngotMetalWorkingItems() + .addCraftingMetalWorkingItems() + .enforceUnification(), + offsetID3b + 1, + TextureSet.SET_METALLIC, + new Pair<>(WerkstoffMaterialPool.Permalloy, 9), + new Pair<>(Materials.Copper, 1), + new Pair<>(Materials.Chrome, 1)); + + public static final Werkstoff Thorium234 = new Werkstoff( + new short[] { 0, 40, 0 }, + "Thorium 234", + superscriptNumbers("Th234"), + new Werkstoff.Stats().setBlastFurnace(true) + .setRadioactive(true), + Werkstoff.Types.ISOTOPE, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3b + 2, + TextureSet.SET_DULL); + + public static final Werkstoff SiliconNitride = new Werkstoff( + new short[] { 132, 140, 120 }, + "Silicon Nitride", + subscriptNumbers("Si3N4"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addMetalItems() + .enforceUnification(), + offsetID3b + 3, + TextureSet.SET_DULL); + + public static final Werkstoff Fluoroform = new Werkstoff( + new short[] { 0, 0, 0 }, + "Fluoroform", + subscriptNumbers("CHF3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3b + 4, + TextureSet.SET_FLUID, + new Pair<>(Materials.Carbon, 1), + new Pair<>(Materials.Hydrogen, 1), + new Pair<>(Materials.Fluorine, 3)); + + public static final Werkstoff FluoroformOxygenMix = new Werkstoff( + new short[] { 0, 0, 0 }, + "Reactive-Ion Etching Mixture", + subscriptNumbers("CHF3/O2"), + new Werkstoff.Stats().setCentrifuge(true), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3b + 5, + TextureSet.SET_FLUID); + + public static final Werkstoff BoronTrioxide = new Werkstoff( + new short[] { 238, 222, 209 }, + "Boron Trioxide", + subscriptNumbers("B2O3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3b + 6, + TextureSet.SET_DULL, + new Pair<>(Materials.Boron, 2), + new Pair<>(Materials.Oxygen, 3)); + + public static final Werkstoff BoronTrichloride = new Werkstoff( + new short[] { 154, 96, 208 }, + "Boron Trichloride", + subscriptNumbers("BCl3"), + new Werkstoff.Stats().setElektrolysis(true), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3b + 7, + TextureSet.SET_FLUID, + new Pair<>(Materials.Boron, 1), + new Pair<>(Materials.Chlorine, 3)); + + public static final Werkstoff LanthanumHexaboride = new Werkstoff( + new short[] { 140, 110, 120 }, + "Lanthanum Hexaboride", + subscriptNumbers("LaB6"), + new Werkstoff.Stats().setMass(200), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust() + .addGems() + .addSimpleMetalWorkingItems(), + offsetID3b + 8, + TextureSet.SET_GEM_HORIZONTAL, + new Pair<>(Materials.Lanthanum, 1), + new Pair<>(Materials.Boron, 6)); + + public static final Werkstoff LanthanumOxide = new Werkstoff( + new short[] { 105, 209, 180 }, + "Lanthanum Oxide", + subscriptNumbers("La2O3"), + new Werkstoff.Stats(), + Werkstoff.Types.COMPOUND, + new Werkstoff.GenerationFeatures().disable() + .onlyDust(), + offsetID3b + 9, + TextureSet.SET_DULL); + + public static final Werkstoff NitrogenPlasmaSilaneMix = new Werkstoff( + new short[] { 140, 125, 220 }, + "Silane-Nitrogen Plasma Mixture", + subscriptNumbers("SiH4/N"), + new Werkstoff.Stats(), + Werkstoff.Types.MIXTURE, + new Werkstoff.GenerationFeatures().disable() + .addCells(), + offsetID3b + 10, + TextureSet.SET_FLUID); + + public static void runInit() { + addSubTags(); + } + + private static void addSubTags() { + + // WerkstoffMaterialPool.PTMEGElastomer.add(SubTag.BOUNCY, SubTag.STRETCHY); + + } + + @Override + public void run() {} +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java b/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java new file mode 100644 index 0000000000..9e1fc65c1b --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTEDigester.java @@ -0,0 +1,240 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.InputHatch; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.Muffler; +import static gregtech.api.enums.HatchElement.OutputBus; +import static gregtech.api.enums.HatchElement.OutputHatch; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gregtech.api.util.GTStructureUtility.ofCoil; + +import javax.annotation.Nonnull; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import gregtech.api.GregTechAPI; +import gregtech.api.enums.HeatingCoilLevel; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.OverclockCalculator; +import gtnhlanth.api.recipe.LanthanidesRecipeMaps; +import gtnhlanth.util.DescTextLocalization; + +public class MTEDigester extends MTEEnhancedMultiBlockBase<MTEDigester> implements ISurvivalConstructable { + + protected int casingAmount = 0; + protected int height = 0; + + private HeatingCoilLevel heatLevel; + + private final IStructureDefinition<MTEDigester> multiDefinition = StructureDefinition.<MTEDigester>builder() + .addShape( + mName, + transpose( + new String[][] { { " ", " ttttt ", " t---t ", " t---t ", " t---t ", " ttttt ", " " }, + { " ttt ", " t---t ", "t-----t", "t-----t", "t-----t", " t---t ", " ttt " }, + { " tccct ", "tc---ct", "c-----c", "c-----c", "c-----c", "tc---ct", " tccct " }, + { " tt~tt ", "thhhhht", "thsssht", "thsssht", "thsssht", "thhhhht", " ttttt " }, })) + + .addElement( + 't', + buildHatchAdder(MTEDigester.class) + .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy, Muffler) + .casingIndex(47) + .dot(1) + .buildAndChain(GregTechAPI.sBlockCasings4, 0)) + .addElement('h', ofBlock(GregTechAPI.sBlockCasings1, 11)) + .addElement('s', ofBlock(GregTechAPI.sBlockCasings4, 1)) + .addElement('c', ofCoil(MTEDigester::setCoilLevel, MTEDigester::getCoilLevel)) + .build(); + + public MTEDigester(String name) { + super(name); + } + + public MTEDigester(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + return checkPiece(mName, 3, 3, 0) && !mMufflerHatches.isEmpty() && mMaintenanceHatches.size() == 1; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + public HeatingCoilLevel getCoilLevel() { + return this.heatLevel; + } + + public void setCoilLevel(HeatingCoilLevel level) { + this.heatLevel = level; + } + + @Override + public RecipeMap<?> getRecipeMap() { + return LanthanidesRecipeMaps.digesterRecipes; + } + + @Override + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { + + @Nonnull + @Override + protected OverclockCalculator createOverclockCalculator(@Nonnull GTRecipe recipe) { + return super.createOverclockCalculator(recipe).enablePerfectOC(); + } + + @Override + protected @Nonnull CheckRecipeResult validateRecipe(@Nonnull GTRecipe recipe) { + return recipe.mSpecialValue <= MTEDigester.this.getCoilLevel() + .getHeat() ? CheckRecipeResultRegistry.SUCCESSFUL + : CheckRecipeResultRegistry.insufficientHeat(recipe.mSpecialValue); + } + + }; + } + + @Override + public boolean supportsVoidProtection() { + return true; + } + + @Override + public boolean supportsInputSeparation() { + return true; + } + + @Override + public boolean supportsBatchMode() { + return true; + } + + @Override + public boolean supportsSingleRecipeLocking() { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 10000; + } + + @Override + public int getPollutionPerTick(ItemStack aStack) { + return 20; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { + return new MTEDigester(this.mName); + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + buildPiece(mName, itemStack, b, 3, 3, 0); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece(mName, stackSize, 3, 3, 0, elementBudget, env, false, true); + } + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("Digester.hint", 6); + } + + public ITexture[] getTexture(IGregTechTileEntity te, ForgeDirection side, ForgeDirection facing, int colorIndex, + boolean active, boolean redstone) { + + // Oil Cracker textures cuz I'm lazy + + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[0][47] }; + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Digester") + .addInfo("Controller block for the Digester") + .addInfo("Input ores and fluid, output water.") + .addInfo(DescTextLocalization.BLUEPRINT_INFO) + .addSeparator() + .addController("Front bottom") + .addInputHatch("Hint block with dot 1") + .addInputBus("Hint block with dot 1") + .addOutputHatch("Hint block with dot 1") + .addOutputBus("Hint block with dot 1") + .addMaintenanceHatch("Hint block with dot 1") + .addMufflerHatch("Hint block with dot 1") + .toolTipFinisher("GTNH: Lanthanides"); + return tt; + } + + @Override + public IStructureDefinition<MTEDigester> getStructureDefinition() { + return multiDefinition; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack arg0) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int getDamageToComponent(ItemStack arg0) { + // TODO Auto-generated method stub + return 0; + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java b/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java new file mode 100644 index 0000000000..7d5a64b579 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTEDissolutionTank.java @@ -0,0 +1,264 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.InputHatch; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.OutputBus; +import static gregtech.api.enums.HatchElement.OutputHatch; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; + +import java.util.Arrays; +import java.util.List; + +import javax.annotation.Nonnull; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import org.jetbrains.annotations.NotNull; + +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import bartworks.common.loaders.ItemRegistry; +import gregtech.api.GregTechAPI; +import gregtech.api.interfaces.ISecondaryDescribable; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.check.CheckRecipeResult; +import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.recipe.check.SimpleCheckRecipeResult; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.MultiblockTooltipBuilder; +import gtnhlanth.api.recipe.LanthanidesRecipeMaps; +import gtnhlanth.util.DescTextLocalization; + +public class MTEDissolutionTank extends MTEEnhancedMultiBlockBase<MTEDissolutionTank> + implements ISurvivalConstructable, ISecondaryDescribable { + + private final IStructureDefinition<MTEDissolutionTank> multiDefinition = StructureDefinition + .<MTEDissolutionTank>builder() + .addShape( + mName, + transpose( + new String[][] { { " sss ", "sssss", "sssss", "sssss", " sss " }, + { "sgggs", "g---g", "g---g", "g---g", "sgggs" }, { "sgggs", "g---g", "g---g", "g---g", "sgggs" }, + { "ss~ss", "shhhs", "shhhs", "shhhs", "sssss" }, { "s s", " ", " ", " ", "s s" } })) + .addElement( + 's', + buildHatchAdder(MTEDissolutionTank.class) + .atLeast(InputHatch, OutputHatch, InputBus, OutputBus, Maintenance, Energy) + .casingIndex(49) + .dot(1) + .buildAndChain(GregTechAPI.sBlockCasings4, 1)) + .addElement('h', ofBlock(GregTechAPI.sBlockCasings1, 11)) + .addElement('g', ofBlockAdder(MTEDissolutionTank::addGlass, ItemRegistry.bw_glasses[0], 1)) + .build(); + + public MTEDissolutionTank(String name) { + super(name); + } + + public MTEDissolutionTank(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + @Override + public IStructureDefinition<MTEDissolutionTank> getStructureDefinition() { + return multiDefinition; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + return checkPiece(mName, 2, 3, 0) && mMaintenanceHatches.size() == 1; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + private boolean addGlass(Block block, int meta) { + return block == ItemRegistry.bw_glasses[0]; + } + + @Override + public RecipeMap<?> getRecipeMap() { + return LanthanidesRecipeMaps.dissolutionTankRecipes; + } + + @Override + protected ProcessingLogic createProcessingLogic() { + return new ProcessingLogic() { + + @NotNull + @Override + protected CheckRecipeResult onRecipeStart(@Nonnull GTRecipe recipe) { + if (!checkRatio(recipe, Arrays.asList(inputFluids))) { + criticalStopMachine(); + return SimpleCheckRecipeResult.ofFailurePersistOnShutdown("dissolution_ratio"); + } + return CheckRecipeResultRegistry.SUCCESSFUL; + } + + }; + } + + @Override + public boolean supportsVoidProtection() { + return true; + } + + @Override + public boolean supportsInputSeparation() { + return true; + } + + @Override + public boolean supportsBatchMode() { + return true; + } + + @Override + public boolean supportsSingleRecipeLocking() { + return true; + } + + private boolean checkRatio(GTRecipe tRecipe, List<FluidStack> tFluidInputs) { + FluidStack majorGenericFluid = tRecipe.mFluidInputs[0]; + FluidStack minorGenericFluid = tRecipe.mFluidInputs[1]; + + int majorAmount; + int minorAmount; + + FluidStack fluidInputOne = tFluidInputs.get(0); + FluidStack fluidInputTwo = tFluidInputs.get(1); + + if (fluidInputOne.getUnlocalizedName() + .equals(majorGenericFluid.getUnlocalizedName())) { + if (fluidInputTwo.getUnlocalizedName() + .equals(minorGenericFluid.getUnlocalizedName())) { + // majorInput = fluidInputOne; + majorAmount = fluidInputOne.amount; + // minorInput = fluidInputTwo; + minorAmount = fluidInputTwo.amount; + // GTLog.out.print("in first IF"); + } else return false; // No valid other input + + } else if (fluidInputTwo.getUnlocalizedName() + .equals(majorGenericFluid.getUnlocalizedName())) { + if (fluidInputOne.getUnlocalizedName() + .equals(minorGenericFluid.getUnlocalizedName())) { + // majorInput = fluidInputTwo; + majorAmount = fluidInputTwo.amount; + // minorInput = fluidInputOne; + minorAmount = fluidInputOne.amount; + // GTLog.out.print("in second if"); + } else return false; + + } else return false; + + return majorAmount / tRecipe.mSpecialValue == minorAmount; + } + + @Override + public int getMaxEfficiency(ItemStack itemStack) { + return 10000; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { + return new MTEDissolutionTank(this.mName); + } + + @Override + public void construct(ItemStack itemStack, boolean b) { + buildPiece(mName, itemStack, b, 2, 3, 0); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece(mName, stackSize, 2, 3, 0, elementBudget, env, false, true); + } + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("DissolutionTank.hint", 4); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity te, ForgeDirection side, ForgeDirection facing, int colorIndex, + boolean active, boolean redstone) { + + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[0][49], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[0][49], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[0][49] }; + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Dissolution Tank") + .addInfo("Controller block for the Dissolution Tank") + .addInfo("Input Water and Fluid, output Fluid") + .addInfo("You must input the Fluids at the correct Ratio") + .addInfo(DescTextLocalization.BLUEPRINT_INFO) + .addSeparator() + .addController("Front bottom") + .addInputHatch("Hint block with dot 1") + .addInputBus("Hint block with dot 1") + .addOutputHatch("Hint block with dot 1") + .addOutputBus("Hint block with dot 1") + .addMaintenanceHatch("Hint block with dot 1") + .toolTipFinisher("GTNH: Lanthanides"); + + return tt; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack arg0) { + return false; + } + + @Override + public int getDamageToComponent(ItemStack arg0) { + return 0; + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java new file mode 100644 index 0000000000..78ea9c7846 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTELINAC.java @@ -0,0 +1,749 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.enums.GTValues.VN; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputHatch; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.OutputHatch; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gtnhlanth.util.DescTextLocalization.addDotText; + +import java.util.ArrayList; +import java.util.Objects; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import com.gtnewhorizon.structurelib.StructureLib; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import bartworks.API.BorosilicateGlass; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.TickTime; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTUtility; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReason; +import gregtech.api.util.shutdown.SimpleShutDownReason; +import gtnhlanth.common.beamline.BeamInformation; +import gtnhlanth.common.beamline.BeamLinePacket; +import gtnhlanth.common.beamline.Particle; +import gtnhlanth.common.hatch.MTEHatchInputBeamline; +import gtnhlanth.common.hatch.MTEHatchOutputBeamline; +import gtnhlanth.common.register.LanthItemList; +import gtnhlanth.common.tileentity.recipe.beamline.BeamlineRecipeLoader; +import gtnhlanth.util.DescTextLocalization; +import gtnhlanth.util.Util; + +public class MTELINAC extends MTEEnhancedMultiBlockBase<MTELINAC> implements ISurvivalConstructable { + + private static final IStructureDefinition<MTELINAC> STRUCTURE_DEFINITION; + + protected static final String STRUCTURE_PIECE_BASE = "base"; + protected static final String STRUCTURE_PIECE_LAYER = "layer"; + protected static final String STRUCTURE_PIECE_END = "end"; + + private byte glassTier; + + private boolean onEndInnerLayer = false; + + private int machineTemp = 0; // Coolant temperature + + private ArrayList<MTEHatchInputBeamline> mInputBeamline = new ArrayList<>(); + private ArrayList<MTEHatchOutputBeamline> mOutputBeamline = new ArrayList<>(); + + private static final int CASING_INDEX = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); + + private static final byte MIN_GLASS_TIER = 6; + + /* + * g: Grate Machine Casing b: Borosilicate glass c: Shielded accelerator casing v: Vacuum k: Shielded glass d: + * Coolant Delivery casing y: Superconducting coil + */ + + static { + STRUCTURE_DEFINITION = StructureDefinition.<MTELINAC>builder() + .addShape( + STRUCTURE_PIECE_BASE, + new String[][] { { "ggggggg", "gbbbbbg", "gbbbbbg", "gbbibbg", "gbbbbbg", "gbbbbbg", "ggg~ggg" }, + { "ggggggg", "gcccccg", "gcccccg", "gcc-ccg", "gcccccg", "gcccccg", "ggggggg" }, + { "ccccccc", "cvvvvvc", "kvvvvvk", "kvv-vvk", "kvvvvvk", "cvvvvvc", "jcccccj" }, + { "cckkkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "jcccccj" }, + { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "jcccccj" }, + { "cckkkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "jcccccj" }, + { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "jcccccj" }, + { "cckhkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "jcccccj" }, }) + .addShape( + STRUCTURE_PIECE_LAYER, + new String[][] { { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "ccccccc" }, + { "cckkkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "ccccccc" } }) + .addShape( + STRUCTURE_PIECE_END, + new String[][] { { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "ccccccc" }, + { "cckhkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "ccccccc" }, + { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "ccccccc" }, + { "cckkkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "ccccccc" }, + { "cckkkcc", "cdvvvdc", "kvvvvvk", "kdv-vdk", "kvvvvvk", "cdvvvdc", "ccccccc" }, + { "cckkkcc", "cdddddc", "kdyyydk", "kdy-ydk", "kdyyydk", "cdddddc", "ccccccc" }, + { "ccccccc", "cvvvvvc", "kvvvvvk", "kvv-vvk", "kvvvvvk", "cvvvvvc", "ccccccc" }, + { "ccccccc", "ccccccc", "ccccccc", "ccc-ccc", "ccccccc", "ccccccc", "ccccccc" }, + { "ccccccc", "cbbbbbc", "cbbbbbc", "cbbobbc", "cbbbbbc", "cbbbbbc", "ccccccc" } }) + .addElement('c', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) + .addElement('g', ofBlock(GregTechAPI.sBlockCasings3, 10)) // Grate Machine Casing + .addElement( + 'b', + BorosilicateGlass.ofBoroGlass( + (byte) 0, + MIN_GLASS_TIER, + Byte.MAX_VALUE, + (te, t) -> te.glassTier = t, + te -> te.glassTier)) + .addElement( + 'i', + buildHatchAdder(MTELINAC.class).hatchClass(MTEHatchInputBeamline.class) + .casingIndex(CASING_INDEX) + .dot(3) + .adder(MTELINAC::addBeamLineInputHatch) + .build()) + .addElement( + 'o', + buildHatchAdder(MTELINAC.class).hatchClass(MTEHatchOutputBeamline.class) + .casingIndex(CASING_INDEX) + .dot(4) + .adder(MTELINAC::addBeamLineOutputHatch) + .build()) + .addElement('v', ofBlock(LanthItemList.ELECTRODE_CASING, 0)) + .addElement('k', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_GLASS, 0)) + .addElement('d', ofBlock(LanthItemList.COOLANT_DELIVERY_CASING, 0)) + .addElement('y', ofBlock(GregTechAPI.sBlockCasings1, 15)) // Superconducting coil + .addElement( + 'h', + buildHatchAdder(MTELINAC.class).atLeast(InputHatch, OutputHatch) + .casingIndex(CASING_INDEX) + .dot(2) + .build()) + + .addElement( + 'j', + buildHatchAdder(MTELINAC.class).atLeast(Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(1) + .buildAndChain(ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0))) + + .build(); + } + + private float outputEnergy; + private int outputRate; + private int outputParticle; + private float outputFocus; + + private int length; + + public MTELINAC(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + public MTELINAC(String name) { + super(name); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity te) { + return new MTELINAC(this.mName); + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Particle Accelerator") + .addInfo("Controller block for the LINAC") + .addInfo("Accelerates charged particles to higher energies") + .addInfo("Increasing length increases output energy, but decreases focus") + .addInfo("Use a lower temperature coolant to improve focus") + // .addInfo("Extendable, with a minimum length of 18 blocks") + .addInfo(DescTextLocalization.BLUEPRINT_INFO) + .addInfo(DescTextLocalization.BEAMLINE_SCANNER_INFO) + .addInfo("Valid Coolants:"); + + // Valid coolant list + for (String fluidName : BeamlineRecipeLoader.coolantMap.keySet()) { + + tt.addInfo( + "- " + FluidRegistry.getFluid(fluidName) + .getLocalizedName(null)); + + } + + tt.addInfo("Requires (length + 1)kL/s of coolant") + .addSeparator() + .beginVariableStructureBlock(7, 7, 7, 7, 19, 83, false) + .addController("Front bottom") + .addCasingInfoRange(LanthItemList.SHIELDED_ACCELERATOR_CASING.getLocalizedName(), 325, 1285, false) + .addCasingInfoRange(LanthItemList.COOLANT_DELIVERY_CASING.getLocalizedName(), 148, 852, false) + .addCasingInfoRange(LanthItemList.SHIELDED_ACCELERATOR_GLASS.getLocalizedName(), 127, 703, false) + .addCasingInfoRange("Superconducting Coil Block", 56, 312, false) + .addCasingInfoRange(LanthItemList.ELECTRODE_CASING.getLocalizedName(), 156, 732, false) + .addCasingInfoExactly("Grate Machine Casing", 47, false) + .addCasingInfoExactly("Borosilicate Glass (LuV+)", 48, false) + .addEnergyHatch(addDotText(1)) + .addMaintenanceHatch(addDotText(1)) + .addInputHatch(addDotText(2)) + .addOutputHatch(addDotText(2)) + .addOtherStructurePart("Beamline Input Hatch", addDotText(3)) + .addOtherStructurePart("Beamline Output Hatch", addDotText(4)) + + .toolTipFinisher("GTNH: Lanthanides");; + return tt; + } + + private boolean addBeamLineInputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchInputBeamline) { + return this.mInputBeamline.add((MTEHatchInputBeamline) mte); + } + + return false; + } + + private boolean addBeamLineOutputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchOutputBeamline) { + return this.mOutputBeamline.add((MTEHatchOutputBeamline) mte); + } + + return false; + } + + @Override + public boolean checkRecipe(ItemStack itemStack) { + + float tempFactor = 0; + // Focus as determined by multi properties + float machineFocus = 0; + // Input particle focus + float inputFocus = 0; + + // Output focus to be set + outputFocus = 0; + + float voltageFactor = 0; + float inputEnergy = 0; + + machineTemp = 0; + + // Energy quantity determined by multi + float machineEnergy = 0; + outputEnergy = 0; + + int particleId = 0; + outputParticle = 0; + + int inputRate = 0; + outputRate = 0; + + ArrayList<FluidStack> tFluidInputs = this.getStoredFluids(); + if (tFluidInputs.size() == 0) { + this.doRandomMaintenanceDamage(); // Penalise letting coolant run dry + this.stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.nocoolant")); + return false; + } + + // Coolant input + FluidStack primFluid = tFluidInputs.get(0); + + // 1b (1000L)/m/operation + final int fluidConsumed = 1000 * length; + + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + if (this.getInputInformation() == null) { + return false; + } + + if (this.getInputInformation() + .getEnergy() == 0) { + return false; + } + + particleId = this.getInputInformation() + .getParticleId(); + Particle inputParticle = Particle.getParticleFromId(particleId); + + if (!inputParticle.canAccelerate()) { + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.noaccel")); + return false; + } + + mMaxProgresstime = 1 * TickTime.SECOND; + // Consume the input tier's corresponding practical voltage instead of the maximum suggested by the logic + mEUt = (int) -GTValues.VP[(int) this.getInputVoltageTier()]; + + // Particle stays the same with this multiblock + outputParticle = particleId; + + if (primFluid.isFluidEqual(new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1))) { + tempFactor = calculateTemperatureFactor(60); // Default temp of 300 is unreasonable + machineTemp = 60; // Solely for tricorder use + } else { + tempFactor = calculateTemperatureFactor( + primFluid.getFluid() + .getTemperature()); + machineTemp = primFluid.getFluid() + .getTemperature(); // Solely for tricorder use + } + + machineFocus = Math.max(((-0.9f) * this.length * tempFactor) + 110, 5); // Min of 5 + if (machineFocus > 90) { // Max of 90 + machineFocus = 90; + } + + inputFocus = this.getInputInformation() + .getFocus(); + + outputFocus = (inputFocus > machineFocus) ? ((inputFocus + machineFocus) / 2) + : inputFocus * (machineFocus / 100); // If input focus > machine focus, take the average of both, else + // weigh the former by the latter + + long voltage = this.getMaxInputVoltage(); + // voltageFactor = calculateVoltageFactor(voltage); + + // machineEnergy = Math.max(-((60) / this.length) * voltageFactor + 60_000, 2000); // Minimum of 2000keV + + machineEnergy = (float) Math.max(length / 4 * Math.pow(voltage, 1.0 / 3.0), 50); // Minimum of 50keV + + inputEnergy = this.getInputInformation() + .getEnergy(); + /* + * outputEnergy = Math.min( + * (1 + inputEnergy / Particle.getParticleFromId(outputParticle) + * .maxSourceEnergy()) * machineEnergy, + * 120_000); // TODO more complex calculation than just + * // addition + */ + + outputEnergy = (float) Math.pow( + 10, + 1 + inputEnergy / Particle.getParticleFromId(outputParticle) + .maxSourceEnergy()) + * machineEnergy; + + inputRate = this.getInputInformation() + .getRate(); + outputRate = inputRate; // Cannot increase rate with this multiblock + + if (Util.coolantFluidCheck(primFluid, fluidConsumed)) { + + this.stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.inscoolant")); + return false; + + } + + primFluid.amount -= fluidConsumed; + + Fluid fluidOutput = BeamlineRecipeLoader.coolantMap.get( + primFluid.getFluid() + .getName()); + + if (Objects.isNull(fluidOutput)) return false; + + FluidStack fluidOutputStack = new FluidStack(fluidOutput, fluidConsumed); + + if (Objects.isNull(fluidOutputStack)) return false; + + this.addFluidOutputs(new FluidStack[] { fluidOutputStack }); + + outputAfterRecipe(); + + return true; + } + + private void outputAfterRecipe() { + + if (!mOutputBeamline.isEmpty()) { + + BeamLinePacket packet = new BeamLinePacket( + new BeamInformation(outputEnergy, outputRate, outputParticle, outputFocus)); + + for (MTEHatchOutputBeamline o : mOutputBeamline) { + + o.q = packet; + } + } + } + + @Override + public void stopMachine() { + + // GTLog.out.print("Machine stopped"); + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + machineTemp = 0; + super.stopMachine(); + } + + @Override + public void stopMachine(ShutDownReason reason) { + + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + machineTemp = 0; + super.stopMachine(reason); + + } + + @Override + public String[] getInfoData() { + + long storedEnergy = 0; + long maxEnergy = 0; + for (MTEHatchEnergy tHatch : mEnergyHatches) { + if (tHatch.isValid()) { + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); + } + } + + BeamInformation information = this.getInputInformation(); + + return new String[] { + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GTUtility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GTUtility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %", + + /* 7 */ EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.info") + + ": " + + EnumChatFormatting.RESET, + + StatCollector.translateToLocal("beamline.temperature") + ": " // Temperature: + + EnumChatFormatting.DARK_RED + + machineTemp + + EnumChatFormatting.RESET + + " K", // e.g. "137 K" + + StatCollector.translateToLocal("beamline.coolusage") + ": " // Coolant usage: + + EnumChatFormatting.AQUA + + length + + EnumChatFormatting.RESET + + " kL/s", // e.g. "24 kL/s + + /* 8 */ EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.in_pre") + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " // "Multiblock Beamline Input:" + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(information.getParticleId()) + .getLocalisedName() // e.g. "Electron + // (e-)" + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " // "Energy:" + + EnumChatFormatting.DARK_RED + + information.getEnergy() + + EnumChatFormatting.RESET + + " keV", // e.g. "10240 keV" + StatCollector.translateToLocal("beamline.focus") + ": " // "Focus:" + + EnumChatFormatting.BLUE + + information.getFocus() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " // "Amount:" + + EnumChatFormatting.LIGHT_PURPLE + + information.getRate(), + EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.out_pre") // "Multiblock Beamline + // Output:" + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(this.outputParticle) + .getLocalisedName() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " + + EnumChatFormatting.DARK_RED + + this.outputEnergy + + EnumChatFormatting.RESET + + " keV", + StatCollector.translateToLocal( + "beamline.focus") + ": " + EnumChatFormatting.BLUE + this.outputFocus + " " + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " + + EnumChatFormatting.LIGHT_PURPLE + + this.outputRate, }; + } + + private BeamInformation getInputInformation() { + + for (MTEHatchInputBeamline in : this.mInputBeamline) { // Easy way to find the desired input. Efficient? No. + // Will it matter? No :boubs_glasses: + + if (in.q == null) return new BeamInformation(0, 0, 0, 0); + // if (in.q == null) return new BeamInformation(10000, 10, 0, 90); // temporary for testing purposes + + return in.q.getContent(); + } + return null; + } + + private static float calculateTemperatureFactor(int fluidTemp) { + + float factor = (float) Math.pow(1.1, 0.2 * fluidTemp); + return factor; + } + + /* + * private static float calculateVoltageFactor(long voltage) { + * float factor = (float) Math.pow(1.00009, -(0.1 * voltage - 114000)); + * return factor; + * } + */ + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("LINAC.hint", 11); + } + + @Override + public boolean checkMachine(IGregTechTileEntity mte, ItemStack stack) { + + mInputBeamline.clear(); + mOutputBeamline.clear(); + + this.outputEnergy = 0; + this.outputRate = 0; + this.outputParticle = 0; + this.outputFocus = 0; + + this.glassTier = 0; + + this.onEndInnerLayer = false; + + length = 8; // Base piece length + + if (!checkPiece(STRUCTURE_PIECE_BASE, 3, 6, 0)) return false; + + while (length < 128) { + + if (!checkPiece(STRUCTURE_PIECE_LAYER, 3, 6, -length)) { + if (!checkPiece(STRUCTURE_PIECE_END, 3, 6, -length)) { + return false; + } + break; + } ; + + length += 2; + } + + // if (!checkPiece(STRUCTURE_PIECE_END, 3, 6, -length)) return false; + + // Likely off by one or two, not visible to player however so doesn't particularly matter + length += 8; + + return this.mInputBeamline.size() == 1 && this.mOutputBeamline.size() == 1 + && this.mMaintenanceHatches.size() == 1 + && this.mEnergyHatches.size() <= 2 + && this.glassTier >= MIN_GLASS_TIER; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + + buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 3, 6, 0); + + int lLength = Math.max(stackSize.stackSize + 7, 8); // !! + + if (!(lLength % 2 == 0)) { + lLength++; // Otherwise you get gaps at the end + } + + for (int i = -8; i > -lLength - 1; i -= 2) { + + // GTLog.out.print("Building inner piece! i = " + i); + + buildPiece(STRUCTURE_PIECE_LAYER, stackSize, hintsOnly, 3, 6, i); + } + + buildPiece(STRUCTURE_PIECE_END, stackSize, hintsOnly, 3, 6, -(lLength + 2)); + + StructureLib.addClientSideChatMessages("Length: " + (11 + lLength) + " blocks."); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + + elementBudget = 200; // Maybe make a config + + if (mMachine) return -1; + + int build = 0; + + build = survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 3, 6, 0, elementBudget, env, false, true); + + if (build >= 0) return build; // Incomplete + + int lLength = Math.max(stackSize.stackSize + 7, 8); // !! + + if (!(lLength % 2 == 0)) { + lLength++; // Otherwise you get gaps at the end + } + + for (int i = -8; i > -lLength - 1; i -= 2) { + + build = survivialBuildPiece(STRUCTURE_PIECE_LAYER, stackSize, 3, 6, i, elementBudget, env, false, true); + + if (build >= 0) return build; + + } + + int finalOutput = survivialBuildPiece( + STRUCTURE_PIECE_END, + stackSize, + 3, + 6, + -(lLength + 2), + elementBudget, + env, + false, + true); + + return finalOutput; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int aColorIndex, boolean active, boolean aRedstone) { + + // Placeholder + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[0][47] }; + } + + @Override + public IStructureDefinition<MTELINAC> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + public boolean addInputHatchToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + this.onEndInnerLayer = true; + return super.addInputHatchToMachineList(aTileEntity, aBaseCasingIndex); + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java new file mode 100644 index 0000000000..68cc750005 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTESourceChamber.java @@ -0,0 +1,409 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static gregtech.api.enums.GTValues.VN; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.OutputBus; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gtnhlanth.util.DescTextLocalization.BLUEPRINT_INFO; +import static gtnhlanth.util.DescTextLocalization.addDotText; + +import java.util.ArrayList; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTUtility; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.SimpleShutDownReason; +import gtnhlanth.common.beamline.BeamInformation; +import gtnhlanth.common.beamline.BeamLinePacket; +import gtnhlanth.common.beamline.Particle; +import gtnhlanth.common.hatch.MTEHatchOutputBeamline; +import gtnhlanth.common.register.LanthItemList; +import gtnhlanth.common.tileentity.recipe.beamline.BeamlineRecipeAdder2; +import gtnhlanth.common.tileentity.recipe.beamline.RecipeSC; +import gtnhlanth.util.DescTextLocalization; + +public class MTESourceChamber extends MTEEnhancedMultiBlockBase<MTESourceChamber> implements ISurvivalConstructable { + + private static final IStructureDefinition<MTESourceChamber> STRUCTURE_DEFINITION; + + private ArrayList<MTEHatchOutputBeamline> mOutputBeamline = new ArrayList<>(); + + private static final int CASING_INDEX = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); + + private float outputEnergy; + private int outputRate; + private int outputParticle; + private float outputFocus; + + static { + STRUCTURE_DEFINITION = StructureDefinition.<MTESourceChamber>builder() + .addShape( + "sc", + new String[][] { { "ccccc", "ckkkc", "ckikc", "ckkkc", "dd~dd" }, + { "ckkkc", "keeek", "ke-ek", "keeek", "ccocc" }, { "ckkkc", "k---k", "k---k", "k---k", "ccccc" }, + { "ckkkc", "k---k", "k---k", "k---k", "ccccc" }, { "ckkkc", "keeek", "ke-ek", "keeek", "ccccc" }, + { "ccccc", "ckkkc", "ckbkc", "ckkkc", "ccccc" } }) + .addElement('c', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) + .addElement('k', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_GLASS, 0)) + .addElement('e', ofBlock(LanthItemList.ELECTRODE_CASING, 0)) + .addElement( + 'b', + buildHatchAdder(MTESourceChamber.class).hatchClass(MTEHatchOutputBeamline.class) + .casingIndex(CASING_INDEX) + .dot(4) + .adder(MTESourceChamber::addBeamLineOutputHatch) + .build()) + .addElement( + 'i', + buildHatchAdder(MTESourceChamber.class).atLeast(InputBus) + .casingIndex(CASING_INDEX) + .dot(1) + .build()) + .addElement( + 'o', + buildHatchAdder(MTESourceChamber.class).atLeast(OutputBus) + .casingIndex(CASING_INDEX) + .dot(2) + .build()) + .addElement( + 'd', + buildHatchAdder(MTESourceChamber.class).atLeast(Maintenance, Energy) + .casingIndex(CASING_INDEX) + .dot(3) + .buildAndChain(ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0))) + + .build(); + } + + public MTESourceChamber(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + public MTESourceChamber(String name) { + super(name); + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece("sc", stackSize, 2, 4, 0, elementBudget, env, false, true); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity te) { + return new MTESourceChamber(this.mName); + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Particle Source") + .addInfo("Controller block for the Source Chamber") + .addInfo(BLUEPRINT_INFO) + .addInfo(DescTextLocalization.BEAMLINE_SCANNER_INFO) + .addSeparator() + .beginStructureBlock(5, 5, 6, true) + .addController("Front bottom") + .addCasingInfoExactly(LanthItemList.SHIELDED_ACCELERATOR_CASING.getLocalizedName(), 56, false) + .addCasingInfoExactly(LanthItemList.SHIELDED_ACCELERATOR_GLASS.getLocalizedName(), 52, false) + .addCasingInfoExactly(LanthItemList.ELECTRODE_CASING.getLocalizedName(), 16, false) + .addOtherStructurePart("Beamline Output Hatch", addDotText(4)) + .addEnergyHatch(addDotText(3)) + .addMaintenanceHatch(addDotText(3)) + .addInputBus(addDotText(1)) + .addOutputBus(addDotText(2)) + .toolTipFinisher("GTNH: Lanthanides"); + return tt; + } + + private boolean addBeamLineOutputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchOutputBeamline) { + return this.mOutputBeamline.add((MTEHatchOutputBeamline) mte); + } + + return false; + } + /* + * protected OverclockDescriber createOverclockDescriber() { return new EUNoTotalOverclockDescriber((byte) 4, 1); } + */ + + @Override + public boolean checkRecipe(ItemStack itemStack) { + + // GTLog.out.print("In checkRecipe"); + + // No input particle, so no input quantities + + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + + ItemStack[] tItems = this.getStoredInputs() + .toArray(new ItemStack[0]); + // GTLog.out.print(Arrays.toString(tItems)); + long tVoltageMaxTier = this.getMaxInputVoltage(); // Used to keep old math the same + long tVoltageActual = GTValues.VP[(int) this.getInputVoltageTier()]; + + RecipeSC tRecipe = (RecipeSC) BeamlineRecipeAdder2.instance.SourceChamberRecipes + .findRecipe(this.getBaseMetaTileEntity(), false, tVoltageActual, new FluidStack[] {}, tItems); + + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItems)) return false; // Consumes + // input + // item + + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + this.mMaxProgresstime = tRecipe.mDuration; + if (mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + + mEUt = (int) -tVoltageActual; + if (this.mEUt > 0) this.mEUt = (-this.mEUt); + + outputParticle = tRecipe.particleId; + float maxParticleEnergy = Particle.getParticleFromId(outputParticle) + .maxSourceEnergy(); // The maximum energy a + // particle can possess + // when produced by this + // multiblock + float maxMaterialEnergy = tRecipe.maxEnergy; // The maximum energy for the recipe processed + outputEnergy = (float) Math.min( + (-maxMaterialEnergy) * Math.pow(1.001, -(tRecipe.energyRatio) * (tVoltageMaxTier - tRecipe.mEUt)) + + maxMaterialEnergy, + maxParticleEnergy); + + if (outputEnergy <= 0) { + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.scerror")); + return false; + } + + outputFocus = tRecipe.focus; + outputRate = tRecipe.rate; + + this.mOutputItems = tRecipe.mOutputs; + this.updateSlots(); + + outputAfterRecipe(); + + return true; + } + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("SourceChamber.hint", 7); // Generate 7 localised hint strings in structure + // description + } + + private void outputAfterRecipe() { + + if (!mOutputBeamline.isEmpty()) { + + BeamLinePacket packet = new BeamLinePacket( + new BeamInformation(outputEnergy, outputRate, outputParticle, outputFocus)); + + for (MTEHatchOutputBeamline o : mOutputBeamline) { + + o.q = packet; + } + } + } + + @Override + public void stopMachine() { + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + super.stopMachine(); + } + + @Override + public RecipeMap<?> getRecipeMap() { + return BeamlineRecipeAdder2.instance.SourceChamberRecipes; + } + + @Override + public String[] getInfoData() { + + long storedEnergy = 0; + long maxEnergy = 0; + for (MTEHatchEnergy tHatch : mEnergyHatches) { + if (tHatch.isValid()) { + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); + } + } + + return new String[] { + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GTUtility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GTUtility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %", + EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.out_pre") + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(this.outputParticle) + .getLocalisedName() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " + + EnumChatFormatting.DARK_RED + + this.outputEnergy + + EnumChatFormatting.RESET + + " keV", + StatCollector.translateToLocal( + "beamline.focus") + ": " + EnumChatFormatting.BLUE + this.outputFocus + " " + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " + + EnumChatFormatting.LIGHT_PURPLE + + this.outputRate, }; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece("sc", stackSize, hintsOnly, 2, 4, 0); + } + + @Override + public IStructureDefinition<MTESourceChamber> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + + this.mOutputBeamline.clear(); // Necessary due to the nature of the beamline hatch adder + + return checkPiece("sc", 2, 4, 0) && this.mMaintenanceHatches.size() == 1 + && this.mInputBusses.size() == 1 + && this.mOutputBusses.size() == 1 + && this.mOutputBeamline.size() == 1 + && this.mEnergyHatches.size() == 1; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int colorIndex, boolean active, boolean redstoneLevel) { + + // Placeholder + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[1][14], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[1][14], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[1][14] }; + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java new file mode 100644 index 0000000000..3b67f8e172 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTESynchrotron.java @@ -0,0 +1,1077 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder; +import static gregtech.api.enums.GTValues.VN; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputHatch; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.OutputHatch; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gtnhlanth.util.DescTextLocalization.addDotText; + +import java.util.ArrayList; +import java.util.Objects; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +import com.google.common.collect.ImmutableMap; +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import bartworks.API.BorosilicateGlass; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.TickTime; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTUtility; +import gregtech.api.util.MultiblockTooltipBuilder; +import gregtech.api.util.shutdown.ShutDownReason; +import gregtech.api.util.shutdown.SimpleShutDownReason; +import gtnhlanth.common.beamline.BeamInformation; +import gtnhlanth.common.beamline.BeamLinePacket; +import gtnhlanth.common.beamline.Particle; +import gtnhlanth.common.block.BlockAntennaCasing; +import gtnhlanth.common.hatch.MTEHatchInputBeamline; +import gtnhlanth.common.hatch.MTEHatchOutputBeamline; +import gtnhlanth.common.register.LanthItemList; +import gtnhlanth.common.tileentity.recipe.beamline.BeamlineRecipeLoader; +import gtnhlanth.util.DescTextLocalization; +import gtnhlanth.util.Util; + +public class MTESynchrotron extends MTEEnhancedMultiBlockBase<MTESynchrotron> implements ISurvivalConstructable { + + private static final IStructureDefinition<MTESynchrotron> STRUCTURE_DEFINITION; + + protected static final String STRUCTURE_PIECE_ENTRANCE = "entrance"; + protected static final String STRUCTURE_PIECE_BASE = "base"; + + public static final int CONSUMED_FLUID = 32_000; // Fluid consumed per processed recipe, maybe increase with EU + public static final int MIN_INPUT_FOCUS = 25; // Inclusive + + private ArrayList<MTEHatchInputBeamline> mInputBeamline = new ArrayList<>(); + private ArrayList<MTEHatchOutputBeamline> mOutputBeamline = new ArrayList<>(); + + public ArrayList<BlockAntennaCasing> mAntennaCasings = new ArrayList<>(); + + private static final int CASING_INDEX = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); + + private static final byte MIN_GLASS_TIER = 6; + + private int energyHatchTier; + + private int antennaeTier; + + private Byte glassTier; + + /* + * c: Shielded accelerator casing v: Vacuum k: Superconducting coil d: Coolant Delivery casing + */ + + // TODO: E > 1200eV for x-ray lithography + // spotless:off + static { + + STRUCTURE_DEFINITION = StructureDefinition.<MTESynchrotron>builder().addShape( + STRUCTURE_PIECE_ENTRANCE, + + + + new String[][] { + { + " ", + " ccc ", + " cgggc ", + " cgvgc ", + " cgggc ", + " ccc " + } + }) + .addShape( + STRUCTURE_PIECE_BASE, + + new String[][] { + { + " ", + " ccc ", + " ccccc cjjjjjc ", + " cc-cc cjjc~cjjc ", + " ccccc cjjjjjc ", + " ccc ", + " " + }, + { + " ", + " ccc ccccccccccc ", + " c---c ccc-------ccc ", + " c---c ccc-------ccc ", + " c---c ccc-------ccc ", + " ccc ccccccccccc ", + " " + }, + { + " ccccccccccc ", + " ccc cc-----------cc ", + " c---c cc-------------cc ", + " c---c cc-------------cc ", + " c---c cc-------------cc ", + " ccc ccc---------ccc ", + " ccccccccccc " + }, + { + " ccccccccccccccc ", + " ccc cc---------------cc ", + " c---ccc-----------------c ", + " c---ccc-----------------cc ", + " c---ccc-----------------c ", + " ccc cc---------------cc ", + " ccccccccccccccc ", + + }, + { + " ccc ccccccccccccccccc ", + " ckkkccc-----------------cc ", + "ck---kc-------------------cc ", + "ck---kc--------------------c ", + "ck---kc-------------------cc ", + " ckkkccc-----------------cc ", + " ccc cccccccccccccccccc " + + }, + { + " cccccccccccc ccccccc ", + " cdddcc-------ccccc-------cc ", + "cd---d----------------------c ", + "cd---d----------------------c ", + "cd---d----------------------c ", + " cdddcc-------ccccc-------cc ", + " cccccccccccc ccccccc ", + }, + { + " ccccccccc ccccc ", + " ckkkc-----cccc cccc-----cc ", + "ck---k-------ccccccc--------c ", + "ck---k-------ccccccc---------c ", + "ck---k-------ccccccc--------c ", + " ckkkc-----cccc cccc-----cc ", + " ccccccccc ccccc " + }, + { + " cccccccc ccccc ", + " c--------cc cc-----cc ", + "c----------cc cc-------c ", + "c----------cc cc-------c ", + "c----------cc cc-------c ", + " c--------cc cc-----cc ", + " cccccccc ccccc " + + }, + { + " ccccccc ccccc ", + " c-------c c-----c ", + "c---------c c-------c ", + "c---------c c-------c ", + "c---------c c-------c ", + " c-------c c-----c ", + " ccccccc ccccc " + + }, + { + " cccccc ccccc ", + " c------c c-----c ", + "c--------c c------c ", + "c--------c c------c ", + "c--------c c------c ", + " c------c c-----c ", + " cccccc ccccc " + + }, + { + " ccccc cccc ", + " c-----c c----c ", + "c-------c c------c ", + "c-------c c------c ", + "c-------c c------c ", + " c-----c c----c ", + " ccccc cccc " + + }, + { + " cccc ccc ", + " c----cc cc---cc ", + "c------c c-----c ", + "c------c c-----c ", + "c------c c-----c ", + " c----cc cc---cc ", + " cccc ccc " + + }, + { + " cccc cccc ", + " c---cc c----c ", + "c------c c-----c ", + "c------c c-----cc ", + "c------c c-----c ", + " c---cc cc---c ", + " cccc cccc " + + }, + { + " cccc cccc ", + " c---cc c----c ", + "c-----c c----cc ", + "c-----c c----cc ", + "c-----c c----cc ", + " c---cc cc---c ", + " cccc cccc " + + }, + { + " ccc ccc ", + " ckkkcc cckkkc ", + "ck---kc ck---kc ", + "ck---kc ck---kc ", + "ck---kc ck---kc ", + " ckkkcc cckkkc ", + " ccc ccc " + + }, + { + " cec cec ", + " cnanc cnanc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + " cnnnc cnnnc ", + " ccc ccc " + + }, + { + " cic cic ", + " cndnc cndnc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + " cndnc cndnc ", + " coc coc " + + }, + { + " cec cec ", + " cnanc cnanc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + "cn---nc cn---nc ", + " cnnnc cnnnc ", + " ccc ccc " + + }, + { + " ccc ccc ", + " ckkkcc cckkkc ", + "ck---kc ck---kc ", + "ck---kc ck---kc ", + "ck---kc ck---kc ", + " ckkkcc cckkkc ", + " ccc ccc " + + }, + { + " cccc cccc ", + " c----c c----c ", + "cc----c c----cc ", + "cc----c c----cc ", + "cc----c c----cc ", + " c---cc cc---c ", + " cccc cccc " + + }, + { + " cccc cccc ", + " c----c c----c ", + " c-----c c-----c ", + "cc-----c c-----cc ", + " c-----c c-----c ", + " c---cc cc---c ", + " cccc cccc " + + }, + { + " ccc ccc ", + " cc---cc cc---cc ", + " c-----c c-----c ", + " c-----c c-----c ", + " c-----c c-----c ", + " cc---cc cc---cc ", + " ccc ccc " + + }, + { + " cccc cccc ", + " c----c c----c ", + " c------c c------c ", + " c------c c------c ", + " c------c c------c ", + " c----c c----c ", + " cccc cccc " + + }, + { + " ccccc ccccc ", + " c-----c c-----c ", + " c------c c------c ", + " c------c c------c ", + " c------c c------c ", + " c-----c c-----c ", + " ccccc ccccc " + + }, + { + " ccccc ccccc ", + " c-----c c-----c ", + " c-------c c-------c ", + " c-------c c-------c ", + " c-------c c-------c ", + " c-----c c-----c ", + " ccccc ccccc " + + }, + { + " ccccc ccccc ", + " c-----cc cc-----c ", + " c-------cc cc-------cc ", + " c-------cc cc-------cc ", + " c-------cc cc-------cc ", + " c-----cc cc------c ", + " ccccc cccccc " + + }, + { + " ccccc ccccccc ", + " cc-----cccc cccc-----ccc ", + " c--------ccccccc--------cccc ", + " c--------ccccccc--------cccc ", + " c--------ccccccc--------cccc ", + " cc-----cccc cccc------cc ", + " ccccc cccccc " + + }, + { + " ccccccc cccccccccc ", + " cc-------ccccc--------cccc ", + " c---------kdkdk--------ccccccccc", + " c---------kdkdk--------ccccccccc", + " c---------kdkdk--------ccccccccc", + " cc-------ccccc--------cccc ", + " ccccccc cccccccc " + + }, + { + " cccccccccccccccccccc ", + " cc-------------------ccccccccc", + " cc---------------------------cg", + " c----------------------------cg", + " cc---------------------------cg", + " c-------------------ccccccccc", + " ccccccccccccccccccc " + + }, + { + " ccccccccccccccccccc ", + " cc-----------------cccccccccc", + " c--------------------------cg", + " cc---------------------------b", + " c--------------------------cg", + " c-----------------cccccccccc", + " ccccccccccccccccc " + + }, + { + " ccccccccccccccc ", + " ccc-------------ccccccccccc", + " cc------------------------cg", + " cc------------------------cg", + " cc------------------------cg", + " ccc-------------ccccccccccc", + " ccccccccccccc " + + }, + { + " ", + " cccccccccccccccccc ", + " ccc-kdkdk------ccccccccccc", + " cc--kdkdk------ccccccccccc", + " ccc-kdkdk------ccccccccccc", + " cccccccccccccccccc " + + }, + { + " ", + " ", + " cccccccccccccccc ", + " ccccccccccccccccc ", + " cccccccccccccccc ", + " ", + " " + + } + + } + + ).addElement('c', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) + .addElement('k', ofBlock(GregTechAPI.sBlockCasings1, 15)) // Superconducting coils + .addElement('d', ofBlock(LanthItemList.COOLANT_DELIVERY_CASING, 0)) + .addElement('e', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(Energy, 4)).dot(6).casingIndex(CASING_INDEX).build()) + .addElement('n', ofBlock(LanthItemList.NIOBIUM_CAVITY_CASING, 0)) + .addElement('a', ofBlockAdder(MTESynchrotron::addAntenna, LanthItemList.ANTENNA_CASING_T1, 0)) //Antenna Casings + .addElement('i', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(InputHatch, 2)).dot(4).casingIndex(CASING_INDEX).build()) + .addElement('o', buildHatchAdder(MTESynchrotron.class).atLeast(ImmutableMap.of(OutputHatch, 2)).dot(5).casingIndex(CASING_INDEX).build()) + .addElement('v', buildHatchAdder(MTESynchrotron.class).hatchClass(MTEHatchInputBeamline.class).casingIndex(CASING_INDEX) + .dot(1).adder(MTESynchrotron::addBeamlineInputHatch).build()) + .addElement('b', buildHatchAdder(MTESynchrotron.class).hatchClass(MTEHatchOutputBeamline.class).casingIndex(CASING_INDEX) + .dot(2).adder(MTESynchrotron::addBeamlineOutputHatch).build()) + .addElement('g', BorosilicateGlass.ofBoroGlass((byte) 0, MIN_GLASS_TIER, Byte.MAX_VALUE, (te, t) -> te.glassTier = t, te -> te.glassTier)) + .addElement('j', + buildHatchAdder(MTESynchrotron.class).atLeast(Maintenance).dot(3).casingIndex(CASING_INDEX) + .buildAndChain(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) + + .build(); + + + + } + + // spotless:on + + /* + * v = pi * lorentz^2 * sfreq sfreq = sw / 2pi sw = e * B / mass(e) * c v = (e * B * l^2) / (2 * mass(e) * c) = + * 292.718624222 * l^2 * B + */ + + private float outputEnergy; + private int outputRate; + private int outputParticle; + private float outputFocus; + private float machineFocus; + + private int machineTemp; + + public MTESynchrotron(String aName) { + super(aName); + } + + public MTESynchrotron(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new MTESynchrotron(this.mName); + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Particle Accelerator") + .addInfo("Controller block for the Synchrotron") + .addInfo("Torus-shaped, accelerates electrons to produce high-energy electromagnetic radiation") + .addInfo(DescTextLocalization.BLUEPRINT_INFO) + .addInfo(DescTextLocalization.BEAMLINE_SCANNER_INFO) + .addInfo("Valid Coolants:"); + + // Valid coolant list + for (String fluidName : BeamlineRecipeLoader.coolantMap.keySet()) { + + tt.addInfo( + "- " + FluidRegistry.getFluid(fluidName) + .getLocalizedName(null)); + + } + + tt.addInfo("Requires 32 kL/s of coolant") + .addSeparator() + .beginStructureBlock(36, 7, 34, true) + .addController("Front middle") + .addCasingInfoExactly(LanthItemList.SHIELDED_ACCELERATOR_CASING.getLocalizedName(), 676, false) + .addCasingInfoExactly("Superconducting Coil Block", 90, false) + .addCasingInfoExactly("Niobium Cavity Casing", 64, false) + .addCasingInfoExactly(LanthItemList.COOLANT_DELIVERY_CASING.getLocalizedName(), 28, false) + .addCasingInfoExactly("Borosilicate Glass Block (LuV+)", 16, false) + .addCasingInfoExactly("Antenna Casing (must match)", 4, true) + .addOtherStructurePart("Beamline Input Hatch", addDotText(1)) + .addOtherStructurePart("Beamline Output Hatch", addDotText(2)) + .addMaintenanceHatch(addDotText(3)) + .addInputHatch(addDotText(4)) + .addOutputHatch(addDotText(5)) + .addEnergyHatch(addDotText(6)) + + .toolTipFinisher("GTNH: Lanthanides"); + return tt; + } + + private boolean addBeamlineInputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchInputBeamline) { + return this.mInputBeamline.add((MTEHatchInputBeamline) mte); + } + + return false; + + } + + private boolean addBeamlineOutputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchOutputBeamline) { + return this.mOutputBeamline.add((MTEHatchOutputBeamline) mte); + } + + return false; + + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int aColorIndex, boolean active, boolean aRedstone) { + // Placeholder + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[1][14], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[1][14], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[1][14] }; + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + elementBudget = 200; + + if (mMachine) return -1; + + int build = survivialBuildPiece(STRUCTURE_PIECE_ENTRANCE, stackSize, 16, 3, 1, elementBudget, env, false, true); + + if (build >= 0) return build; + + return survivialBuildPiece(STRUCTURE_PIECE_BASE, stackSize, 16, 3, 0, elementBudget, env, false, true); + + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(STRUCTURE_PIECE_ENTRANCE, stackSize, hintsOnly, 16, 3, 1); + buildPiece(STRUCTURE_PIECE_BASE, stackSize, hintsOnly, 16, 3, 0); + + } + + @Override + public IStructureDefinition<MTESynchrotron> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + public boolean addEnergyInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof MTEHatchEnergy) { + + MTEHatchEnergy hatch = (MTEHatchEnergy) aMetaTileEntity; + + // First energy hatch added + if (this.mEnergyHatches.size() == 0) this.energyHatchTier = hatch.mTier; + + // Disallow any hatches that don't match the tier of the first hatch added + if (hatch.mTier != this.energyHatchTier) return false; + + hatch.updateTexture(aBaseCasingIndex); + hatch.updateCraftingIcon(this.getMachineCraftingIcon()); + return mEnergyHatches.add(hatch); + } + return false; + } + + private boolean addAntenna(Block block, int meta) { + + if (block == null) return false; + + if (!(block instanceof BlockAntennaCasing)) return false; + + BlockAntennaCasing antennaBlock = (BlockAntennaCasing) block; + + int antennaTier = antennaBlock.getTier(); + + // First antenna casing added + if (this.mAntennaCasings.size() == 0) this.antennaeTier = antennaTier; + + if (antennaTier != this.antennaeTier) return false; + + return mAntennaCasings.add(antennaBlock); + + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return true; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + + float inputEnergy = 0; + float inputFocus = 0; + float inputRate = 0; + int inputParticleId = 0; + + machineFocus = 0; + machineTemp = 0; + + outputEnergy = 0; + outputFocus = 0; + outputRate = 0; + outputParticle = 0; + + float tempFactor = 0; + + float voltageFactor = 0; + + ArrayList<FluidStack> fluidList = this.getStoredFluids(); + + if (fluidList.size() == 0) { + + this.stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.nocoolant")); + + return false; + } + + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + if (this.getInputInformation() == null) { + return false; + } + + if (this.getInputInformation() + .getEnergy() == 0) { // Only really applies if there's no input + return false; + } + + if (this.getInputInformation() + .getFocus() < MIN_INPUT_FOCUS) { + return false; + } + + inputParticleId = this.getInputInformation() + .getParticleId(); + + Particle inputParticle = Particle.getParticleFromId(inputParticleId); + + if (!inputParticle.canAccelerate()) { + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.noaccel")); + return false; + } + + mMaxProgresstime = TickTime.SECOND; + + long voltage = this.getMaxInputVoltage(); + mEUt = (int) (-voltage / GTValues.V[(int) this.getInputVoltageTier()] + * GTValues.VP[(int) this.getInputVoltageTier()]); // Multiply VP by amps + + outputParticle = 1; // Photon + + FluidStack primaryFluid = fluidList.get(0); + + int fluidTemperature; + + if (primaryFluid.isFluidEqual(new FluidStack(FluidRegistry.getFluid("ic2coolant"), 1))) { + fluidTemperature = 60; // Default temp of 300 is unreasonable + } else { + fluidTemperature = primaryFluid.getFluid() + .getTemperature(); + } + + machineTemp = fluidTemperature; // Solely for tricorder info + + machineFocus = getMachineFocus(fluidTemperature); + + inputFocus = this.getInputInformation() + .getFocus(); + + outputFocus = (inputFocus > machineFocus) ? ((inputFocus + machineFocus) / 2.5f) + : inputFocus * (machineFocus / 100); // If input focus > machine focus, divide their sum by 2.5, else + // weigh the former by the latter. This punishes having too low a + // machine focus for low values of input focus + // E.g. An input focus of 50 requires a machine focus of 100 to get an + // output focus of 50, + // whereas an input focus of 60 only requires around 80 + // In general, as input focus increases, output scales better with + // machine focus + + voltageFactor = getVoltageFactor(voltage, this.antennaeTier); + + inputEnergy = this.getInputInformation() + .getEnergy(); + float mass = inputParticle.getMass(); + + // Perhaps divide by mass somehow here too + outputEnergy = (float) calculateOutputParticleEnergy(voltage, inputEnergy, this.antennaeTier); // maybe + // adjust + // behaviour here + + inputRate = this.getInputInformation() + .getRate(); + + outputRate = (int) (inputRate * getOutputRatetio(voltageFactor, this.antennaeTier)); + + if (outputRate == 0) { + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.low_input_rate")); + return false; + } + + if (Util.coolantFluidCheck(primaryFluid, CONSUMED_FLUID)) { + + stopMachine(SimpleShutDownReason.ofCritical("gtnhlanth.inscoolant")); + return false; + + } + + primaryFluid.amount -= CONSUMED_FLUID; + + Fluid fluidOutput = BeamlineRecipeLoader.coolantMap.get( + primaryFluid.getFluid() + .getName()); + + if (Objects.isNull(fluidOutput)) return false; + + FluidStack fluidOutputStack = new FluidStack(fluidOutput, CONSUMED_FLUID); + + if (Objects.isNull(fluidOutputStack)) return false; + + this.addFluidOutputs(new FluidStack[] { fluidOutputStack }); + + outputAfterRecipe(); + + return true; + } + + private void outputAfterRecipe() { + + if (!mOutputBeamline.isEmpty()) { + + BeamLinePacket packet = new BeamLinePacket( + new BeamInformation(outputEnergy, outputRate, outputParticle, outputFocus)); + + for (MTEHatchOutputBeamline o : mOutputBeamline) { + + o.q = packet; + } + } + } + + @Override + public void stopMachine() { + + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + machineFocus = 0; + machineTemp = 0; + super.stopMachine(); + + } + + @Override + public void stopMachine(ShutDownReason reason) { + + outputFocus = 0; + outputEnergy = 0; + outputParticle = 0; + outputRate = 0; + machineFocus = 0; + machineTemp = 0; + super.stopMachine(reason); + + } + + private BeamInformation getInputInformation() { + + for (MTEHatchInputBeamline in : this.mInputBeamline) { + + if (in.q == null) return new BeamInformation(0, 0, 0, 0); + // if (in.q == null) return new BeamInformation(10000, 10, 0, 90); // TODO temporary for testing purposes + + return in.q.getContent(); + } + return null; + } + + private static float getVoltageFactor(long mEU, int antennaTier) { + + // float factor = (float) Math.pow(1.00004, -mEU * Math.pow(antennaTier, 1.0/3.0) + 80000); + float factor = (float) -Math.pow(1.1, -mEU / 2000 * Math.pow(antennaTier, 2.0 / 3.0)) + 1; // Strictly improves + // with higher tier + // antenna + return (float) Math.max(1.0, factor); + + } + + /* + * private static float getTemperatureFactor(int temperature) { float factor = (float) Math.pow(1.11, 0.18 * + * temperature); return factor; } + */ + private static double calculateOutputParticleEnergy(long voltage, double inputParticleEnergy, int antennaTier) { + + /* + * Energy in general increases as input energy increases, with the relationship between the machine EUt and + * energy being an negative exponential, with a maximum depending on both input particle energy and antenna + * tier. The extent to which the output depends on the former is determined by the cbrt of the latter, meaning + * that increases in antenna tier result in diminishing returns. In the same way, the curve of the output energy + * vs. machine voltage exponential depends on antenna tier, with an increase in antenna tier resulting in a more + * shallow curve up. The effect of this also increases with the tier. LaTeX: + * -\frac{l^{1.11t^{\frac{1}{3}}}}{40000000}\cdot\left(0.15^{\frac{2}{t^{\frac{3}{2}}}}\right)^{\frac{x}{60768}} + * \ +\ \frac{l^{1.11t^{\frac{1}{3}}}}{40000000} + */ + + double energy = (Math.pow(inputParticleEnergy, 1.13 * Math.pow(antennaTier, 4.0 / 9.0)) / 40_000_000) + * (-Math.pow(Math.pow(0.15, 2.0 / (Math.pow(antennaTier, 5.0 / 2.0))), voltage / 60768.0) + 1); // In + // keV + + return energy; + + } + + private static float getMachineFocus(int temperature) { + + return (float) Math.max(Math.min(Math.pow(1.5, -1.0 / 40.0 * (temperature - 480)), 90), 10); + } + + // Punny, right? + private static float getOutputRatetio(float voltageFactor, int antennaTier) { + return (float) (voltageFactor / (10 / Math.pow(2.5, antennaTier))); // Scale ratio with antenna tier, such a + // high + // exponential should be fine so long as + // there + // are only few antenna tiers + } + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("Synchrotron.hint", 12); + } + + @Override + public String[] getInfoData() { + + long storedEnergy = 0; + long maxEnergy = 0; + for (MTEHatchEnergy tHatch : mEnergyHatches) { + if (tHatch.isValid()) { + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); + } + } + + BeamInformation information = this.getInputInformation(); + + return new String[] { + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GTUtility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GTUtility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %", + + /* 7 */ EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.info") + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.focus") + ": " // Machine Focus: + + EnumChatFormatting.BLUE + + machineFocus + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.temperature") + ": " // Temperature: + + EnumChatFormatting.DARK_RED + + machineTemp + + EnumChatFormatting.RESET + + " K", // e.g. "137 K" + StatCollector.translateToLocal("beamline.coolusage") + ": " // Coolant Usage: + + EnumChatFormatting.AQUA + + 32_000 + + EnumChatFormatting.RESET + + " kL/s", // 32 kL/s + + /* 8 */ EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.in_pre") + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " // "Multiblock Beamline Input:" + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(information.getParticleId()) + .getLocalisedName() // e.g. "Electron + // (e-)" + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " // "Energy:" + + EnumChatFormatting.DARK_RED + + information.getEnergy() + + EnumChatFormatting.RESET + + " keV", // e.g. "10240 keV" + StatCollector.translateToLocal("beamline.focus") + ": " // "Focus:" + + EnumChatFormatting.BLUE + + information.getFocus() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " // "Amount:" + + EnumChatFormatting.LIGHT_PURPLE + + information.getRate(), + EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.out_pre") // "Multiblock Beamline + // Output:" + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(this.outputParticle) + .getLocalisedName() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " + + EnumChatFormatting.DARK_RED + + this.outputEnergy * 1000 + + EnumChatFormatting.RESET + + " eV", + StatCollector.translateToLocal( + "beamline.focus") + ": " + EnumChatFormatting.BLUE + this.outputFocus + " " + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " + + EnumChatFormatting.LIGHT_PURPLE + + this.outputRate, }; + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + + this.mInputBeamline.clear(); + this.mOutputBeamline.clear(); + + this.mAntennaCasings.clear(); + + this.mEnergyHatches.clear(); + this.energyHatchTier = 0; + this.antennaeTier = 0; + + this.glassTier = 0; + + this.outputEnergy = 0; + this.outputRate = 0; + this.outputFocus = 0; + this.outputParticle = 0; + + if (!checkPiece(STRUCTURE_PIECE_ENTRANCE, 16, 3, 1)) return false; + if (!checkPiece(STRUCTURE_PIECE_BASE, 16, 3, 0)) return false; + + return this.mInputBeamline.size() == 1 && this.mOutputBeamline.size() == 1 + && this.mMaintenanceHatches.size() == 1 + && this.mEnergyHatches.size() == 4 + && this.glassTier >= MIN_GLASS_TIER; + } + + @Override + public int getMaxEfficiency(ItemStack aStack) { + return 10000; + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 0; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return false; + } + +} diff --git a/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java new file mode 100644 index 0000000000..8545d5e23a --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/MTETargetChamber.java @@ -0,0 +1,480 @@ +package gtnhlanth.common.tileentity; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlockAdder; +import static gregtech.api.enums.GTValues.VN; +import static gregtech.api.enums.HatchElement.Energy; +import static gregtech.api.enums.HatchElement.InputBus; +import static gregtech.api.enums.HatchElement.Maintenance; +import static gregtech.api.enums.HatchElement.OutputBus; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_OIL_CRACKER_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; +import static gregtech.api.util.GTStructureUtility.buildHatchAdder; +import static gtnhlanth.util.DescTextLocalization.BLUEPRINT_INFO; +import static gtnhlanth.util.DescTextLocalization.addDotText; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; + +import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable; +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import bartworks.common.loaders.ItemRegistry; +import gregtech.api.GregTechAPI; +import gregtech.api.enums.TickTime; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.MTEEnhancedMultiBlockBase; +import gregtech.api.metatileentity.implementations.MTEHatchEnergy; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.render.TextureFactory; +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gregtech.api.util.MultiblockTooltipBuilder; +import gtnhlanth.common.beamline.BeamInformation; +import gtnhlanth.common.beamline.Particle; +import gtnhlanth.common.hatch.MTEBusInputFocus; +import gtnhlanth.common.hatch.MTEHatchInputBeamline; +import gtnhlanth.common.register.LanthItemList; +import gtnhlanth.common.tileentity.recipe.beamline.BeamlineRecipeAdder2; +import gtnhlanth.common.tileentity.recipe.beamline.RecipeTC; +import gtnhlanth.util.DescTextLocalization; + +public class MTETargetChamber extends MTEEnhancedMultiBlockBase<MTETargetChamber> implements ISurvivalConstructable { + + private static final IStructureDefinition<MTETargetChamber> STRUCTURE_DEFINITION; + + private ArrayList<MTEHatchInputBeamline> mInputBeamline = new ArrayList<>(); + + private ArrayList<MTEBusInputFocus> mInputFocus = new ArrayList<>(); + + private static final int CASING_INDEX_FRONT = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings3, 10); // Grate + private static final int CASING_INDEX_CENTRE = GTUtility.getCasingTextureIndex(GregTechAPI.sBlockCasings5, 14); // Shielded + // Acc. + + private float inputEnergy; + private float inputRate; + private int inputParticle; + private float inputFocus; + + // spotless:off + static { + STRUCTURE_DEFINITION = StructureDefinition.<MTETargetChamber>builder() + .addShape( + "base", + new String[][] { + {"ggggg", "gjjjg", "gjbjg", "gjjjg", "ff~ff"}, + {"cslsc", "s-r-s", "srhrs", "s-r-s", "ccccc"}, + {"csssc", "s---s", "s---s", "s---s", "ccccc"}, + {"csssc", "s---s", "s---s", "s---s", "ccccc"}, + {"cstsc", "s-u-s", "suius", "s-u-s", "ccccc"}, + {"ggggg", "gjjjg", "gjojg", "gjjjg", "ggggg"}}) + + .addElement('g', ofBlock(GregTechAPI.sBlockCasings3, 10)) //Grate casing + .addElement( + 'f', + buildHatchAdder(MTETargetChamber.class).atLeast(Maintenance, Energy) + .casingIndex(CASING_INDEX_FRONT).dot(2).buildAndChain(ofBlock(GregTechAPI.sBlockCasings3, 10))) + + .addElement('j', ofBlockAdder(MTETargetChamber::addGlass, ItemRegistry.bw_glasses[0], 1)) + .addElement('b', buildHatchAdder(MTETargetChamber.class).hatchClass(MTEHatchInputBeamline.class).casingIndex(CASING_INDEX_CENTRE).dot(5).adder(MTETargetChamber::addBeamLineInputHatch).build()) + .addElement('c', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_CASING, 0)) + + .addElement('l', buildHatchAdder(MTETargetChamber.class).hatchClass(MTEBusInputFocus.class).casingIndex(CASING_INDEX_CENTRE).dot(1).adder(MTETargetChamber::addFocusInputHatch).build()) + + .addElement('t', buildHatchAdder(MTETargetChamber.class).atLeast(InputBus).casingIndex(CASING_INDEX_CENTRE).dot(3).build()) + .addElement('s', ofBlock(LanthItemList.SHIELDED_ACCELERATOR_GLASS, 0)) + .addElement('r', ofBlock(LanthItemList.FOCUS_MANIPULATION_CASING, 0)) + .addElement('h', ofBlock(LanthItemList.FOCUS_HOLDER, 0)) + .addElement('u', ofBlock(LanthItemList.TARGET_RECEPTACLE_CASING, 0)) + .addElement('i', ofBlock(LanthItemList.TARGET_HOLDER, 0)) + .addElement('o', buildHatchAdder(MTETargetChamber.class).atLeast(OutputBus).casingIndex(CASING_INDEX_CENTRE).dot(4).build()) + + .build(); + } + //spotless:on + + private boolean addGlass(Block block, int meta) { + return block == ItemRegistry.bw_glasses[0]; + } + + private boolean addBeamLineInputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEHatchInputBeamline) { + return this.mInputBeamline.add((MTEHatchInputBeamline) mte); + } + + return false; + } + + private boolean addFocusInputHatch(IGregTechTileEntity te, int casingIndex) { + + if (te == null) return false; + + IMetaTileEntity mte = te.getMetaTileEntity(); + + if (mte == null) return false; + + if (mte instanceof MTEBusInputFocus) { + return this.mInputFocus.add((MTEBusInputFocus) mte); + } + + return false; + } + + public MTETargetChamber(int id, String name, String nameRegional) { + super(id, name, nameRegional); + } + + public MTETargetChamber(String name) { + super(name); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity te) { + return new MTETargetChamber(this.mName); + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection side, ForgeDirection facing, + int colorIndex, boolean active, boolean redstoneLevel) { + // Placeholder + if (side == facing) { + if (active) return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_ACTIVE_GLOW) + .extFacing() + .glow() + .build() }; + return new ITexture[] { casingTexturePages[0][47], TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER) + .extFacing() + .build(), + TextureFactory.builder() + .addIcon(OVERLAY_FRONT_OIL_CRACKER_GLOW) + .extFacing() + .glow() + .build() }; + } + return new ITexture[] { casingTexturePages[0][47] }; + } + + @Override + protected MultiblockTooltipBuilder createTooltip() { + final MultiblockTooltipBuilder tt = new MultiblockTooltipBuilder(); + tt.addMachineType("Collision Chamber") + .addInfo("Controller block for the Target Chamber") + .addInfo("Hitting things with other things") + + .addInfo(BLUEPRINT_INFO) + .addInfo(DescTextLocalization.BEAMLINE_SCANNER_INFO) + .addSeparator() + .beginStructureBlock(5, 5, 6, true) + .addController("Front bottom") + .addCasingInfoExactly("Grate Machine Casing", 29, false) + .addCasingInfoExactly("Shielded Accelerator Casing", 28, false) + .addCasingInfoExactly("Borosilicate Glass", 16, true) + .addCasingInfoExactly(LanthItemList.SHIELDED_ACCELERATOR_GLASS.getLocalizedName(), 34, false) + .addCasingInfoExactly(LanthItemList.TARGET_RECEPTACLE_CASING.getLocalizedName(), 4, false) + .addCasingInfoExactly(LanthItemList.FOCUS_MANIPULATION_CASING.getLocalizedName(), 4, false) + .addCasingInfoExactly(LanthItemList.FOCUS_HOLDER.getLocalizedName(), 1, false) + .addCasingInfoExactly(LanthItemList.TARGET_HOLDER.getLocalizedName(), 1, false) + .addOtherStructurePart("Focus Input Bus", addDotText(1)) + .addMaintenanceHatch(addDotText(2)) + .addEnergyHatch(addDotText(2)) + .addInputBus(addDotText(3)) + .addOutputBus(addDotText(4)) + .addOtherStructurePart("Beamline Input Hatch", addDotText(5)) + .toolTipFinisher("GTNH: Lanthanides"); + return tt; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece("base", stackSize, hintsOnly, 2, 4, 0); + + } + + @Override + public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) { + if (mMachine) return -1; + return survivialBuildPiece("base", stackSize, 2, 4, 0, elementBudget, env, false, true); + } + + @Override + public IStructureDefinition<MTETargetChamber> getStructureDefinition() { + return STRUCTURE_DEFINITION; + } + + @Override + public RecipeMap<?> getRecipeMap() { + return BeamlineRecipeAdder2.instance.TargetChamberRecipes; + } + + @Override + public boolean checkRecipe(ItemStack itemStack) { + + inputEnergy = 0; + inputRate = 0; + inputParticle = 0; + inputFocus = 0; + + ArrayList<ItemStack> tItems = this.getStoredInputs(); + ItemStack tFocusItem = this.getFocusItemStack(); + + ItemStack tFocusItemZeroDamage = null; + + if (tFocusItem != null) { + + tFocusItemZeroDamage = tFocusItem.copy(); + tFocusItemZeroDamage.setItemDamage(0); + } + + ArrayList<ItemStack> tItemsWithFocusItem = new ArrayList<>(); + tItemsWithFocusItem.add(tFocusItemZeroDamage); + tItemsWithFocusItem.addAll(tItems); + + long tVoltage = this.getMaxInputVoltage(); + + ItemStack[] tItemsArray = tItems.toArray(new ItemStack[0]); + + ItemStack[] tItemsWithFocusItemArray = tItemsWithFocusItem.toArray(new ItemStack[0]); + + RecipeTC tRecipe = (RecipeTC) BeamlineRecipeAdder2.instance.TargetChamberRecipes.findRecipeQuery() + .items(tItemsWithFocusItemArray) + .voltage(tVoltage) + .filter((GTRecipe recipe) -> { + + RecipeTC recipeTc = (RecipeTC) recipe; + + BeamInformation inputInfo = this.getInputInformation(); + + int particle = recipeTc.particleId; + + return (particle == inputInfo.getParticleId() + && !(inputInfo.getEnergy() < recipeTc.minEnergy || inputInfo.getEnergy() > recipeTc.maxEnergy)); + + }) + .find(); + + if (tRecipe == null || !tRecipe.isRecipeInputEqual(true, new FluidStack[] {}, tItemsWithFocusItemArray)) + return false; + + if (tRecipe.focusItem != null) { + if (tRecipe.focusItem.getItem() != tFocusItem.getItem()) return false; + } + + this.mEfficiency = (10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + BeamInformation inputInfo = this.getInputInformation(); + + if (inputInfo == null) return false; + + inputEnergy = inputInfo.getEnergy(); + inputRate = inputInfo.getRate(); + inputParticle = inputInfo.getParticleId(); + inputFocus = inputInfo.getFocus(); + + if (inputEnergy < tRecipe.minEnergy || inputEnergy > tRecipe.maxEnergy) return false; + + if (inputFocus < tRecipe.minFocus) return false; + + if (inputParticle != tRecipe.particleId) return false; + + this.mMaxProgresstime = Math.max(Math.round((tRecipe.amount / inputRate * 5 * TickTime.SECOND)), 1); // 5 + // seconds + // per + // integer multiple + // over the rate. E.g., 100a, 10r + // would equal 50 seconds + if (this.mMaxProgresstime == Integer.MAX_VALUE - 1 && this.mEUt == Integer.MAX_VALUE - 1) return false; + + mEUt = (int) -tVoltage; + if (this.mEUt > 0) this.mEUt = (-this.mEUt); + + this.mOutputItems = tRecipe.mOutputs; + + if (tRecipe.focusItem != null) // Recipe actually uses the mask, can also assume machine mask item is nonnull + // due to above conditions + mInputFocus.get(0) + .depleteFocusDurability(1); + + this.updateSlots(); + + return true; + } + + private BeamInformation getInputInformation() { + + for (MTEHatchInputBeamline in : this.mInputBeamline) { + + if (in.q == null) return new BeamInformation(0, 0, 0, 0); + // if (in.q == null) return new BeamInformation(10, 10, Particle.PHOTON.ordinal(), 90); // temporary + // for + // testing purposes + + return in.q.getContent(); + } + return null; + } + + private ItemStack getFocusItemStack() { + + for (MTEBusInputFocus hatch : this.mInputFocus) { + return hatch.getContentUsageSlots() + .get(0); + } + + return null; + + } + + @Override + public boolean checkMachine(IGregTechTileEntity arg0, ItemStack arg1) { + + mInputBeamline.clear(); + mInputFocus.clear(); + + if (!checkPiece("base", 2, 4, 0)) return false; + + return this.mInputBeamline.size() == 1 && this.mMaintenanceHatches.size() == 1 + && this.mInputBusses.size() == 1 + && this.mOutputBusses.size() == 1 + && this.mInputFocus.size() == 1; + } + + @Override + public boolean explodesOnComponentBreak(ItemStack arg0) { + return false; + } + + @Override + public int getDamageToComponent(ItemStack arg0) { + return 0; + } + + @Override + public int getMaxEfficiency(ItemStack arg0) { + return 10000; + } + + @Override + public boolean isCorrectMachinePart(ItemStack arg0) { + return true; + } + + @Override + public String[] getStructureDescription(ItemStack arg0) { + return DescTextLocalization.addText("TargetChamber.hint", 13); + } + + @Override + public String[] getInfoData() { + + long storedEnergy = 0; + long maxEnergy = 0; + for (MTEHatchEnergy tHatch : mEnergyHatches) { + if (tHatch.isValid()) { + storedEnergy += tHatch.getBaseMetaTileEntity() + .getStoredEU(); + maxEnergy += tHatch.getBaseMetaTileEntity() + .getEUCapacity(); + } + } + + BeamInformation information = this.getInputInformation(); + + return new String[] { + /* 1 */ StatCollector.translateToLocal("GT5U.multiblock.Progress") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(mProgresstime / 20) + + EnumChatFormatting.RESET + + " s / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(mMaxProgresstime / 20) + + EnumChatFormatting.RESET + + " s", + /* 2 */ StatCollector.translateToLocal("GT5U.multiblock.energy") + ": " + + EnumChatFormatting.GREEN + + GTUtility.formatNumbers(storedEnergy) + + EnumChatFormatting.RESET + + " EU / " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(maxEnergy) + + EnumChatFormatting.RESET + + " EU", + /* 3 */ StatCollector.translateToLocal("GT5U.multiblock.usage") + ": " + + EnumChatFormatting.RED + + GTUtility.formatNumbers(getActualEnergyUsage()) + + EnumChatFormatting.RESET + + " EU/t", + /* 4 */ StatCollector.translateToLocal("GT5U.multiblock.mei") + ": " + + EnumChatFormatting.YELLOW + + GTUtility.formatNumbers(getMaxInputVoltage()) + + EnumChatFormatting.RESET + + " EU/t(*2A) " + + StatCollector.translateToLocal("GT5U.machines.tier") + + ": " + + EnumChatFormatting.YELLOW + + VN[GTUtility.getTier(getMaxInputVoltage())] + + EnumChatFormatting.RESET, + /* 5 */ StatCollector.translateToLocal("GT5U.multiblock.problems") + ": " + + EnumChatFormatting.RED + + (getIdealStatus() - getRepairStatus()) + + EnumChatFormatting.RESET + + " " + + StatCollector.translateToLocal("GT5U.multiblock.efficiency") + + ": " + + EnumChatFormatting.YELLOW + + Float.toString(mEfficiency / 100.0F) + + EnumChatFormatting.RESET + + " %", + + /* 6 */ EnumChatFormatting.BOLD + StatCollector.translateToLocal("beamline.in_pre") + + ": " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.particle") + ": " // "Multiblock Beamline Input:" + + EnumChatFormatting.GOLD + + Particle.getParticleFromId(information.getParticleId()) + .getLocalisedName() // e.g. "Electron + // (e-)" + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.energy") + ": " // "Energy:" + + EnumChatFormatting.DARK_RED + + information.getEnergy() * 1000 // In line with the synchrotron's output + + EnumChatFormatting.RESET + + " eV", // e.g. "10240 eV" + StatCollector.translateToLocal("beamline.focus") + ": " // "Focus:" + + EnumChatFormatting.BLUE + + information.getFocus() + + " " + + EnumChatFormatting.RESET, + StatCollector.translateToLocal("beamline.amount") + ": " // "Amount:" + + EnumChatFormatting.LIGHT_PURPLE + + information.getRate(), }; + } + +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeAdder2.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeAdder2.java new file mode 100644 index 0000000000..dad71375c3 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeAdder2.java @@ -0,0 +1,165 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import java.util.Arrays; + +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; + +import gregtech.api.gui.modularui.GTUITextures; +import gregtech.api.recipe.RecipeMap; +import gregtech.api.recipe.RecipeMapBackend; +import gregtech.api.recipe.RecipeMapBuilder; +import gregtech.api.util.GTUtility; +import gtnhlanth.common.beamline.Particle; + +public class BeamlineRecipeAdder2 { + + public static final BeamlineRecipeAdder2 instance = new BeamlineRecipeAdder2(); + + public final RecipeMap<RecipeMapBackend> SourceChamberRecipes = RecipeMapBuilder.of("gtnhlanth.recipe.sc") + .minInputs(0, 0) + .maxIO(1, 2, 0, 0) + .amperage(1) + .frontend(SourceChamberFrontend::new) + .progressBar(GTUITextures.PROGRESSBAR_ASSEMBLY_LINE_1) + .neiSpecialInfoFormatter((recipeInfo) -> { + + RecipeSC recipe = (RecipeSC) recipeInfo.recipe; + + float focus = recipe.focus; + float maxEnergy = recipe.maxEnergy; + + int amount = recipe.rate; + + Particle particle = Particle.getParticleFromId(recipe.particleId); + + return Arrays.asList( + + // StatCollector.translateToLocal("beamline.particle") + ": " + particle.getLocalisedName(), + + StatCollector.translateToLocal("beamline.energy") + ": <=" + + GTUtility.formatNumbers(Math.min(maxEnergy, particle.maxSourceEnergy())) + + " keV", + + StatCollector.translateToLocal("beamline.focus") + ": " + GTUtility.formatNumbers(focus), + + StatCollector.translateToLocal("beamline.rate") + ": " + GTUtility.formatNumbers(amount) + + ); + }) + // .slotOverlays(null) + + .build(); + + public final RecipeMap<RecipeMapBackend> TargetChamberRecipes = RecipeMapBuilder.of("gtnhlanth.recipe.tc") + .minInputs(0, 0) + .maxIO(3, 4, 0, 0) + .frontend(TargetChamberFrontend::new) + .neiSpecialInfoFormatter(((recipeInfo) -> { + + RecipeTC recipe = (RecipeTC) recipeInfo.recipe; + + float minEnergy = recipe.minEnergy; + float maxEnergy = recipe.maxEnergy; + + float minFocus = recipe.minFocus; + + float amount = recipe.amount; + + Particle particle = Particle.getParticleFromId(recipe.particleId); + + return Arrays.asList( + + // StatCollector.translateToLocal("beamline.particle") + ": " + particle.getLocalisedName(), + + StatCollector.translateToLocal("beamline.energy") + ": " + + GTUtility.formatNumbers(minEnergy * 1000) + + "-" + + GTUtility.formatNumbers(maxEnergy * 1000) + + " eV", // Note the eV unit + + StatCollector.translateToLocal("beamline.focus") + ": >=" + GTUtility.formatNumbers(minFocus), + + StatCollector.translateToLocal("beamline.amount") + ": " + GTUtility.formatNumbers(amount) + + ); + })) + // .slotOverlays(null) + .progressBar(GTUITextures.PROGRESSBAR_ASSEMBLY_LINE_1) + .progressBarPos(108, 22) + .neiTransferRect(100, 22, 28, 18) + .build(); + + /*** + * + * @param itemInputs - duh + * @param itemOutputs - duh + * @param particleId - The ID of the {@link Particle} generated by the recipe. + * It is recommended to use Particle#ordinal() + * @param rate - The rate/amount of particles generated + * @param maxEnergy - The maximum energy particles generated by this recipe can possess (keV). Set this value >= + * max particle energy to limit it to the latter + * @param focus - Focus of the particle generated + * @param energyRatio - Set high for little-to-no EUt energy scaling, low for the opposite + * @param minEUt - Minimum EUt required for the recipe. ! May not output if input energy is equal to minimum ! + */ + public boolean addSourceChamberRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, int particleId, int rate, + float maxEnergy, float focus, float energyRatio, int minEUt) { + + return (SourceChamberRecipes.addRecipe( + new RecipeSC( + false, + itemInputs, + itemOutputs, + null, + new int[] {}, + null, + null, + 20, + minEUt, + particleId, + rate, + maxEnergy, + focus, + energyRatio)) + != null); + } + + /*** + * + * @param itemInput - The item to be used as a target. Should have durability + * @param itemOutput - duh + * @param particleId - The ID of the {@link Particle} used by the recipe. It + * is recommended to use Particle#ordinal() + * @param amount - The total amount of particles required for the recipe to come to completion. The duration of + * the recipe will be determined by this and the input particle rate. + * @param minEnergy - The minimum energy amount required by this recipe in keV (inclusive) + * @param maxEnergy - The maximum energy amount allowed by this recipe in keV (inclusive) + * @param minFocus - Minimum focus allowed by the recipe + * @param energyRatio - Set high for little-to-no EUt energy scaling, low for the opposite + * @param minEUt - Minimum EUt required for the recipe to start + */ + + public boolean addTargetChamberRecipe(ItemStack itemInput, ItemStack itemOutput, ItemStack itemFocus, + int particleId, int amount, float minEnergy, float maxEnergy, float minFocus, float energyRatio, int minEUt) { + + return (TargetChamberRecipes.addRecipe( + new RecipeTC( + false, + itemInput, + itemOutput, + itemFocus, + particleId, + amount, + minEnergy, + maxEnergy, + minFocus, + energyRatio, + minEUt), + false, + false, + false) != null); + + } + +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeLoader.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeLoader.java new file mode 100644 index 0000000000..d71b9a571e --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/BeamlineRecipeLoader.java @@ -0,0 +1,193 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import java.util.Arrays; +import java.util.HashMap; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GTOreDictUnificator; +import gregtech.api.util.GTUtility; +import gtPlusPlus.core.material.MaterialsElements; +import gtnhlanth.common.beamline.Particle; +import gtnhlanth.common.item.MaskList; +import gtnhlanth.common.register.LanthItemList; +import gtnhlanth.common.register.WerkstoffMaterialPool; + +public class BeamlineRecipeLoader { + + public static final HashMap<String, Fluid> coolantMap = new HashMap<>(); + + private static final ItemList[] VIABLE_WAFERS = new ItemList[] { ItemList.Circuit_Silicon_Wafer, + ItemList.Circuit_Silicon_Wafer2, ItemList.Circuit_Silicon_Wafer3, ItemList.Circuit_Silicon_Wafer4, + ItemList.Circuit_Silicon_Wafer5, ItemList.Circuit_Silicon_Wafer6, ItemList.Circuit_Silicon_Wafer7 }; + + public static void load() { + + /* + * Coolant list + */ + + coolantMap.put( + Materials.LiquidNitrogen.getGas(1L) + .getFluid() + .getName(), + Materials.Nitrogen.getGas(1L) + .getFluid()); + coolantMap.put( + Materials.LiquidOxygen.getGas(1L) + .getFluid() + .getName(), + Materials.Oxygen.getGas(1L) + .getFluid()); + coolantMap.put("ic2coolant", FluidRegistry.getFluid("ic2hotcoolant")); + coolantMap.put( + Materials.SuperCoolant.getFluid(1L) + .getFluid() + .getName(), + Materials.Water.getFluid(1L) + .getFluid()); + + /* + * ELECTRON + */ + BeamlineRecipeAdder2.instance.addSourceChamberRecipe( + new ItemStack[] { GTOreDictUnificator.get(OrePrefixes.stick, Materials.Tungsten, 1) }, + null, + Particle.ELECTRON.ordinal(), + 20, + 1000, + 98, + 0.1f, + 7680); + + BeamlineRecipeAdder2.instance.addSourceChamberRecipe( + new ItemStack[] { WerkstoffMaterialPool.LanthanumHexaboride.get(OrePrefixes.stickLong, 1) }, + null, + Particle.ELECTRON.ordinal(), + 60, + 5000, + 99, + 0.3f, + 7680); + + /* + * NEUTRON + */ + BeamlineRecipeAdder2.instance.addSourceChamberRecipe( + new ItemStack[] { MaterialsElements.getInstance().CALIFORNIUM.getDust(1) }, + null, + Particle.NEUTRON.ordinal(), + 10, + 9000, + 95, + 999, + 1920); + + /* + * ALPHA + */ + BeamlineRecipeAdder2.instance.addSourceChamberRecipe( + new ItemStack[] { Materials.Uranium.getDust(1) }, + new ItemStack[] { WerkstoffMaterialPool.Thorium234.get(OrePrefixes.dust, 1) }, + Particle.ALPHA.ordinal(), + 1, + 4270, + 90, + 999, + 480); + + /* + * TARGET CHAMBER + */ + + for (MaskList mask : MaskList.values()) { + + if (mask.getProducedItem() == null) // Blank or error + continue; + + int index = 0; + for (ItemList wafer : VIABLE_WAFERS) { + + index++; + + if (!Arrays.asList(mask.getForbiddenWafers()) + .contains(wafer)) { + + BeamlineRecipeAdder2.instance.addTargetChamberRecipe( + wafer.get(1), + GTUtility.copyAmountUnsafe((int) Math.pow(2, index + 2), mask.getProducedItem()), + new ItemStack(LanthItemList.maskMap.get(mask), 0), + 1, + mask.getBaselineAmount() * (int) Math.pow(Math.sqrt(3), index - 1), // 3x recipe amount increase + // per 2 increases in wafer + // tier. This greatly + // incentivises the use of + // higher tier boule wafer + // recipes + mask.getMinEnergy(), + mask.getMaxEnergy(), + mask.getMinFocus(), + 1, + 1920); + + } + + } + + /* + * if (!Arrays.asList(MaskList.CPU.getForbiddenWafers()).contains(wafer)) { + * BeamlineRecipeAdder.instance.addTargetChamberRecipe( wafer.get(1), GT_Utility.copyAmountUnsafe((int) + * Math.pow(2, index + 2), ItemList.Circuit_Wafer_CPU.get(1)), //Varies new + * ItemStack(LanthItemList.maskMap.get(MaskList.CPU), 0), // Varies 0, 10 * (int) Math.pow(2, index - 1), // + * Varies 1, //Varies 10000000, //Varies 50, //Varies 1, 1920 ); } /* PPIC + */ + + /* + * if (!Arrays.asList(MaskList.PPIC.getForbiddenWafers()).contains(wafer)) { + * GTLog.out.print("Adding recipe for PPIC with " + wafer.get(1).getUnlocalizedName() + " amount: " + 40 * + * (int) Math.pow(2, index - 1)); BeamlineRecipeAdder.instance.addTargetChamberRecipe( wafer.get(1), + * ItemList.Circuit_Wafer_PPIC.get((int) Math.pow(2, index + 2)), //Varies new + * ItemStack(LanthItemList.maskMap.get(MaskList.PPIC), 0), // Varies 0, 40 * (int) Math.pow(2, index - 1), + * // Varies 1, //Varies 10000000, //Varies 50, //Varies 1, 1920 ); } + */ + + } + /* + * BeamlineRecipeAdder2.instance.addTargetChamberRecipe( new ItemStack(Items.coal, 1), new + * ItemStack(Items.diamond, 1), null, 1, 20, 100, 1000, 60, 1, 1920); + * BeamlineRecipeAdder2.instance.addTargetChamberRecipe( new ItemStack(Items.coal, 1), new + * ItemStack(Items.cooked_chicken, 1), null, 1, 20, 1, 10, 60, 1, 1920); + */ + + BeamlineRecipeAdder2.instance.addTargetChamberRecipe( + new ItemStack(Items.chicken, 1), + new ItemStack(Items.cooked_chicken), + null, + Particle.PHOTON.ordinal(), + 400, + 5, + 20, + 80, + 1, + 7864320); + + BeamlineRecipeAdder2.instance.addTargetChamberRecipe( + new ItemStack(Items.chicken, 1), + new ItemStack(Items.egg), + null, + Particle.PHOTON.ordinal(), + 400, + 21, + 600, + 80, + 1, + 7864320); + + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeSC.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeSC.java new file mode 100644 index 0000000000..979cb6a8bb --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeSC.java @@ -0,0 +1,52 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import java.util.ArrayList; +import java.util.Arrays; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gtnhlanth.common.register.LanthItemList; + +public class RecipeSC extends GTRecipe { + + public int particleId; + public int rate; + public float maxEnergy; + public float focus; + public float energyRatio; + + public RecipeSC(boolean aOptimize, ItemStack[] aInputs, ItemStack[] aOutputs, Object aSpecialItems, int[] aChances, + FluidStack[] aFluidInputs, FluidStack[] aFluidOutputs, int aDuration, int aEUt, int particleId, int rate, + float maxEnergy, float focus, float energyRatio) { + + super(aOptimize, aInputs, aOutputs, null, aChances, null, null, aDuration, aEUt, 0); + + this.particleId = particleId; + this.rate = rate; + this.maxEnergy = maxEnergy; + this.focus = focus; + this.energyRatio = energyRatio; + } + + @Override + public ItemStack getRepresentativeOutput(int aIndex) { + + ArrayList<ItemStack> mOutputsWithParticle = new ArrayList<>(); + + ItemStack particleStack = new ItemStack(LanthItemList.PARTICLE_ITEM); + + Items.ender_pearl.setDamage(particleStack, this.particleId); + + mOutputsWithParticle.addAll(Arrays.asList(mOutputs)); + mOutputsWithParticle.add(particleStack); + + ItemStack[] mOutputsWithParticleArray = mOutputsWithParticle.toArray(new ItemStack[0]); + + if (aIndex < 0 || aIndex >= mOutputsWithParticleArray.length) return null; + return GTUtility.copyOrNull(mOutputsWithParticleArray[aIndex]); + } +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeTC.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeTC.java new file mode 100644 index 0000000000..30be015abb --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/RecipeTC.java @@ -0,0 +1,71 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import java.util.ArrayList; +import java.util.Arrays; + +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +import gregtech.api.util.GTRecipe; +import gregtech.api.util.GTUtility; +import gtnhlanth.common.register.LanthItemList; + +public class RecipeTC extends GTRecipe { + + public int particleId; + public int amount; + + public float minEnergy; + public float maxEnergy; + + public float minFocus; + public float energyRatio; + + public ItemStack focusItem; + + public RecipeTC(boolean aOptimize, ItemStack aInput, ItemStack aOutput, ItemStack aFocusItem, int particleId, + int amount, float minEnergy, float maxEnergy, float minFocus, float energyRatio, int aEUt) { + + super( + aOptimize, + new ItemStack[] { aFocusItem, aInput }, + new ItemStack[] { aOutput }, + null, + null, + null, + null, + 1, + aEUt, + 0); + + this.particleId = particleId; + this.amount = amount; + + this.minEnergy = minEnergy; + this.maxEnergy = maxEnergy; + + this.minFocus = minFocus; + + this.energyRatio = energyRatio; + + this.focusItem = aFocusItem; + } + + @Override + public ItemStack getRepresentativeInput(int aIndex) { + + ArrayList<ItemStack> mInputsWithParticle = new ArrayList<>(); + + ItemStack particleStack = new ItemStack(LanthItemList.PARTICLE_ITEM); + Items.ender_pearl.setDamage(particleStack, this.particleId); + + mInputsWithParticle.add(particleStack); + mInputsWithParticle.addAll(Arrays.asList(mInputs)); + + ItemStack[] mInputsWithParticleArray = mInputsWithParticle.toArray(new ItemStack[0]); + + if (aIndex < 0 || aIndex >= mInputsWithParticleArray.length) return null; + return GTUtility.copyOrNull(mInputsWithParticleArray[aIndex]); + } + +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/SourceChamberFrontend.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/SourceChamberFrontend.java new file mode 100644 index 0000000000..3d8a3abfd1 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/SourceChamberFrontend.java @@ -0,0 +1,24 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import gregtech.api.recipe.BasicUIPropertiesBuilder; +import gregtech.api.recipe.NEIRecipePropertiesBuilder; +import gregtech.api.recipe.RecipeMapFrontend; +import gregtech.nei.RecipeDisplayInfo; + +public class SourceChamberFrontend extends RecipeMapFrontend { + + public SourceChamberFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder, + NEIRecipePropertiesBuilder neiPropertiesBuilder) { + super(uiPropertiesBuilder, neiPropertiesBuilder); + } + + @Override + public void drawDescription(RecipeDisplayInfo recipeInfo) { + drawEnergyInfo(recipeInfo); + // drawDurationInfo(recipeInfo); Unnecessary and misleading + drawSpecialInfo(recipeInfo); + drawMetadataInfo(recipeInfo); + drawRecipeOwnerInfo(recipeInfo); + } + +} diff --git a/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/TargetChamberFrontend.java b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/TargetChamberFrontend.java new file mode 100644 index 0000000000..87852381e6 --- /dev/null +++ b/src/main/java/gtnhlanth/common/tileentity/recipe/beamline/TargetChamberFrontend.java @@ -0,0 +1,109 @@ +package gtnhlanth.common.tileentity.recipe.beamline; + +import static gregtech.api.util.GTUtility.trans; + +import java.util.List; + +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; + +import com.gtnewhorizons.modularui.api.math.Pos2d; + +import gregtech.api.recipe.BasicUIPropertiesBuilder; +import gregtech.api.recipe.NEIRecipePropertiesBuilder; +import gregtech.api.recipe.RecipeMapFrontend; +import gregtech.api.util.GTUtility; +import gregtech.api.util.OverclockCalculator; +import gregtech.common.gui.modularui.UIHelper; +import gregtech.nei.GTNEIDefaultHandler; +import gregtech.nei.RecipeDisplayInfo; +import gtnhlanth.util.Util; + +public class TargetChamberFrontend extends RecipeMapFrontend { + + public TargetChamberFrontend(BasicUIPropertiesBuilder uiPropertiesBuilder, + NEIRecipePropertiesBuilder neiPropertiesBuilder) { + super(uiPropertiesBuilder, neiPropertiesBuilder); + } + + public void drawDescription(RecipeDisplayInfo recipeInfo) { + drawEnergyInfo(recipeInfo); + // drawDurationInfo(recipeInfo); + drawSpecialInfo(recipeInfo); + drawMetadataInfo(recipeInfo); + drawRecipeOwnerInfo(recipeInfo); + } + + @Override + protected void drawNEIOverlayForInput(GTNEIDefaultHandler.FixedPositionedStack stack) { + if (stack.isNotConsumed()) { // The stack actually takes damage, but is technically still not considered to be + // consumed by the code + drawNEIOverlayText("PC", stack); + } + } + + @Override + protected List<String> handleNEIItemInputTooltip(List<String> currentTip, + GTNEIDefaultHandler.FixedPositionedStack pStack) { + if (pStack.isNotConsumed()) { // See above + currentTip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("gtnhlanth.tt.pc")); // Partially + // consumed: + // Takes damage + // in the + // process + } + return currentTip; + } + + @Override + public void drawEnergyInfo(RecipeDisplayInfo recipeInfo) { + if (recipeInfo.calculator.getConsumption() <= 0) return; + + // recipeInfo.drawText(trans("152", "Total: ") + getTotalPowerString(recipeInfo.calculator)); + + recipeInfo.drawText(trans("153", "Usage: ") + getEUtDisplay(recipeInfo.calculator)); + recipeInfo.drawText(trans("154", "Voltage: ") + getVoltageString(recipeInfo.calculator)); + recipeInfo.drawText(trans("155", "Amperage: ") + getAmperageString(recipeInfo.calculator)); + + } + + @Override + public List<Pos2d> getItemOutputPositions(int itemOutputCount) { + return UIHelper.getGridPositions(itemOutputCount, 128, 24, 1, 3); // Make output items display vertically, not + // in a square + } + + @Override + public List<Pos2d> getItemInputPositions(int itemInputCount) { + + /* + * Pos2d posParticle = new Pos2d(8, 28); // Particle item ArrayList<Pos2d> posList = new ArrayList<>(); + * posList.add(posParticle); posList.addAll(UIHelper.getGridPositions(itemInputCount - 1, 36, 28, 3)); + */ + + List<Pos2d> posList = Util.getGridPositions(itemInputCount, 8, 20, 3, 1, 20); + return posList; + } + + private String getEUtDisplay(OverclockCalculator calculator) { + return getEUtWithoutTier(calculator); + } + + private String getEUtWithoutTier(OverclockCalculator calculator) { + return GTUtility.formatNumbers(calculator.getConsumption()) + " EU/t"; + } + + private String getVoltageString(OverclockCalculator calculator) { + long voltage = computeVoltageForEURate(calculator.getConsumption()); + return GTUtility.formatNumbers(voltage) + " EU/t" + GTUtility.getTierNameWithParentheses(voltage); + } + + private long computeVoltageForEURate(long euPerTick) { + return euPerTick; + } + + private String getAmperageString(OverclockCalculator calculator) { + return GTUtility.formatNumbers(1); + } + +} |