Shredder
@ -155,6 +155,15 @@ tile.watz_conductor.name=Watz-Stromanschluss
|
||||
tile.watz_core.name=Watzreaktorkern
|
||||
container.watzPowerplant=Watzkraftwerk
|
||||
|
||||
tile.fwatz_conductor.name=4000K Supraleiter-Magnet
|
||||
tile.fwatz_cooler.name=Kühlmitteltankhülle
|
||||
tile.fwatz_tank.name=Kühlmitteltank
|
||||
tile.fwatz_scaffold.name=Watzwerkstützen
|
||||
tile.fwatz_hatch.name=Watzwerkzugriffsluke
|
||||
tile.fwatz_computer.name=Watzwerkrechenmatrix
|
||||
tile.fwatz_core.name=Fusionarer Watzwerkkern
|
||||
tile.fwatz_plasma.name=Destabilisiertes Antischrabidiumplasma
|
||||
|
||||
item.fuse.name=Sicherung
|
||||
|
||||
tile.test_nuke.name=Test Atombombe
|
||||
@ -427,6 +436,7 @@ item.grenade_gas.name=Gasgranate
|
||||
item.grenade_plasma.name=Plasmagranate
|
||||
item.grenade_tau.name=Taugranate
|
||||
item.grenade_schrabidium.name=Schrabidiumgranate
|
||||
item.grenade_lemon.name=Zitronengranate
|
||||
item.grenade_nuke.name=Mark VI Bohrgranate
|
||||
item.grenade_nuclear.name=Nuka-Granate
|
||||
|
||||
@ -470,6 +480,7 @@ item.apple_schrabidium.name=Schrabidiumapfel
|
||||
item.cotton_candy.name=Radioaktive Zuckerwatte
|
||||
item.tem_flakes.name=Tem Flakes
|
||||
item.glowing_stew.name=Leuchtende Pilzsuppe
|
||||
item.lemon.name="Zitrone"
|
||||
|
||||
tile.frozen_grass.name=Gefrorenes Gras
|
||||
tile.frozen_dirt.name=Gefrorene Erde
|
||||
@ -494,6 +505,7 @@ item.gun_revolver_cursed.name=Verfluchte Pistole
|
||||
item.gun_fatman.name=M42 Nukleares Katapult "Fat Man"
|
||||
item.gun_xvl1456.name=XVL1456 Tau-Kanone Prototyp
|
||||
item.gun_osipr.name=Standartausrüstung für Sicherheitskräfte
|
||||
item.gun_zomg.name=Singularitätsbetriebener Paarvernichtungsstrahl "ZOMG Kanone"
|
||||
|
||||
item.gun_revolver_iron_ammo.name=Patrone
|
||||
item.gun_revolver_ammo.name=Bleipatrone
|
||||
|
||||
@ -155,6 +155,15 @@ tile.watz_conductor.name=Watz Electricity Port
|
||||
tile.watz_core.name=Watz Reactor Control
|
||||
container.watzPowerplant=Watz Power Plant
|
||||
|
||||
tile.fwatz_conductor.name=4000K Superconducting Magnet
|
||||
tile.fwatz_cooler.name=Regenerative Coolant Fluid Tank Shell
|
||||
tile.fwatz_tank.name=Regenerative Coolant Fluid Tank
|
||||
tile.fwatz_scaffold.name=Fusionary Watz Plant Structural Support
|
||||
tile.fwatz_hatch.name=Fusionary Watz Plant Access Hatch
|
||||
tile.fwatz_computer.name=Fusionary Watz Reactor Calculation Matrix
|
||||
tile.fwatz_core.name=Fusionary Watz Reactor Control
|
||||
tile.fwatz_plasma.name=Destabilized Antischrabidium Plasma
|
||||
|
||||
item.fuse.name=Fuse
|
||||
|
||||
tile.test_nuke.name=Test Nuke
|
||||
@ -427,6 +436,7 @@ item.grenade_gas.name=Gas Grenade
|
||||
item.grenade_plasma.name=Plasma Grenade
|
||||
item.grenade_tau.name=Tau Grenade
|
||||
item.grenade_schrabidium.name=Schrabidium Grenade
|
||||
item.grenade_lemon.name=Combustible Lemon
|
||||
item.grenade_nuke.name=Mark VI Drill Grenade
|
||||
item.grenade_nuclear.name=Nuka Grenade
|
||||
|
||||
@ -470,6 +480,7 @@ item.apple_schrabidium.name=Schrabidium Apple
|
||||
item.cotton_candy.name=Radioactive Cotton Candy
|
||||
item.tem_flakes.name=Tem Flakes
|
||||
item.glowing_stew.name=Glowing Mushroom Stew
|
||||
item.lemon.name="Lemon"
|
||||
|
||||
tile.frozen_grass.name=Frozen Grass
|
||||
tile.frozen_dirt.name=Frozen Dirt
|
||||
@ -494,6 +505,7 @@ item.gun_revolver_cursed.name=Cursed Revolver
|
||||
item.gun_fatman.name=M42 Nuclear Catapult "Fat Man"
|
||||
item.gun_xvl1456.name=XVL1456 Tau Cannon Prototype
|
||||
item.gun_osipr.name=Overwatch Standard Issue Pulse Rifle
|
||||
item.gun_zomg.name=Singularity Powered Annihilation Ray "ZOMG Cannon"
|
||||
|
||||
item.gun_revolver_iron_ammo.name=Bullet
|
||||
item.gun_revolver_ammo.name=Lead Bullet
|
||||
|
||||
BIN
assets/hbm/textures/gui/gui_shredder.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
assets/hbm/textures/items/blades_advanced_alloy.png
Normal file
|
After Width: | Height: | Size: 312 B |
BIN
assets/hbm/textures/items/blades_steel.png
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
assets/hbm/textures/items/blades_titanium.png
Normal file
|
After Width: | Height: | Size: 306 B |
BIN
assets/hbm/textures/items/crowbar.png
Normal file
|
After Width: | Height: | Size: 269 B |
BIN
assets/hbm/textures/items/plate_mixed.png
Normal file
|
After Width: | Height: | Size: 331 B |
BIN
assets/hbm/textures/items/plate_paa.png
Normal file
|
After Width: | Height: | Size: 272 B |
BIN
assets/hbm/textures/items/scrap.png
Normal file
|
After Width: | Height: | Size: 557 B |
143
com/hbm/blocks/MachineShredder.java
Normal file
@ -0,0 +1,143 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
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.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineShredder extends BlockContainer {
|
||||
|
||||
private final Random field_149933_a = new Random();
|
||||
private Random rand;
|
||||
private static boolean keepInventory;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon iconBottom;
|
||||
private IIcon iconTop;
|
||||
private IIcon iconSide;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.iconBottom = iconRegister.registerIcon(RefStrings.MODID + ":machine_diesel_bottom");
|
||||
this.iconTop = iconRegister.registerIcon(RefStrings.MODID + ":machine_diesel_top");
|
||||
this.iconSide = iconRegister.registerIcon(RefStrings.MODID + ":machine_diesel_side");
|
||||
this.blockIcon = iconRegister.registerIcon(RefStrings.MODID + ":machine_diesel_front");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int metadata) {
|
||||
if(side == 0)
|
||||
return iconBottom;
|
||||
if(side == 1)
|
||||
return iconTop;
|
||||
if(side == 2 || side == 3)
|
||||
return blockIcon;
|
||||
if(side == 4 || side == 5)
|
||||
return iconSide;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_shredder);
|
||||
}
|
||||
|
||||
protected MachineShredder(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineShredder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityMachineShredder entity = (TileEntityMachineShredder) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_shredder, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
|
||||
{
|
||||
if (!keepInventory)
|
||||
{
|
||||
TileEntityMachineShredder tileentityfurnace = (TileEntityMachineShredder)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
|
||||
|
||||
if (tileentityfurnace != null)
|
||||
{
|
||||
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
|
||||
{
|
||||
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
|
||||
|
||||
while (itemstack.stackSize > 0)
|
||||
{
|
||||
int j1 = this.field_149933_a.nextInt(21) + 10;
|
||||
|
||||
if (j1 > itemstack.stackSize)
|
||||
{
|
||||
j1 = itemstack.stackSize;
|
||||
}
|
||||
|
||||
itemstack.stackSize -= j1;
|
||||
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
|
||||
|
||||
if (itemstack.hasTagCompound())
|
||||
{
|
||||
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
|
||||
}
|
||||
|
||||
float f3 = 0.05F;
|
||||
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
|
||||
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
|
||||
p_149749_1_.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
|
||||
}
|
||||
}
|
||||
|
||||
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
|
||||
}
|
||||
}
|
||||
@ -244,6 +244,9 @@ public class ModBlocks {
|
||||
public static Block machine_diesel;
|
||||
public static final int guiID_machine_diesel = 31;
|
||||
|
||||
public static Block machine_shredder;
|
||||
public static final int guiID_machine_shredder = 34;
|
||||
|
||||
public static Block launch_pad;
|
||||
public static Block launch_pad_generic;
|
||||
public static Block launch_pad_incendiary;
|
||||
@ -412,6 +415,8 @@ public class ModBlocks {
|
||||
|
||||
machine_diesel = new MachineDiesel(Material.iron).setBlockName("machine_diesel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock);
|
||||
|
||||
machine_shredder = new MachineShredder(Material.iron).setBlockName("machine_shredder").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock);
|
||||
|
||||
red_wire_coated = new WireCoated(Material.iron).setBlockName("red_wire_coated").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_wire_coated");
|
||||
red_cable = new BlockCable(Material.iron).setBlockName("red_cable").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":red_cable_icon");
|
||||
|
||||
@ -624,6 +629,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_electric_furnace_off, machine_electric_furnace_off.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_electric_furnace_on, machine_electric_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_deuterium, machine_deuterium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_shredder, machine_shredder.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_schrabidium_transmutator, machine_schrabidium_transmutator.getUnlocalizedName());
|
||||
|
||||
//Industrial Factories
|
||||
|
||||
@ -321,20 +321,6 @@ public class TileEntityMachineDiesel extends TileEntity implements ISidedInvento
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isItemValid() {
|
||||
|
||||
if(slots[1] != null && slots[1].getItem() == Items.coal)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(slots[1] != null && slots[1].getItem() == Item.getItemFromBlock(Blocks.coal_block))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ffgeua(int x, int y, int z, boolean newTact) {
|
||||
Block block = this.worldObj.getBlock(x, y, z);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import com.hbm.gui.MachineRecipes;
|
||||
import com.hbm.interfaces.IConductor;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.items.ItemBattery;
|
||||
@ -216,7 +217,8 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
|
||||
//ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
|
||||
ItemStack itemStack = MachineRecipes.getShredderResult(this.slots[1]);
|
||||
if(itemStack == null)
|
||||
{
|
||||
return false;
|
||||
@ -240,7 +242,8 @@ public class TileEntityMachineElectricFurnace extends TileEntity implements ISid
|
||||
|
||||
private void processItem() {
|
||||
if(canProcess()) {
|
||||
ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
|
||||
//ItemStack itemStack = FurnaceRecipes.smelting().getSmeltingResult(this.slots[1]);
|
||||
ItemStack itemStack = MachineRecipes.getShredderResult(this.slots[1]);
|
||||
|
||||
if(slots[2] == null)
|
||||
{
|
||||
|
||||
@ -286,7 +286,7 @@ public class TileEntityMachineSchrabidiumTransmutator extends TileEntity impleme
|
||||
if (power + 100 <= maxPower && slots[3] != null && slots[3].getItem() == ModItems.battery_schrabidium
|
||||
&& slots[3].getItemDamage() < 1000) {
|
||||
power += 100;
|
||||
slots[0].setItemDamage(slots[0].getItemDamage() + 1);
|
||||
slots[3].setItemDamage(slots[3].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if (power + 100 <= maxPower && slots[3] != null && slots[3].getItem() == ModItems.fusion_core
|
||||
|
||||
441
com/hbm/blocks/TileEntityMachineShredder.java
Normal file
@ -0,0 +1,441 @@
|
||||
package com.hbm.blocks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
|
||||
import com.hbm.gui.MachineRecipes;
|
||||
import com.hbm.interfaces.IConductor;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.ISource;
|
||||
import com.hbm.items.ItemBattery;
|
||||
import com.hbm.items.ItemBlades;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
public class TileEntityMachineShredder extends TileEntity implements ISidedInventory, IConsumer {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
public int power;
|
||||
public int progress;
|
||||
public int soundCycle = 0;
|
||||
public static final int maxPower = 10000;
|
||||
public static final int processingSpeed = 60;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {1, 2};
|
||||
private static final int[] slots_side = new int[] {2};
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineShredder() {
|
||||
slots = new ItemStack[30];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.machineDiesel";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
//You scrubs aren't needed for anything (right now)
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
if(i == 0)
|
||||
if(stack.getItem() == ModItems.canister_fuel || stack.getItem() == Item.getItemFromBlock(ModBlocks.red_barrel))
|
||||
return true;
|
||||
if(i == 2)
|
||||
if(stack.getItem() instanceof ItemBattery)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
this.power = nbt.getShort("powerTime");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setShort("powerTime", (short) power);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
if(i == 1)
|
||||
if(itemStack.getItem() == ModItems.canister_empty || itemStack.getItem() == ModItems.tank_steel)
|
||||
return true;
|
||||
if(i == 2)
|
||||
if(itemStack.getItemDamage() == 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getDiFurnaceProgressScaled(int i) {
|
||||
return (progress * i) / processingSpeed;
|
||||
}
|
||||
|
||||
public boolean hasPower() {
|
||||
return power > 0;
|
||||
}
|
||||
|
||||
public boolean isProcessing() {
|
||||
return this.progress > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
boolean flag = this.hasPower();
|
||||
boolean flag1 = false;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
if(hasPower() && canProcess())
|
||||
{
|
||||
progress++;
|
||||
|
||||
power -= 5;
|
||||
|
||||
this.slots[27].setItemDamage(this.slots[27].getItemDamage() + 1);
|
||||
this.slots[28].setItemDamage(this.slots[28].getItemDamage() + 1);
|
||||
|
||||
if(this.progress == TileEntityMachineShredder.processingSpeed)
|
||||
{
|
||||
this.progress = 0;
|
||||
this.processItem();
|
||||
flag1 = true;
|
||||
}
|
||||
}else{
|
||||
progress = 0;
|
||||
}
|
||||
|
||||
boolean trigger = true;
|
||||
|
||||
if(hasPower() && canProcess() && this.progress == 0)
|
||||
{
|
||||
trigger = false;
|
||||
}
|
||||
|
||||
if(trigger)
|
||||
{
|
||||
flag1 = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(/*power + 100 <= maxPower && */slots[29] != null && slots[29].getItem() == ModItems.battery_creative)
|
||||
{
|
||||
power = maxPower;
|
||||
}
|
||||
|
||||
if(power + 100 <= maxPower && slots[29] != null && slots[29].getItem() == ModItems.battery_generic && slots[29].getItemDamage() < 50)
|
||||
{
|
||||
power += 100;
|
||||
slots[29].setItemDamage(slots[29].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if(power + 100 <= maxPower && slots[29] != null && slots[29].getItem() == ModItems.battery_advanced && slots[29].getItemDamage() < 200)
|
||||
{
|
||||
power += 100;
|
||||
slots[29].setItemDamage(slots[29].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if(power + 100 <= maxPower && slots[29] != null && slots[29].getItem() == ModItems.battery_schrabidium && slots[29].getItemDamage() < 1000)
|
||||
{
|
||||
power += 100;
|
||||
slots[29].setItemDamage(slots[29].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if(power + 100 <= maxPower && slots[29] != null && slots[29].getItem() == ModItems.fusion_core && slots[29].getItemDamage() < 5000)
|
||||
{
|
||||
power += 100;
|
||||
slots[29].setItemDamage(slots[29].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if(power + 100 <= maxPower && slots[29] != null && slots[29].getItem() == ModItems.energy_core && slots[29].getItemDamage() < 5000)
|
||||
{
|
||||
power += 100;
|
||||
slots[29].setItemDamage(slots[29].getItemDamage() + 1);
|
||||
}
|
||||
|
||||
if(flag1)
|
||||
{
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
/*public void processItem() {
|
||||
|
||||
boolean flag = false;
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack result = MachineRecipes.getResult(slots[i]);
|
||||
if(slots[i] != null && slots[i].stackSize > 0 && hasSpace(result));
|
||||
flag = true;
|
||||
}
|
||||
|
||||
if(!flag) {
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
ItemStack result = MachineRecipes.getResult(slots[i]);
|
||||
|
||||
if(slots[i] != null && slots[i].stackSize > 0 && hasSpace(result)) {
|
||||
slots[i].stackSize -= 1;
|
||||
if(slots[i].stackSize < 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
boolean flag1 = false;
|
||||
|
||||
for(int j = 9; j < 27; j++)
|
||||
{
|
||||
if(slots[j] != null && slots[j].getItem() == result.getItem() && slots[j].stackSize + result.stackSize <= result.getMaxStackSize())
|
||||
{
|
||||
slots[j].stackSize += result.stackSize;
|
||||
flag1 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag1)
|
||||
{
|
||||
for(int j = 9; j < 27; j++)
|
||||
{
|
||||
if(slots[j] == null)
|
||||
{
|
||||
slots[j] = result;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
public void processItem() {
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
if(slots[i] != null && hasSpace(slots[i]))
|
||||
{
|
||||
ItemStack inp = slots[i].copy();
|
||||
ItemStack outp = MachineRecipes.getShredderResult(inp);
|
||||
boolean flag = false;
|
||||
|
||||
for (int j = 9; j < 27; j++)
|
||||
{
|
||||
if (slots[j] != null && slots[j].getItem().equals(outp.getItem()) && slots[j].stackSize + outp.stackSize <= outp.getMaxStackSize()) {
|
||||
slots[j].stackSize += outp.stackSize;
|
||||
slots[i].stackSize -= 1;
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!flag)
|
||||
for (int j = 9; j < 27; j++)
|
||||
{
|
||||
if (slots[j] == null) {
|
||||
slots[j] = outp.copy();
|
||||
slots[i].stackSize -= 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(slots[i].stackSize <= 0)
|
||||
slots[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean canProcess() {
|
||||
if(slots[27] != null && slots[28] != null &&
|
||||
slots[27].getItem() instanceof ItemBlades && slots[28].getItem() instanceof ItemBlades &&
|
||||
slots[27].getItemDamage() < slots[27].getMaxDamage() && slots[28].getItemDamage() < slots[28].getMaxDamage())
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
if(slots[i] != null && slots[i].stackSize > 0 && hasSpace(slots[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpace(ItemStack stack) {
|
||||
|
||||
ItemStack result = MachineRecipes.getShredderResult(stack);
|
||||
|
||||
if (result != null)
|
||||
for (int i = 9; i < 27; i++) {
|
||||
if (slots[i] == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (slots[i] != null && slots[i].getItem().equals(result.getItem())
|
||||
&& slots[i].stackSize + result.stackSize <= result.getMaxStackSize()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPower(int i) {
|
||||
this.power = i;
|
||||
|
||||
}
|
||||
|
||||
public int getPowerScaled(int i) {
|
||||
return (power * i) / maxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPower() {
|
||||
return this.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPower() {
|
||||
return this.maxPower;
|
||||
}
|
||||
}
|
||||
139
com/hbm/gui/ContainerMachineShredder.java
Normal file
@ -0,0 +1,139 @@
|
||||
package com.hbm.gui;
|
||||
|
||||
import com.hbm.blocks.TileEntityMachineDiesel;
|
||||
import com.hbm.blocks.TileEntityMachineShredder;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineShredder extends Container {
|
||||
|
||||
private TileEntityMachineShredder diFurnace;
|
||||
private int power;
|
||||
|
||||
public ContainerMachineShredder(InventoryPlayer invPlayer, TileEntityMachineShredder tedf) {
|
||||
power = 0;
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 44, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 62, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 80, 18));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 44, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 62, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 80, 36));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 44, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 7, 62, 54));
|
||||
this.addSlotToContainer(new Slot(tedf, 8, 80, 54));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 9, 116, 18));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 10, 134, 18));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 11, 152, 18));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 12, 116, 36));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 13, 134, 36));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 14, 152, 36));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 15, 116, 54));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 16, 134, 54));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 17, 152, 54));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 18, 116, 72));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 19, 134, 72));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 20, 152, 72));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 21, 116, 90));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 22, 134, 90));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 23, 152, 90));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 24, 116, 108));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 25, 134, 108));
|
||||
this.addSlotToContainer(new SlotDiFurnace(invPlayer.player, tedf, 26, 152, 108));
|
||||
this.addSlotToContainer(new Slot(tedf, 27, 44, 108));
|
||||
this.addSlotToContainer(new Slot(tedf, 28, 80, 108));
|
||||
this.addSlotToContainer(new Slot(tedf, 29, 8, 108));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142 + 56));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
crafting.sendProgressBarUpdate(this, 0, this.diFurnace.power);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 2) {
|
||||
if (!this.mergeItemStack(var5, 3, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(var5, 0, 1, false))
|
||||
{
|
||||
if (!this.mergeItemStack(var5, 2, 3, false))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
|
||||
for(int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting par1 = (ICrafting)this.crafters.get(i);
|
||||
|
||||
if(this.power != this.diFurnace.power)
|
||||
{
|
||||
par1.sendProgressBarUpdate(this, 0, this.diFurnace.power);
|
||||
}
|
||||
}
|
||||
|
||||
this.power = this.diFurnace.power;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if(i == 0)
|
||||
{
|
||||
diFurnace.power = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
com/hbm/gui/GUIMachineShredder.java
Normal file
@ -0,0 +1,47 @@
|
||||
package com.hbm.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.blocks.TileEntityMachineDiesel;
|
||||
import com.hbm.blocks.TileEntityMachineShredder;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineShredder extends GuiContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_shredder.png");
|
||||
private TileEntityMachineShredder diFurnace;
|
||||
|
||||
public GUIMachineShredder(InventoryPlayer invPlayer, TileEntityMachineShredder tedf) {
|
||||
super(new ContainerMachineShredder(invPlayer, tedf));
|
||||
diFurnace = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.diFurnace.hasCustomInventoryName() ? this.diFurnace.getInventoryName() : I18n.format(this.diFurnace.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(diFurnace.power > 0) {
|
||||
int i = diFurnace.getPowerScaled(52);
|
||||
//drawTexturedModalRect(guiLeft + 152, guiTop + 69 - i, 176, 52 - i, 16, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,16 +2,20 @@ package com.hbm.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class MachineRecipes {
|
||||
|
||||
@ -369,7 +373,8 @@ public class MachineRecipes {
|
||||
new ItemStack(ModItems.ingot_advanced_alloy, 2));
|
||||
recipes.put(new ItemStack[] { new ItemStack(ModItems.canister_empty), new ItemStack(Items.coal) },
|
||||
new ItemStack(ModItems.canister_fuel, 1));
|
||||
recipes.put(new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium) },
|
||||
recipes.put(
|
||||
new ItemStack[] { new ItemStack(ModItems.ingot_tungsten), new ItemStack(ModItems.nugget_schrabidium) },
|
||||
new ItemStack(ModItems.ingot_magnetized_tungsten, 1));
|
||||
return recipes;
|
||||
}
|
||||
@ -508,4 +513,202 @@ public class MachineRecipes {
|
||||
fuels.add(new ItemStack(ModItems.pellet_rtg));
|
||||
return fuels;
|
||||
}
|
||||
|
||||
public class ShredderRecipe {
|
||||
|
||||
public ItemStack input;
|
||||
public ItemStack output;
|
||||
|
||||
public void registerEverythingImSrs() {
|
||||
|
||||
//Makes the OreDict easily accessible. Neat.
|
||||
|
||||
for (Object item : GameData.getItemRegistry()) {
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
int[] array;
|
||||
|
||||
if (item instanceof Item) {
|
||||
|
||||
ItemStack stack = new ItemStack((Item) item);
|
||||
array = OreDictionary.getOreIDs(stack);
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
//if (!OreDictionary.getOreName(array[i]).equals("Unknown")) {
|
||||
list.add(OreDictionary.getOreName(array[i]));
|
||||
//}
|
||||
}
|
||||
//if(list.size() > 0)
|
||||
theWholeThing.add(new DictCouple(stack, list));
|
||||
}
|
||||
}
|
||||
|
||||
for (Object block : GameData.getBlockRegistry()) {
|
||||
|
||||
List<String> list = new ArrayList<String>();
|
||||
int[] array;
|
||||
|
||||
if (block instanceof Block) {
|
||||
|
||||
ItemStack stack = new ItemStack((Block) block);
|
||||
array = OreDictionary.getOreIDs(stack);
|
||||
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
//if (!OreDictionary.getOreName(array[i]).equals("Unknown")) {
|
||||
list.add(OreDictionary.getOreName(array[i]));
|
||||
//}
|
||||
}
|
||||
|
||||
//if(list.size() > 0)
|
||||
theWholeThing.add(new DictCouple(stack, list));
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("Added " + theWholeThing.size() + " elements from the Ore Dict!");
|
||||
}
|
||||
|
||||
public void addRecipes() {
|
||||
|
||||
// Not very efficient, I know, but at least it works AND it's
|
||||
// somewhat smart!
|
||||
|
||||
for(int i = 0; i < theWholeThing.size(); i++)
|
||||
{
|
||||
for(int j = 0; j < theWholeThing.get(i).list.size(); j++)
|
||||
{
|
||||
String s = theWholeThing.get(i).list.get(j);
|
||||
|
||||
if (s.length() > 5 && s.substring(0, 5).equals("ingot")) {
|
||||
ItemStack stack = canFindDustByName(s.substring(5));
|
||||
if (stack != null) {
|
||||
setRecipe(theWholeThing.get(i).item, stack);
|
||||
} else {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
|
||||
}
|
||||
} else if (s.length() > 3 && s.substring(0, 3).equals("ore")) {
|
||||
ItemStack stack = canFindDustByName(s.substring(3));
|
||||
if (stack != null) {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(stack.getItem(), 2));
|
||||
} else {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
|
||||
}
|
||||
} else if (s.length() > 5 && s.substring(0, 5).equals("block")) {
|
||||
ItemStack stack = canFindDustByName(s.substring(5));
|
||||
if (stack != null) {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(stack.getItem(), 9));
|
||||
} else {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
|
||||
}
|
||||
} else if (s.length() > 4 && s.substring(0, 4).equals("dust")) {
|
||||
setRecipe(theWholeThing.get(i).item, theWholeThing.get(i).item);
|
||||
} else {
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
|
||||
}
|
||||
}
|
||||
|
||||
if(theWholeThing.get(i).list.isEmpty())
|
||||
setRecipe(theWholeThing.get(i).item, new ItemStack(ModItems.scrap));
|
||||
}
|
||||
|
||||
System.out.println("Added " + recipes.size() + " in total.");
|
||||
System.out.println("Added " + dustCount + " ore dust recipes.");
|
||||
}
|
||||
|
||||
public ItemStack canFindDustByName(String s) {
|
||||
|
||||
for(DictCouple d : theWholeThing)
|
||||
{
|
||||
for(String s1 : d.list)
|
||||
{
|
||||
if(s1.length() > 4 && s1.substring(0, 4).equals("dust") && s1.substring(4).equals(s))
|
||||
{
|
||||
dustCount++;
|
||||
return d.item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setRecipe(ItemStack inp, ItemStack outp) {
|
||||
ShredderRecipe recipe = new ShredderRecipe();
|
||||
|
||||
recipe.input = inp;
|
||||
recipe.output = outp;
|
||||
|
||||
recipes.add(recipe);
|
||||
}
|
||||
|
||||
public void PrintRecipes() {
|
||||
/*for(int i = 0; i < recipes.size(); i++) {
|
||||
System.out.println("Recipe #" + i + ", " + recipes.get(i).input + " - " + recipes.get(i).output);
|
||||
}*/
|
||||
/*for(int i = 0; i < theWholeThing.size(); i++) {
|
||||
System.out.println(theWholeThing.get(i).item);
|
||||
}*/
|
||||
/*for(int i = 0; i < theWholeThing.size(); i++) {
|
||||
//for(int j = 0; j < theWholeThing.get(i).list.size(); j++)
|
||||
{
|
||||
//System.out.println(theWholeThing.get(i).item + " | " + getShredderResult(theWholeThing.get(i).item));
|
||||
}
|
||||
|
||||
|
||||
}*/
|
||||
|
||||
/*for (int j = 0; j < recipes.size(); j++) {
|
||||
if (recipes.get(j) != null && recipes.get(j).input != null && recipes.get(j).output != null &&
|
||||
recipes.get(j).input.getItem() != null && recipes.get(j).output.getItem() != null)
|
||||
System.out.println(recipes.get(j).input + " | " + recipes.get(j).output);
|
||||
else
|
||||
System.out.println(recipes.get(j));
|
||||
}
|
||||
|
||||
System.out.println("TWT: " + theWholeThing.size() + ", REC: " + recipes.size());*/
|
||||
}
|
||||
}
|
||||
|
||||
public static class DictCouple {
|
||||
|
||||
public ItemStack item;
|
||||
public List<String> list;
|
||||
|
||||
public DictCouple(ItemStack item, List<String> list) {
|
||||
this.item = item;
|
||||
this.list = list;
|
||||
}
|
||||
|
||||
public static List<String> findWithStack(ItemStack stack) {
|
||||
for(DictCouple couple : theWholeThing) {
|
||||
if(couple.item.equals(stack));
|
||||
return couple.list;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ShredderRecipe> recipes = new ArrayList<ShredderRecipe>();
|
||||
public static List<DictCouple> theWholeThing = new ArrayList<DictCouple>();
|
||||
public static int dustCount = 0;
|
||||
|
||||
public static ItemStack getShredderResult(ItemStack stack) {
|
||||
for(ShredderRecipe rec : recipes)
|
||||
{
|
||||
if(stack != null && rec.input.getItem().equals(stack.getItem()))
|
||||
return rec.output.copy();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public Map<Object, Object> getShredderRecipes() {
|
||||
Map<Object, Object> recipes = new HashMap<Object, Object>();
|
||||
|
||||
for(int i = 0; i < this.recipes.size(); i++) {
|
||||
recipes.put(((ShredderRecipe)recipes.get(i)).input, ((ShredderRecipe)recipes.get(i)).output);
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class GunZOMG extends Item {
|
||||
if (world.isRemote) {
|
||||
player.addChatMessage(new ChatComponentText("[ZOMG] Welcome, user!"));
|
||||
}
|
||||
stack.stackTagCompound.setBoolean("superuser", true);
|
||||
stack.stackTagCompound.setBoolean("superuser", false);
|
||||
}
|
||||
} else {
|
||||
if (world.isRemote) {
|
||||
@ -178,4 +178,23 @@ public class GunZOMG extends Item {
|
||||
public int getItemEnchantability() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
if(itemstack.getTagCompound() == null)
|
||||
{
|
||||
list.add("Gun not validated.");
|
||||
} else if(itemstack.getTagCompound().getBoolean("valid")) {
|
||||
if(itemstack.getTagCompound().getBoolean("superuser")) {
|
||||
list.add("Gun set to superuser mode.");
|
||||
list.add("Firing mode: Negative energy bursts");
|
||||
} else {
|
||||
list.add("Gun set to regular user mode.");
|
||||
list.add("Firing mode: Dark pulse spray");
|
||||
}
|
||||
} else {
|
||||
list.add("Gun not validated.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
com/hbm/items/ItemBlades.java
Normal file
@ -0,0 +1,12 @@
|
||||
package com.hbm.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemBlades extends Item {
|
||||
|
||||
public ItemBlades(int dura)
|
||||
{
|
||||
this.setMaxDamage(dura);
|
||||
}
|
||||
|
||||
}
|
||||
@ -179,6 +179,10 @@ public class ModItems {
|
||||
public static Item chopper_blades;
|
||||
public static Item combine_scrap;
|
||||
|
||||
public static Item blades_steel;
|
||||
public static Item blades_titanium;
|
||||
public static Item blades_advanced_alloy;
|
||||
|
||||
public static Item pellet_rtg;
|
||||
public static Item tritium_deuterium_cake;
|
||||
|
||||
@ -285,6 +289,7 @@ public class ModItems {
|
||||
public static Item rod_dual_coolant;
|
||||
public static Item rod_quad_coolant;
|
||||
|
||||
public static Item scrap;
|
||||
public static Item trinitite;
|
||||
public static Item nuclear_waste;
|
||||
public static Item rod_uranium_fuel_depleted;
|
||||
@ -502,6 +507,8 @@ public class ModItems {
|
||||
|
||||
public static Item schrabidium_hammer;
|
||||
|
||||
public static Item crowbar;
|
||||
|
||||
public static Item hazmat_helmet;
|
||||
public static Item hazmat_plate;
|
||||
public static Item hazmat_legs;
|
||||
@ -744,6 +751,10 @@ public class ModItems {
|
||||
inf_sulfur = new Item().setUnlocalizedName("inf_sulfur").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":inf_sulfur");
|
||||
inf_diesel = new Item().setUnlocalizedName("inf_diesel").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":inf_diesel");
|
||||
|
||||
blades_steel = new ItemBlades(12000).setUnlocalizedName("blades_steel").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":blades_steel");
|
||||
blades_titanium = new ItemBlades(42000).setUnlocalizedName("blades_titanium").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":blades_titanium");
|
||||
blades_advanced_alloy = new ItemBlades(72000).setUnlocalizedName("blades_advanced_alloy").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":blades_advanced_alloy");
|
||||
|
||||
canister_empty = new ItemCustomLore().setUnlocalizedName("canister_empty").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":canister_empty");
|
||||
canister_fuel = new ItemCustomLore().setUnlocalizedName("canister_fuel").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_fuel");
|
||||
canister_napalm = new ItemCustomLore().setUnlocalizedName("canister_napalm").setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.canister_empty).setTextureName(RefStrings.MODID + ":canister_napalm");
|
||||
@ -833,6 +844,7 @@ public class ModItems {
|
||||
|
||||
trinitite = new Item().setUnlocalizedName("trinitite").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":trinitite_new");
|
||||
nuclear_waste = new Item().setUnlocalizedName("nuclear_waste").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":nuclear_waste");
|
||||
scrap = new Item().setUnlocalizedName("scrap").setCreativeTab(MainRegistry.tabParts).setTextureName(RefStrings.MODID + ":scrap");
|
||||
rod_uranium_fuel_depleted = new Item().setUnlocalizedName("rod_uranium_fuel_depleted").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.rod_empty).setTextureName(RefStrings.MODID + ":rod_uranium_fuel_depleted");
|
||||
rod_dual_uranium_fuel_depleted = new Item().setUnlocalizedName("rod_dual_uranium_fuel_depleted").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.rod_dual_empty).setTextureName(RefStrings.MODID + ":rod_dual_uranium_fuel_depleted");
|
||||
rod_quad_uranium_fuel_depleted = new Item().setUnlocalizedName("rod_quad_uranium_fuel_depleted").setMaxStackSize(1).setCreativeTab(MainRegistry.tabParts).setContainerItem(ModItems.rod_quad_empty).setTextureName(RefStrings.MODID + ":rod_quad_uranium_fuel_depleted");
|
||||
@ -1073,6 +1085,7 @@ public class ModItems {
|
||||
schrabidium_hammer = new WeaponSpecial(MainRegistry.enumToolMaterialHammer).setUnlocalizedName("schrabidium_hammer").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":schrabidium_hammer");
|
||||
euphemium_stopper = new ItemSyringe().setUnlocalizedName("euphemium_stopper").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":euphemium_stopper");
|
||||
matchstick = new ItemMatch().setUnlocalizedName("matchstick").setCreativeTab(CreativeTabs.tabTools).setFull3D().setTextureName(RefStrings.MODID + ":matchstick");
|
||||
crowbar = new ModSword(MainRegistry.enumToolMaterialTitanium).setUnlocalizedName("crowbar").setFull3D().setTextureName(RefStrings.MODID + ":crowbar");
|
||||
|
||||
bucket_mud = new ItemModBucket(ModBlocks.mud_block).setUnlocalizedName("bucket_mud").setContainerItem(Items.bucket).setCreativeTab(MainRegistry.tabBlock).setTextureName(RefStrings.MODID + ":bucket_mud");
|
||||
|
||||
@ -1342,6 +1355,11 @@ public class ModItems {
|
||||
GameRegistry.registerItem(redcoil_capacitor, redcoil_capacitor.getUnlocalizedName());
|
||||
GameRegistry.registerItem(titanium_filter, titanium_filter.getUnlocalizedName());
|
||||
|
||||
//Shredder Blades
|
||||
GameRegistry.registerItem(blades_steel, blades_steel.getUnlocalizedName());
|
||||
GameRegistry.registerItem(blades_titanium, blades_titanium.getUnlocalizedName());
|
||||
GameRegistry.registerItem(blades_advanced_alloy, blades_advanced_alloy.getUnlocalizedName());
|
||||
|
||||
//Fuelrods
|
||||
GameRegistry.registerItem(rod_empty, rod_empty.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rod_dual_empty, rod_dual_empty.getUnlocalizedName());
|
||||
@ -1440,6 +1458,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(rod_dual_waste, rod_dual_waste.getUnlocalizedName());
|
||||
GameRegistry.registerItem(rod_quad_waste, rod_quad_waste.getUnlocalizedName());
|
||||
|
||||
GameRegistry.registerItem(scrap, scrap.getUnlocalizedName());
|
||||
GameRegistry.registerItem(trinitite, trinitite.getUnlocalizedName());
|
||||
GameRegistry.registerItem(nuclear_waste, nuclear_waste.getUnlocalizedName());
|
||||
|
||||
@ -1533,6 +1552,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(alloy_shovel, alloy_shovel.getUnlocalizedName());
|
||||
GameRegistry.registerItem(alloy_hoe, alloy_hoe.getUnlocalizedName());
|
||||
GameRegistry.registerItem(matchstick, matchstick.getUnlocalizedName());
|
||||
GameRegistry.registerItem(crowbar, crowbar.getUnlocalizedName());
|
||||
|
||||
//Syringes
|
||||
GameRegistry.registerItem(syringe_empty, syringe_empty.getUnlocalizedName());
|
||||
|
||||
@ -19,6 +19,7 @@ import com.hbm.blocks.TileEntityMachineCentrifuge;
|
||||
import com.hbm.blocks.TileEntityMachinePuF6Tank;
|
||||
import com.hbm.blocks.TileEntityMachineReactor;
|
||||
import com.hbm.blocks.TileEntityMachineSchrabidiumTransmutator;
|
||||
import com.hbm.blocks.TileEntityMachineShredder;
|
||||
import com.hbm.blocks.TileEntityMachineUF6Tank;
|
||||
import com.hbm.blocks.TileEntityNukeBoy;
|
||||
import com.hbm.blocks.TileEntityNukeFleija;
|
||||
@ -48,6 +49,7 @@ import com.hbm.gui.ContainerMachineCoal;
|
||||
import com.hbm.gui.ContainerMachineDeuterium;
|
||||
import com.hbm.gui.ContainerMachineDiesel;
|
||||
import com.hbm.gui.ContainerMachineSchrabidiumTransmutator;
|
||||
import com.hbm.gui.ContainerMachineShredder;
|
||||
import com.hbm.gui.ContainerNukeBoy;
|
||||
import com.hbm.gui.ContainerNukeFleija;
|
||||
import com.hbm.gui.ContainerNukeFurnace;
|
||||
@ -80,6 +82,7 @@ import com.hbm.gui.GUIMachineGenerator;
|
||||
import com.hbm.gui.GUIMachinePuF6Tank;
|
||||
import com.hbm.gui.GUIMachineReactor;
|
||||
import com.hbm.gui.GUIMachineSchrabidiumTransmutator;
|
||||
import com.hbm.gui.GUIMachineShredder;
|
||||
import com.hbm.gui.GUIMachineUF6Tank;
|
||||
import com.hbm.gui.GUINukeBoy;
|
||||
import com.hbm.gui.GUINukeFleija;
|
||||
@ -356,6 +359,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new ContainerWatzCore(player.inventory, (TileEntityWatzCore) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_shredder:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineShredder)
|
||||
{
|
||||
return new ContainerMachineShredder(player.inventory, (TileEntityMachineShredder) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -616,6 +627,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new GUIWatzCore(player.inventory, (TileEntityWatzCore) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_shredder:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineShredder)
|
||||
{
|
||||
return new GUIMachineShredder(player.inventory, (TileEntityMachineShredder) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.hbm.main;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
@ -43,6 +44,7 @@ import com.hbm.blocks.TileEntityMachineCentrifuge;
|
||||
import com.hbm.blocks.TileEntityMachinePuF6Tank;
|
||||
import com.hbm.blocks.TileEntityMachineReactor;
|
||||
import com.hbm.blocks.TileEntityMachineSchrabidiumTransmutator;
|
||||
import com.hbm.blocks.TileEntityMachineShredder;
|
||||
import com.hbm.blocks.TileEntityMachineUF6Tank;
|
||||
import com.hbm.blocks.TileEntityNukeBoy;
|
||||
import com.hbm.blocks.TileEntityNukeFleija;
|
||||
@ -115,6 +117,8 @@ import com.hbm.entity.EntityRainbow;
|
||||
import com.hbm.entity.EntityRocket;
|
||||
import com.hbm.entity.EntitySchrab;
|
||||
import com.hbm.entity.EntityTestMissile;
|
||||
import com.hbm.gui.MachineRecipes;
|
||||
import com.hbm.gui.MachineRecipes.ShredderRecipe;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.HbmWorld;
|
||||
import com.hbm.lib.Library;
|
||||
@ -128,6 +132,7 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.EntityRegistry;
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@Mod(modid = RefStrings.MODID, name = RefStrings.NAME, version = RefStrings.VERSION)
|
||||
@ -281,6 +286,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityMachineSchrabidiumTransmutator.class, "tileentity_schrabidium_transmutator");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineDiesel.class, "tileentity_diesel_generator");
|
||||
GameRegistry.registerTileEntity(TileEntityWatzCore.class, "tileentity_watz_powerplant");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineShredder.class, "tileentity_machine_shredder");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
@ -423,7 +429,14 @@ public class MainRegistry
|
||||
@EventHandler
|
||||
public static void PostLoad(FMLPostInitializationEvent PostEvent)
|
||||
{
|
||||
ShredderRecipe recipes = new MachineRecipes().new ShredderRecipe();
|
||||
|
||||
recipes.registerEverythingImSrs();
|
||||
|
||||
recipes.addRecipes();
|
||||
|
||||
//if(MainRegistry.enableDebugMode)
|
||||
recipes.PrintRecipes();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
||||