Emptied trash, upgraded Forge, added blockrender

This commit is contained in:
MachineMuse 2012-12-24 15:45:26 -07:00
parent 7d6f51620d
commit 7b87d1e9c3
21 changed files with 292 additions and 941 deletions

View file

@ -106,7 +106,7 @@ public abstract class Doodler {
* @param yoffset
* @param radius
*/
public static void drawTriangles(float[] v, float[] c,
public static void drawTriangles2D(float[] v, float[] c,
int[] i) {
arraysOn();
texturelessOn();
@ -150,6 +150,56 @@ public abstract class Doodler {
}
/**
* Draws a swirly green circle at the specified coordinates in the current
* reference frame.
*
* @param xoffset
* @param yoffset
* @param radius
*/
public static void drawTriangles3D(float[] v, float[] c,
int[] i) {
arraysOn();
texturelessOn();
// float subdivisions = 5f;
// float radius = 0.5f;
// GL11.glPushMatrix();
// GL11.glTranslatef(-radius, -radius, 0);
// for (int i1 = 0; i1 <= subdivisions * 2; i1++) {
// for (int i2 = 0; i2 <= subdivisions * 2; i2++) {
FloatBuffer vertices = BufferUtils.createFloatBuffer(v.length);
vertices.put(v);
vertices.flip();
FloatBuffer colours = BufferUtils.createFloatBuffer(c.length);
colours.put(c);
colours.flip();
IntBuffer indices = BufferUtils.createIntBuffer(i.length);
indices.put(i);
indices.flip();
// GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL);
GL11.glVertexPointer(3, 0, vertices);
GL11.glColorPointer(4, 0, colours);
GL11.glDrawElements(GL11.GL_TRIANGLES, indices);
// GL11.glTranslatef(0, radius / subdivisions, 0);
// }
// GL11.glTranslatef(radius / subdivisions, -radius * 2, 0);
// }
// GL11.glPopMatrix();
texturelessOff();
arraysOff();
}
/**
* 2D rendering mode on/off
*/
@ -174,9 +224,9 @@ public abstract class Doodler {
}
public static void off2D() {
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_DEPTH_TEST);
// GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHTING);
}
/**
@ -235,15 +285,15 @@ public abstract class Doodler {
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(c1.r, c1.g, c1.b, c1.a);
tessellator.addVertex((double) right, (double) top,
tessellator.addVertex(right, top,
zLevel);
tessellator
.addVertex((double) left, (double) top, zLevel);
.addVertex(left, top, zLevel);
tessellator.setColorRGBA_F(c2.r, c2.g, c2.b, c2.a);
tessellator.addVertex((double) left, (double) bottom,
tessellator.addVertex(left, bottom,
zLevel);
tessellator.addVertex((double) right, (double) bottom,
tessellator.addVertex(right, bottom,
zLevel);
tessellator.draw();

View file

@ -65,8 +65,14 @@ public abstract class AugManager {
*
* @return
*/
public float getWeight(NBTTagCompound aug) {
return aug.getFloat(WEIGHT);
public static float getWeight(NBTTagCompound aug) {
String augname = aug.getString(NAME);
if (augname.equals(STONEARMORPLATING)
|| augname.equals(IRONARMORPLATING)
|| augname.equals(DIAMONDARMORPLATING)) {
return 10.0F * getLevel(aug);
}
return 0;
}
/**
@ -108,25 +114,19 @@ public abstract class AugManager {
NBTTagCompound newAug = new NBTTagCompound();
if (validAug.equals(STONEARMORPLATING)) {
newAug.setString(NAME, STONEARMORPLATING);
newAug.setFloat(WEIGHT, 10.0F);
newAug.setInteger(DURABILITY, 100);
} else if (validAug.equals(IRONARMORPLATING)) {
newAug.setString(NAME, IRONARMORPLATING);
newAug.setFloat(WEIGHT, 10.0F);
newAug.setInteger(DURABILITY, 100);
} else if (validAug.equals(DIAMONDARMORPLATING)) {
newAug.setString(NAME, DIAMONDARMORPLATING);
newAug.setFloat(WEIGHT, 10.0F);
newAug.setInteger(DURABILITY, 100);
} else if (validAug.equals(NICADBATTERY)) {
newAug.setString(NAME, NICADBATTERY);
newAug.setFloat(WEIGHT, 10.0F);
} else if (validAug.equals(LIIONBATTERY)) {
newAug.setString(NAME, LIIONBATTERY);
newAug.setFloat(WEIGHT, 10.0F);
} else if (validAug.equals(CARBONTUBEBATTERY)) {
newAug.setString(NAME, CARBONTUBEBATTERY);
newAug.setFloat(WEIGHT, 10.0F);
}
return newAug;
}

View file

@ -0,0 +1,80 @@
/**
*
*/
package machinemuse.powersuits.client;
import machinemuse.powersuits.common.Config;
import machinemuse.powersuits.common.Config.Blocks;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
/**
* @author Claire
*
*/
public class BlockRenderer implements ISimpleBlockRenderingHandler {
/**
*
*/
public BlockRenderer() {
// TODO Auto-generated constructor stub
}
/*
* (non-Javadoc)
*
* @see cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler#
* renderInventoryBlock(net.minecraft.block.Block, int, int,
* net.minecraft.client.renderer.RenderBlocks)
*/
@Override
public void renderInventoryBlock(Block block, int metadata, int modelID,
RenderBlocks renderer) {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see
* cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler#renderWorldBlock
* (net.minecraft.world.IBlockAccess, int, int, int,
* net.minecraft.block.Block, int,
* net.minecraft.client.renderer.RenderBlocks)
*/
@Override
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z,
Block block, int modelId, RenderBlocks renderer) {
// TODO Auto-generated method stub
return false;
}
/*
* (non-Javadoc)
*
* @see cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler#
* shouldRender3DInInventory()
*/
@Override
public boolean shouldRender3DInInventory() {
// TODO Auto-generated method stub
return false;
}
/*
* (non-Javadoc)
*
* @see
* cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler#getRenderId()
*/
@Override
public int getRenderId() {
return Config.getAssignedBlockID(Blocks.TinkerTable);
}
}

View file

@ -6,8 +6,9 @@ import machinemuse.powersuits.common.PowersuitsMod;
import machinemuse.powersuits.network.MusePacketHandler;
import net.minecraft.item.Item;
import net.minecraftforge.client.MinecraftForgeClient;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* The Client Proxy does all the things that should only be done client-side,
@ -33,6 +34,7 @@ public class ClientProxy extends CommonProxy {
// i.shiftedIndex, eRenderer);
// }
RenderingRegistry.registerBlockHandler(new BlockRenderer());
MinecraftForgeClient.preloadTexture("/gui/tinktablegui.png");
}

View file

@ -141,7 +141,7 @@ public class EquipmentRenderer implements IItemRenderer {
1, 3, 2,
1, 4, 3
};
Doodler.drawTriangles(v, c, i);
Doodler.drawTriangles2D(v, c, i);
}
public void drawFeet(ItemStack itemStack) {

View file

@ -2,8 +2,8 @@ package machinemuse.powersuits.common;
import machinemuse.powersuits.network.MusePacketHandler;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* Server side of the CommonProxy/ClientProxy paradigm. Provides functions which

View file

@ -10,8 +10,7 @@ import machinemuse.powersuits.item.ItemPowerArmorHead;
import machinemuse.powersuits.item.ItemPowerArmorLegs;
import machinemuse.powersuits.item.ItemPowerArmorTorso;
import machinemuse.powersuits.item.ItemPowerTool;
import machinemuse.powersuits.trash.ClientPacketHandler;
import machinemuse.powersuits.trash.ServerPacketHandler;
import machinemuse.powersuits.network.MusePacketHandler;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -53,9 +52,9 @@ import cpw.mods.fml.common.registry.GameRegistry;
// Inventory Tweaks.
@NetworkMod(clientSideRequired = true, serverSideRequired = true,
clientPacketHandlerSpec =
@SidedPacketHandler(channels = { "mmPowersuits" }, packetHandler = ClientPacketHandler.class),
@SidedPacketHandler(channels = { "mmPowersuits" }, packetHandler = MusePacketHandler.class),
serverPacketHandlerSpec =
@SidedPacketHandler(channels = { "mmPowersuits" }, packetHandler = ServerPacketHandler.class))
@SidedPacketHandler(channels = { "mmPowersuits" }, packetHandler = MusePacketHandler.class))
public class PowersuitsMod {
/**

View file

@ -4,23 +4,56 @@ import java.util.List;
import machinemuse.powersuits.common.Config;
import machinemuse.powersuits.common.Config.Items;
import net.minecraft.item.Item;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemTool;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Describes the modular power tool.
*
* @author MachineMuse
*/
public class ItemPowerTool extends Item implements IModularItem {
public class ItemPowerTool extends ItemTool implements IModularItem {
protected List<String> validAugTypes;
/**
* Copied the comment for reference
*/
// /** Array of blocks the tool has extra effect against. */
// private Block[] blocksEffectiveAgainst;
// public float efficiencyOnProperMaterial = 4.0F;
//
// /** Damage versus entities. */
// public int damageVsEntity;
//
// /** The material this tool is made from. */
// protected EnumToolMaterial toolMaterial;
/**
* Constructor. Takes information from the Config.Items enum.
*/
public ItemPowerTool() {
super(Config.getAssignedItemID(Config.Items.PowerTool));
super( // ID
Config.getAssignedItemID(Config.Items.PowerTool),
// Damage bonus, added to the material's damage
0,
// Tool material, can be changed if necessary
EnumToolMaterial.EMERALD,
// not important since it's private and we will override the
// getter
new Block[0] // Block[] BlocksEffectiveAgainst
);
setMaxStackSize(1);
setMaxDamage(0);
this.damageVsEntity = 1;
setCreativeTab(Config.getCreativeTab());
setIconIndex(Config.Items.PowerTool.iconIndex);
setItemName(Config.Items.PowerTool.idName);
@ -32,4 +65,99 @@ public class ItemPowerTool extends Item implements IModularItem {
return Config.Items.PowerTool;
}
/**
* Returns the strength of the stack against a given block. 1.0F base,
* (Quality+1)*2 if correct blocktype, 1.5F if sword
*/
@Override
public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) {
// for (int var3 = 0; var3 < this.blocksEffectiveAgainst.length; ++var3)
// {
// if (this.blocksEffectiveAgainst[var3] == par2Block) {
// return this.efficiencyOnProperMaterial;
// }
// }
//
return 1.0F;
}
/**
* Current implementations of this method in child classes do not use the
* entry argument beside stack. They just raise the damage on the stack.
*/
@Override
public boolean hitEntity(ItemStack stack,
EntityLiving entityDoingHitting, EntityLiving entityBeingHit) {
// stack.damageItem(2, entityBeingHit);
return true;
}
/**
* Called when a block is destroyed using this tool.
*/
@Override
public boolean onBlockDestroyed(ItemStack stack, World world,
int blockID, int x, int y, int z,
EntityLiving par7EntityLiving) {
if (Block.blocksList[blockID]
.getBlockHardness(world, x, y, z) != 0.0D) {
stack.damageItem(1, par7EntityLiving);
}
return true;
}
/**
* Returns the damage against a given entity.
*/
@Override
public int getDamageVsEntity(Entity par1Entity) {
return 1;
}
@Override
@SideOnly(Side.CLIENT)
/**
* Returns True is the item is renderer in full 3D when hold.
*/
public boolean isFull3D() {
return true;
}
/**
* Return the enchantability factor of the item. In this case, 0. Might add
* an enchantability module later :P
*/
@Override
public int getItemEnchantability() {
return 0;
}
/**
* Return the name for this tool's material.
*/
@Override
public String getToolMaterialName() {
return this.toolMaterial.toString();
}
/**
* Return whether this item is repairable in an anvil.
*/
@Override
public boolean getIsRepairable(ItemStack par1ItemStack,
ItemStack par2ItemStack) {
return this.toolMaterial.getToolCraftingMaterial() == par2ItemStack.itemID ? true
: super.getIsRepairable(par1ItemStack, par2ItemStack);
}
/** FORGE: Overridden to allow custom tool effectiveness */
@Override
public float getStrVsBlock(ItemStack stack, Block block, int meta) {
if (ForgeHooks.isToolEffective(stack, block, meta)) {
return efficiencyOnProperMaterial;
}
return getStrVsBlock(stack, block);
}
}

View file

@ -116,8 +116,8 @@ public class ItemUtils {
* @return
*/
public static List<NBTTagCompound> getItemAugsWithPadding(ItemStack stack) {
List<String> validAugs = AugManager.getValidAugsForItem(stack
.getItem());
List<String> validAugs = AugManager
.getValidAugsForItem(stack.getItem());
NBTTagCompound itemAugs = getItemAugs(stack);
List<NBTTagCompound> augsList = new ArrayList<NBTTagCompound>();
for (String validAug : validAugs) {
@ -202,9 +202,7 @@ public class ItemUtils {
public static float getTotalWeight(List<NBTTagCompound> playerAugs) {
float weight = 0;
for (NBTTagCompound aug : playerAugs) {
if (aug.hasKey(AugManager.WEIGHT)) {
weight += aug.getFloat(AugManager.WEIGHT);
}
weight += AugManager.getWeight(aug);
}
return weight;
}

View file

@ -13,8 +13,8 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
/**
* @author MachineMuse

View file

@ -13,9 +13,9 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;
import cpw.mods.fml.relauncher.Side;
/**
* Packet for requesting to purchase an upgrade. Player-to-server. Server
@ -65,8 +65,7 @@ public class MusePacketUpgradeRequest extends MusePacket {
Side side = FMLCommonHandler.instance().getEffectiveSide();
if (side == Side.SERVER) {
EntityPlayerMP srvplayer = (EntityPlayerMP) player;
stack = srvplayer.inventory
.getStackInSlot(slot);
stack = srvplayer.inventory.getStackInSlot(slot);
}
}
@ -85,9 +84,8 @@ public class MusePacketUpgradeRequest extends MusePacket {
.getStackInSlot(slot)), aug);
slots.add(this.slot);
for (Integer slotiter : slots) {
MusePacket reply = new MusePacketInventory(
player, slotiter,
inventory.getStackInSlot(slotiter));
MusePacket reply = new MusePacketInventory(player,
slotiter, inventory.getStackInSlot(slotiter));
PacketDispatcher.sendPacketToPlayer(reply.getPacket(),
player);
}

View file

@ -1,9 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.List;
public abstract class AugLayout {
private List<AugSlot> slots;
}

View file

@ -1,63 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.ArrayList;
import java.util.List;
@Deprecated
public class AugSlot {
private List<AugSlot> connectedSlots;
private SlotType type;
private ItemAugmentation installedAug;
public AugSlot(SlotType type) {
connectedSlots = new ArrayList<AugSlot>();
this.type = type;
}
public List<AugSlot> getConnectedSlots() {
return connectedSlots;
}
public void connectToSlot(AugSlot other) {
if (!this.connectedSlots.contains(other)) {
this.connectedSlots.add(other);
}
if (!other.connectedSlots.contains(this)) {
other.connectedSlots.add(this);
}
}
// Returns true if successful, false otherwise
public boolean installAugmentation(ItemAugmentation aug) {
if (aug.canGoInSlot(type)) {
installedAug = aug;
return true;
} else {
return false;
}
}
public void disconnectFromSlot(AugSlot other) {
if (!this.connectedSlots.contains(other)) {
this.connectedSlots.add(other);
}
if (!other.connectedSlots.contains(this)) {
other.connectedSlots.add(this);
}
}
public SlotType getType() {
return type;
}
public static enum SlotType {
Vision,
Hearing,
Movement,
Generator,
PowerConduit,
Weapon,
Tool,
}
}

View file

@ -1,100 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.ArrayList;
import java.util.List;
/**
* An enumeration of the different types of augmentations and their IDs. Also
* contains valid-for-slot configuration.
*
* @author MachineMuse
*
*/
@Deprecated
public enum AugmentationTypes {
ArmorPlate("armorPlate", "Armor Plate", 1),
DamageShieldPassive("shieldPassive", "Passive Shielding", 2),
DamageShieldActive("shieldActive", "Active Shielding", 3),
SteamGenerator("steamGenerator", "Steam Generator", 4),
BatteryElectric("batteryElectric", "Electric Battery", 5),
;
public static int maxid = 6;
public String idName;
public String englishName;
public int id;
private AugmentationTypes(String idName, String englishName, int id) {
this.idName = idName;
this.englishName = englishName;
this.id = id;
}
/**
* For readability and ease of editing.
*
* @param list
* @param type
*/
private static void putList(List<AugmentationTypes> list,
AugmentationTypes type) {
list.add(type);
}
/**
* Returns an array of augmentations that are valid for a head slot item.
*
* @param list
* @param type
*/
public static List<AugmentationTypes> validHeadAugmentations() {
List<AugmentationTypes> list =
new ArrayList<AugmentationTypes>();
putList(list, ArmorPlate);
putList(list, DamageShieldPassive);
putList(list, DamageShieldActive);
putList(list, SteamGenerator);
putList(list, BatteryElectric);
return list;
}
public static List<AugmentationTypes> validTorsoAugmentations() {
List<AugmentationTypes> list =
new ArrayList<AugmentationTypes>();
putList(list, ArmorPlate);
putList(list, DamageShieldPassive);
putList(list, DamageShieldActive);
putList(list, BatteryElectric);
return list;
}
public static List<AugmentationTypes> validLegsAugmentations() {
List<AugmentationTypes> list =
new ArrayList<AugmentationTypes>();
putList(list, ArmorPlate);
putList(list, DamageShieldPassive);
putList(list, DamageShieldActive);
putList(list, BatteryElectric);
return list;
}
public static List<AugmentationTypes> validFeetAugmentations() {
List<AugmentationTypes> list =
new ArrayList<AugmentationTypes>();
putList(list, ArmorPlate);
putList(list, DamageShieldPassive);
putList(list, DamageShieldActive);
putList(list, BatteryElectric);
return list;
}
public static List<AugmentationTypes> validToolAugmentations() {
List<AugmentationTypes> list =
new ArrayList<AugmentationTypes>();
putList(list, BatteryElectric);
putList(list, SteamGenerator);
return list;
}
}

View file

@ -1,22 +0,0 @@
package machinemuse.powersuits.trash;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
/**
* Packet handler for the client side.
*
* @author MachineMuse
*
*/
@Deprecated
public class ClientPacketHandler implements IPacketHandler {
@Override
public void onPacketData(INetworkManager manager,
Packet250CustomPayload payload, Player player) {
}
}

View file

@ -1,260 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import machinemuse.powersuits.item.ItemPowerArmor;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World;
@Deprecated
public class ContainerTinkerTable extends Container {
EntityPlayer player;
private World world;
private int posX;
private int posY;
private int posZ;
private final int inventoryTop = 145;
public InventoryModularItem[] itemInventories;
public SlotArmorInTinkerTable[] armorslots;
public ArrayList<SlotAugmentation> augslots;
public ContainerTinkerTable(EntityPlayer player, World world, int x, int y,
int z) {
this.player = player;
this.world = world;
this.posX = x;
this.posY = y;
this.posZ = z;
int id = 0;
int slotx = 0;
int sloty = 0;
armorslots = new SlotArmorInTinkerTable[4];
itemInventories = new InventoryModularItem[5];
augslots = new ArrayList<SlotAugmentation>();
for (int i = 0; i < 4; i++) {
armorslots[i] = new SlotArmorInTinkerTable(this,
player.inventory,
player.inventory.getSizeInventory() - 1 - i,
8,
8 + i * 18,
i);
this.addSlotToContainer(armorslots[i]);
}
bindPlayerInventory(player);
this.update();
}
public void update() {
this.inventorySlots.removeAll(augslots);
augslots.clear();
for (int i = 0; i < 4; i++) {
ItemStack stack = armorslots[i].getStack();
if (stack != null) {
if (stack.getItem() instanceof ItemPowerArmor) {
itemInventories[i] = InventoryModularItem
.fromItemStack(stack, this);
this.bindItemInventory(itemInventories[i], i);
}
}
}
}
public void bindItemInventory(InventoryModularItem inv, int row) {
for (int i = 0; i < inv.getSizeInventory(); ++i) {
SlotAugmentation slot = new SlotAugmentation(
inv,
i,
32 + i * 18,
9 + row * 18);
this.addSlotToContainer(slot);
this.augslots.add(slot);
}
}
public void bindPlayerInventory(EntityPlayer player) {
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
this.addSlotToContainer(new Slot(
player.inventory,
9 + j + i * 9,
8 + j * 18,
inventoryTop + i * 18));
}
}
for (int i = 0; i < 9; ++i) {
this.addSlotToContainer(new Slot(
player.inventory,
i,
8 + i * 18,
inventoryTop + 58));
}
}
/**
* Callback for when the crafting gui is closed.
*/
public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)
{
}
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
{
return par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D,
(double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
}
/**
* Called when a player shift-clicks on a slot. You must override this or
* you will crash when someone does that.
*/
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, 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 == 0)
{
if (!this.mergeItemStack(var5, 10, 46, true))
{
return null;
}
var4.onSlotChange(var5, var3);
}
else if (par2 >= 10 && par2 < 37)
{
if (!this.mergeItemStack(var5, 37, 46, false))
{
return null;
}
}
else if (par2 >= 37 && par2 < 46)
{
if (!this.mergeItemStack(var5, 10, 37, false))
{
return null;
}
}
else if (!this.mergeItemStack(var5, 10, 46, false))
{
return null;
}
if (var5.stackSize == 0)
{
var4.putStack((ItemStack) null);
}
else
{
var4.onSlotChanged();
}
if (var5.stackSize == var3.stackSize)
{
return null;
}
var4.onPickupFromSlot(par1EntityPlayer, var5);
}
return var3;
}
/**
* Adds a recipe. See spreadsheet on first page for details.
*/
public void addRecipe(ItemStack outputStack, Object... recipeParameters)
{
String reshapedString = "";
int currentArg = 0;
int var5 = 0;
int var6 = 0;
if (recipeParameters[currentArg] instanceof String[])
{
String[] nextRecipeString = (String[]) ((String[]) recipeParameters[currentArg++]);
for (int i = 0; i < nextRecipeString.length; ++i)
{
String nextChar = nextRecipeString[i];
++var6;
var5 = nextChar.length();
reshapedString = reshapedString + nextChar;
}
}
else
{
while (recipeParameters[currentArg] instanceof String)
{
String var11 = (String) recipeParameters[currentArg++];
++var6;
var5 = var11.length();
reshapedString = reshapedString + var11;
}
}
HashMap var12;
for (var12 = new HashMap(); currentArg < recipeParameters.length; currentArg += 2)
{
Character var13 = (Character) recipeParameters[currentArg];
ItemStack var14 = null;
if (recipeParameters[currentArg + 1] instanceof Item)
{
var14 = new ItemStack((Item) recipeParameters[currentArg + 1]);
}
else if (recipeParameters[currentArg + 1] instanceof Block)
{
var14 = new ItemStack((Block) recipeParameters[currentArg + 1],
1, -1);
}
else if (recipeParameters[currentArg + 1] instanceof ItemStack)
{
var14 = (ItemStack) recipeParameters[currentArg + 1];
}
var12.put(var13, var14);
}
ItemStack[] var15 = new ItemStack[var5 * var6];
for (int var16 = 0; var16 < var5 * var6; ++var16)
{
char var10 = reshapedString.charAt(var16);
if (var12.containsKey(Character.valueOf(var10)))
{
var15[var16] = ((ItemStack) var12.get(Character.valueOf(var10)))
.copy();
}
else
{
var15[var16] = null;
}
}
List<IRecipe> recipes = new ArrayList<IRecipe>();
recipes.add(new ShapedRecipes(var5, var6, var15,
outputStack));
}
}

View file

@ -1,222 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.ArrayList;
import machinemuse.powersuits.item.ItemPowerArmor;
import machinemuse.powersuits.item.ItemPowerTool;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@Deprecated
public class InventoryModularItem implements IInventory {
/** List of the stacks in the crafting matrix. */
private ArrayList<ItemStack> stackList;
private ItemStack associatedWith;
private ContainerTinkerTable container;
/** the width of the crafting inventory */
public InventoryModularItem(ContainerTinkerTable container)
{
this.container = container;
this.stackList = new ArrayList<ItemStack>();
}
/**
* Creates a new Inventory from the nbt tag list associated with an
* itemStack.
*/
public static InventoryModularItem fromItemStack(ItemStack stack,
ContainerTinkerTable container) {
InventoryModularItem inv = null;
if (stack.getItem() instanceof ItemPowerArmor) {
NBTTagCompound tags = stack.getTagCompound();
if (tags != null) {
inv = fromNBT(tags, container);
} else {
inv = new InventoryModularItem(container);
}
inv.associatedWith = stack;
inv.addEmptySlot();
} else if (stack.getItem() instanceof ItemPowerTool) {
NBTTagCompound tags = stack.getTagCompound();
if (tags != null) {
inv = fromNBT(tags, container);
} else {
inv = new InventoryModularItem(container);
}
inv.associatedWith = stack;
inv.addEmptySlot();
}
return inv;
}
/**
* Creates a new Inventory from an nbt tag list.
*/
public static InventoryModularItem fromNBT(NBTTagCompound tags,
ContainerTinkerTable container) {
InventoryModularItem inv = new InventoryModularItem(container);
int[] moduleIDs = tags.getIntArray("Contents");
for (int i = 0; i < moduleIDs.length; i++) {
inv.stackList.add(new ItemStack(ItemAugmentation.index, 1,
moduleIDs[i]));
}
return inv;
}
/**
* Creates an NBT tag list describing the inventory in its current state,
* and associates it with the given ItemStack.
*/
public void toNBTOfStack(ItemStack stack) {
if (stack != null) {
stack.setTagCompound(toNBT());
}
}
/**
* Creates an NBT tag list describing the inventory in its current state.
*/
public NBTTagCompound toNBT() {
NBTTagCompound nbt = new NBTTagCompound();
int[] moduleIDs = new int[stackList.size()];
for (int i = 0; i < stackList.size(); i++) {
if (stackList.get(i) != null) {
moduleIDs[i] = stackList.get(i).getItemDamage();
} else {
moduleIDs[i] = -1;
}
}
nbt.setIntArray("Contents", moduleIDs);
return nbt;
}
/**
* Returns the number of slots in the inventory.
*/
public int getSizeInventory()
{
return this.stackList.size();
}
/**
* Returns the stack in slot i
*/
public ItemStack getStackInSlot(int par1)
{
return par1 >= this.getSizeInventory() ? null : this.stackList
.get(par1);
}
/**
* Returns the name of the inventory.
*/
public String getInvName()
{
return "container.crafting";
}
/**
* When some containers are closed they call this on each slot, then drop
* whatever it returns as an EntityItem - like when you close a workbench
* GUI.
*/
public ItemStack getStackInSlotOnClosing(int par1)
{
if (this.stackList.get(par1) != null)
{
ItemStack var2 = this.stackList.get(par1);
this.stackList.remove(par1);
return var2;
}
else
{
return null;
}
}
/**
* Removes from an inventory slot (first arg) up to a specified number
* (second arg) of items and returns them in a new stack.
*/
public ItemStack decrStackSize(int index, int number)
{
if (this.stackList.get(index) != null)
{
ItemStack var3;
if (this.stackList.get(index).stackSize <= number)
{
var3 = this.stackList.get(index);
this.stackList.remove(index);
return var3;
}
else
{
var3 = this.stackList.get(index).splitStack(number);
if (this.stackList.get(index).stackSize == 0)
{
this.stackList.remove(index);
}
return var3;
}
}
else
{
return null;
}
}
/**
* Sets the given item stack to the specified slot in the inventory (can be
* crafting or armor sections).
*/
public void setInventorySlotContents(int index, ItemStack stack)
{
this.stackList.set(index, stack);
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be
* 64, possibly will be extended. *Isn't this more of a set than a get?*
*/
public int getInventoryStackLimit()
{
return 1;
}
/**
* Called when an the contents of an Inventory change, usually
*/
public void onInventoryChanged() {
if (this.associatedWith != null) {
this.toNBTOfStack(associatedWith);
}
container.update();
}
public void addEmptySlot() {
this.stackList.add(null);
}
/**
* Do not make give this method the name canInteractWith because it clashes
* with Container
*/
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
{
return true;
}
public void openChest() {
}
public void closeChest() {
}
}

View file

@ -1,60 +0,0 @@
package machinemuse.powersuits.trash;
import java.util.ArrayList;
import java.util.List;
import machinemuse.powersuits.common.Config;
import net.minecraft.item.Item;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@Deprecated
public class ItemAugmentation extends Item {
static List<ItemAugmentation> allAugs = new ArrayList<ItemAugmentation>();
public static int index;
public ItemAugmentation(Config.Items item) {
super(Config.getAssignedItemID(item));
index = shiftedIndex;
this.setHasSubtypes(true);
this.setMaxDamage(0);
allAugs.add(this);
}
public static List<ItemAugmentation> getAllAugs() {
return allAugs;
}
public boolean canGoInSlot(AugSlot.SlotType type) {
return true;
}
@SideOnly(Side.CLIENT)
/**
* Gets an icon index based on an item's damage value
*/
public int getIconFromDamage(int par1)
{
return this.iconIndex;
}
// public String getItemNameIS(ItemStack par1ItemStack)
// {
// int var2 = MathHelper.clamp_int(par1ItemStack.getItemDamage(), 0, 15);
// // return "augmentation." + AugTypes.values()[var2].idName;
// }
// @SideOnly(Side.CLIENT)
// /**
// * returns a list of items with the same ID, but different meta (eg: dye
// returns 16 items)
// */
// // public void getSubItems(int id, CreativeTabs creativeTab,
// // List tabItems)
// // {
// // for (AugTypes i : AugTypes.values())
// // {
// // tabItems.add(new ItemStack(id, 1, i.id));
// // }
// // }
}

View file

@ -1,28 +0,0 @@
package machinemuse.powersuits.trash;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet250CustomPayload;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.Player;
/**
* Packet handler for the server side.
*
* @author MachineMuse
*
*/
@Deprecated
public class ServerPacketHandler implements IPacketHandler {
@Override
public void onPacketData(INetworkManager manager,
Packet250CustomPayload packet, Player player) {
DataInputStream data = new DataInputStream(new ByteArrayInputStream(
packet.data));
EntityPlayer sender = (EntityPlayer) player;
}
}

View file

@ -1,86 +0,0 @@
package machinemuse.powersuits.trash;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@Deprecated
public class SlotArmorInTinkerTable extends Slot {
/**
* The armor type that can be placed on that slot, it uses the same values
* of armorType field on ItemArmor.
*/
final int armorType;
final ContainerTinkerTable table;
private ItemStack stackCache;
/**
* Constructor. Takes an inventory and an index, x and y locations for the
* icon, and armorType.
*/
SlotArmorInTinkerTable(ContainerTinkerTable table, IInventory inventory,
int index, int x, int y,
int armorType)
{
super(inventory, index, x, y);
this.armorType = armorType;
this.table = table;
this.stackCache = this.getStack();
}
/**
* Returns the maximum stack size for a given slot (usually the same as
* getInventoryStackLimit(), but 1 in the case of armor slots)
*/
public int getSlotStackLimit()
{
return 1;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for
* the armor slots.
*/
public boolean isItemValid(ItemStack stack)
{
if (stack == null) {
return false;
} else {
Item stackType = (Item) stack.getItem();
if (stack.getItem() instanceof ItemArmor) {
if (((ItemArmor) stackType).armorType == this.armorType) {
return true;
} else {
return false;
}
} else if (stackType.shiftedIndex == Block.pumpkin.blockID
&& this.armorType == 0) {
return true;
} else if (stackType.shiftedIndex == Item.skull.shiftedIndex
&& this.armorType == 0) {
return true;
} else {
return false;
}
}
}
@SideOnly(Side.CLIENT)
/**
* Returns the icon index on items.png that is used as background image of the slot.
*/
public int getBackgroundIconIndex()
{
return 15 + this.armorType * 16;
}
public void onSlotChanged() {
super.onSlotChanged();
table.update();
}
}

View file

@ -1,54 +0,0 @@
package machinemuse.powersuits.trash;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
@Deprecated
public class SlotAugmentation extends Slot {
public SlotAugmentation(IInventory par1iInventory, int par2, int par3,
int par4) {
super(par1iInventory, par2, par3, par4);
}
/**
* Returns the maximum stack size for a given slot (usually the same as
* getInventoryStackLimit(), but 1 in the case of armor slots)
*/
public int getSlotStackLimit()
{
return 1;
}
/**
* Check if the stack is a valid item for this slot. Always true beside for
* the armor slots.
*/
public boolean isItemValid(ItemStack stack)
{
if (stack == null) {
return false;
} else {
Item stackType = (Item) stack.getItem();
if (stack.getItem() instanceof ItemAugmentation) {
return true;
} else {
return false;
}
}
}
@SideOnly(Side.CLIENT)
/**
* Returns the icon index on items.png that is used as background image of the slot.
*/
public int getBackgroundIconIndex()
{
return 18;
}
}