Format and Refactor

This commit is contained in:
Henry Mao 2013-01-04 12:24:31 +08:00
parent 4f1bd2ef73
commit 180a811afa
27 changed files with 82 additions and 142 deletions

View file

@ -21,7 +21,6 @@ import assemblyline.common.machine.TileEntityManipulator;
import assemblyline.common.machine.TileEntityRejector;
import assemblyline.common.machine.belt.TileEntityConveyorBelt;
import assemblyline.common.machine.detector.TileEntityDetector;
import assemblyline.common.machine.encoder.ContainerEncoder;
import assemblyline.common.machine.encoder.TileEntityEncoder;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;

View file

@ -2,10 +2,11 @@ package assemblyline.client.gui;
import java.util.ArrayList;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.GuiScrollingList;
public class GuiCommandList extends GuiScrollingList

View file

@ -53,7 +53,7 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher
this.tileEntity = tileEntity;
if (tileEntity != null)
{
}
this.x = position.intX();
this.y = position.intY();
@ -103,7 +103,7 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher
tempCmds.add(commandField.getText());
ItemDisk.setCommands(disk, tempCmds);
tileEntity.setInventorySlotContents(0, disk);
//TODO: Make the client send the server the new command to be added
// TODO: Make the client send the server the new command to be added
}
}
@ -162,7 +162,7 @@ public class GuiEncoder extends GuiContainer implements IInventoryWatcher
private void drawCommand(String command, int x, int y)
{
}
@Override

View file

@ -43,7 +43,13 @@ public class RenderCrate extends RenderImprintable
{
if (ItemImprinter.getFilters(tileEntity.getFilter()).size() > 0)
{
itemStack = ItemImprinter.getFilters(tileEntity.getFilter()).get(0).splitStack(0); // see if it has a filter instead
itemStack = ItemImprinter.getFilters(tileEntity.getFilter()).get(0).splitStack(0); // see
// if
// it
// has
// a
// filter
// instead
}
}
}

View file

@ -9,7 +9,7 @@ import org.lwjgl.opengl.GL11;
/**
*
* @author Briman0094
*
*
*/
public class RenderHelper
{
@ -17,7 +17,7 @@ public class RenderHelper
{
renderFloatingText(text, x, y, z, 0xFFFFFF);
}
/**
* Renders a floating text in a specific position.
*/

View file

@ -7,9 +7,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import universalelectricity.core.vector.Vector3;
import assemblyline.common.machine.imprinter.ItemImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprintable;

View file

@ -1,6 +1,5 @@
package assemblyline.client.render;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import org.lwjgl.opengl.GL11;

View file

@ -14,16 +14,15 @@ import universalelectricity.prefab.UETab;
import universalelectricity.prefab.UpdateNotifier;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.common.block.BlockCrate;
import assemblyline.common.block.BlockEncoder2;
import assemblyline.common.block.ItemBlockCrate;
import assemblyline.common.machine.BlockManipulator;
import assemblyline.common.machine.BlockRejector;
import assemblyline.common.machine.belt.BlockConveyorBelt;
import assemblyline.common.machine.detector.BlockDetector;
import assemblyline.common.machine.encoder.BlockEncoder;
import assemblyline.common.machine.encoder.ItemDisk;
import assemblyline.common.machine.imprinter.BlockImprinter;
import assemblyline.common.machine.imprinter.ItemImprinter;
import assemblyline.common.machine.machine.BlockRejector;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
@ -66,10 +65,9 @@ public class AssemblyLine
public static Block blockConveyorBelt;
public static Block blockManipulator;
//public static Block blockEncoder;
public static Block blockCrate;
public static Block blockImprinter;
public static Block blockProgrammer;
public static Block blockEncoder;
public static Block blockDetector;
public static Block blockRejector;
@ -86,12 +84,13 @@ public class AssemblyLine
CONFIGURATION.load();
blockConveyorBelt = new BlockConveyorBelt(CONFIGURATION.getBlock("Conveyor Belt", BLOCK_ID_PREFIX).getInt());
blockManipulator = new BlockManipulator(CONFIGURATION.getBlock("Manipulator", BLOCK_ID_PREFIX + 1).getInt());
//blockEncoder = new BlockEncoder2(CONFIGURATION.getBlock("Encoder", BLOCK_ID_PREFIX + 2).getInt());
// blockEncoder = new BlockEncoder2(CONFIGURATION.getBlock("Encoder", BLOCK_ID_PREFIX +
// 2).getInt());
blockCrate = new BlockCrate(CONFIGURATION.getBlock("Crate", BLOCK_ID_PREFIX + 3).getInt(), 0);
blockImprinter = new BlockImprinter(CONFIGURATION.getBlock("Imprinter", BLOCK_ID_PREFIX + 4).getInt(), 0);
blockDetector = new BlockDetector(CONFIGURATION.getBlock("Detector", BLOCK_ID_PREFIX + 5).getInt(), 1);
blockRejector = new BlockRejector(CONFIGURATION.getBlock("Rejector", BLOCK_ID_PREFIX + 6).getInt());
blockProgrammer = new BlockEncoder(CONFIGURATION.getBlock("Programmer", BLOCK_ID_PREFIX + 7).getInt(), 0);
blockEncoder = new BlockEncoder(CONFIGURATION.getBlock("Programmer", BLOCK_ID_PREFIX + 7).getInt(), 0);
itemImprint = new ItemImprinter(CONFIGURATION.getBlock("Imprint", ITEM_ID_PREFIX).getInt());
itemDisk = new ItemDisk(CONFIGURATION.getBlock("Disk", ITEM_ID_PREFIX + 1).getInt());
@ -101,9 +100,8 @@ public class AssemblyLine
GameRegistry.registerBlock(blockConveyorBelt, "Conveyor Belt");
GameRegistry.registerBlock(blockCrate, ItemBlockCrate.class, "Crate");
GameRegistry.registerBlock(blockManipulator, "Manipulator");
// GameRegistry.registerBlock(blockEncoder, "Encoder");
GameRegistry.registerBlock(blockImprinter, "Imprinter");
GameRegistry.registerBlock(blockProgrammer, "Programmer");
GameRegistry.registerBlock(blockEncoder, "Encoder");
GameRegistry.registerBlock(blockDetector, "Detector");
GameRegistry.registerBlock(blockRejector, "Rejector");
@ -119,6 +117,12 @@ public class AssemblyLine
System.out.println(NAME + " Loaded: " + TranslationHelper.loadLanguages(LANGUAGE_PATH, LANGUAGES_SUPPORTED) + " languages.");
// Disk
GameRegistry.addRecipe(new ShapedOreRecipe(itemDisk, new Object[] { "R", "P", "I", 'P', Item.paper, 'R', Item.redstone, 'I', new ItemStack(Item.dyePowder, 1, 0) }));
// Encoder
GameRegistry.addRecipe(new ShapedOreRecipe(blockEncoder, new Object[] { "S S", "SCS", "SSS", 'S', "ingotSteel", 'C', "eliteCircuit" }));
// Imprint
GameRegistry.addRecipe(new ShapedOreRecipe(itemImprint, new Object[] { "R", "P", "I", 'P', Item.paper, 'R', Item.redstone, 'I', new ItemStack(Item.dyePowder, 1, 0) }));

View file

@ -40,8 +40,8 @@ public class CommonProxy implements IGuiHandler
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
{
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
//System.out.println("Server GUI request for ID " + ID);
// System.out.println("Server GUI request for ID " + ID);
switch (ID)
{

View file

@ -14,7 +14,8 @@ import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.imprinter.ItemImprinter;
/**
* A block that allows the placement of mass amount of a specific item within it. It will be allowed to go on Conveyor Belts
* A block that allows the placement of mass amount of a specific item within it. It will be allowed
* to go on Conveyor Belts
*
* @author Calclavia
*

View file

@ -1,7 +1,5 @@
package assemblyline.common.block;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -12,6 +10,8 @@ import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.common.machine.imprinter.ItemImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprintable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class TileEntityCrate extends TileEntityImprintable implements ISidedInventory, IPacketReceiver
{
@ -24,44 +24,24 @@ public class TileEntityCrate extends TileEntityImprintable implements ISidedInve
return false;
}
/*@Override
public void handlePacketData(INetworkManager network, int packetType, Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream)
{
if (this.worldObj.isRemote)
{
try
{
if (dataStream.readBoolean())
{
if (this.containingItems[0] == null)
{
this.containingItems[0] = new ItemStack(dataStream.readInt(), dataStream.readInt(), dataStream.readInt());
}
else
{
this.containingItems[0].itemID = dataStream.readInt();
this.containingItems[0].stackSize = dataStream.readInt();
this.containingItems[0].setItemDamage(dataStream.readInt());
}
}
else
{
this.containingItems[0] = null;
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}*/
/*
* @Override public void handlePacketData(INetworkManager network, int packetType,
* Packet250CustomPayload packet, EntityPlayer player, ByteArrayDataInput dataStream) { if
* (this.worldObj.isRemote) { try { if (dataStream.readBoolean()) { if (this.containingItems[0]
* == null) { this.containingItems[0] = new ItemStack(dataStream.readInt(),
* dataStream.readInt(), dataStream.readInt()); } else { this.containingItems[0].itemID =
* dataStream.readInt(); this.containingItems[0].stackSize = dataStream.readInt();
* this.containingItems[0].setItemDamage(dataStream.readInt()); } } else {
* this.containingItems[0] = null; } } catch (Exception e) { e.printStackTrace(); } } }
*/
/*@Override
public Packet getDescriptionPacket()
{
if (this.containingItems[0] != null) { return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true, this.containingItems[0].itemID, this.containingItems[0].stackSize, this.containingItems[0].getItemDamage()); }
return PacketManager.getPacket(AssemblyLine.CHANNEL, this, false);
}*/
/*
* @Override public Packet getDescriptionPacket() { if (this.containingItems[0] != null) {
* return PacketManager.getPacket(AssemblyLine.CHANNEL, this, true,
* this.containingItems[0].itemID, this.containingItems[0].stackSize,
* this.containingItems[0].getItemDamage()); } return
* PacketManager.getPacket(AssemblyLine.CHANNEL, this, false); }
*/
/**
* Inventory functions.
@ -71,7 +51,7 @@ public class TileEntityCrate extends TileEntityImprintable implements ISidedInve
{
return this.containingItems[par1];
}
@Override
public ItemStack decrStackSize(int par1, int par2)
{

View file

@ -1,11 +1,10 @@
package assemblyline.common.machine.machine;
package assemblyline.common.machine;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import universalelectricity.core.UniversalElectricity;
import universalelectricity.prefab.UETab;
import assemblyline.client.render.BlockRenderingHandler;
import assemblyline.common.machine.TileEntityRejector;
import assemblyline.common.machine.imprinter.BlockImprintable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -102,7 +102,7 @@ public abstract class TileEntityAssemblyNetwork extends TileEntityElectricityRec
if (this.wattsReceived >= this.getRequest().getWatts())
{
this.wattsReceived -= getRequest().getWatts();
//this.wattsReceived = 0;
// this.wattsReceived = 0;
this.powerTransferRange = this.getMaxTransferRange();
}
else
@ -117,7 +117,7 @@ public abstract class TileEntityAssemblyNetwork extends TileEntityElectricityRec
protected void onUpdate()
{
}
@Override

View file

@ -1,33 +1,21 @@
package assemblyline.common.machine;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet250CustomPayload;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.TranslationHelper;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.api.IManipulator;
import assemblyline.common.machine.imprinter.TileEntityImprintable;
import com.google.common.io.ByteArrayDataInput;
import cpw.mods.fml.common.network.PacketDispatcher;
public class TileEntityManipulator extends TileEntityImprintable implements IRedstoneReceptor, IManipulator

View file

@ -1,26 +1,17 @@
package assemblyline.common.machine;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.TranslationHelper;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.common.machine.imprinter.ItemImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprintable;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
/**
*
@ -33,13 +24,14 @@ public class TileEntityRejector extends TileEntityImprintable
* should the piston fire, or be extended
*/
public boolean firePiston = false;
public TileEntityRejector()
{
super();
//ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH));
// ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN,
// ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH));
}
@Override
protected int getMaxTransferRange()
{

View file

@ -13,7 +13,6 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.core.electricity.ElectricityConnections;
import universalelectricity.core.vector.Vector3;
import universalelectricity.prefab.implement.IRotatable;
import universalelectricity.prefab.network.IPacketReceiver;
import universalelectricity.prefab.network.PacketManager;
@ -48,7 +47,8 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
public TileEntityConveyorBelt()
{
super();
//ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN, ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH));
// ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN,
// ForgeDirection.EAST, ForgeDirection.WEST, ForgeDirection.NORTH, ForgeDirection.SOUTH));
ElectricityConnections.registerConnector(this, EnumSet.of(ForgeDirection.DOWN));
}
@ -120,7 +120,7 @@ public class TileEntityConveyorBelt extends TileEntityAssemblyNetwork implements
if (this.isRunning())
{
//System.out.println(FMLCommonHandler.instance().getEffectiveSide());
// System.out.println(FMLCommonHandler.instance().getEffectiveSide());
this.wheelRotation += 40;
if (this.wheelRotation > 360)

View file

@ -23,7 +23,7 @@ public class BlockDetector extends BlockImprintable
this.blockIndexInTexture = texture;
this.setTextureFile(AssemblyLine.BLOCK_TEXTURE_PATH);
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving entity)
{
@ -45,16 +45,16 @@ public class BlockDetector extends BlockImprintable
change = ForgeDirection.WEST.ordinal();
break;
}
if (entity.rotationPitch < -70f) //up
if (entity.rotationPitch < -70f) // up
{
change = ForgeDirection.DOWN.ordinal();
}
if (entity.rotationPitch > 70f) //down
if (entity.rotationPitch > 70f) // down
{
change = ForgeDirection.UP.ordinal();
}
world.setBlockMetadataWithNotify(x, y, z, change);
}
@ -80,7 +80,7 @@ public class BlockDetector extends BlockImprintable
return this.blockIndexInTexture;
}
@Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{

View file

@ -10,7 +10,6 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.ForgeDirection;
import universalelectricity.prefab.network.PacketManager;
import assemblyline.common.AssemblyLine;
import assemblyline.common.machine.imprinter.ItemImprinter;
import assemblyline.common.machine.imprinter.TileEntityImprintable;
public class TileEntityDetector extends TileEntityImprintable
@ -43,22 +42,10 @@ public class TileEntityDetector extends TileEntityImprintable
powerCheck = this.isFiltering(itemStack);
/*if (this.isInverted)
{
if (!found)
{
powerCheck = true;
}
else
{
powerCheck = false;
}
}
else if (found)
{
powerCheck = true;
break;
}*/
/*
* if (this.isInverted) { if (!found) { powerCheck = true; } else {
* powerCheck = false; } } else if (found) { powerCheck = true; break; }
*/
}
}
else

View file

@ -51,13 +51,13 @@ public class BlockEncoder extends BlockMachine
return true;
}
@Override
public TileEntity createNewTileEntity(World world)
{
return createNewTileEntity(world, 0);
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{

View file

@ -1,22 +1,12 @@
package assemblyline.common.machine.encoder;
import java.util.ArrayList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import universalelectricity.core.vector.Vector3;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class ContainerEncoder extends Container
{
@ -32,11 +22,11 @@ public class ContainerEncoder extends Container
this.position = position;
this.inventoryPlayer = inventoryPlayer;
this.encoder = encoder;
// Disk
this.addSlotToContainer(new Slot(encoder, 0, 80, 24));
// Output Disk
//this.addSlotToContainer(new SlotDiskResult(this, 2, 136, 24));
// this.addSlotToContainer(new SlotDiskResult(this, 2, 136, 24));
int var3;

View file

@ -22,7 +22,7 @@ public class ItemDisk extends Item
this.setHasSubtypes(true);
this.setTextureFile(AssemblyLine.ITEM_TEXTURE_PATH);
}
@Override
public int getItemStackLimit()
{

View file

@ -3,7 +3,6 @@ package assemblyline.common.machine.encoder;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet;
import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.ISidedInventory;
import universalelectricity.prefab.tile.TileEntityAdvanced;

View file

@ -12,7 +12,6 @@ import net.minecraft.world.World;
import universalelectricity.prefab.BlockMachine;
import universalelectricity.prefab.implement.IRedstoneReceptor;
import assemblyline.api.IFilterable;
import assemblyline.common.machine.detector.TileEntityDetector;
/**
* Extend this block class if a filter is allowed to be placed inside of this block.
@ -70,7 +69,7 @@ public abstract class BlockImprintable extends BlockMachine
return false;
}
@Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer par5EntityPlayer, int side, float hitX, float hitY, float hitZ)
{

View file

@ -22,7 +22,7 @@ public class ItemImprinter extends Item
this.setHasSubtypes(true);
this.setTextureFile(AssemblyLine.ITEM_TEXTURE_PATH);
}
@Override
public int getItemStackLimit()
{

View file

@ -25,7 +25,7 @@ public class SlotCraftingResult extends Slot
public boolean canTakeStack(EntityPlayer player)
{
return playerHasRequiredIngredients(player, getStack());
//return true;
// return true;
}
@Override

View file

@ -4,10 +4,8 @@ import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
@ -82,12 +80,12 @@ public abstract class TileEntityImprintable extends TileEntityAssemblyNetwork im
PacketManager.sendPacketToClients(this.getDescriptionPacket());
}
}
public boolean isInverted()
{
return this.inverted;
}
public void toggleInversion()
{
setInverted(!isInverted());

View file

@ -12,7 +12,7 @@ public class WatchedSlot extends Slot
super(inventory, id, xPosition, yPosition);
this.slotWatcher = slotWatcher;
}
@Override
public void onSlotChanged()
{