diff options
Diffstat (limited to 'src/Java/gtPlusPlus/core')
19 files changed, 945 insertions, 103 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; + + + } } |