Some things that I accidently left out during the last push...
@@ -0,0 +1,56 @@
 | 
			
		||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs;
 | 
			
		||||
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityAdvancedWasteHandler;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers.ContainerAdvancedWasteHandler;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModInfo;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.client.gui.inventory.GuiContainer;
 | 
			
		||||
import net.minecraft.entity.player.InventoryPlayer;
 | 
			
		||||
import net.minecraft.inventory.Container;
 | 
			
		||||
import net.minecraft.util.ResourceLocation;
 | 
			
		||||
 | 
			
		||||
public class GuiAdvancedWasteHandler extends GuiContainer {
 | 
			
		||||
	
 | 
			
		||||
	int currentcooldownscaled;
 | 
			
		||||
 | 
			
		||||
	int currentpowerscaled;
 | 
			
		||||
	
 | 
			
		||||
	int currentconversion;
 | 
			
		||||
	
 | 
			
		||||
	private TileEntityAdvancedWasteHandler tileentity;
 | 
			
		||||
	
 | 
			
		||||
	private ResourceLocation resource = new ResourceLocation(ModInfo.MODID + ":" + "textures/gui/GuiAdvancedWasteHandler.png");
 | 
			
		||||
	
 | 
			
		||||
	public GuiAdvancedWasteHandler(InventoryPlayer inventoryplayer, TileEntityAdvancedWasteHandler tileentity) {
 | 
			
		||||
		super(new ContainerAdvancedWasteHandler(inventoryplayer, tileentity));
 | 
			
		||||
		this.tileentity = tileentity;
 | 
			
		||||
		this.xSize = 176;
 | 
			
		||||
		this.ySize = 187;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	protected void drawGuiContainerBackgroundLayer(float f, int mx, int my) {
 | 
			
		||||
		this.mc.getTextureManager().bindTexture(resource);
 | 
			
		||||
		currentcooldownscaled = this.tileentity.cooldownscaled(51);
 | 
			
		||||
		currentpowerscaled = this.tileentity.powerScaled(55);
 | 
			
		||||
		currentconversion = this.tileentity.genscaled(52);
 | 
			
		||||
		
 | 
			
		||||
		drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
 | 
			
		||||
		
 | 
			
		||||
		drawTexturedModalRect(guiLeft+74, guiTop+44, 176, 0, currentcooldownscaled, 16);
 | 
			
		||||
		drawTexturedModalRect(guiLeft+14, guiTop+44, 176, 16, currentpowerscaled, 16);
 | 
			
		||||
		drawTexturedModalRect(guiLeft+41, guiTop+65, 176, 32, currentconversion, 16);
 | 
			
		||||
		drawCenteredString(fontRendererObj, "Advanced Waste Handler", guiLeft+90, guiTop-10, 0xFFFFFF);
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		if (mx > guiLeft+14 && mx < guiLeft+70 && my > guiTop+44 && my < guiTop+64) {
 | 
			
		||||
			drawString(fontRendererObj, tileentity.currentPower + "/" + tileentity.maxpower, guiLeft+110, guiTop+70, 0xa8a8a8);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean doesGuiPauseGame() {
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,160 @@
 | 
			
		||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks;
 | 
			
		||||
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.AdvancedSatelliteUtilization;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modGUIs.ModGUIs;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityAdvancedWasteHandler;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityEnderCoreGenerator;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModCreativeTabs;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.ModInfo;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.ModMachineBlock;
 | 
			
		||||
 | 
			
		||||
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.EntityLivingBase;
 | 
			
		||||
import net.minecraft.entity.player.EntityPlayer;
 | 
			
		||||
import net.minecraft.init.Blocks;
 | 
			
		||||
import net.minecraft.item.Item;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
import net.minecraft.tileentity.TileEntity;
 | 
			
		||||
import net.minecraft.util.IIcon;
 | 
			
		||||
import net.minecraft.util.MathHelper;
 | 
			
		||||
import net.minecraft.world.World;
 | 
			
		||||
 | 
			
		||||
public class AdvancedWasteHandler extends ModMachineBlock {
 | 
			
		||||
	boolean active;
 | 
			
		||||
	
 | 
			
		||||
	public IIcon icon[] = new IIcon[4];
 | 
			
		||||
	
 | 
			
		||||
	protected AdvancedWasteHandler(boolean active) {
 | 
			
		||||
		super(Material.rock);
 | 
			
		||||
		this.active = active;
 | 
			
		||||
		setBlockName("AdvancedWasteHandler_" + active);
 | 
			
		||||
		if (!active) setCreativeTab(ModCreativeTabs.TabASU);
 | 
			
		||||
		setBlockTextureName(ModInfo.MODID + ":" + "AdvancedWasteHandler/" + getUnlocalizedName().substring(5));
 | 
			
		||||
		setResistance(8);
 | 
			
		||||
		setHardness(8);
 | 
			
		||||
		setHarvestLevel("pickaxe", 2);
 | 
			
		||||
		if (active) setLightLevel(0.9f);
 | 
			
		||||
	}
 | 
			
		||||
	@Override
 | 
			
		||||
	public TileEntity createNewTileEntity(World w, int var) {
 | 
			
		||||
		return new TileEntityAdvancedWasteHandler();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entitylivingbase, ItemStack item) {
 | 
			
		||||
		int i = MathHelper.floor_double((double)(entitylivingbase.rotationYaw * 4.0f/360.0f) + 0.5D) & 3;
 | 
			
		||||
		switch (i) {
 | 
			
		||||
		case 0: world.setBlockMetadataWithNotify(x, y, z, 2, 2);
 | 
			
		||||
		break;
 | 
			
		||||
		case 1: world.setBlockMetadataWithNotify(x, y, z, 5, 2);
 | 
			
		||||
		break;
 | 
			
		||||
		case 2: world.setBlockMetadataWithNotify(x, y, z, 3, 2);
 | 
			
		||||
		break;
 | 
			
		||||
		case 3: world.setBlockMetadataWithNotify(x, y, z, 4, 2);
 | 
			
		||||
		break;
 | 
			
		||||
		}
 | 
			
		||||
		super.onBlockPlacedBy(world, x, y, z, entitylivingbase, item);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	@SideOnly(Side.CLIENT)
 | 
			
		||||
	public void registerBlockIcons(IIconRegister icon) {
 | 
			
		||||
		this.icon[0] = icon.registerIcon(ModInfo.MODID + ":" + "AdvancedWasteHandler/" + getUnlocalizedName().substring(5) + "_front");
 | 
			
		||||
		this.icon[1] = icon.registerIcon(ModInfo.MODID + ":" + "AdvancedWasteHandler/" + getUnlocalizedName().substring(5)+ "_sides");
 | 
			
		||||
		this.icon[2] = icon.registerIcon(ModInfo.MODID + ":" + "AdvancedWasteHandler/" + getUnlocalizedName().substring(5)+ "_top");
 | 
			
		||||
		this.icon[3] = icon.registerIcon(ModInfo.MODID + ":" + "AdvancedWasteHandler/" + getUnlocalizedName().substring(5)+ "_bottom");
 | 
			
		||||
		super.registerBlockIcons(icon);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	@SideOnly(Side.CLIENT)
 | 
			
		||||
	public IIcon getIcon(int side, int meta) {
 | 
			
		||||
		IIcon iconreturned;
 | 
			
		||||
		if (meta == 0) {
 | 
			
		||||
			switch (side) {
 | 
			
		||||
			case 0: iconreturned = icon[3];
 | 
			
		||||
			break;
 | 
			
		||||
			case 1: iconreturned = icon[2];
 | 
			
		||||
			break;
 | 
			
		||||
			case 3: iconreturned = icon[0];
 | 
			
		||||
			break;
 | 
			
		||||
			default: iconreturned = icon[1];
 | 
			
		||||
			}
 | 
			
		||||
		} else if (side == 1) {
 | 
			
		||||
			iconreturned = this.icon[2];
 | 
			
		||||
		}else if (side == 0) {
 | 
			
		||||
			iconreturned = this.icon[3];
 | 
			
		||||
		} else if (side != meta) {
 | 
			
		||||
			iconreturned = this.icon[1];
 | 
			
		||||
		} else {
 | 
			
		||||
			iconreturned = this.icon[0];
 | 
			
		||||
		}
 | 
			
		||||
		return iconreturned;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
 | 
			
		||||
		if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == ModItems.wrench) {
 | 
			
		||||
			int info[] = this.wrenched(player, world, x, y, z, true, (int) ((TileEntityAdvancedWasteHandler)world.getTileEntity(x, y, z)).currentPower, (byte) ((TileEntityAdvancedWasteHandler)world.getTileEntity(x, y, z)).powerScaled(100), new ItemStack(ModBlocks.AdvancedWasteHandler, 1));
 | 
			
		||||
			switch (info[1]) {
 | 
			
		||||
			case 0: ((TileEntityAdvancedWasteHandler)world.getTileEntity(x, y, z)).currentPower = info[0];
 | 
			
		||||
			break;
 | 
			
		||||
			
 | 
			
		||||
			case 1: FMLNetworkHandler.openGui(player, AdvancedSatelliteUtilization.instance, ModGUIs.ADVANCEDWASTEHANDLERID, world, x, y, z);
 | 
			
		||||
			break;
 | 
			
		||||
			}
 | 
			
		||||
		} else if (((TileEntityAdvancedWasteHandler)world.getTileEntity(x, y, z)).humanInterface() && !world.isRemote) {
 | 
			
		||||
			FMLNetworkHandler.openGui(player, AdvancedSatelliteUtilization.instance, ModGUIs.ADVANCEDWASTEHANDLERID, world, x, y, z);
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
 | 
			
		||||
		return Item.getItemFromBlock(ModBlocks.AdvancedWasteHandler);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) {
 | 
			
		||||
		return Item.getItemFromBlock(ModBlocks.AdvancedWasteHandler);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void updateGenerator(World world, int x, int y, int z, boolean active) {
 | 
			
		||||
		int meta = world.getBlockMetadata(x, y, z);
 | 
			
		||||
		TileEntity te = (TileEntityAdvancedWasteHandler)world.getTileEntity(x, y, z);
 | 
			
		||||
		
 | 
			
		||||
		if (active) {
 | 
			
		||||
			world.setBlock(x, y, z, ModBlocks.AdvancedWasteHandler_active);
 | 
			
		||||
		} else {
 | 
			
		||||
			world.setBlock(x, y, z, ModBlocks.AdvancedWasteHandler);
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		world.setBlockMetadataWithNotify(x, y, z, meta, 2);
 | 
			
		||||
		
 | 
			
		||||
		if (te != null) {
 | 
			
		||||
			te.validate();
 | 
			
		||||
			world.setTileEntity(x, y, z, te);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void randomDisplayTick(World world, int x, int y, int z, Random r) {
 | 
			
		||||
		if (active) {
 | 
			
		||||
			for (int i = 0; i < 4; i++) {
 | 
			
		||||
				world.spawnParticle("explode", x+0.4F, y+1.3F, z+0.55f, 0, 0.01F, 0);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		super.randomDisplayTick(world, x, y, z, r);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,46 @@
 | 
			
		||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.init.Items;
 | 
			
		||||
import net.minecraft.inventory.ISidedInventory;
 | 
			
		||||
import net.minecraft.item.Item;
 | 
			
		||||
import net.minecraft.item.ItemStack;
 | 
			
		||||
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.AdvancedWasteHandler;
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference.TileEntityGenerator;
 | 
			
		||||
 | 
			
		||||
public class TileEntityAdvancedWasteHandler extends TileEntityGenerator implements ISidedInventory {
 | 
			
		||||
	int fuelqueue[] = new int[6];
 | 
			
		||||
	Item item[] = new Item[6];
 | 
			
		||||
	public TileEntityAdvancedWasteHandler() {
 | 
			
		||||
		for (int i = 0; i < fuelqueue.length; i++) {
 | 
			
		||||
			fuelqueue[i] = 5;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		item[0] = Items.bone;
 | 
			
		||||
		item[1] = Items.clay_ball;
 | 
			
		||||
		item[2] = Items.slime_ball;
 | 
			
		||||
		item[3] = Items.egg;
 | 
			
		||||
		item[4] = Items.feather;
 | 
			
		||||
		item[5] = Items.rotten_flesh;
 | 
			
		||||
		
 | 
			
		||||
		this.ItemValidityByItem(item);
 | 
			
		||||
		this.configureVars(fuelqueue);
 | 
			
		||||
		
 | 
			
		||||
		this.setSimple();
 | 
			
		||||
		
 | 
			
		||||
		this.setMaxPower(1000);
 | 
			
		||||
		this.configureVars(200);
 | 
			
		||||
		setItems(new ItemStack[11]);
 | 
			
		||||
		setUpgradeslotstart(8);
 | 
			
		||||
		
 | 
			
		||||
		setFuelConversionSpeed(0.25F);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void updateEntity() {
 | 
			
		||||
		
 | 
			
		||||
		AdvancedWasteHandler.updateGenerator(worldObj, xCoord, yCoord, zCoord, this.currentfuelqueue > 0 && this.currentfuelqueue <= 4 || this.currentcooldown > 0);		
 | 
			
		||||
		super.updateEntity();
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,52 @@
 | 
			
		||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.modcontainers;
 | 
			
		||||
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.modblocks.tileentities.TileEntityAdvancedWasteHandler;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class ContainerAdvancedWasteHandler extends Container {
 | 
			
		||||
	public static byte input[] = new byte[11];
 | 
			
		||||
	public TileEntityAdvancedWasteHandler tileentity;
 | 
			
		||||
	
 | 
			
		||||
	public ContainerAdvancedWasteHandler(InventoryPlayer inventoryplayer, TileEntityAdvancedWasteHandler tileentity) {
 | 
			
		||||
		this.tileentity = tileentity;
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 0; i < 9; i++) {
 | 
			
		||||
			this.addSlotToContainer(new Slot(inventoryplayer, i, 8 + i * 18, 163));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for (byte i = 0; i < 3; i++) {
 | 
			
		||||
			for (byte j = 0; j < 9; j++) {
 | 
			
		||||
				this.addSlotToContainer(new Slot(inventoryplayer, 9 + j + i * 9, 8 + j * 18, 105 + i * 18));
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 0; i < input.length; i++) {
 | 
			
		||||
			input[i] = (byte) i;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 8; i < input.length; i++) {
 | 
			
		||||
			this.addSlotToContainer(new Slot(tileentity, input[i], 6 + (i-8)*26, 4));
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		for (int i = 0; i < 8; i++) {
 | 
			
		||||
			this.addSlotToContainer(new Slot(tileentity, input[i], 6 + i*18, 25));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean canInteractWith(EntityPlayer p_75145_1_) {
 | 
			
		||||
		// TODO Auto-generated method stub
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2SlotId) {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,429 @@
 | 
			
		||||
package org.bitbucket.alltra101ify.advancedsatelliteutilization.reference.moditemblockreference;
 | 
			
		||||
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
 | 
			
		||||
import org.bitbucket.alltra101ify.advancedsatelliteutilization.moditems.ModItems;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.entity.player.EntityPlayer;
 | 
			
		||||
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.network.NetworkManager;
 | 
			
		||||
import net.minecraft.network.Packet;
 | 
			
		||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
 | 
			
		||||
import net.minecraft.tileentity.TileEntity;
 | 
			
		||||
 | 
			
		||||
public class TileEntityGenerator extends TileEntity implements ISidedInventory {
 | 
			
		||||
	protected ItemStack[] items;
 | 
			
		||||
	public boolean toggle, multiblock;
 | 
			
		||||
	protected String customName;
 | 
			
		||||
	public int maxpower, cooldown, currentcooldown, fuelqueue[], count, upgradeslotstart;
 | 
			
		||||
	public float FuelConversionSpeed, currentfuelqueue, currentPower;
 | 
			
		||||
	public float rotationX, rotationY, speed, speedSlower;
 | 
			
		||||
	Item[] validItemByItem;
 | 
			
		||||
	String validItemByString, particle;
 | 
			
		||||
	protected int x, y, z;
 | 
			
		||||
	@Override
 | 
			
		||||
	public void updateEntity() {
 | 
			
		||||
		if (currentcooldown != 0) {
 | 
			
		||||
			currentcooldown--;
 | 
			
		||||
		}
 | 
			
		||||
		for (int i = upgradeslotstart; i < items.length; i++) {
 | 
			
		||||
			if (items[i] != null) {
 | 
			
		||||
				if (currentcooldown >= 1 && items[i].getItem() == ModItems.fanModule) {
 | 
			
		||||
					currentcooldown--;
 | 
			
		||||
				} else if (toggle && items[i].getItem() == ModItems.conversionSpeedUpgrade && currentfuelqueue >= 2) {
 | 
			
		||||
					currentfuelqueue = currentfuelqueue - 2;
 | 
			
		||||
					currentPower = currentPower + 2;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		
 | 
			
		||||
		if (!multiblock && toggle) {
 | 
			
		||||
			toggle = false;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (currentfuelqueue > maxpower) {
 | 
			
		||||
			currentfuelqueue = maxpower;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (currentPower >= maxpower) {
 | 
			
		||||
			currentPower = maxpower;
 | 
			
		||||
		}
 | 
			
		||||
		if (currentPower <= 0) {
 | 
			
		||||
			currentPower = 0;
 | 
			
		||||
		}
 | 
			
		||||
		
 | 
			
		||||
		if (toggle) {
 | 
			
		||||
			for (int j = 0; j < upgradeslotstart; j++) {
 | 
			
		||||
				//Register fuel and such using item and fuel index system
 | 
			
		||||
				if (items[j] != null && this.validItemByItem != null) {
 | 
			
		||||
					for (int i = 0; i < validItemByItem.length; i++) {
 | 
			
		||||
						if (currentcooldown == 0 && currentfuelqueue <= maxpower - fuelqueue[i] && items[j].getItem() == validItemByItem[i]) {
 | 
			
		||||
							if (items[j].stackSize == 1) {
 | 
			
		||||
								this.items[j] = null;
 | 
			
		||||
							} else {
 | 
			
		||||
								items[j].splitStack(1);
 | 
			
		||||
								if (this.items[j].stackSize == 0) {
 | 
			
		||||
									this.items[j] = null;
 | 
			
		||||
			
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						this.currentfuelqueue += fuelqueue[i];
 | 
			
		||||
						this.currentcooldown = cooldown;	
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} else
 | 
			
		||||
				//Register fuel and such by default or customized index fuel
 | 
			
		||||
				if (items[j] != null && this.validItemByString !=null) {
 | 
			
		||||
					if (currentfuelqueue <= maxpower - fuelqueue[0] && currentcooldown == 0) {
 | 
			
		||||
						if (items[j].stackSize == 1) {
 | 
			
		||||
							this.items[j] = null;
 | 
			
		||||
						} else {
 | 
			
		||||
							items[j].splitStack(1);
 | 
			
		||||
							if (this.items[j].stackSize == 0) {
 | 
			
		||||
								this.items[j] = null;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						this.currentfuelqueue += fuelqueue[0];
 | 
			
		||||
						this.currentcooldown = cooldown;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
	
 | 
			
		||||
			if (currentfuelqueue > 0 && currentPower != maxpower) {
 | 
			
		||||
				if (currentfuelqueue >= FuelConversionSpeed) {
 | 
			
		||||
					currentfuelqueue -= FuelConversionSpeed;
 | 
			
		||||
					currentPower += FuelConversionSpeed;
 | 
			
		||||
				} else if (currentfuelqueue < FuelConversionSpeed && currentfuelqueue >= 1) {
 | 
			
		||||
					currentfuelqueue --;
 | 
			
		||||
					currentPower ++;
 | 
			
		||||
				} else if (currentfuelqueue >= 0.05F) {
 | 
			
		||||
					currentfuelqueue = currentfuelqueue - 0.05F;
 | 
			
		||||
					currentPower = currentPower + 0.05F;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		rotationY += speed;
 | 
			
		||||
		if (rotationY > 6.3f) {
 | 
			
		||||
			rotationY = 0f;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		rotationX += speedSlower;
 | 
			
		||||
		if (rotationX >= 6.3f) {
 | 
			
		||||
			rotationX = 0f;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (toggle && speed < 0.055f) {
 | 
			
		||||
			speed += 0.0005f;
 | 
			
		||||
			speedSlower += 0.00007f;
 | 
			
		||||
 | 
			
		||||
		} else if (toggle == false && speed > 0f) {
 | 
			
		||||
			speed -= 0.0005f;
 | 
			
		||||
			speedSlower -= 0.00007f;
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int powerScaled(int scale) {
 | 
			
		||||
		return (int) (this.currentPower * scale / maxpower);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public int genscaled(int scale) {
 | 
			
		||||
		return (int) (this.currentfuelqueue * scale / maxpower);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int cooldownscaled(int scale) {
 | 
			
		||||
		return (this.currentcooldown * scale / cooldown);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean humanInterface() {
 | 
			
		||||
		for (int i = upgradeslotstart; i < items.length; i++) {
 | 
			
		||||
			if (items[i] != null && items[i].getItem() == ModItems.humanInterfaceGate) {
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setUpgradeslotstart(int upgradeslotstart) {
 | 
			
		||||
		this.upgradeslotstart = upgradeslotstart;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public Packet getDescriptionPacket() {
 | 
			
		||||
		NBTTagCompound tag = new NBTTagCompound();
 | 
			
		||||
		writeToNBT(tag);
 | 
			
		||||
		
 | 
			
		||||
		return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 0, tag);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
 | 
			
		||||
		readFromNBT(pkt.func_148857_g());
 | 
			
		||||
		worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getSizeInventory() {
 | 
			
		||||
 | 
			
		||||
		return this.items.length;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ItemStack getStackInSlot(int slotNumber) {
 | 
			
		||||
 | 
			
		||||
		return this.items[slotNumber];
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ItemStack decrStackSize(int slotNumber, int amountDecr) {
 | 
			
		||||
 | 
			
		||||
		if (this.items[slotNumber] != null) {
 | 
			
		||||
			//how much is returned to the hand
 | 
			
		||||
			ItemStack itemstack;
 | 
			
		||||
 | 
			
		||||
			if (this.items[slotNumber].stackSize <= amountDecr) {
 | 
			
		||||
				itemstack = this.items[slotNumber];
 | 
			
		||||
				this.items[slotNumber] = null;
 | 
			
		||||
			} else {
 | 
			
		||||
				itemstack = items[slotNumber].splitStack(amountDecr);
 | 
			
		||||
				if (this.items[slotNumber].stackSize == 0) {
 | 
			
		||||
					this.items[slotNumber] = null;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			return itemstack;
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public ItemStack getStackInSlotOnClosing(int p_70304_1_) {
 | 
			
		||||
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setFuelConversionSpeed(float fuelConversionSpeed) {
 | 
			
		||||
		FuelConversionSpeed = fuelConversionSpeed;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void setInventorySlotContents(int slotNumber, ItemStack itemstack) {
 | 
			
		||||
		this.items[slotNumber] = itemstack;
 | 
			
		||||
		if (itemstack != null
 | 
			
		||||
				&& itemstack.stackSize > this.getInventoryStackLimit()) {
 | 
			
		||||
			itemstack.stackSize = this.getInventoryStackLimit();
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	protected void setCustomInventoryName(String customName) {
 | 
			
		||||
 | 
			
		||||
		this.customName = customName;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean hasCustomInventoryName() {
 | 
			
		||||
		boolean customname = false;
 | 
			
		||||
		if (customName != null) {
 | 
			
		||||
			customname = true;
 | 
			
		||||
		}
 | 
			
		||||
		return customname;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int getInventoryStackLimit() {
 | 
			
		||||
 | 
			
		||||
		return 64;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
 | 
			
		||||
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void openInventory() {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void closeInventory() {
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
 | 
			
		||||
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean canInsertItem(int p_1020071_, ItemStack p_102007_2_,
 | 
			
		||||
			int p_102007_3_) {
 | 
			
		||||
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_,
 | 
			
		||||
			int p_102008_3_) {
 | 
			
		||||
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String getInventoryName() {
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public boolean isItemValidForSlot(int i, ItemStack itemstack) {
 | 
			
		||||
		return isItemValidForFuelSlot(itemstack);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean isItemValidForFuelSlot(ItemStack itemstack) {
 | 
			
		||||
		boolean itemvalid = false;
 | 
			
		||||
			if (this.validItemByString != null && itemstack.getItem().getUnlocalizedName().toLowerCase().contains(this.validItemByString)) {
 | 
			
		||||
				itemvalid = true;
 | 
			
		||||
			} else if (this.validItemByItem != null) {
 | 
			
		||||
				for (int i1 = 0; i1 < this.validItemByItem.length; i1++) {
 | 
			
		||||
					if (itemstack.getItem().equals(this.validItemByItem[i1])) {
 | 
			
		||||
						itemvalid = true;
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		
 | 
			
		||||
		return itemvalid;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * @param fuelqueue how much more fuel do we give?
 | 
			
		||||
	 * @param maxpower self-explanatory
 | 
			
		||||
	 * @param cooldown cool down time to transfer next item to fuel (in ticks)
 | 
			
		||||
	 */
 | 
			
		||||
	public void configureVars(int[] fuelqueue, int maxpower, int cooldown) {
 | 
			
		||||
		this.fuelqueue = fuelqueue;
 | 
			
		||||
		this.maxpower = maxpower;
 | 
			
		||||
		this.cooldown = cooldown;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void configureVars (int[] fuelqueue) {
 | 
			
		||||
		this.fuelqueue = fuelqueue;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void configureVars (int cooldown) {
 | 
			
		||||
		this.cooldown = cooldown;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setItems(ItemStack[] items) {
 | 
			
		||||
		this.items = items;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setMaxPower (int maxpower) {
 | 
			
		||||
		this.maxpower = maxpower;
 | 
			
		||||
	}
 | 
			
		||||
	public void ItemValidityByItem(Item[] item) {
 | 
			
		||||
		this.validItemByItem = item;
 | 
			
		||||
	}
 | 
			
		||||
	/**
 | 
			
		||||
	 * 
 | 
			
		||||
	 * @param string (should only be used for testing as there is very little control) Sets what is valid by name of item.
 | 
			
		||||
	 */
 | 
			
		||||
	public void itemValidityByString(String string) {
 | 
			
		||||
		this.validItemByString = string;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public int RetrievePower (int amountofpower) {
 | 
			
		||||
		if (currentPower >= amountofpower) {
 | 
			
		||||
			currentPower = currentPower - amountofpower;
 | 
			
		||||
		}
 | 
			
		||||
		return amountofpower;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setCoords(int x, int y, int z) {
 | 
			
		||||
		this.x = x;
 | 
			
		||||
		this.y = y;
 | 
			
		||||
		this.z = z;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setParticle(String particle) {
 | 
			
		||||
		this.particle = particle;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void writeToNBT(NBTTagCompound var1) {
 | 
			
		||||
		var1.setFloat("rotationY", this.rotationY);
 | 
			
		||||
		var1.setFloat("rotationX", this.rotationX);
 | 
			
		||||
		var1.setFloat("speed", this.speed);
 | 
			
		||||
		var1.setBoolean("toggle", this.toggle);
 | 
			
		||||
		var1.setFloat("speedSlower", this.speedSlower);
 | 
			
		||||
		var1.setBoolean("multiblock", this.multiblock);
 | 
			
		||||
		var1.setFloat("currentPower", this.currentPower);
 | 
			
		||||
		var1.setFloat("Fuel", this.currentfuelqueue);
 | 
			
		||||
		var1.setInteger("currentCooldown", this.currentcooldown);
 | 
			
		||||
		var1.setInteger("cooldown", this.cooldown);
 | 
			
		||||
 | 
			
		||||
		NBTTagList slots = new NBTTagList();
 | 
			
		||||
		for (int i = 0; i < items.length; i++) {
 | 
			
		||||
			if (this.items[i] != null) {
 | 
			
		||||
				NBTTagCompound item = new NBTTagCompound();
 | 
			
		||||
				item.setByte("itemPos", (byte) i);
 | 
			
		||||
				this.items[i].writeToNBT(item);
 | 
			
		||||
				slots.appendTag(item);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (this.hasCustomInventoryName()) {
 | 
			
		||||
			var1.setString("customName", this.customName);
 | 
			
		||||
		}
 | 
			
		||||
		var1.setTag("items", slots);
 | 
			
		||||
		super.writeToNBT(var1);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	@Override
 | 
			
		||||
	public void readFromNBT(NBTTagCompound var1) {
 | 
			
		||||
		this.rotationY = var1.getFloat("rotationY");
 | 
			
		||||
		this.rotationX = var1.getFloat("rotationX");
 | 
			
		||||
		this.speed = var1.getFloat("speed");
 | 
			
		||||
		this.toggle = var1.getBoolean("toggle");
 | 
			
		||||
		this.speedSlower = var1.getFloat("speedSlower");
 | 
			
		||||
		this.currentPower = var1.getFloat("currentPower");
 | 
			
		||||
		this.multiblock = var1.getBoolean("multiblock");
 | 
			
		||||
		this.currentfuelqueue = var1.getFloat("Fuel");
 | 
			
		||||
		this.currentcooldown = var1.getInteger("currentCooldown");
 | 
			
		||||
		this.cooldown = var1.getInteger("cooldown");
 | 
			
		||||
 | 
			
		||||
		NBTTagList slots = var1.getTagList("items", 10);
 | 
			
		||||
		this.items = new ItemStack[getSizeInventory()];
 | 
			
		||||
 | 
			
		||||
		for (int i = 0; i < slots.tagCount(); i++) {
 | 
			
		||||
			NBTTagCompound item = slots.getCompoundTagAt(i);
 | 
			
		||||
			byte itemPos = item.getByte("itemPos");
 | 
			
		||||
 | 
			
		||||
			if (itemPos >= 0 && itemPos < this.items.length) {
 | 
			
		||||
				this.items[itemPos] = ItemStack.loadItemStackFromNBT(item);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if (var1.hasKey("customName")) {
 | 
			
		||||
				this.setCustomInventoryName(var1.getString("customName"));
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		super.readFromNBT(var1);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public void setSimple() {
 | 
			
		||||
		this.multiblock = true;
 | 
			
		||||
		this.toggle = true;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
| 
		 After Width: | Height: | Size: 2.0 KiB  | 
| 
		 After Width: | Height: | Size: 1.9 KiB  | 
| 
		 After Width: | Height: | Size: 2.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.4 KiB  | 
| 
		 After Width: | Height: | Size: 2.0 KiB  | 
| 
		 After Width: | Height: | Size: 6.8 KiB  | 
@@ -0,0 +1,9 @@
 | 
			
		||||
{ 
 | 
			
		||||
   "animation":{
 | 
			
		||||
      "width":32,
 | 
			
		||||
      "height":32,
 | 
			
		||||
      "interpolate": true,
 | 
			
		||||
      "frametime":2,
 | 
			
		||||
      "frames":[0,1,2,3,4,5,6,7,8,9,10,11,11,10,9,8,7,6,4,2,1,0]
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
| 
		 After Width: | Height: | Size: 7.2 KiB  | 
@@ -0,0 +1,9 @@
 | 
			
		||||
{ 
 | 
			
		||||
   "animation":{
 | 
			
		||||
      "width":32,
 | 
			
		||||
      "height":32,
 | 
			
		||||
      "interpolate": true,
 | 
			
		||||
      "frametime":2,
 | 
			
		||||
      "frames":[0,1,2,3,4,5,6,7,8,9,10,11,10,9,8,7,6,4,2,1,0]
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
| 
		 After Width: | Height: | Size: 2.7 KiB  | 
@@ -0,0 +1,9 @@
 | 
			
		||||
{ 
 | 
			
		||||
   "animation":{
 | 
			
		||||
      "width":32,
 | 
			
		||||
      "height":32,
 | 
			
		||||
      "interpolate": true,
 | 
			
		||||
      "frametime":2,
 | 
			
		||||
      "frames":[0,1,2,3,4,5,6,7,8,9,10,11,11,10,9,8,7,6,4,2,1,0]
 | 
			
		||||
   }
 | 
			
		||||
}
 | 
			
		||||
| 
		 After Width: | Height: | Size: 2.0 KiB  | 
| 
		 After Width: | Height: | Size: 2.5 KiB  |