diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-01-06 18:18:27 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2019-01-06 18:18:27 +0000 |
commit | 05d2066fd364ddff525b9ac4b38771d196641a5e (patch) | |
tree | 11abbdf56d18c4cc542b9edeb6c73274c1675eee /src/Java/gtPlusPlus | |
parent | ae46cb2fab01f82ab49b1e63172da88e0adde212 (diff) | |
download | GT5-Unofficial-05d2066fd364ddff525b9ac4b38771d196641a5e.tar.gz GT5-Unofficial-05d2066fd364ddff525b9ac4b38771d196641a5e.tar.bz2 GT5-Unofficial-05d2066fd364ddff525b9ac4b38771d196641a5e.zip |
+ Added a new Alloy.
+ Added Recipes for the Fusion MK4 Components and the Deep Earth Drilling Platform components.
+ Added additional feature support to all Assembly Line recipes when TecTech is found.
+ Added initial work for future particle science.
% Initial functions added for Multiblock Requirements.
% More work on Multiblock Blueprints and Layers.
% Updated lead lined chest significantly.
% Improved Fish trap inventory handling and general logic, it's now slightly faster with slightly better loot rates.
% Changed texture of Fish trap.
Diffstat (limited to 'src/Java/gtPlusPlus')
27 files changed, 1618 insertions, 359 deletions
diff --git a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java index 5fb36e8189..90b005afbd 100644 --- a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java +++ b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java @@ -4,7 +4,14 @@ import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; - +import gtPlusPlus.GTplusplus; +import gtPlusPlus.api.interfaces.ITileTooltip; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.handler.GuiHandler; +import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import gtPlusPlus.core.util.minecraft.InventoryUtils; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -18,15 +25,6 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.interfaces.ITileTooltip; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.handler.GuiHandler; -import gtPlusPlus.core.item.base.itemblock.ItemBlockBasicTile; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; -import gtPlusPlus.core.util.minecraft.InventoryUtils; - public class DecayablesChest extends BlockContainer implements ITileTooltip { @SideOnly(Side.CLIENT) @@ -40,6 +38,7 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip * Determines which tooltip is displayed within the itemblock. */ private final int mTooltipID = 5; + public final int field_149956_a = 0; @Override public int getTooltipID() { @@ -54,8 +53,62 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockDecayablesChest"); LanguageRegistry.addName(this, "Lead Lined Box"); + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); } + + /** + * Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two + * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. + */ + public boolean isOpaqueCube() + { + return false; + } + + /** + * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) + */ + public boolean renderAsNormalBlock() + { + return false; + } + + /** + * The type of render function that is called for this block + */ + public int getRenderType() + { + return gtPlusPlus.core.client.renderer.RenderDecayChest.INSTANCE.mRenderID; + } + + /** + * Updates the blocks bounds based on its current state. Args: world, x, y, z + */ + public void setBlockBoundsBasedOnState(IBlockAccess p_149719_1_, int p_149719_2_, int p_149719_3_, int p_149719_4_) + { + if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ - 1) == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F); + } + else if (p_149719_1_.getBlock(p_149719_2_, p_149719_3_, p_149719_4_ + 1) == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F); + } + else if (p_149719_1_.getBlock(p_149719_2_ - 1, p_149719_3_, p_149719_4_) == this) + { + this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + else if (p_149719_1_.getBlock(p_149719_2_ + 1, p_149719_3_, p_149719_4_) == this) + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F); + } + else + { + this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F); + } + } + /** * Gets the block's texture. Args: side, meta @@ -101,11 +154,6 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip } @Override - public boolean isOpaqueCube() { - return false; - } - - @Override public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { return new TileEntityDecayablesChest(); } @@ -148,4 +196,17 @@ public class DecayablesChest extends BlockContainer implements ITileTooltip } }*/ + /** + * Update Chest Meta - Stub + * @param aWorld + * @param xPos + * @param yPos + * @param zPos + */ + @Deprecated + public void func_149954_e(World aWorld, int xPos, int yPos, int zPos) + { + + } + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java b/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java new file mode 100644 index 0000000000..c116dcf115 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/ModelDecayChest.java @@ -0,0 +1,46 @@ +package gtPlusPlus.core.client.model; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.model.ModelRenderer; + +@SideOnly(Side.CLIENT) +public class ModelDecayChest extends ModelBase +{ + /** The chest lid in the chest's model. */ + public ModelRenderer chestLid = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + /** The model of the bottom of the chest. */ + public ModelRenderer chestBelow; + /** The chest's knob in the chest model. */ + public ModelRenderer chestKnob; + + public ModelDecayChest() + { + this.chestLid.addBox(0.0F, -5.0F, -14.0F, 14, 5, 14, 0.0F); + this.chestLid.rotationPointX = 1.0F; + this.chestLid.rotationPointY = 7.0F; + this.chestLid.rotationPointZ = 15.0F; + this.chestKnob = (new ModelRenderer(this, 0, 0)).setTextureSize(64, 64); + this.chestKnob.addBox(-1.0F, -2.0F, -15.0F, 2, 4, 1, 0.0F); + this.chestKnob.rotationPointX = 8.0F; + this.chestKnob.rotationPointY = 7.0F; + this.chestKnob.rotationPointZ = 15.0F; + this.chestBelow = (new ModelRenderer(this, 0, 19)).setTextureSize(64, 64); + this.chestBelow.addBox(0.0F, 0.0F, 0.0F, 14, 10, 14, 0.0F); + this.chestBelow.rotationPointX = 1.0F; + this.chestBelow.rotationPointY = 6.0F; + this.chestBelow.rotationPointZ = 1.0F; + } + + /** + * This method renders out all parts of the chest model. + */ + public void renderAll() + { + this.chestKnob.rotateAngleX = this.chestLid.rotateAngleX; + this.chestLid.render(0.0625F); + this.chestKnob.render(0.0625F); + this.chestBelow.render(0.0625F); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java b/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java new file mode 100644 index 0000000000..7b120c5de1 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderDecayChest.java @@ -0,0 +1,81 @@ +package gtPlusPlus.core.client.renderer; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import cpw.mods.fml.client.registry.RenderingRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.model.ModelDecayChest; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.ResourceLocation; + +@SideOnly(Side.CLIENT) +public class RenderDecayChest extends TileEntitySpecialRenderer { + + private static final ResourceLocation mChestTexture = new ResourceLocation(CORE.MODID, "textures/blocks/TileEntities/DecayablesChest_full.png"); + private ModelDecayChest mChestModel = new ModelDecayChest(); + + public static RenderDecayChest INSTANCE; + public final int mRenderID; + + public RenderDecayChest() { + INSTANCE = this; + this.mRenderID = RenderingRegistry.getNextAvailableRenderId(); + Logger.INFO("Registered Lead Lined Chest Renderer."); + } + + public void renderTileEntityAt(TileEntityDecayablesChest p_147500_1_, double p_147500_2_, double p_147500_4_, + double p_147500_6_, float p_147500_8_) { + + int i = 0; + + if (true) { + this.bindTexture(mChestTexture); + GL11.glPushMatrix(); + GL11.glEnable(GL12.GL_RESCALE_NORMAL); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glTranslatef((float) p_147500_2_, (float) p_147500_4_ + 1.0F, (float) p_147500_6_ + 1.0F); + GL11.glScalef(1.0F, -1.0F, -1.0F); + GL11.glTranslatef(0.5F, 0.5F, 0.5F); + short short1 = 0; + + if (i == 2) { + short1 = 180; + } + + if (i == 3) { + short1 = 0; + } + + if (i == 4) { + short1 = 90; + } + + if (i == 5) { + short1 = -90; + } + + GL11.glRotatef((float) short1, 0.0F, 1.0F, 0.0F); + GL11.glTranslatef(-0.5F, -0.5F, -0.5F); + float f1 = p_147500_1_.prevLidAngle + (p_147500_1_.lidAngle - p_147500_1_.prevLidAngle) * p_147500_8_; + + f1 = 1.0F - f1; + f1 = 1.0F - f1 * f1 * f1; + mChestModel.chestLid.rotateAngleX = -(f1 * CORE.PI / 2.0F); + mChestModel.renderAll(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); + } + } + + public void renderTileEntityAt(TileEntity p_147500_1_, double p_147500_2_, double p_147500_4_, double p_147500_6_, + float p_147500_8_) { + this.renderTileEntityAt((TileEntityDecayablesChest) p_147500_1_, p_147500_2_, p_147500_4_, p_147500_6_, p_147500_8_); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java b/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java index 81f228064c..dfb9bb7298 100644 --- a/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java +++ b/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java @@ -34,6 +34,7 @@ public class Container_DecayablesChest extends Container { public Container_DecayablesChest(final InventoryPlayer inventory, final TileEntityDecayablesChest te) { this.tile_entity = te; this.inventoryChest = te.getInventory(); + te.openInventory(); int var6; int var7; @@ -81,6 +82,7 @@ public class Container_DecayablesChest extends Container { @Override public void onContainerClosed(final EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); + tile_entity.closeInventory(); } @Override diff --git a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java index fe1c8f64a9..a2f44441d9 100644 --- a/src/Java/gtPlusPlus/core/container/Container_FishTrap.java +++ b/src/Java/gtPlusPlus/core/container/Container_FishTrap.java @@ -34,6 +34,7 @@ public class Container_FishTrap extends Container { this.tile_entity = te; this.inventoryChest = te.getInventory(); + te.openInventory(); int var6; int var7; this.worldObj = te.getWorldObj(); @@ -80,6 +81,7 @@ public class Container_FishTrap extends Container { @Override public void onContainerClosed(final EntityPlayer par1EntityPlayer) { super.onContainerClosed(par1EntityPlayer); + tile_entity.closeInventory(); } @Override diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index a9ad289e7f..b77abe1ef1 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -31,6 +31,7 @@ import gtPlusPlus.core.item.base.ingots.BaseItemIngot; import gtPlusPlus.core.item.base.ingots.BaseItemIngot_OLD; import gtPlusPlus.core.item.base.misc.BaseItemMisc; import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; +import gtPlusPlus.core.item.base.misc.BaseItemParticle; import gtPlusPlus.core.item.base.plates.BaseItemPlate; import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.bauble.HealthBoostBauble; @@ -289,6 +290,12 @@ public final class ModItems { public static Item boxFood; public static Item boxMagic; + private static DustDecayable dustMolybdenum99; + + private static DustDecayable dustTechnetium99; + + private static DustDecayable dustTechnetium99M; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -550,6 +557,7 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.TRINIUM_TITANIUM); MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH, false); MaterialGenerator.generate(ALLOY.TRINIUM_NAQUADAH_CARBON); + MaterialGenerator.generate(ALLOY.TRINIUM_REINFORCED_STEEL); //Top Tier Alloys MaterialGenerator.generate(ALLOY.LAFIUM); @@ -774,10 +782,28 @@ public final class ModItems { itemDoublePlateEuropium = new BaseItemPlateDouble(ELEMENT.getInstance().EUROPIUM); } + + /* + * Decayable Materials + */ + dustNeptunium238 = new DustDecayable("dustNeptunium238", Utils.rgbtoHexValue(175, 240, 75), 50640, new String[] {""+StringUtils.superscript("238Np"), "Result: Plutonium 238 ("+StringUtils.superscript("238Pu")+")"}, ELEMENT.getInstance().PLUTONIUM238.getDust(1).getItem(), 5); dustDecayedRadium226 = ItemUtils.generateSpecialUseDusts("DecayedRadium226", "Decayed Radium-226", "Contains Radon ("+StringUtils.superscript("222Rn")+")", ELEMENT.getInstance().RADIUM.getRgbAsHex())[0]; dustRadium226 = new DustDecayable("dustRadium226", ELEMENT.getInstance().RADIUM.getRgbAsHex(), 90000, new String[] {""+StringUtils.superscript("226Ra"), "Result: Radon ("+StringUtils.superscript("222Rn")+")"}, ItemUtils.getSimpleStack(dustDecayedRadium226).getItem(), 5); + dustTechnetium99 = new DustDecayable("dustTechnetium99", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 164500, new String[] {""+StringUtils.superscript("99Mo"), "Result: Ruthenium 99("+StringUtils.superscript("99Ru")+")"}, ELEMENT.getInstance().RUTHENIUM.getDust(1).getItem(), 4); + dustTechnetium99M = new DustDecayable("dustTechnetium99M", ELEMENT.getInstance().TECHNETIUM.getRgbAsHex(), 8570, new String[] {""+StringUtils.superscript("99ᵐTc"), "Result: Technicium 99 ("+StringUtils.superscript("99Tc")+")"}, dustTechnetium99, 4); + dustMolybdenum99 = new DustDecayable("dustMolybdenum99", ELEMENT.getInstance().MOLYBDENUM.getRgbAsHex(), 16450, new String[] {""+StringUtils.superscript("99Mo"), "Result: Technicium 99ᵐ ("+StringUtils.superscript("99ᵐTc")+")"}, dustTechnetium99M, 4); + + new BaseItemParticle(ELEMENT.getInstance().HYDROGEN, "Ion"); + new BaseItemParticle(ELEMENT.getInstance().HELIUM, "Ion"); + new BaseItemParticle(ELEMENT.getInstance().LITHIUM, "Ion"); + new BaseItemParticle(ELEMENT.getInstance().BERYLLIUM, "Ion"); + + + + + itemBoilerChassis = new ItemBoilerChassis(); itemDehydratorCoilWire = new ItemDehydratorCoilWire(); itemDehydratorCoil = new ItemDehydratorCoil(); diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java index 006c346c64..54710662d8 100644 --- a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java +++ b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java @@ -260,6 +260,7 @@ public class BaseItemTickable extends CoreItem { //Done Ticking if (maxTicks-getFilterDamage(world, aStack) <= 0) { setIsActive(world, aStack, false); + return false; } if (getIsActive(world, aStack)) { if (aNBT != null) { @@ -272,6 +273,9 @@ public class BaseItemTickable extends CoreItem { return true; } + else { + return false; + } } else { return false; @@ -293,7 +297,7 @@ public class BaseItemTickable extends CoreItem { @SuppressWarnings("unchecked") @Override - public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { + public void addInformation(ItemStack stack, EntityPlayer player, @SuppressWarnings("rawtypes") List list, boolean bool) { World world = player.getEntityWorld(); if (this.descriptionString.length > 0) { list.add(EnumChatFormatting.GRAY+this.descriptionString[0]); diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java index b9cd9ede5f..51b133241b 100644 --- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java +++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java @@ -22,7 +22,10 @@ public class ItemBlockBasicTile extends ItemBlock{ @Override public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { if (this.mID == 0){ //Fish trap - list.add("This trap catches fish faster if surrounded by more water blocks."); + list.add("This trap catches fish faster if surrounded by more water blocks"); + list.add("Can also be placed beside upto 4 other fish traps"); + list.add("Requires at least two faces touching water"); + list.add("1/1000 chance to produce triple loot."); } else if (this.mID == 1){ //Modularity list.add("Used to construct modular armour & bauble upgrades.."); @@ -39,8 +42,9 @@ public class ItemBlockBasicTile extends ItemBlock{ list.add("Default is used to select slot for auto-insertion"); } else if (this.mID == 5){ //Decayables Chest - list.add("Holds radioactive materials"); - list.add("Items which decay will tick while inside"); + list.add("Chest which holds radioactive materials"); + list.add("Items which decay will tick while inside"); + list.add("Place with right click"); } else { list.add("Bad Tooltip ID - "+mID); diff --git a/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java new file mode 100644 index 0000000000..363b9ad00d --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/base/misc/BaseItemParticle.java @@ -0,0 +1,26 @@ +package gtPlusPlus.core.item.base.misc; + +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.CoreItem; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; + +public class BaseItemParticle extends CoreItem { + + private final Material mParticleMaterial; + + public BaseItemParticle(Material aMat, String aType) { + super("particle"+aMat.getLocalizedName()+aType, aMat.getLocalizedName()+" "+aType, AddToCreativeTab.tabOther, 64, 0, new String[] {}, EnumRarity.rare, EnumChatFormatting.DARK_AQUA, false, null); + this.setTextureName(CORE.MODID + ":" + "science/Atom"); + mParticleMaterial = aMat; + } + + @Override + public int getColorFromItemStack(final ItemStack stack, final int HEX_OxFFFFFF) { + return this.mParticleMaterial.getRgbAsHex(); + } + +} diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java index 18d147e98c..aa6fdabacc 100644 --- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java +++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java @@ -10,7 +10,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; import gregtech.api.util.GT_OreDictUnificator; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.base.BaseItemTickable; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.EntityUtils; @@ -36,7 +35,7 @@ public class DustDecayable extends BaseItemTickable { this.mIcon[1] = reg.registerIcon(gt2); } - @SuppressWarnings("unchecked") + @SuppressWarnings({ "unchecked", "rawtypes" }) @Override public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) { super.addInformation(stack, player, list, bool); diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index f52856b824..a8b7d6b297 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -449,9 +449,8 @@ public final class ALLOY { false, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().SILICON, 40), - new MaterialStack(ELEMENT.getInstance().CARBON, 50), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) + new MaterialStack(ELEMENT.getInstance().SILICON, 50), + new MaterialStack(ELEMENT.getInstance().CARBON, 50) }); public static final Material TANTALUM_CARBIDE = new Material( @@ -465,9 +464,8 @@ public final class ALLOY { true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().TANTALUM, 40), - new MaterialStack(ELEMENT.getInstance().CARBON, 50), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) + new MaterialStack(ELEMENT.getInstance().TANTALUM, 50), + new MaterialStack(ELEMENT.getInstance().CARBON, 50) }); public static final Material ZIRCONIUM_CARBIDE = new Material( @@ -481,9 +479,8 @@ public final class ALLOY { true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 40), - new MaterialStack(ELEMENT.getInstance().CARBON, 50), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) + new MaterialStack(ELEMENT.getInstance().ZIRCONIUM, 50), + new MaterialStack(ELEMENT.getInstance().CARBON, 50) }); public static final Material NIOBIUM_CARBIDE = new Material( @@ -497,9 +494,8 @@ public final class ALLOY { true, //Uses Blast furnace? //Material Stacks with Percentage of required elements. new MaterialStack[]{ - new MaterialStack(ELEMENT.getInstance().NIOBIUM, 40), - new MaterialStack(ELEMENT.getInstance().CARBON, 50), - new MaterialStack(ELEMENT.getInstance().OXYGEN, 10) + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 50), + new MaterialStack(ELEMENT.getInstance().CARBON, 50) }); public static final Material LEAGRISIUM = new Material( @@ -615,6 +611,25 @@ public final class ALLOY { new MaterialStack(TRINIUM_NAQUADAH, 9), new MaterialStack(ELEMENT.getInstance().CARBON, 1) }); + + public static final Material TRINIUM_REINFORCED_STEEL = new Material( + "Arceus Alloy 2B", //Material Name + MaterialState.SOLID, //State + new short[]{205, 197, 23, 0}, //Material Colour + 7555, //Melting Point in C + 12350, + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().TRINIUM_REFINED, 30), + new MaterialStack(ALLOY.MARAGING350, 40), + new MaterialStack(ALLOY.TUNGSTENSTEEL, 20), + new MaterialStack(ALLOY.OSMIRIDIUM, 10) + }); + + /* * Witchery Material diff --git a/src/Java/gtPlusPlus/core/material/Ion.java b/src/Java/gtPlusPlus/core/material/Ion.java new file mode 100644 index 0000000000..2b5b113b92 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/Ion.java @@ -0,0 +1,30 @@ +package gtPlusPlus.core.material; + +public class Ion { + + private final Material mElement; + private final boolean mContainsPositiveCharge; + private final int mTotalIonization; + + public Ion(Material aMat, int chargeAmount) { + mElement = aMat; + mContainsPositiveCharge = (chargeAmount >= 0); + mTotalIonization = chargeAmount; + } + + public synchronized final Material getElement() { + return mElement; + } + + public synchronized final boolean containsPositiveCharge() { + return mContainsPositiveCharge; + } + + public synchronized final int getTotalIonization() { + return mTotalIonization; + } + + public final boolean isNeutral() { + return mTotalIonization == 0; + } +} diff --git a/src/Java/gtPlusPlus/core/material/Particle.java b/src/Java/gtPlusPlus/core/material/Particle.java new file mode 100644 index 0000000000..5b3e37b4a9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/material/Particle.java @@ -0,0 +1,105 @@ +package gtPlusPlus.core.material; + +public class Particle { + + public static final Particle GRAVITON; + + public static final Particle UP; + public static final Particle DOWN; + public static final Particle CHARM; + public static final Particle STRANGE; + public static final Particle TOP; + public static final Particle BOTTOM; + + public static final Particle ELECTRON; + public static final Particle ELECTRON_NEUTRINO; + public static final Particle MUON; + public static final Particle MUON_NEUTRINO; + public static final Particle TAU; + public static final Particle TAU_NEUTRINO; + + public static final Particle GLUON; + public static final Particle PHOTON; + public static final Particle Z_BOSON; + public static final Particle W_BOSON; + public static final Particle HIGGS_BOSON; + + public static final Particle PROTON; + public static final Particle NEUTRON; + public static final Particle LAMBDA; + public static final Particle OMEGA; + + public static final Particle PION; + public static final Particle ETA_MESON; + + static { + + /* + * Standard Model of Physics + */ + + //I exist, because I must. + GRAVITON = new Particle(ElementaryGroup.BOSON, "Graviton"); + + //Quarks + UP = new Particle(ElementaryGroup.QUARK, "Up"); + DOWN = new Particle(ElementaryGroup.QUARK, "Down"); + CHARM = new Particle(ElementaryGroup.QUARK, "Charm"); + STRANGE = new Particle(ElementaryGroup.QUARK, "Strange"); + TOP = new Particle(ElementaryGroup.QUARK, "Top"); + BOTTOM = new Particle(ElementaryGroup.QUARK, "Bottom"); + + //Leptons + ELECTRON = new Particle(ElementaryGroup.LEPTON, "Electron"); + MUON = new Particle(ElementaryGroup.LEPTON, "Muon"); + TAU = new Particle(ElementaryGroup.LEPTON, "Tau"); + ELECTRON_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Electron Neutrino"); + MUON_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Muon Neutrino"); + TAU_NEUTRINO = new Particle(ElementaryGroup.LEPTON, "Tau Neutrino"); + + //Bosons + GLUON = new Particle(ElementaryGroup.BOSON, "Gluon"); + PHOTON = new Particle(ElementaryGroup.BOSON, "Photon"); + Z_BOSON = new Particle(ElementaryGroup.BOSON, "Z Boson"); + W_BOSON = new Particle(ElementaryGroup.BOSON, "W Boson"); + HIGGS_BOSON = new Particle(ElementaryGroup.BOSON, "Higgs Boson"); + + /* + * Composite Particles + */ + + //Baryons + PROTON = new Particle(ElementaryGroup.BARYON, "Proton", new Particle[] {UP, UP, DOWN}); + NEUTRON = new Particle(ElementaryGroup.BARYON, "Neutron", new Particle[] {UP, DOWN, DOWN}); + LAMBDA = new Particle(ElementaryGroup.BARYON, "Lambda", new Particle[] {UP, DOWN, STRANGE}); + OMEGA = new Particle(ElementaryGroup.BARYON, "Omega", new Particle[] {STRANGE, STRANGE, STRANGE}); + + //Mesons + PION = new Particle(ElementaryGroup.MESON, "Pion", new Particle[] {MUON, MUON_NEUTRINO}); + ETA_MESON = new Particle(ElementaryGroup.MESON, "ETA Meson", new Particle[] {PION, PION, PION}); + + } + + public static enum ElementaryGroup { + QUARK, + LEPTON, + BOSON, + BARYON, + MESON; + } + + public final ElementaryGroup mParticleType; + public final String mParticleName; + public final Particle[] mComposition; + + public Particle(ElementaryGroup aParticleType, String aParticleName) { + this(aParticleType, aParticleName, null); + } + + public Particle(ElementaryGroup aParticleType, String aParticleName, Particle[] aComposition) { + mParticleType = aParticleType; + mParticleName = aParticleName; + mComposition = aComposition == null ? new Particle[] {this} : aComposition; + } + +} diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index 0cfda0ba6d..727a411e4f 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -30,6 +30,7 @@ import gtPlusPlus.australia.entity.type.EntityDingo; import gtPlusPlus.australia.entity.type.EntityOctopus; import gtPlusPlus.core.client.model.ModelGiantChicken; import gtPlusPlus.core.client.renderer.CustomOreBlockRenderer; +import gtPlusPlus.core.client.renderer.RenderDecayChest; import gtPlusPlus.core.client.renderer.RenderGiantChicken; import gtPlusPlus.core.client.renderer.RenderMiningExplosivesPrimed; import gtPlusPlus.core.client.renderer.RenderPlasmaBolt; @@ -50,6 +51,7 @@ import gtPlusPlus.core.handler.render.FirepitRender; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE.ConfigSwitches; import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.util.minecraft.particles.EntityParticleFXMysterious; import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; @@ -137,6 +139,8 @@ public class ClientProxy extends CommonProxy implements Runnable{ Logger.INFO("Registering Custom Renderer for the Fire Pit."); ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFirepit.class, new FirepitRender()); + Logger.INFO("Registering Custom Renderer for the Lead Lined Chest."); + ClientRegistry.bindTileEntitySpecialRenderer(TileEntityDecayablesChest.class, new RenderDecayChest()); //GT++ Australia diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index 96fb7f0125..97cef1ce0b 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -1102,6 +1102,12 @@ public class RECIPES_GREGTECH { 2 * 20); } + + //Technetium + GT_Values.RA.addChemicalRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustTechnetium99", 1), null, + FluidUtils.getFluidStack("sulfuricacid", 1000), FluidUtils.getFluidStack("sulfuricacid", 144 * 2), + ItemUtils.getItemStackOfAmountFromOreDict("dustTechnetium", 1), 100 * 20); + } diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index cf2e730cbe..1a83b74691 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -8,6 +8,7 @@ import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.ALLOY; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.minecraft.*; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -16,6 +17,7 @@ import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; public class RECIPES_Machines { @@ -860,18 +862,18 @@ public class RECIPES_Machines { CI.component_Plate[2], CI.electricMotor_ULV, CI.component_Plate[2], CI.getTieredCircuit(1), CI.machineHull_LV, CI.getTieredCircuit(0), GregtechItemList.Pollution_Detector.get(1)); - + //Air Intake Hatch - + ItemStack aTieredFluidRegulator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("FluidRegulator_IV").get(1, ItemList.Pump_IV.get(1)) : ItemList.Pump_IV.get(1); - - + + RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[6], ItemList.Casing_Grate.get(1), CI.component_Plate[6], CI.component_Plate[6], aTieredFluidRegulator, CI.component_Plate[6], CI.getTieredCircuit(5), ItemList.Hatch_Input_IV.get(1), CI.getTieredCircuit(5), GregtechItemList.Hatch_Air_Intake.get(1)); - + //ULV RecipeUtils.addShapedGregtechRecipe( CI.component_Plate[0], ItemUtils.simpleMetaStack(ModItems.itemAirFilter, 0, 1), CI.component_Plate[0], @@ -1048,7 +1050,7 @@ public class RECIPES_Machines { } - + //Shelves RecipeUtils.addShapedGregtechRecipe( "screwWood", "plateWood", "screwWood", @@ -1137,9 +1139,9 @@ public class RECIPES_Machines { } if (CORE.ConfigSwitches.enableMultiblock_LargeAutoCrafter){ - + ItemStack aCoreBlock = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Block_IridiumTungstensteel").get(1, ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1)) : ItemUtils.getItemStackOfAmountFromOreDict("blockOsmiridium", 1); - + RecipeUtils.recipeBuilder( "plateTungstenSteel", CI.craftingToolHammer_Hard, "plateTungstenSteel", "plateStellite", aCoreBlock, "plateStellite", @@ -1255,9 +1257,9 @@ public class RECIPES_Machines { CI.fieldGenerator_IV, CI.machineHull_ZPM, CI.robotArm_IV, plate, GregtechItemList.Gregtech_Computer_Cube.get(1), plate, GregtechItemList.Machine_Adv_ImplosionCompressor.get(1)); - - - + + + //Supply Depot plate = ALLOY.TUNGSTEN_CARBIDE.getPlateDouble(1); gear = ALLOY.TRINIUM_TITANIUM.getRing(1); @@ -1266,7 +1268,7 @@ public class RECIPES_Machines { cell2 = CI.electricMotor_IV; ItemStack casingAmazon = GregtechItemList.Casing_AmazonWarehouse.get(1); ItemStack aTieredUnboxinator = CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK ? ItemList.valueOf("Machine_LuV_Unboxinator").get(1, ItemList.Machine_IV_Unboxinator.get(1)) : ItemList.Machine_IV_Unboxinator.get(1); - + RecipeUtils.recipeBuilder( plate, ItemUtils.getItemStackOfAmountFromOreDict("cableGt12VanadiumGallium", 1), plate, @@ -1278,21 +1280,21 @@ public class RECIPES_Machines { CI.robotArm_LuV, aTieredUnboxinator, CI.robotArm_LuV, CI.conveyorModule_LuV, GregtechItemList.Gregtech_Computer_Cube.get(1), CI.conveyorModule_LuV, GregtechItemList.Amazon_Warehouse_Controller.get(1)); - - + + //Industrial Mixing Machine RecipeUtils.recipeBuilder( "plateStaballoy",CI.getTieredCircuit(5),"plateStaballoy", "plateZirconiumCarbide", EV_MACHINE_Mixer, "plateZirconiumCarbide", "plateStaballoy",CI.getTieredCircuit(5),"plateStaballoy", GregtechItemList.Industrial_Mixer.get(1)); - + } if (CORE.ConfigSwitches.enableMultiblock_IndustrialMultiMachine){ ItemStack plate = ALLOY.STABALLOY.getPlate(1); - + ItemStack o_Compressor; ItemStack o_Lathe; ItemStack o_Electromagnet; @@ -1375,8 +1377,151 @@ public class RECIPES_Machines { GregtechItemList.Charger_MAX.get(1)); + + + /* + * 6/1/19 - Content additions + */ + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + + /* + * Fusion MK4 + */ + + //Fusion MK4 Controller + CORE.RA.addAssemblylineRecipe( + ItemList.FusionComputer_UV.get(1), + (int) GT_Values.V[5], + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(9), 4 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(7), 32 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("wireGt16Superconductor", 8 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("plateDenseNeutronium", 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.fieldGenerator_ZPM, 6 * (CORE.GTNH ? 2 : 1)), + ItemList.Energy_LapotronicOrb2.get(1 * (CORE.GTNH ? 2 : 1)), + ItemList.FusionComputer_UV.get(1), + GregtechItemList.Casing_Fusion_Internal.get(1) + }, + new FluidStack[] { + ALLOY.PIKYONIUM.getFluid(32 * 144), + ALLOY.HG1223.getFluid(64 * 144) + }, + GregtechItemList.FusionComputer_UV2.get(1), + (int) GT_Values.V[6], + (int) GT_Values.V[8]); + + //Fusion MK4 Casing + CORE.RA.addAssemblylineRecipe( + ItemList.Casing_Fusion2.get(1), + (int) GT_Values.V[4], + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(5), 8 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(4), 16 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("blockTungstenCarbide", 4 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.electricMotor_ZPM, 3 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.electricPiston_LuV, 4 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.machineHull_ZPM, 1 * (CORE.GTNH ? 2 : 1)), + ItemList.Casing_Fusion2.get(1) + }, + new FluidStack[] { + Materials.NaquadahAlloy.getMolten(576 * (CORE.GTNH ? 2 : 1)), + ALLOY.ZERON_100.getFluid(16 * 144) + }, + GregtechItemList.Casing_Fusion_External.get(1), + (int) GT_Values.V[5], + (int) GT_Values.V[7]); + + //Fusion MK4 Coil + CORE.RA.addAssemblylineRecipe( + ItemList.Casing_Fusion_Coil.get(1), + (int) GT_Values.V[4], + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(8), 4 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(6), 8 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("plateNeutronium", 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.emitter_ZPM, 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.sensor_ZPM, 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.fieldGenerator_LuV, 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.getDataOrb(), 8 * (CORE.GTNH ? 2 : 1)), + ItemList.Energy_LapotronicOrb2.get(2 * (CORE.GTNH ? 2 : 1)), + ItemList.Casing_Fusion_Coil.get(1) + }, + new FluidStack[] { + ALLOY.CINOBITE.getFluid(16 * 144 * (CORE.GTNH ? 2 : 1)), + ALLOY.ABYSSAL.getFluid(64 * 144) + }, + GregtechItemList.Casing_Fusion_Internal.get(1), + (int) GT_Values.V[5], + (int) GT_Values.V[7]); + + + + + ItemStack aDrillController; + if (CORE.GTNH) { + aDrillController = ItemList.valueOf("OreDrill4").get(1); + } + else { + ItemList g = ItemList.valueOf("OreDrill4"); + if (g == null) { + aDrillController = CI.machineHull_UV; + } + else { + aDrillController = g.get(1); + } + } + + //Drilling Platform + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + aDrillController, + ItemUtils.getItemStackOfAmountFromOreDict("frameGtTriniumNaquadahCarbonite", 3), + ItemUtils.getItemStackOfAmountFromOreDict(CI.getTieredCircuitOreDictName(8), 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.conveyorModule_ZPM, 2 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.electricPump_ZPM, 4 * (CORE.GTNH ? 2 : 1)), + }, + ALLOY.LAFIUM.getFluid(144 * 8 * (CORE.GTNH ? 2 : 1)), + GregtechItemList.BedrockMiner_MKI.get(1), + (int) GT_Values.V[5], + (int) GT_Values.V[7]); + + //Drilling Platform Casings + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + ItemUtils.getItemStackOfAmountFromOreDict("frameGtTriniumNaquadahCarbonite", 4), + ItemUtils.getItemStackOfAmountFromOreDict("plateDoubleTriniumTitaniumAlloy", 1 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getItemStackOfAmountFromOreDict("gearGtPikyonium64B", 2 * (CORE.GTNH ? 2 : 1)), + ALLOY.TRINIUM_REINFORCED_STEEL.getPlateDouble(4 * (CORE.GTNH ? 2 : 1)), + ItemUtils.getSimpleStack(CI.machineHull_LuV, 1 * (CORE.GTNH ? 2 : 1)), + }, + ALLOY.MARAGING350.getFluid(144 * 16 * (CORE.GTNH ? 2 : 1)), + GregtechItemList.Casing_BedrockMiner.get(1), + (int) GT_Values.V[4], + (int) GT_Values.V[6]); + + + + + + + + + + } + + + + + + + + + + } - + //Mystic Frame @@ -1388,8 +1533,8 @@ public class RECIPES_Machines { ItemUtils.getSimpleStack(Dimension_Everglades.blockPortalFrame, 2))){ Logger.INFO("Added a recipe for the Toxic Everglades Portal frame"); } - - + + Logger.INFO("Done loading recipes for the Various machine blocks."); } } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java index 0a9a77a415..63ea1ac783 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java @@ -1,22 +1,40 @@ package gtPlusPlus.core.tileentities.general; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.inventories.Inventory_DecayablesChest; +import gtPlusPlus.core.item.materials.DustDecayable; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.inventories.Inventory_DecayablesChest; -import gtPlusPlus.core.item.materials.DustDecayable; -import gtPlusPlus.core.util.minecraft.ItemUtils; public class TileEntityDecayablesChest extends TileEntity implements ISidedInventory { - private final Inventory_DecayablesChest inventoryContents; + + /** Determines if the check for adjacent chests has taken place. */ + public boolean adjacentChestChecked; + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityDecayablesChest adjacentChestZNeg; + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityDecayablesChest adjacentChestXPos; + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityDecayablesChest adjacentChestXNeg; + /** Contains the chest tile located adjacent to this one (if any) */ + public TileEntityDecayablesChest adjacentChestZPos; + /** The current angle of the lid (between 0 and 1) */ + public float lidAngle; + /** The angle of the lid last tick */ + public float prevLidAngle; + /** The number of players currently using this chest */ + public int numPlayersUsing; + private int cachedChestType; + private String customName; - + private int tickCount = 0; public TileEntityDecayablesChest() { @@ -29,12 +47,22 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven @Override public void updateEntity() { - try{ + + // Try do chesty stuff + try { + this.updateEntityChest(); + } catch (Throwable t) { + + } + + try { if (!this.worldObj.isRemote) { - this.tickCount++; - - if ((this.tickCount % 20) == 0) { + if ((this.tickCount % 10) == 0) { + cachedChestType = 1; + } + + if ((this.tickCount % 20) == 0) { for (ItemStack inv : this.getInventory().getInventory()) { if (inv == null) { continue; @@ -44,23 +72,23 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven tryUpdateDecayable(D, inv, this.worldObj); } } - } + } + updateSlots(); } + } catch (final Throwable t) { } - catch (final Throwable t){} } - - + public void tryUpdateDecayable(final DustDecayable b, ItemStack iStack, final World world) { if (world == null || iStack == null) { return; - } + } if (world.isRemote) { return; } - - boolean a1, a2; + + boolean a1, a2; int u = 0; a1 = b.getIsActive(world, iStack); a2 = b.tickItemTag(world, iStack); @@ -71,13 +99,22 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven a1 = b.getIsActive(world, iStack); a2 = b.tickItemTag(world, iStack); u++; - } - - if (!a1 && !a2) { - ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult()); - replacement.stackSize=1; - iStack = replacement.copy(); - markDirty(); + } + Logger.INFO("| "+b.getUnlocalizedName()+" | "+a1+"/"+a2); + + if (!a1 && !a2) { + ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult()); + replacement.stackSize = 1; + //iStack = replacement.copy(); + for (int fff = 0; fff < this.inventoryContents.getSizeInventory(); fff++) { + if (this.inventoryContents.getStackInSlot(fff) == iStack) { + this.inventoryContents.setInventorySlotContents(fff, replacement.copy()); + } + } + + updateSlots(); + this.inventoryContents. + markDirty(); } } @@ -151,17 +188,28 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven @Override public void openInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + if (this.numPlayersUsing < 0) { + this.numPlayersUsing = 0; + } + if (!this.worldObj.isRemote) { + this.numPlayersUsing++; + cachedChestType = 1; + } + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); this.getInventory().openInventory(); } @Override - public void closeInventory() { - this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1); + public void closeInventory() { + if (!this.worldObj.isRemote) { + this.numPlayersUsing--; + cachedChestType = 1; + } + this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numPlayersUsing); this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType()); - this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); + this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType()); this.getInventory().closeInventory(); } @@ -173,8 +221,8 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven @Override public int[] getAccessibleSlotsFromSide(final int p_94128_1_) { final int[] accessibleSides = new int[this.getSizeInventory()]; - for (int r=0; r<this.getInventory().getSizeInventory(); r++){ - accessibleSides[r]=r; + for (int r = 0; r < this.getInventory().getSizeInventory(); r++) { + accessibleSides[r] = r; } return accessibleSides; @@ -182,12 +230,12 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven @Override public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) { - return true; + return this.getInventory().isItemValidForSlot(0, p_102007_2_); } @Override public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) { - return true; + return this.getInventory().isItemValidForSlot(0, p_102008_2_); } public String getCustomName() { @@ -208,4 +256,160 @@ public class TileEntityDecayablesChest extends TileEntity implements ISidedInven return (this.customName != null) && !this.customName.equals(""); } + /** + * Causes the TileEntity to reset all it's cached values for it's container + * Block, metadata and in the case of chests, the adjacent chest check + */ + public void updateContainingBlockInfo() { + super.updateContainingBlockInfo(); + this.adjacentChestChecked = false; + } + + /** + * Performs the check for adjacent chests to determine if this chest is double + * or not. + */ + public void checkForAdjacentChests() { + if (!this.adjacentChestChecked) { + this.adjacentChestChecked = true; + this.adjacentChestZNeg = null; + this.adjacentChestXPos = null; + this.adjacentChestXNeg = null; + this.adjacentChestZPos = null; + } + } + + public void updateEntityChest() { + float f; + this.prevLidAngle = this.lidAngle; + f = 0.04F; + double d2; + if (this.numPlayersUsing > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null + && this.adjacentChestXNeg == null) { + double d1 = (double) this.xCoord + 0.5D; + d2 = (double) this.zCoord + 0.5D; + this.worldObj.playSoundEffect(d1, (double) this.yCoord + 0.5D, d2, "random.chestopen", 0.5F, + this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.numPlayersUsing == 0 && this.lidAngle > 0.0F || this.numPlayersUsing > 0 && this.lidAngle < 1.0F) { + float f1 = this.lidAngle; + if (this.numPlayersUsing > 0) { + //this.lidAngle += f; + this.lidAngle += (float) (f * (1 + 0.10 * 0.01)); + } else { + //this.lidAngle -= f; + this.lidAngle -= (float) (f * (1 + 0.10 * 0.01)); + } + if (this.lidAngle > 1.0F) { + this.lidAngle = 1.0F; + } + float f2 = 0.5F; + if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null) { + d2 = (double) this.xCoord + 0.5D; + double d0 = (double) this.zCoord + 0.5D; + this.worldObj.playSoundEffect(d2, (double) this.yCoord + 0.5D, d0, "random.chestclosed", 0.5F, + this.worldObj.rand.nextFloat() * 0.1F + 0.9F); + } + + if (this.lidAngle < 0.0F) { + this.lidAngle = 0.0F; + } + } + } + + /** + * Called when a client event is received with the event number and argument, + * see World.sendClientEvent + */ + public boolean receiveClientEvent(int p_145842_1_, int p_145842_2_) { + if (p_145842_1_ == 1) + { + this.numPlayersUsing = p_145842_2_; + return true; + } + else + { + return super.receiveClientEvent(p_145842_1_, p_145842_2_); + } + } + + /** + * invalidates a tile entity + */ + public final void invalidate() { + super.invalidate(); + cachedChestType = 1; + this.updateContainingBlockInfo(); + this.checkForAdjacentChests(); + } + + private final int updateSlots() { + //Have slots changed? + if (cachedChestType == 0) { + return 0; + } + ItemUtils.organiseInventory(getInventory()); + cachedChestType = 0; + return cachedChestType; + +/* //Try merge stacks + for (int i = 0; i < this.getSizeInventory(); i++) { + for (int i2 = 0; i2 < this.getSizeInventory(); i2++) { + if (i != i2) { + ItemStack[] t1 = new ItemStack[] {this.getStackInSlot(i), this.getStackInSlot(i2)}; + if (t1[0] == null || t1[1] == null) { + continue; + } + else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) { + continue; + } + //Try Merge + else { + + if (GT_Utility.areStacksEqual(t1[0], t1[1])) { + while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { + t1[0].stackSize++; + t1[1].stackSize--; + if (t1[1].stackSize <= 0) { + t1[1] = null; + break; + } + if (t1[0].stackSize == 64) { + break; + } + } + this.setInventorySlotContents(i, t1[1]); + this.setInventorySlotContents(i2, t1[0]); + + } + } + } + } + } + + //Move nulls to end + int count2 = 0; + for (int i = 0; i < this.getSizeInventory(); i++) + if (this.getStackInSlot(i) != null) + this.setInventorySlotContents(count2++, this.getStackInSlot(i)); + while (count2 < this.getSizeInventory()) + this.setInventorySlotContents(count2++, null); + + //Sort by name + int arraySlot = 0; + HashMap<Integer, Pair<String, ItemStack>> aNameMap = new HashMap<Integer, Pair<String, ItemStack>>(); + + for (ItemStack ggg : this.inventoryContents.getInventory()) { + aNameMap.put(arraySlot++, new Pair<String, ItemStack>(ggg != null ? ggg.getDisplayName() : "", ggg)); + } + arraySlot = 0; + String[] aNameMapInternal = new String[aNameMap.size()]; + for (Pair pp : aNameMap.values()) { + aNameMapInternal[arraySlot++] = pp.getKey().toString(); + } + Arrays.sort(aNameMapInternal); */ + + } + } diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java index cafbbbe196..4220d57de6 100644 --- a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityFishTrap.java @@ -100,6 +100,7 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { public boolean tryAddLoot() { if (this.getInventory().getInventory() != null) { int checkingSlot = 0; + ItemUtils.organiseInventory(getInventory()); final ItemStack loot = this.generateLootForFishTrap().copy(); try { //Utils.LOG_WARNING("Trying to add "+loot.getDisplayName()+" | "+loot.getItemDamage()); @@ -203,9 +204,6 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { if ((this.tickCount % 20) == 0) { this.isInWater = this.isSurroundedByWater(); } - else { - - } if (this.isInWater) { this.calculateTickrate(); @@ -219,13 +217,20 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { // x["+this.locationX+"] y["+this.locationY+"] // z["+this.locationZ+"] (Ticking for loot every // "+this.baseTickRate+" ticks)"); - this.tryAddLoot(); + + int aExtraLootChance = MathUtils.randInt(1, 1000); + if (aExtraLootChance == 1000) { + this.tryAddLoot(); + this.tryAddLoot(); + this.tryAddLoot(); + } + else { + this.tryAddLoot(); + } + this.markDirty(); } else { - Logger.WARNING("This Trap does not have enough water around it."); - Logger.WARNING("Not adding Loot to the fishtrap at x[" + this.locationX + "] y[" + this.locationY - + "] z[" + this.locationZ + "] (Ticking for loot every " + this.baseTickRate + " ticks)"); this.markDirty(); } this.tickCount = 0; @@ -240,20 +245,24 @@ public class TileEntityFishTrap extends TileEntity implements ISidedInventory { } public void calculateTickrate() { - int calculateTickrate = 0; - if (this.waterSides <= 2) { - calculateTickrate = 0; - } - else if ((this.waterSides > 2) && (this.waterSides < 4)) { - calculateTickrate = 4800; - } - else if ((this.waterSides >= 4) && (this.waterSides < 6)) { - calculateTickrate = 3600; + int water = this.waterSides; + int variance = (int) ((MathUtils.randInt(200, 2000)/water)*0.5); + if (water <= 1) { + this.baseTickRate = 0; + } else if (water == 2) { + this.baseTickRate = 6800; + } else if (water == 3) { + this.baseTickRate = 5600; + } else if (water == 4) { + this.baseTickRate = 4400; + } else if (water == 5) { + this.baseTickRate = 3200; + } else { + this.baseTickRate = 1750; } - else if (this.waterSides == 6) { - calculateTickrate = 2400; + if (water > 1) { + this.baseTickRate += variance; } - this.baseTickRate = calculateTickrate; } public boolean anyPlayerInRange() { diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index fe344c70ed..d00f35f41f 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -7,6 +7,7 @@ import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; import net.minecraft.block.Block; import net.minecraft.init.Items; +import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemStack; @@ -17,6 +18,7 @@ import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.GregtechException; import gtPlusPlus.api.objects.Logger; @@ -895,5 +897,76 @@ public class ItemUtils { return true; } + + + public static IInventory organiseInventory(IInventory aInputInventory) { + ItemStack[] p = new ItemStack[aInputInventory.getSizeInventory()]; + for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { + p[o] = aInputInventory.getStackInSlot(o); + } + ItemStack[] g = organiseInventory(p); + IInventory aTemp = aInputInventory; + for (int o = 0; o < aInputInventory.getSizeInventory(); o++) { + aTemp.setInventorySlotContents(o, g[o]); + } + return aTemp; + } + + + public static ItemStack[] organiseInventory(ItemStack[] aInputs) { + + //Update Slots + int aInvSize = aInputs.length; + ItemStack[] newArray = new ItemStack[aInvSize]; + + + //Try merge stacks + for (int i = 0; i < aInvSize; i++) { + for (int i2 = 0; i2 < aInvSize; i2++) { + if (i != i2) { + ItemStack[] t1 = new ItemStack[] {aInputs[i], aInputs[i2]}; + if (t1[0] == null || t1[1] == null) { + continue; + } + else if (!GT_Utility.areStacksEqual(t1[0], t1[1])) { + continue; + } + //Try Merge + else { + + if (GT_Utility.areStacksEqual(t1[0], t1[1])) { + while ((t1[0].stackSize < 64 && t1[1].stackSize > 0)) { + t1[0].stackSize++; + t1[1].stackSize--; + if (t1[1].stackSize <= 0) { + t1[1] = null; + break; + } + if (t1[0].stackSize == 64) { + break; + } + } + newArray[i] = t1[1]; + newArray[i2] = t1[0]; + } + } + } + } + } + + ItemStack[] newArray2 = new ItemStack[aInvSize]; + + //Move nulls to end + int count2 = 0; + for (int i = 0; i < aInvSize; i++) + if (newArray[i] != null) + newArray2[count2++] = newArray[i]; + while (count2 < aInvSize) + newArray2[count2++] = null; + + return newArray2; + + + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 8bcaf0b2ec..26ac0dd4b2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -49,6 +49,7 @@ import gtPlusPlus.xmod.gregtech.api.gui.GUI_Multi_Basic_Slotted; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_ControlCore; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBattery; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBattery; +import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; @@ -81,6 +82,7 @@ GT_MetaTileEntity_MultiBlockBase { private static final Method findRecipe09; public GT_Recipe mLastRecipe; + private MultiblockRequirements mRequirements; private boolean mInternalCircuit = false; protected long mTotalRunTime = 0; @@ -233,6 +235,17 @@ GT_MetaTileEntity_MultiBlockBase { public abstract String[] getTooltip(); + public synchronized final MultiblockRequirements getRequirements() { + return mRequirements; + } + + //public abstract MultiblockRequirements setRequirements(); + + public synchronized final void setRequirementsInternal() { + //this.mRequirements = setRequirements(); + this.mRequirements = null; + } + public int getAmountOfOutputs() { return 1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java index cb6d2faabf..7af6af2ffd 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockBlueprint.java @@ -15,13 +15,24 @@ import net.minecraftforge.common.util.ForgeDirection; public abstract class MultiblockBlueprint { private final MultiblockLayer[] mBlueprintData; - + public final int height; public final int width; public final int depth; public final int mMinimumCasingCount; public final int mTextureID; - + + /** + * Cached Matrix of the Multiblock, which makes future structural checks far quicker. + */ + private final BlockPos[][][] StructureMatrix; + + /** + * Has {@value StructureMatrix} been set yet? + */ + @SuppressWarnings("unused") + private boolean mGeneratedMatrix = false; + /** * A detailed class which will contain blueprints for a Multiblock. * Values are not relative to the controller, but in total. @@ -38,9 +49,10 @@ public abstract class MultiblockBlueprint { depth = z; mMinimumCasingCount = aMinimumCasings; mTextureID = aTextureID; - Logger.INFO("Created new Blueprint."); + StructureMatrix = new BlockPos[width][height][depth]; + //Logger.INFO("Created new Blueprint."); } - + /** * * @param aY - The Y level of the layer to return, where 0 is the bottom and N is the top. @@ -49,7 +61,7 @@ public abstract class MultiblockBlueprint { public MultiblockLayer getLayer(int aY) { return mBlueprintData[aY]; } - + /** * * @param aLayer - A {@link MultiblockLayer} object. @@ -59,7 +71,7 @@ public abstract class MultiblockBlueprint { public void setLayer(MultiblockLayer aLayer, int aY) { mBlueprintData[aY] = aLayer; } - + public MultiblockLayer getControllerLayer() { for (MultiblockLayer u : mBlueprintData) { if (u.hasController()) { @@ -68,7 +80,7 @@ public abstract class MultiblockBlueprint { } return null; } - + public int getControllerY() { int i = 0; for (MultiblockLayer u : mBlueprintData) { @@ -79,20 +91,17 @@ public abstract class MultiblockBlueprint { } return 0; } - + + @SuppressWarnings({ "unused", "rawtypes" }) public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity) { - int mLogID = 0; - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"]"); - + //Check for Nulls if (aBaseMetaTileEntity == null) { return false; } - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"]"); final IMetaTileEntity aMetaTileEntity = aBaseMetaTileEntity.getMetaTileEntity(); if (aMetaTileEntity == null) { return false; } - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"]"); GT_MetaTileEntity_MultiBlockBase aControllerObject = null; if (aMetaTileEntity instanceof GT_MetaTileEntity_MultiBlockBase) { aControllerObject = (GT_MetaTileEntity_MultiBlockBase) aMetaTileEntity; @@ -100,212 +109,195 @@ public abstract class MultiblockBlueprint { if (aControllerObject == null) { return false; } - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"]"); - + + //Get some Vars int xOffSetMulti = ((this.getControllerLayer().width-1)/2); int zOffSetMulti = ((this.getControllerLayer().depth-1)/2); final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * xOffSetMulti; final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * zOffSetMulti; - - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"]"); - + ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); int tAmount = 0; - //Logger.INFO("Trying to Build Blueprint ["+(mLogID++)+"] (pre-Iteration)"); - - //Try Fancy Cache Stuff + int contX = aControllerObject.getBaseMetaTileEntity().getXCoord(), contY = aControllerObject.getBaseMetaTileEntity().getYCoord(), contZ = aControllerObject.getBaseMetaTileEntity().getZCoord(); - BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, 0, 0, 0); - BlockPos[][][] StructureMatrix = new BlockPos[width][height][depth]; + Logger.INFO("Controller is located at ["+contX+", "+contY+", "+contZ+"]"); - ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); - Pair<Integer, Integer> controllerLocationRelativeToGrid = this.getControllerLayer().getControllerLocation(); + boolean debugCacheDataVisually = true; - for (int Y = 0; Y < height; Y++) { - for (int Z = 0; Z < depth; Z++) { - for (int X = 0; X < width; X++) { - - int offsetX, offsetY, offsetZ; - - if (aDir == ForgeDirection.NORTH) { - offsetX = X; - offsetY = -this.getControllerY(); - offsetZ = Z; - } - - else if (aDir == ForgeDirection.EAST) { - offsetX = -X; - offsetY = -this.getControllerY(); - offsetZ = Z; - } + + if (/*!mGeneratedMatrix || StructureMatrix == null*/ true) { + //Try Fancy Cache Stuff + BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, 0, 0, 0); + for (int Y = 0; Y < height; Y++) { + for (int Z = 0; Z < depth; Z++) { + for (int X = 0; X < width; X++) { + int offsetX, offsetZ; + Pair<Integer, Integer> j = MultiblockLayer.rotateOffsetValues(aDir, X, Z); + offsetX = j.getKey(); + offsetZ = j.getValue(); - else if (aDir == ForgeDirection.SOUTH) { - offsetX = -X; - offsetY = -this.getControllerY(); - offsetZ = -Z; - } + Logger.INFO("Pre-Rotated Offsets ["+X+", "+(aPos.yPos + Y)+", "+Z+"] | "+aDir.name()); + Logger.INFO("Rotated Offsets ["+offsetX+", "+(aPos.yPos + Y)+", "+offsetZ+"]"); - else if (aDir == ForgeDirection.WEST) { - offsetX = X; - offsetY = -this.getControllerY(); - offsetZ = -Z; - } - else { - offsetX = X; - offsetY = -this.getControllerY(); - offsetZ = Z; - } - - //Resolve Negatives - int negTestX, negTestZ; - if (aPos.xPos < 0) { - //Logger.INFO("Found Negative X Pos."); - int testA = aPos.xPos; - testA -= -offsetX; - //Logger.INFO("Adding Inverted Offset of "+offsetX+", making "+testA); - negTestX = testA; - } - else { - negTestX = offsetX + aPos.xPos; - } - - if (aPos.zPos < 0) { - //Logger.INFO("Found Negative Z Pos."); - int testA = aPos.zPos; - testA -= -offsetZ; - //Logger.INFO("Adding Inverted Offset of "+offsetZ+", making "+testA); - negTestZ = testA; - } - else { - negTestZ = offsetZ + aPos.zPos; + // Resolve Negatives + int negTestX, negTestZ; + if (aPos.xPos < 0) { + int testA = aPos.xPos; + testA -= -offsetX; + negTestX = testA; + } else { + negTestX = offsetX + aPos.xPos; + } + if (aPos.zPos < 0) { + int testA = aPos.zPos; + testA -= -offsetZ; + negTestZ = testA; + } else { + negTestZ = offsetZ + aPos.zPos; + } + Logger.INFO("Caching With Offset ["+negTestX+", "+(aPos.yPos + Y)+", "+negTestZ+"]"); + StructureMatrix[X][Y][Z] = new BlockPos(negTestX, (aPos.yPos + Y), negTestZ, aPos.world); + + if (debugCacheDataVisually) { + aBaseMetaTileEntity.getWorld().setBlock(negTestX, (aPos.yPos + Y), negTestZ, Blocks.glass); + } } - - - StructureMatrix[X][Y][Z] = new BlockPos(negTestX, aPos.yPos + Y, negTestZ, aPos.world); } - } + } + Logger.INFO("Cached blueprint matrix."); + mGeneratedMatrix = true; } - + else { + Logger.INFO("Found cached blueprint matrix."); + } + + if (StructureMatrix == null) { + Logger.INFO("Error caching blueprint matrix."); + return false; + } + + int a1, a2, a3; a1 = StructureMatrix.length; a2 = StructureMatrix[0].length; - a3 = StructureMatrix[0][0].length; - - + a3 = StructureMatrix[0][0].length; + + Logger.INFO("Matrix Size ["+a1+", "+a2+", "+a3+"]"); + for (int H = 0; H < a2; H++) { - + MultiblockLayer currentLayer = this.getLayer(H); for (int W = 0; W < a1; W++) { for (int D = 0; D < a3; D++) { - + BlockPos aToCheck = StructureMatrix[W][H][D]; if (aToCheck == null) { Logger.INFO("Found bad data stored at X: "+W+", Y: "+H+", Z: "+D); continue; } - + else { + //Logger.INFO("Found data stored at X: "+W+", Y: "+H+", Z: "+D); + Logger.INFO("Checking "+aToCheck.getLocationString()); + } + final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntity(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); final Block tBlock = aBaseMetaTileEntity.getBlock(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); final int tMeta = aBaseMetaTileEntity.getMetaID(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos); + + LayerBlockData g1 = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); + if (g1 == null) { + Logger.INFO("Failed to find LayerBlockData. Using AIR_FALLBACK"); + //return false;*/ + g1 = LayerBlockData.FALLBACK_AIR_CHECK; + } + else { + if (g1.isController) { + Logger.INFO("Controller is at X: "+W+", Y: "+H+", Z: "+D); + } + } + + boolean isMatch = g1.match(tBlock, tMeta); - - if (!currentLayer.getBlockForPos(tBlock, tMeta, W, D, aDir)) { + if (!isMatch) { Logger.INFO("Checking ["+aToCheck.xPos+", "+ aToCheck.yPos +", "+ aToCheck.zPos+"]"); - Logger.INFO("Checking Position relative to Grid. X: "+W+", Y: "+H+", Z: "+D); - - - Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Bad ["+W+", "+D+"]"); - - LayerBlockData g; - if (aDir == ForgeDirection.SOUTH) { - g = currentLayer.mVariantOrientations.get(2)[W][D]; - } - else if (aDir == ForgeDirection.WEST) { - g = currentLayer.mVariantOrientations.get(3)[W][D]; - } - else if (aDir == ForgeDirection.NORTH) { - g = currentLayer.mVariantOrientations.get(0)[W][D]; - } - else if (aDir == ForgeDirection.EAST) { - g = currentLayer.mVariantOrientations.get(1)[W][D]; - } - else { - g = currentLayer.mLayerData[W][D]; - } - + Logger.INFO("Checking Position relative to Grid. X: "+W+", Y: "+H+", Z: "+D); + Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Bad ["+W+", "+D+"]"); + + LayerBlockData g = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); + if (g == null) { Logger.INFO("Expected "+" BAD DATA - Possibly Unset Area in Blueprint."); - + } else { - Logger.INFO("Expected "+g.mBlock.getLocalizedName()+" : "+g.mMeta + ""); - - } - - - - /* - BlockPos aPos2 = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, X, Y, Z); - aBaseMetaTileEntity.getWorld().setBlock(aPos2.xPos, aPos2.yPos, aPos2.zPos, Blocks.bedrock); */ - - return false; + Logger.INFO("Expected "+g.mBlock.getLocalizedName()+" : "+g.mMeta + ""); + } + aBaseMetaTileEntity.getWorld().setBlock(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos, g.mBlock); + aBaseMetaTileEntity.getWorld().setBlockMetadataWithNotify(aToCheck.xPos, aToCheck.yPos, aToCheck.zPos, g.mMeta, 4); + //return false; } else { - //Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Okay"); - if (!aControllerObject.addToMachineList(tTileEntity, mTextureID)) { - tAmount++; - } - } - } - } - } - - - - - try {/* - for (int Y = 0; Y < height; Y++) { - - MultiblockLayer aCurrentLayerToCheck = this.getLayer(Y); - int aWidth = aCurrentLayerToCheck.width; - int aDepth = aCurrentLayerToCheck.depth; - - - for (int Z = 0; Z < aDepth; Z++) { - for (int X = 0; X < aWidth; X++) { - - final IGregTechTileEntity tTileEntity = getTileAtOffset(aBaseMetaTileEntity, X, Y, Z); - final Pair<Block, Integer> tPair = getBlockAtOffset(aBaseMetaTileEntity, X, Y, Z); - final Block tBlock = tPair.getKey(); - final int tMeta = tPair.getValue(); - Logger.INFO("Checking Position relative to Controller. X: "+X+", Y: "+Y+", Z: "+Z); - Logger.INFO("Checking Position relative to Grid. X: "+X+", Y: "+Y+", Z: "+Z); - - if (!aCurrentLayerToCheck.getBlockForPos(tBlock, tMeta, X, Z, ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()))) { + LayerBlockData g = currentLayer.getDataFromCoordsWithDirection(aDir, W, D); + + + + + + + + + - Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Bad"); - BlockPos aPos2 = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, X, Y, Z); - aBaseMetaTileEntity.getWorld().setBlock(aPos2.xPos, aPos2.yPos, aPos2.zPos, Blocks.bedrock); + + + + + + + + + + boolean isHatchValidType = false; + if (g != null) { + if (g.canBeHatch && !g.isController && tTileEntity != null) { + IMetaTileEntity aMetaTileEntity2 = tTileEntity.getMetaTileEntity(); + if (aMetaTileEntity2 != null) { + if (aMetaTileEntity2 instanceof GT_MetaTileEntity_MultiBlockBase) { + isHatchValidType = true; + break; + } + else { + for (Class c : g.mHatchClass) { + if (c != null) { + if (c.isInstance(aMetaTileEntity2)) { + isHatchValidType = true; + break; + } + } + } + } + } + } + } - return false; - } - else { - Logger.INFO("Found "+tBlock.getLocalizedName()+" : "+tMeta + " | Okay"); + if (!isHatchValidType && !g.isController && tTileEntity != null) { + Logger.INFO("Checking ["+aToCheck.xPos+", "+ aToCheck.yPos +", "+ aToCheck.zPos+"]"); + Logger.INFO("Hatch Type did not match allowed types. "+tTileEntity.getClass().getSimpleName()); + return false; + } if (!aControllerObject.addToMachineList(tTileEntity, mTextureID)) { tAmount++; } + + } - } - } - } - */} - catch (Throwable r) { - r.printStackTrace(); - } - + } + } + } + boolean hasCorrectHatches = ( aControllerObject.mInputBusses.size() >= this.getMinimumInputBus() && aControllerObject.mOutputBusses.size() >= this.getMinimumOutputBus() && @@ -315,7 +307,7 @@ public abstract class MultiblockBlueprint { aControllerObject.mEnergyHatches.size() >= this.getMinimumInputEnergy() && aControllerObject.mMaintenanceHatches.size() >= this.getMinimumMaintHatch() && aControllerObject.mMufflerHatches.size() >= this.getMinimumMufflers()); - + Logger.INFO("mInputBusses: "+aControllerObject.mInputBusses.size()); Logger.INFO("mOutputBusses: "+aControllerObject.mOutputBusses.size()); @@ -325,30 +317,30 @@ public abstract class MultiblockBlueprint { Logger.INFO("mDynamoHatches: "+aControllerObject.mDynamoHatches.size()); Logger.INFO("mMaintenanceHatches: "+aControllerObject.mMaintenanceHatches.size()); Logger.INFO("mMufflerHatches: "+aControllerObject.mMufflerHatches.size()); - + boolean built = hasCorrectHatches && tAmount >= mMinimumCasingCount; Logger.INFO("Built? "+built); Logger.INFO("hasCorrectHatches? "+hasCorrectHatches); Logger.INFO("tAmount? "+tAmount); return built; } - + public BlockPos getOffsetRelativeToGridPosition(final IGregTechTileEntity aBaseMetaTileEntity, final int x, final int y, final int z) { - + if (aBaseMetaTileEntity == null) { return null; } - + int controllerX, controllerY, controllerZ; MultiblockLayer layerController = this.getControllerLayer(); - + if (layerController == null) { return null; } - + int controllerYRelative = this.getControllerY(); Pair<Integer, Integer> controllerLocationRelativeToGrid = layerController.getControllerLocation(); - + if (controllerLocationRelativeToGrid == null) { return null; } @@ -356,54 +348,52 @@ public abstract class MultiblockBlueprint { controllerX = aBaseMetaTileEntity.getXCoord(); controllerY = aBaseMetaTileEntity.getYCoord(); controllerZ = aBaseMetaTileEntity.getZCoord(); - + Logger.INFO("Controller is at ["+controllerX+", "+controllerY+", "+controllerZ+"]"); ForgeDirection aDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()); Logger.INFO("Controller is facing "+aDir.name()); - + //Find Bottom Left corner of Structure // 0, 0, 0 - - int offsetX, offsetY, offsetZ; - + + int offsetX, offsetY, offsetZ; + int X = controllerLocationRelativeToGrid.getKey(), Z = controllerLocationRelativeToGrid.getValue(); + Logger.INFO("Attempting to translate offsets ["+X+", "+Z+"]"); if (aDir == ForgeDirection.NORTH) { - offsetX = controllerLocationRelativeToGrid.getKey(); - offsetY = -controllerYRelative; - offsetZ = controllerLocationRelativeToGrid.getValue(); + offsetX = -X; + offsetZ = -Z; } else if (aDir == ForgeDirection.EAST) { - offsetX = controllerLocationRelativeToGrid.getValue(); - offsetY = -controllerYRelative; - offsetZ = -controllerLocationRelativeToGrid.getKey(); + offsetX = Z; + offsetZ = -X; } else if (aDir == ForgeDirection.SOUTH) { - offsetX = controllerLocationRelativeToGrid.getKey(); - offsetY = -controllerYRelative; - offsetZ = controllerLocationRelativeToGrid.getValue(); + offsetX = X; + offsetZ = Z; } else if (aDir == ForgeDirection.WEST) { - offsetX = -controllerLocationRelativeToGrid.getValue(); - offsetY = -controllerYRelative; - offsetZ = controllerLocationRelativeToGrid.getKey(); + offsetX = -Z; + offsetZ = X; } else { - offsetX = -controllerLocationRelativeToGrid.getKey(); - offsetY = -controllerYRelative; - offsetZ = -controllerLocationRelativeToGrid.getValue(); - } + offsetX = -X; + offsetZ = -Z; + } + + offsetY = -controllerYRelative; Logger.INFO("Attempting to use offsets ["+offsetX+", "+offsetY+", "+offsetZ+"]"); - + //Resolve Negatives - int negTestX, negTestY, negTestZ; + int negTestX, negTestZ; if (controllerX < 0) { Logger.INFO("Found Negative X Pos."); int testA = controllerX; - testA -= -offsetX; + testA -= offsetX; Logger.INFO("Adding Inverted Offset of "+offsetX+", making "+testA); negTestX = testA; } @@ -420,36 +410,36 @@ public abstract class MultiblockBlueprint { else { negTestZ = offsetZ + controllerZ; } - - + + //} //Bottom left Corner position BlockPos p = new BlockPos(negTestX, offsetY+controllerY, negTestZ, aBaseMetaTileEntity.getWorld()); Logger.INFO("World XYZ for Bottom left Corner Block of structure ["+p.xPos+", "+p.yPos+", "+p.zPos+"]"); - + //Add the xyz relative to the grid. BlockPos offsetPos = new BlockPos(p.xPos+x, p.yPos+y, p.zPos+z, aBaseMetaTileEntity.getWorld()); Logger.INFO("World XYZ for Target Check Block in structure ["+offsetPos.xPos+", "+offsetPos.yPos+", "+offsetPos.zPos+"]"); - + return p; } - - + + public IGregTechTileEntity getTileAtOffset(final IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z){ BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, x, y, z); final IGregTechTileEntity tTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityOffset(aPos.xPos, aPos.yPos, aPos.zPos); //aBaseMetaTileEntity.getWorld().setBlock(xh, yh, zh, Blocks.gold_ore); return tTileEntity; } - + public Pair<Block, Integer> getBlockAtOffset(final IGregTechTileEntity aBaseMetaTileEntity, int x, int y, int z){ BlockPos aPos = getOffsetRelativeToGridPosition(aBaseMetaTileEntity, x, y, z); final Block tBlock = aBaseMetaTileEntity.getBlockOffset(aPos.xPos, aPos.yPos, aPos.zPos); final int tMeta = aBaseMetaTileEntity.getMetaIDOffset(aPos.xPos, aPos.yPos, aPos.zPos); return new Pair<Block, Integer>(tBlock, tMeta); } - + public Triplet<Integer, Integer, Integer> getOffsetFromControllerTo00(){ MultiblockLayer l = this.getControllerLayer(); if (l == null) { @@ -457,14 +447,14 @@ public abstract class MultiblockBlueprint { } int yOffset = this.getControllerY(); Pair<Integer, Integer> cl = l.getControllerLocation(); - + if (cl == null) { return null; } return new Triplet<Integer, Integer, Integer> (cl.getKey(), yOffset, cl.getValue()); //return new Triplet<Integer, Integer, Integer> (cl.getKey(), yOffset, cl.getValue()); - + } public abstract int getMinimumInputBus(); @@ -475,5 +465,5 @@ public abstract class MultiblockBlueprint { public abstract int getMinimumOutputEnergy(); public abstract int getMinimumMaintHatch(); public abstract int getMinimumMufflers(); - + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java index bd77c9c8a1..9ffe1258f8 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/objects/MultiblockLayer.java @@ -3,11 +3,22 @@ package gtPlusPlus.xmod.gregtech.api.objects; import java.util.HashMap; import gregtech.api.GregTech_API; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_DataAccess; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.util.data.ArrayUtils; +import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer.LayerBlockData; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.init.Blocks; @@ -42,7 +53,7 @@ public class MultiblockLayer { width = x; depth = z; mLayerData = new LayerBlockData[x][z]; - Logger.INFO("Created new Blueprint Layer."); + //Logger.INFO("Created new Blueprint Layer."); } /** @@ -65,7 +76,7 @@ public class MultiblockLayer { * @return - Is this data added to the layer data map? */ public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch) { - return addBlockForPos(aBlock, aMeta, x, z, canBeHatch, null); + return addBlockForPos(aBlock, aMeta, x, z, canBeHatch, new Class[] {}); } /** @@ -79,12 +90,44 @@ public class MultiblockLayer { * @return - Is this data added to the layer data map? */ public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch, Class aHatchTypeClass) { + return addBlockForPos(aBlock, aMeta, x, z, canBeHatch, new Class[] {aHatchTypeClass}); + } + + /** + * + * @param aBlock - The block expected as this location. + * @param aMeta - The meta for the block above. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @param canBeHatch - is this location able to be substituted for a hatch? + * @param aHatchTypeClass - Specify the class for the hatch if you want it explicit. Use base classes to allow custom hatches which extend. + * @return - Is this data added to the layer data map? + */ + public boolean addBlockForPos(Block aBlock, int aMeta, int x, int z, boolean canBeHatch, Class[] aHatchTypeClass) { if (x > width -1) { return false; } if (z > depth - 1) { return false; } + + if (canBeHatch && (aHatchTypeClass == null || aHatchTypeClass.length <= 0)){ + aHatchTypeClass = new Class[] { + GT_MetaTileEntity_Hatch_DataAccess.class, + GT_MetaTileEntity_Hatch_Dynamo.class, + GT_MetaTileEntity_Hatch_Energy.class, + GT_MetaTileEntity_Hatch_Input.class, + GT_MetaTileEntity_Hatch_InputBus.class, + GT_MetaTileEntity_Hatch_Maintenance.class, + GT_MetaTileEntity_Hatch_Muffler.class, + GT_MetaTileEntity_Hatch_Output.class, + GT_MetaTileEntity_Hatch_OutputBus.class, + GT_MetaTileEntity_Hatch.class + }; + } + + + mLayerData[x][z] = new LayerBlockData(aBlock, aMeta, canBeHatch, aHatchTypeClass); return true; } @@ -99,6 +142,113 @@ public class MultiblockLayer { setControllerLocation(new Pair<Integer, Integer>(x, z)); return addBlockForPos(GregTech_API.sBlockMachines, 0, x, z, true, GT_MetaTileEntity_MultiBlockBase.class); } + + + /** + * Adds a Muffler to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addMuffler(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Muffler.class); + } + + + /** + * Adds a Maint Hatch to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addMaintHatch(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Maintenance.class); + } + + + /** + * Adds ah Input to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addInputBus(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_InputBus.class); + } + + + /** + * Adds an Output to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addOutputBus(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_OutputBus.class); + } + + /** + * Adds ah Input to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addInputHatch(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Input.class); + } + + + /** + * Adds an Output to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addOutputHatch(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Output.class); + } + + /** + * Adds ah Input to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addInput(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, new Class[] {GT_MetaTileEntity_Hatch_Input.class, GT_MetaTileEntity_Hatch_InputBus.class}); + } + + + /** + * Adds an Output to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addOutput(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, new Class[] {GT_MetaTileEntity_Hatch_Output.class, GT_MetaTileEntity_Hatch_OutputBus.class}); + } + + /** + * Adds ah Input to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addEnergyInput(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Energy.class); + } + + + /** + * Adds an Output to the layer at the designated location. + * @param x - The X location, where 0 is the top left corner & counts upwards, moving right. + * @param z - The Z location, where 0 is the top left corner & counts upwards, moving down. + * @return - Is this controller added to the layer data map? + */ + public boolean addEnergyOutput(Block aBlock, int aMeta, int x, int z) { + return addBlockForPos(aBlock, aMeta, x, z, true, GT_MetaTileEntity_Hatch_Dynamo.class); + } /** * @@ -110,7 +260,7 @@ public class MultiblockLayer { * @return - True if the correct Block was found. May also return true if a hatch is found when allowed or it's the controller. */ public boolean getBlockForPos(Block aBlock, int aMeta, int x, int z, ForgeDirection aDir) { - Logger.INFO("Grid Index X: "+x+" | Z: "+z + " | "+aDir.name()); + //Logger.INFO("Grid Index X: "+x+" | Z: "+z + " | "+aDir.name()); LayerBlockData g; if (aDir == ForgeDirection.SOUTH) { g = mVariantOrientations.get(2)[x][z]; @@ -121,11 +271,11 @@ public class MultiblockLayer { else if (aDir == ForgeDirection.NORTH) { LayerBlockData[][] aData = mVariantOrientations.get(0); if (aData != null) { - Logger.INFO("Found Valid Orientation Data. "+aData.length + ", "+aData[0].length); + //Logger.INFO("Found Valid Orientation Data. "+aData.length + ", "+aData[0].length); g = aData[x][z]; } else { - Logger.INFO("Did not find valid orientation data."); + //Logger.INFO("Did not find valid orientation data."); g = null; } } @@ -136,8 +286,8 @@ public class MultiblockLayer { g = mLayerData[x][z]; } if (g == null) { - /*Logger.INFO("Failed to find LayerBlockData."); - return false;*/ + Logger.INFO("Failed to find LayerBlockData. Using AIR_FALLBACK"); + //return false;*/ g = LayerBlockData.FALLBACK_AIR_CHECK; } @@ -164,32 +314,32 @@ public class MultiblockLayer { Logger.INFO("Failed to lock layer"); return; } - Logger.INFO("Trying to lock layer"); + //Logger.INFO("Trying to lock layer"); this.mFinalised = true; generateOrientations(); - Logger.INFO("Trying to Build Blueprint Layer [Constructed orietations & finalized]"); + //Logger.INFO("Trying to Build Blueprint Layer [Constructed orietations & finalized]"); } private void generateOrientations() { try { - Logger.INFO("Trying to gen orients for layer"); + //Logger.INFO("Trying to gen orients for layer"); //North mVariantOrientations.put(mLayerData); LayerBlockData[][] val; - Logger.INFO("1 done"); + //Logger.INFO("1 done"); //East val = rotateArrayClockwise(mLayerData); mVariantOrientations.put((LayerBlockData[][]) val); - Logger.INFO("2 done"); + //Logger.INFO("2 done"); //South val = rotateArrayClockwise(mLayerData); mVariantOrientations.put((LayerBlockData[][]) val); - Logger.INFO("3 done"); + //Logger.INFO("3 done"); //West val = rotateArrayClockwise(mLayerData); mVariantOrientations.put((LayerBlockData[][]) val); - Logger.INFO("4 done"); + //Logger.INFO("4 done"); } catch (Throwable t) { @@ -198,19 +348,19 @@ public class MultiblockLayer { } public static LayerBlockData[][] rotateArrayClockwise(LayerBlockData[][] mat) { - Logger.INFO("Rotating Layer 90' Clockwise"); + //Logger.INFO("Rotating Layer 90' Clockwise"); try { final int M = mat.length; final int N = mat[0].length; - Logger.INFO("Dimension X: "+M); - Logger.INFO("Dimension Z: "+N); + //Logger.INFO("Dimension X: "+M); + //Logger.INFO("Dimension Z: "+N); LayerBlockData[][] ret = new LayerBlockData[N][M]; for (int r = 0; r < M; r++) { for (int c = 0; c < N; c++) { ret[c][M-1-r] = mat[r][c]; } } - Logger.INFO("Returning Rotated Layer"); + //Logger.INFO("Returning Rotated Layer"); return ret; } catch (Throwable t) { @@ -237,7 +387,55 @@ public class MultiblockLayer { this.mControllerLocation = mControllerLocation; } + public LayerBlockData getDataFromCoordsWithDirection(ForgeDirection aDir, int W, int D) { + LayerBlockData g; + if (aDir == ForgeDirection.SOUTH) { + g = this.mVariantOrientations.get(2)[W][D]; + } + else if (aDir == ForgeDirection.WEST) { + g = this.mVariantOrientations.get(3)[W][D]; + } + else if (aDir == ForgeDirection.NORTH) { + g = this.mVariantOrientations.get(0)[W][D]; + } + else if (aDir == ForgeDirection.EAST) { + g = this.mVariantOrientations.get(1)[W][D]; + } + else { + g = this.mLayerData[W][D]; + } + return g; + } + + public static Pair<Integer, Integer> rotateOffsetValues(ForgeDirection aDir, int X, int Z) { + int offsetX, offsetZ; + + if (aDir == ForgeDirection.NORTH) { + offsetX = X; + offsetZ = Z; + } + else if (aDir == ForgeDirection.EAST) { + offsetX = -X; + offsetZ = Z; + } + + else if (aDir == ForgeDirection.SOUTH) { + offsetX = -X; + offsetZ = -Z; + } + + else if (aDir == ForgeDirection.WEST) { + offsetX = X; + offsetZ = -Z; + } + else { + offsetX = X; + offsetZ = Z; + } + + return new Pair<Integer, Integer>(offsetX, offsetZ); + } @@ -363,21 +561,25 @@ public class MultiblockLayer { public final Block mBlock; public final int mMeta; public final boolean canBeHatch; - public final Class mHatchClass; + public final Class[] mHatchClass; - private final boolean isController; + public final boolean isController; public LayerBlockData(Block aBlock, int aMeta, boolean aHatch) { - this(aBlock, aMeta, aHatch, null); + this(aBlock, aMeta, aHatch, new Class[] {}); } public LayerBlockData(Block aBlock, int aMeta, boolean aHatch, Class clazz) { + this(aBlock, aMeta, aHatch, new Class[] {clazz}); + } + + public LayerBlockData(Block aBlock, int aMeta, boolean aHatch, Class[] clazz) { mBlock = aBlock; mMeta = aMeta; canBeHatch = aHatch; mHatchClass = clazz; - if (clazz != null && clazz.equals(GT_MetaTileEntity_MultiBlockBase.class)) { + if (clazz != null && clazz.length > 0 && clazz[0].equals(GT_MetaTileEntity_MultiBlockBase.class)) { isController = true; } else { @@ -391,17 +593,20 @@ public class MultiblockLayer { if (blockToTest instanceof BlockAir && mBlock instanceof BlockAir) { return true; } - - //If Block does't match at all and it cannot be hatch - if (blockToTest != mBlock && !canBeHatch) { - return false; + + if (isController && blockToTest == GregTech_API.sBlockMachines) { + return true; } - - //If Block does Match, is not controller, is not hatch and Meta does not match - if (!isController && !canBeHatch && metaToTest != mMeta) { - return false; + + if (canBeHatch && blockToTest == GregTech_API.sBlockMachines) { + return true; + } + + if (blockToTest == mBlock && metaToTest == mMeta) { + return true; } - return true; + + return false; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java new file mode 100644 index 0000000000..3551172904 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blueprint/Blueprint_LFTR.java @@ -0,0 +1,137 @@ +package gtPlusPlus.xmod.gregtech.common.blueprint; + +import gregtech.api.enums.TAE; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.xmod.gregtech.api.objects.MultiblockBlueprint; +import gtPlusPlus.xmod.gregtech.api.objects.MultiblockLayer; +import net.minecraft.block.Block; + +public class Blueprint_LFTR extends MultiblockBlueprint { + + public Blueprint_LFTR() { + super(7, 4, 7, 10, TAE.GTPP_INDEX(12)); + + + Block aCasingMain = ModBlocks.blockCasingsMisc; + int aMetaCasingMain = 12; + int aMetaCasingSecondary = 13; + + + + /** + * First Layer (All edges can be Hatches, controller is centered in the front) + */ + + MultiblockLayer a0 = new MultiblockLayer(7, 7); + for (int i = 0; i < 7; i++) { + a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true); + } + for (int i = 0; i < 7; i++) { + for (int u = 1; u < 6; u++) { + a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, i == 0 ? true : i == 6 ? true : false); + } + } + for (int i = 0; i < 7; i++) { + if (i != 3) { + a0.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true); + } + else { + a0.addController(i, 6); + } + } + a0.lock(true); + + + + + /** + * Middle Layer(s) + */ + + MultiblockLayer a1 = new MultiblockLayer(7, 7); + for (int i = 0; i < 7; i++) { + a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 0, false); + } + for (int i = 0; i < 7; i++) { + for (int u = 1; u < 6; u++) { + if (i == 0 || i == 6) + a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, u, false); + } + } + for (int i = 0; i < 7; i++) { + a1.addBlockForPos(aCasingMain, aMetaCasingSecondary, i, 6, false); + + } + a1.lock(true); + + + /** + * Top Layer (All edges can be Hatches, Mufflers required in inner 3x3) + */ + + MultiblockLayer a2 = new MultiblockLayer(7, 7); + for (int i = 0; i < 7; i++) { + a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 0, true); + } + for (int i = 0; i < 7; i++) { + for (int u = 1; u < 6; u++) { + if ((i == 2 || i == 3 || i == 4) && (u == 2 || u ==3 || u == 4)) { + a2.addMuffler(aCasingMain, aMetaCasingMain, i, u); + } + else { + a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, u, true); + } + } + } + for (int i = 0; i < 7; i++) { + a2.addBlockForPos(aCasingMain, aMetaCasingMain, i, 6, true); + } + a2.lock(true); + + this.setLayer(a0, 0); + this.setLayer(a1, 1); + this.setLayer(a1, 2); + this.setLayer(a2, 3); + } + + @Override + public int getMinimumInputBus() { + return 0; + } + + @Override + public int getMinimumInputHatch() { + return 4; + } + + @Override + public int getMinimumOutputBus() { + return 0; + } + + @Override + public int getMinimumOutputHatch() { + return 4; + } + + @Override + public int getMinimumInputEnergy() { + return 0; + } + + @Override + public int getMinimumOutputEnergy() { + return 4; + } + + @Override + public int getMinimumMaintHatch() { + return 1; + } + + @Override + public int getMinimumMufflers() { + return 4; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java b/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java new file mode 100644 index 0000000000..ba44acdcb5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/requirements/RequirementsBasicCubic.java @@ -0,0 +1,11 @@ +package gtPlusPlus.xmod.gregtech.common.requirements; + +import gtPlusPlus.xmod.gregtech.api.objects.MultiblockRequirements; + +public class RequirementsBasicCubic extends MultiblockRequirements { + + public RequirementsBasicCubic( ) { + super(-1, -1, -1, -1, 1, 0, 1, null); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java index 59123a9a6d..c7b4f166b4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/advanced/GregtechMetaTileEntity_Adv_Fusion_MK4.java @@ -44,7 +44,7 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus @Override public int tier() { - return 8; + return 9; } @Override @@ -86,8 +86,8 @@ public class GregtechMetaTileEntity_Adv_Fusion_MK4 extends GT_MetaTileEntity_Fus "1-16 Output Hatches", "1-16 Energy Hatches", "All Hatches must be "+aTierName+" or better", - "32768 EU/t and 80mio EU Cap per Energy Hatch", CORE.GT_Tooltip}; + //"32768 EU/t and 80mio EU Cap per Energy Hatch" } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java index fde2347c87..bcd1fe941b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMTE_NuclearReactor.java @@ -27,6 +27,7 @@ import gtPlusPlus.core.material.nuclear.NUCLIDE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blueprint.Blueprint_LFTR; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.FluidStack; @@ -135,11 +136,23 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { return "MatterFabricator"; } + private Blueprint_LFTR mBlueprint; + @Override public boolean checkMachine(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { + + if (mBlueprint == null) { + mBlueprint = new Blueprint_LFTR(); + } + return mBlueprint.checkMachine(aBaseMetaTileEntity); + + + /* + + // Life Lessons from Greg. - /** + *//** [23:41:15] <GregoriusTechneticies> xdir and zdir are x2 and not x3 [23:41:26] <GregoriusTechneticies> thats you issue [23:44:33] <Alkalus> mmm? @@ -154,7 +167,7 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { [23:45:51] <Alkalus> Ahh [23:45:57] <GregoriusTechneticies> and not 2 [23:46:06] <Alkalus> Noted, thanks :D - */ + *//* final int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX * 3; final int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ * 3; @@ -197,7 +210,7 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { } //TODO - Add Carbon Moderation Rods - /* + else { //carbon moderation rods are at 1,1 & -1,-1 & 1,-1 & -1,1 if (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) != ModBlocks.blockCasingsMisc) { Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); @@ -208,7 +221,7 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { Utils.LOG_WARNING("LFTR Casing(s) Missing from one of the top layers inner 3x3."); return false; } - }*/ + } } @@ -319,7 +332,7 @@ public class GregtechMTE_NuclearReactor extends GregtechMeta_MultiBlockBase { this.turnCasingActive(false); Logger.INFO("Multiblock Formed."); return true; - } + */} @Override public boolean isCorrectMachinePart(final ItemStack aStack) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java index b1b450040b..32c99a7bba 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java @@ -13,10 +13,12 @@ import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.interfaces.internal.IGT_RecipeAdder; import gregtech.api.util.CustomRecipeMap; +import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.data.ArrayUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -659,6 +661,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { private static final Method mSixSlotAssembly; private static final Method mAssemblyLine; + private static final Method mScannerTT; private static final Method[] mChemicalRecipe = new Method[3]; private static final Method mLargeChemReactor; @@ -675,7 +678,28 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { mSixSlotAssembly = ReflectionUtils.getMethod(clazz, "addAssemblerRecipe", ItemStack[].class, FluidStack.class, ItemStack.class, int.class, int.class); //Assembly Line mAssemblyLine = ReflectionUtils.getMethod(clazz, "addAssemblylineRecipe", ItemStack.class, int.class, ItemStack[].class, FluidStack[].class, ItemStack.class, int.class, int.class); + + Method T = null; + if (LoadedMods.TecTech) { + try { + Class TTRecipeAdder = Class.forName("com.github.technus.tectech.recipe.TT_recipeAdder"); + if (TTRecipeAdder != null) { + Method ttTest = ReflectionUtils.getMethod(TTRecipeAdder, "addResearchableAssemblylineRecipe", + ItemStack.class, int.class, int.class, int.class, int.class, Object[].class, + FluidStack[].class, ItemStack.class, int.class, int.class); + if (ttTest != null) { + T = ttTest; + } + } + } catch (ClassNotFoundException e) { + } + } + else { + T = null; + } + mScannerTT = T; + mChemicalRecipe[1] = ReflectionUtils.getMethod(clazz, "addChemicalRecipe", ItemStack.class, ItemStack.class, FluidStack.class, FluidStack.class, ItemStack.class, int.class, int.class); mChemicalRecipe[2] = ReflectionUtils.getMethod(clazz, "addChemicalRecipe", ItemStack.class, ItemStack.class, FluidStack.class, FluidStack.class, ItemStack.class, ItemStack.class, int.class); @@ -688,6 +712,7 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { mSixSlotAssembly = null; mAssemblyLine = null; mLargeChemReactor = null; + mScannerTT = null; } @@ -727,7 +752,10 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } else { if (mAssemblyLine != null) { - try { + try { + if (!tryAddTecTechScannerRecipe(aResearchItem, aInputs, aFluidInputs, aOutput, aDuration, aEUt)) { + Logger.INFO("Failed to generate TecTech recipe for "+aResearchItem.getDisplayName()+", please report this to Alkalus."); + } return (boolean) mAssemblyLine.invoke(GT_Values.RA, aResearchItem, aResearchTime, aInputs, aFluidInputs, aOutput, aDuration, aEUt); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { @@ -750,8 +778,28 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder { } } } + } + + private boolean tryAddTecTechScannerRecipe(ItemStack aResearchItem, Object[] aInputs, FluidStack[] aFluidInputs, ItemStack aOutput, int assDuration, int assEUt) { + if (!LoadedMods.TecTech) { + return true; + } + else { - + int compSec = (GT_Utility.getTier(assEUt)+1) * 16; + int compMax = (GT_Utility.getTier(assEUt)+1) * 10000; + + if (mScannerTT != null) { + try { + return (boolean) mScannerTT.invoke(null, aResearchItem, compMax, compSec, + (assEUt/2), 16, aInputs, aFluidInputs, aOutput, assDuration, assEUt); + } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + Logger.INFO("Failed to generate TecTech recipe for "+aResearchItem.getDisplayName()+", please report this to Alkalus. [Severe]"); + e.printStackTrace(); + } + } + } + return false; } |