aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlkalus <3060479+draknyte1@users.noreply.github.com>2018-12-24 14:55:21 +0000
committerAlkalus <3060479+draknyte1@users.noreply.github.com>2018-12-24 14:55:21 +0000
commita641e66b8417ef72acca286a74b090ae759152d8 (patch)
treeac0a6f7b350e64c6d6073bb987f04577d09883e8
parentcce81dbd131542db14eb9c12bcc47880c330e09f (diff)
downloadGT5-Unofficial-a641e66b8417ef72acca286a74b090ae759152d8.tar.gz
GT5-Unofficial-a641e66b8417ef72acca286a74b090ae759152d8.tar.bz2
GT5-Unofficial-a641e66b8417ef72acca286a74b090ae759152d8.zip
+ Added a storage container for radioactive materials.
$ Fixed Decayable dusts not working as intended, Closes #393. $ Made recycling recipe generation less verbose & more readable. $ Fixed issue with the Advanced Mufflers onConfigLoad function.
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java4
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java151
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java141
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java59
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java24
-rw-r--r--src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java176
-rw-r--r--src/Java/gtPlusPlus/core/item/ModItems.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java16
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java8
-rw-r--r--src/Java/gtPlusPlus/core/item/materials/DustDecayable.java23
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java1
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java198
-rw-r--r--src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java16
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java18
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java85
-rw-r--r--src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_bottom.pngbin0 -> 617 bytes
-rw-r--r--src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_side.pngbin0 -> 666 bytes
-rw-r--r--src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_top.pngbin0 -> 670 bytes
18 files changed, 869 insertions, 55 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index 081ae3d347..eb40fd080e 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -28,6 +28,8 @@ public final class ModBlocks {
public static Block blockFishTrap;
public static Block blockWorkbench;
public static Block blockWorkbenchAdvanced;
+ public static Block blockDecayablesChest;
+
//Blocks
//public static Block blockBloodSteel;
//public static Block blockStaballoy;
@@ -112,6 +114,8 @@ public final class ModBlocks {
blockCircuitProgrammer = new CircuitProgrammer();
+ blockDecayablesChest = new DecayablesChest();
+
blockPlayerDoorWooden = new PlayerDoors(Material.wood, "door_wood", true);
blockPlayerDoorIron = new PlayerDoors(Material.iron, "door_iron", true);
blockPlayerDoorCustom_Glass = new PlayerDoors(Material.glass, "door_glass", false);
diff --git a/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java
new file mode 100644
index 0000000000..5fb36e8189
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/machine/DecayablesChest.java
@@ -0,0 +1,151 @@
+package gtPlusPlus.core.block.machine;
+
+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 net.minecraft.block.Block;
+import net.minecraft.block.BlockContainer;
+import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.EnumCreatureType;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+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)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
+
+ /**
+ * Determines which tooltip is displayed within the itemblock.
+ */
+ private final int mTooltipID = 5;
+
+ @Override
+ public int getTooltipID() {
+ return this.mTooltipID;
+ }
+
+ @SuppressWarnings("deprecation")
+ public DecayablesChest()
+ {
+ super(Material.iron);
+ this.setBlockName("blockDecayablesChest");
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockDecayablesChest");
+ LanguageRegistry.addName(this, "Lead Lined Box");
+
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int p_149691_1_, final int p_149691_2_)
+ {
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : this.textureFront);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_top");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_top");
+ this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_side");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "DecayablesChest_bottom");
+ }
+
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz)
+ {
+ if (world.isRemote) {
+ return true;
+ }
+
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileEntityDecayablesChest)){
+ player.openGui(GTplusplus.instance, GuiHandler.GUI13, world, x, y, z);
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public int getRenderBlockPass() {
+ return 1;
+ }
+
+ @Override
+ public boolean isOpaqueCube() {
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
+ return new TileEntityDecayablesChest();
+ }
+
+ @Override
+ public void onBlockAdded(final World world, final int x, final int y, final int z) {
+ super.onBlockAdded(world, x, y, z);
+ }
+
+ @Override
+ public void breakBlock(final World world, final int x, final int y, final int z, final Block block, final int number) {
+ InventoryUtils.dropInventoryItems(world, x, y, z, block);
+ super.breakBlock(world, x, y, z, block, number);
+ }
+
+ @Override
+ public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, final ItemStack stack) {
+ if (stack.hasDisplayName()) {
+ ((TileEntityDecayablesChest) world.getTileEntity(x,y,z)).setCustomName(stack.getDisplayName());
+ }
+ }
+
+ @Override
+ public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) {
+ return false;
+ }
+
+ /*@Override
+ public void breakBlock(World world, BlockPos pos, IBlockState blockstate) {
+ TileEntityFishTrap te = (TileEntityFishTrap) world.getTileEntity(pos);
+ InventoryHelper.dropInventoryItems(world, pos, te);
+ super.breakBlock(world, pos, blockstate);
+ }
+
+
+ @Override
+ public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
+ if (stack.hasDisplayName()) {
+ ((TileEntityFishTrap) worldIn.getTileEntity(pos)).setCustomName(stack.getDisplayName());
+ }
+ }*/
+
+} \ 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
new file mode 100644
index 0000000000..81f228064c
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/Container_DecayablesChest.java
@@ -0,0 +1,141 @@
+package gtPlusPlus.core.container;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.Inventory_DecayablesChest;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
+import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
+
+public class Container_DecayablesChest extends Container {
+
+ protected TileEntityDecayablesChest tile_entity;
+ public final Inventory_DecayablesChest inventoryChest;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 15; // Number of slots in storage area
+ public static int InventorySlotNumber = 36; // Inventory Slots (Inventory
+ // and Hotbar)
+ public static int FullSlotNumber = InventorySlotNumber + StorageSlotNumber; // All
+ // slots
+
+ private final int[] slotStorage = new int[15];
+
+ public Container_DecayablesChest(final InventoryPlayer inventory, final TileEntityDecayablesChest te) {
+ this.tile_entity = te;
+ this.inventoryChest = te.getInventory();
+
+ int var6;
+ int var7;
+ this.worldObj = te.getWorldObj();
+ this.posX = te.xCoord;
+ this.posY = te.yCoord;
+ this.posZ = te.zCoord;
+
+ int o = 0;
+
+ // Storage Side
+ for (var6 = 0; var6 < 3; var6++) {
+ for (var7 = 0; var7 < 5; var7++) {
+ this.slotStorage[o] = o;
+ this.addSlotToContainer(new Slot(this.inventoryChest, o++, 44 + (var7 * 18), 15 + (var6 * 18)));
+ }
+ }
+
+ // Player Inventory
+ for (var6 = 0; var6 < 3; ++var6) {
+ for (var7 = 0; var7 < 9; ++var7) {
+ this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18)));
+ }
+ }
+
+ // Player Hotbar
+ for (var6 = 0; var6 < 9; ++var6) {
+ this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142));
+ }
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold,
+ final EntityPlayer aPlayer) {
+
+ if (!aPlayer.worldObj.isRemote) {
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)) {
+ // Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+ }
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public void onContainerClosed(final EntityPlayer par1EntityPlayer) {
+ super.onContainerClosed(par1EntityPlayer);
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer) {
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockDecayablesChest) {
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot) this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack()) {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ /*
+ * if (par2 == 0) { if (!this.mergeItemStack(var5,
+ * InOutputSlotNumber, FullSlotNumber, true)) { return null; }
+ *
+ * var4.onSlotChange(var5, var3); } else if (par2 >=
+ * InOutputSlotNumber && par2 < InventoryOutSlotNumber) { if
+ * (!this.mergeItemStack(var5, InventoryOutSlotNumber,
+ * FullSlotNumber, false)) { return null; } } else if (par2 >=
+ * InventoryOutSlotNumber && par2 < FullSlotNumber) { if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber,
+ * InventoryOutSlotNumber, false)) { return null; } } else if
+ * (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber,
+ * false)) { return null; }
+ */
+
+ if (var5.stackSize == 0) {
+ var4.putStack((ItemStack) null);
+ } else {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize) {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ // Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java
new file mode 100644
index 0000000000..094629ae48
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_DecayablesChest.java
@@ -0,0 +1,59 @@
+package gtPlusPlus.core.gui.machine;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+
+import gtPlusPlus.core.container.Container_DecayablesChest;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
+
+@SideOnly(Side.CLIENT)
+public class GUI_DecayablesChest extends GuiContainer {
+
+ private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/FishTrap.png");
+
+ public GUI_DecayablesChest(final InventoryPlayer player_inventory, final TileEntityDecayablesChest te){
+ super(new Container_DecayablesChest(player_inventory, te));
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int i, final int j){
+ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752);
+ //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
+
+ }
+
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ final int x = (this.width - this.xSize) / 2;
+ final int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+
+
+ //This method is called when the Gui is first called!
+ @Override
+ public void initGui()
+ {
+ //You have to add this line for the Gui to function properly!
+ super.initGui();
+
+ //The parameters of GuiButton are(id, x, y, width, height, text);
+ //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X"));
+ //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y"));
+ //NOTE: the id always has to be different or else it might get called twice or never!
+
+ //Add any other buttons here too!
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index c02425afbf..2ae0987ece 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -32,6 +32,7 @@ import gtPlusPlus.core.item.tool.misc.box.ContainerBoxBase;
import gtPlusPlus.core.item.tool.misc.box.CustomBoxInventory;
import gtPlusPlus.core.tileentities.base.TileEntityBase;
import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer;
+import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.core.tileentities.machines.*;
@@ -49,6 +50,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI10 = 9; // Universal Toolbox
public static final int GUI11 = 10; // Auto Lunchbox
public static final int GUI12 = 11; // Bag for Magic Tools
+ public static final int GUI13 = 12; // Decayables Chest
public static void init() {
@@ -91,13 +93,15 @@ public class GuiHandler implements IGuiHandler {
return new Container_TradeTable(player.inventory, (TileEntityTradeTable) te);
} else if (ID == GUI8) {
return new Container_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
+ } else if (ID == GUI13) {
+ return new Container_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te);
}
}
if (ID == GUI9) {
return new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem()));
}
- //Tool, lunch, magic
+ // Tool, lunch, magic
if (ID == GUI10) {
return new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem()));
}
@@ -145,25 +149,29 @@ public class GuiHandler implements IGuiHandler {
((TileEntityBase) te).getOwner());
} else if (ID == GUI8) {
return new GUI_CircuitProgrammer(player.inventory, (TileEntityCircuitProgrammer) te);
+ } else if (ID == GUI13) {
+ return new GUI_DecayablesChest(player.inventory, (TileEntityDecayablesChest) te);
}
}
if (ID == GUI9) {
- return new GuiBaseGrindle(new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
+ return new GuiBaseGrindle(
+ new Container_Grindle(player, player.inventory, new BaseInventoryGrindle(player.getHeldItem())));
}
-
- //Tool, lunch, magic
+ // Tool, lunch, magic
if (ID == GUI10) {
- return new ToolBoxGui(new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())));
+ return new ToolBoxGui(
+ new ToolBoxContainer(player, player.inventory, new ToolBoxInventory(player.getHeldItem())));
}
if (ID == GUI11) {
- return new LunchBoxGui(new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())));
+ return new LunchBoxGui(
+ new LunchBoxContainer(player, player.inventory, new LunchBoxInventory(player.getHeldItem())));
}
if (ID == GUI12) {
- return new MagicBagGui(new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())));
+ return new MagicBagGui(
+ new MagicBagContainer(player, player.inventory, new MagicBagInventory(player.getHeldItem())));
}
-
return null;
}
diff --git a/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java b/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java
new file mode 100644
index 0000000000..666f4aac53
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/Inventory_DecayablesChest.java
@@ -0,0 +1,176 @@
+package gtPlusPlus.core.inventories;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class Inventory_DecayablesChest implements IInventory{
+
+ private final String name = "DecayablesChest";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 15;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory = new ItemStack[INV_SIZE];
+
+ public void readFromNBT(final NBTTagCompound nbt){
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++){
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE)){
+ //Utils.LOG_INFO("Trying to read NBT data from inventory.");
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt){
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++){
+ final ItemStack stack = this.inventory[i];
+ if(stack != null){
+ //Utils.LOG_INFO("Trying to write NBT data to inventory.");
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ return this.inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack)
+ {
+ // Don't want to be able to store the inventory item within itself
+ // Bad things will happen, like losing your inventory
+ // Actually, this needs a custom Slot to work
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java
index cc0b4325f3..a9ad289e7f 100644
--- a/src/Java/gtPlusPlus/core/item/ModItems.java
+++ b/src/Java/gtPlusPlus/core/item/ModItems.java
@@ -775,8 +775,8 @@ public final class ModItems {
}
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", ""+StringUtils.superscript("226Ra"), ELEMENT.getInstance().RADIUM.getRgbAsHex())[0];
- dustRadium226 = new DustDecayable("dustRadium226", ELEMENT.getInstance().RADIUM.getRgbAsHex(), 90000, new String[] {""+StringUtils.superscript("226Ra"), "Result: Radon 222 ("+StringUtils.superscript("222Rn")+")"}, ItemUtils.getSimpleStack(dustDecayedRadium226).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);
itemBoilerChassis = new ItemBoilerChassis();
itemDehydratorCoilWire = new ItemDehydratorCoilWire();
diff --git a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java
index 78c2724ea8..006c346c64 100644
--- a/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java
+++ b/src/Java/gtPlusPlus/core/item/base/BaseItemTickable.java
@@ -51,7 +51,10 @@ public class BaseItemTickable extends CoreItem {
public void onUpdate(final ItemStack iStack, final World world, final Entity entityHolding, final int p_77663_4_, final boolean p_77663_5_) {
if (world == null || iStack == null) {
return;
- }
+ }
+ if (world.isRemote) {
+ return;
+ }
boolean active = getIsActive(world, iStack);
@@ -120,7 +123,7 @@ public class BaseItemTickable extends CoreItem {
//Try set world time
if (world != null) {
- tagNBT.setLong("CreationDate", world.getTotalWorldTime());
+ //tagNBT.setLong("CreationDate", world.getTotalWorldTime());
}
tagMain.setTag("TickableItem", tagNBT);
@@ -250,9 +253,9 @@ public class BaseItemTickable extends CoreItem {
if (aNBT.hasKey("TickableItem")) {
aNBT = aNBT.getCompoundTag("TickableItem");
- if (!aNBT.hasKey("CreationDate") && world != null) {
+ /*if (!aNBT.hasKey("CreationDate") && world != null) {
aNBT.setLong("CreationDate", world.getTotalWorldTime());
- }
+ }*/
//Done Ticking
if (maxTicks-getFilterDamage(world, aStack) <= 0) {
@@ -269,7 +272,10 @@ public class BaseItemTickable extends CoreItem {
return true;
}
- }
+ }
+ else {
+ return false;
+ }
}
}
return createNBT(world, aStack);
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
index 77689f83aa..b9cd9ede5f 100644
--- a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockBasicTile.java
@@ -38,6 +38,14 @@ public class ItemBlockBasicTile extends ItemBlock{
list.add("Change default setting with a Screwdriver");
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");
+ }
+ else {
+ list.add("Bad Tooltip ID - "+mID);
+
+ }
super.addInformation(stack, aPlayer, list, bool);
}
diff --git a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java
index aa3b044802..18d147e98c 100644
--- a/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java
+++ b/src/Java/gtPlusPlus/core/item/materials/DustDecayable.java
@@ -10,7 +10,7 @@ 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;
@@ -22,7 +22,7 @@ public class DustDecayable extends BaseItemTickable {
private final int radLevel;
public DustDecayable(String unlocal, int colour, int maxTicks, String[] desc1, Item turnsInto, int radLevel) {
- super(true, true, unlocal, colour, maxTicks, desc1);
+ super(true, true, unlocal, colour, (maxTicks/1), desc1);
this.turnsIntoItem = turnsInto;
this.radLevel = radLevel;
GT_OreDictUnificator.registerOre(unlocal, ItemUtils.getSimpleStack(this));
@@ -30,9 +30,9 @@ public class DustDecayable extends BaseItemTickable {
@Override
public void registerIcons(IIconRegister reg) {
- String gt = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust";
+ String gt = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust";
this.mIcon[0] = reg.registerIcon(gt);
- String gt2 = "gregtech" + ":" + "materialicons/"+"SHINY"+"/" + "dust" + "_OVERLAY";
+ String gt2 = "gregtech" + ":" + "materialicons/"+"NUCLEAR"+"/" + "dust" + "_OVERLAY";
this.mIcon[1] = reg.registerIcon(gt2);
}
@@ -50,16 +50,23 @@ public class DustDecayable extends BaseItemTickable {
if (world == null || iStack == null) {
return;
}
+ if (world.isRemote) {
+ return;
+ }
if (entityHolding instanceof EntityPlayer){
if (!((EntityPlayer) entityHolding).capabilities.isCreativeMode){
EntityUtils.applyRadiationDamageToEntity(iStack.stackSize, this.radLevel, world, entityHolding);
}
}
+ boolean a1, a2;
- if (!tickItemTag(world, iStack) && !this.getIsActive(world, iStack)) {
+ a1 = this.getIsActive(world, iStack);
+ a2 = tickItemTag(world, iStack);
+
+ if (!a1 && !a2) {
if (entityHolding instanceof EntityPlayer){
- ItemStack replacement = ItemUtils.getSimpleStack(turnsIntoItem);
+ ItemStack replacement = ItemUtils.getSimpleStack(getDecayResult());
//Logger.INFO("Replacing "+iStack.getDisplayName()+" with "+replacement.getDisplayName()+".");
final ItemStack tempTransform = replacement;
if (iStack.stackSize > 1){
@@ -79,5 +86,9 @@ public class DustDecayable extends BaseItemTickable {
}
}
}
+
+ public Item getDecayResult() {
+ return turnsIntoItem;
+ }
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index b9f5727ed7..771283d686 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -25,6 +25,7 @@ public class ModTileEntities {
GameRegistry.registerTileEntity(TileEntityGenericSpawner.class, "TileEntityGenericSpawner");
GameRegistry.registerTileEntity(TileEntityCircuitProgrammer.class, "TileCircuitProgrammer");
GameRegistry.registerTileEntity(TileEntityPlayerDoorBase.class, "TilePlayerDoorBase");
+ GameRegistry.registerTileEntity(TileEntityDecayablesChest.class, "TileDecayablesChest");
//Mod TEs
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
new file mode 100644
index 0000000000..eefdaff439
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityDecayablesChest.java
@@ -0,0 +1,198 @@
+package gtPlusPlus.core.tileentities.general;
+
+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.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;
+ private String customName;
+
+ private int tickCount = 0;
+
+ public TileEntityDecayablesChest() {
+ this.inventoryContents = new Inventory_DecayablesChest();
+ }
+
+ public Inventory_DecayablesChest getInventory() {
+ return this.inventoryContents;
+ }
+
+ @Override
+ public void updateEntity() {
+ try{
+ if (!this.worldObj.isRemote) {
+
+ this.tickCount++;
+
+ if ((this.tickCount % 20) == 0) {
+ for (ItemStack inv : this.getInventory().getInventory()) {
+ if (inv.getItem() instanceof DustDecayable) {
+ DustDecayable D = (DustDecayable) inv.getItem();
+ tryUpdateDecayable(D, inv, this.worldObj);
+ }
+ }
+ }
+
+ }
+ }
+ 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;
+ a1 = b.getIsActive(world, iStack);
+ a2 = b.tickItemTag(world, iStack);
+
+ if (!a1 && !a2) {
+ ItemStack replacement = ItemUtils.getSimpleStack(b.getDecayResult());
+ replacement.stackSize=1;
+ iStack = replacement.copy();
+ markDirty();
+ }
+ }
+
+ public boolean anyPlayerInRange() {
+ return this.worldObj.getClosestPlayer(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D, 32) != null;
+ }
+
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) {
+ if (!nbt.hasKey(tag)) {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbt) {
+ super.writeToNBT(nbt);
+ // Utils.LOG_WARNING("Trying to write NBT data to TE.");
+ final NBTTagCompound chestData = new NBTTagCompound();
+ this.inventoryContents.writeToNBT(chestData);
+ nbt.setTag("ContentsChest", chestData);
+ if (this.hasCustomInventoryName()) {
+ nbt.setString("CustomName", this.getCustomName());
+ }
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt) {
+ super.readFromNBT(nbt);
+ // Utils.LOG_WARNING("Trying to read NBT data from TE.");
+ this.inventoryContents.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ if (nbt.hasKey("CustomName", 8)) {
+ this.setCustomName(nbt.getString("CustomName"));
+ }
+ }
+
+ @Override
+ public int getSizeInventory() {
+ return this.getInventory().getSizeInventory();
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot) {
+ return this.getInventory().getStackInSlot(slot);
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int count) {
+ return this.getInventory().decrStackSize(slot, count);
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot) {
+ return this.getInventory().getStackInSlotOnClosing(slot);
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack) {
+ this.getInventory().setInventorySlotContents(slot, stack);
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return this.getInventory().getInventoryStackLimit();
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final EntityPlayer entityplayer) {
+ return this.getInventory().isUseableByPlayer(entityplayer);
+ }
+
+ @Override
+ public void openInventory() {
+ this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, 1);
+ 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);
+ 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().closeInventory();
+ }
+
+ @Override
+ public boolean isItemValidForSlot(final int slot, final ItemStack itemstack) {
+ return this.getInventory().isItemValidForSlot(slot, itemstack);
+ }
+
+ @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;
+ }
+ return accessibleSides;
+
+ }
+
+ @Override
+ public boolean canInsertItem(final int p_102007_1_, final ItemStack p_102007_2_, final int p_102007_3_) {
+ return true;
+ }
+
+ @Override
+ public boolean canExtractItem(final int p_102008_1_, final ItemStack p_102008_2_, final int p_102008_3_) {
+ return true;
+ }
+
+ public String getCustomName() {
+ return this.customName;
+ }
+
+ public void setCustomName(final String customName) {
+ this.customName = customName;
+ }
+
+ @Override
+ public String getInventoryName() {
+ return this.hasCustomInventoryName() ? this.customName : "container.DecayablesChest";
+ }
+
+ @Override
+ public boolean hasCustomInventoryName() {
+ return (this.customName != null) && !this.customName.equals("");
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
index 1a3219bb90..fe344c70ed 100644
--- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
+++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java
@@ -333,18 +333,20 @@ public class ItemUtils {
if (oredictName.toLowerCase().contains("dust")) {
final String MaterialName = oredictName.toLowerCase().replace("dust", "");
final Materials m = Materials.get(MaterialName);
- returnValue = getGregtechDust(m, amount);
- if (returnValue != null) {
- return returnValue;
+ if (m != null && m != Materials._NULL) {
+ returnValue = getGregtechDust(m, amount);
+ if (checkForInvalidItems(returnValue)) {
+ return returnValue;
+ }
}
}
-
- /*if (returnValue == null) {
+ if (returnValue == null) {
returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
if (ItemUtils.checkForInvalidItems(returnValue)) {
return returnValue.copy();
}
- }*/
+ }
+
Logger.RECIPE(oredictName + " was not valid.");
return null;
} catch (final Throwable t) {
@@ -760,7 +762,7 @@ public class ItemUtils {
public static ItemStack getErrorStack(int mAmount) {
//System.exit(1);
try {
- new GregtechException("Logging - [Issue #999]");
+ //new GregtechException("Logging - [Issue #999]");
}
catch (Throwable t) {
t.printStackTrace();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
index 76fa63626d..5ce74588fa 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
@@ -4,13 +4,8 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
-import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_2by2;
-import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.CONTAINER_Electric_4by4;
-import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_2by2;
-import gtPlusPlus.xmod.gregtech.api.gui.hatches.charge.GUI_Electric_4by4;
import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -27,10 +22,15 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch
@Override
public void onConfigLoad(GT_Config aConfig) {
super.onConfigLoad(aConfig);
- if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) {
- Integer a1 = (int) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "mPollutionSmogLimit");
- if (a1 != null && a1 > 0) {
- mPollutionSmogLimit = a1;
+ if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) {
+ try {
+ Integer a1 = (int) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "mPollutionSmogLimit");
+ if (a1 != null && a1 > 0) {
+ mPollutionSmogLimit = a1;
+ }
+ }
+ catch (Throwable t) {
+ mPollutionSmogLimit = 500000;
}
}
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
index e15c5da29e..180a684fb8 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/RecipeGen_Recycling.java
@@ -7,9 +7,11 @@ import java.util.Map;
import org.apache.commons.lang3.reflect.FieldUtils;
+import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
@@ -18,6 +20,7 @@ import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.api.objects.data.Pair;
+import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.material.state.MaterialState;
import gtPlusPlus.core.util.Utils;
@@ -73,13 +76,10 @@ public class RecipeGen_Recycling implements Runnable {
Pair<OrePrefixes, ItemStack>[] mValidPairs = new Pair[mValidPrefixesAsString.length];
for (int r=0;r<mValidPairs.length;r++){
- ItemStack temp = ItemUtils.getItemStackOfAmountFromOreDictNoBroken(mValidPrefixesAsString[r].name()+Utils.sanitizeString(material.getLocalizedName()), 1);
+ ItemStack temp = getItemStackOfAmountFromOreDictNoBroken(mValidPrefixesAsString[r].name()+Utils.sanitizeString(material.getLocalizedName()), 1);
if (temp != null){
mValidPairs[mSlotIndex++] = new Pair<OrePrefixes, ItemStack>(mValidPrefixesAsString[r], temp.copy());
}
- else {
- Logger.WARNING("Invalid Item: "+mValidPrefixesAsString[r].name()+Utils.sanitizeString(material.getLocalizedName()));
- }
}
if (mValidPairs.length > 0){
@@ -103,16 +103,11 @@ public class RecipeGen_Recycling implements Runnable {
}
}
- Logger.WARNING("Found " + mValidPairs.length + " valid OreDict prefixes.");
if (mValidPrefixesAsString.length >= 1) {
for (final Pair<OrePrefixes, ItemStack> validPrefix : mValidPairs) {
try {
- if (material == null || validPrefix == null) {
- continue;
- }
-
- if (material.getState() != MaterialState.SOLID || validPrefix.getKey() == OrePrefixes.ingotHot){
+ if (material == null || validPrefix == null || material.getState() != MaterialState.SOLID || validPrefix.getKey() == OrePrefixes.ingotHot) {
continue;
}
@@ -227,14 +222,6 @@ public class RecipeGen_Recycling implements Runnable {
Logger.WARNING("Trying to get a Tiny Dust");
rStack = get(OrePrefixes.dustTiny, aMaterial, (aMaterialAmount * 9) / M);
}
- if (rStack == null) {
- Logger.WARNING("Returning Null. Method: " + ReflectionUtils.getMethodName(0));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(1));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(2));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(3));
- Logger.WARNING("Called from method: " + ReflectionUtils.getMethodName(4));
- }
-
return rStack;
}
@@ -322,5 +309,67 @@ public class RecipeGen_Recycling implements Runnable {
Logger.WARNING("Invalid map stored in GT_OreDictUnificator.class, unable to find sName2StackMap field.");
return null;
}
+
+ public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, final int amount) {
+
+ try {
+
+ if (oredictName.contains("-") || oredictName.contains("_")) {
+ oredictName = Utils.sanitizeString(oredictName, new char[] {'-', '_'});
+ }
+ else {
+ oredictName = Utils.sanitizeString(oredictName);
+ }
+
+ // Adds a check to grab dusts using GT methodology if possible.
+ ItemStack returnValue = null;
+ if (oredictName.toLowerCase().contains("dust")) {
+ final String MaterialName = oredictName.toLowerCase().replace("dust", "");
+ final Materials m = Materials.get(MaterialName);
+ if (m != null && m != Materials._NULL) {
+ returnValue = ItemUtils.getGregtechDust(m, amount);
+ if (ItemUtils.checkForInvalidItems(returnValue)) {
+ return returnValue;
+ }
+ }
+ }
+ if (returnValue == null) {
+ returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
+ if (ItemUtils.checkForInvalidItems(returnValue)) {
+ return returnValue.copy();
+ }
+ }
+ return null;
+ } catch (final Throwable t) {
+ return null;
+ }
+ }
+
+ public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, final int amount) {
+ String mTemp = oredictName;
+
+ // Banned Materials and replacements for GT5.8 compat.
+
+ if (oredictName.toLowerCase().contains("ingotclay")) {
+ return ItemUtils.getSimpleStack(Items.clay_ball, amount);
+ }
+
+ if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) {
+ if (oredictName.toLowerCase().contains("rutile")) {
+ mTemp = oredictName.replace("Rutile", "Titanium");
+ }
+ if (oredictName.toLowerCase().contains("vanadiumsteel")) {
+ mTemp = oredictName.replace("VanadiumSteel", "StainlessSteel");
+ }
+ }
+ final ArrayList<ItemStack> oreDictList = OreDictionary.getOres(mTemp);
+ if (!oreDictList.isEmpty()) {
+ final ItemStack returnValue = oreDictList.get(0).copy();
+ returnValue.stackSize = amount;
+ return returnValue;
+ }
+ return null;
+ //return getItemStackOfAmountFromOreDictNoBroken(mTemp, amount);
+ }
}
diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_bottom.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_bottom.png
new file mode 100644
index 0000000000..ee332fba19
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_bottom.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_side.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_side.png
new file mode 100644
index 0000000000..b61a42b935
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_side.png
Binary files differ
diff --git a/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_top.png b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_top.png
new file mode 100644
index 0000000000..0647c2105f
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/blocks/TileEntities/DecayablesChest_top.png
Binary files differ