Some more patch migration before bed.

This commit is contained in:
LexManos 2012-08-06 03:54:57 -07:00
parent d286154997
commit 80ad4be5b1
7 changed files with 110 additions and 9 deletions

View file

@ -3,7 +3,7 @@
* License v1.0.
*/
package net.minecraft.src.forge;
package net.minecraftforge.common;
import net.minecraft.src.IInventory;
@ -16,19 +16,13 @@ public interface ISidedInventory extends IInventory
/**
* Get the start of the side inventory.
* @param side The global side to get the start of range.
* 0: -Y (bottom side)
* 1: +Y (top side)
* 2: -Z
* 3: +Z
* 4: -X
* 5: +x
*/
int getStartInventorySide(int side);
int getStartInventorySide(Orientation side);
/**
* Get the size of the side inventory.
* @param side The global side.
*/
int getSizeInventorySide(int side);
int getSizeInventorySide(Orientation side);
}

View file

@ -8,3 +8,12 @@
this.onCrafting(par1ItemStack);
for (int var2 = 0; var2 < this.craftMatrix.getSizeInventory(); ++var2)
@@ -119,7 +120,7 @@
if (var3.getItem().hasContainerItem())
{
- ItemStack var4 = new ItemStack(var3.getItem().getContainerItem());
+ ItemStack var4 = var3.getItem().getContainerItemStack(var3);
if (!var3.getItem().doesContainerItemLeaveCraftingGrid(var3) || !this.thePlayer.inventory.addItemStackToInventory(var4))
{

View file

@ -34,3 +34,11 @@
{
var2 += (float)(var3 * var3 + 1);
}
@@ -1056,6 +1066,7 @@
public void destroyCurrentEquippedItem()
{
this.inventory.setInventorySlotContents(this.inventory.currentItem, (ItemStack)null);
+ ForgeHooks.onDestroyCurrentItem(par1EntityPlayer, var5);
}
/**

View file

@ -0,0 +1,19 @@
--- ../src_base/minecraft/net/minecraft/src/Item.java
+++ ../src_work/minecraft/net/minecraft/src/Item.java
@@ -625,4 +625,16 @@
{
StatList.initStats();
}
+
+ /**
+ * ItemStack sensitive version of getContainerItem.
+ * Returns a full ItemStack instance of the result.
+ *
+ * @param itemStack The current ItemStack
+ * @return The resulting ItemStack
+ */
+ public ItemStack getContainerItemStack(ItemStack itemStack)
+ {
+ return new ItemStack(getContainerItem());
+ }
}

View file

@ -0,0 +1,20 @@
--- ../src_base/minecraft/net/minecraft/src/ItemMap.java
+++ ../src_work/minecraft/net/minecraft/src/ItemMap.java
@@ -84,7 +84,7 @@
byte var23 = 0;
byte var24 = 0;
byte var25 = 0;
- int[] var26 = new int[256];
+ int[] var26 = new int[Block.blocksList.length];
Chunk var27 = par1World.getChunkFromBlockCoords(var21, var22);
if (!var27.isEmpty())
@@ -183,7 +183,7 @@
var33 = 0;
var34 = 0;
- for (var35 = 0; var35 < 256; ++var35)
+ for (var35 = 0; var35 < Block.blocksList.length; ++var35)
{
if (var26[var35] > var33)
{

View file

@ -0,0 +1,11 @@
--- ../src_base/minecraft/net/minecraft/src/PlayerControllerMP.java
+++ ../src_work/minecraft/net/minecraft/src/PlayerControllerMP.java
@@ -112,7 +112,7 @@
{
var5.playAuxSFX(2001, par1, par2, par3, var6.blockID + (var5.getBlockMetadata(par1, par2, par3) << 12));
int var7 = var5.getBlockMetadata(par1, par2, par3);
- boolean var8 = var5.setBlockWithNotify(par1, par2, par3, 0);
+ boolean var8 = var6.removeBlockByPlayer(var5, mc.thePlayer, par1, par2, par3);
if (var8)
{

View file

@ -0,0 +1,40 @@
--- ../src_base/minecraft/net/minecraft/src/TileEntityBrewingStand.java
+++ ../src_work/minecraft/net/minecraft/src/TileEntityBrewingStand.java
@@ -2,7 +2,10 @@
import java.util.List;
-public class TileEntityBrewingStand extends TileEntity implements IInventory
+import net.minecraftforge.common.ISidedInventory;
+import net.minecraftforge.common.Orientation;
+
+public class TileEntityBrewingStand extends TileEntity implements IInventory, ISidedInventory
{
/** The itemstacks currently placed in the slots of the brewing stand */
private ItemStack[] brewingItemStacks = new ItemStack[4];
@@ -156,7 +159,7 @@
if (Item.itemsList[var1.itemID].hasContainerItem())
{
- this.brewingItemStacks[3] = new ItemStack(Item.itemsList[var1.itemID].getContainerItem());
+ this.brewingItemStacks[3] = Item.itemsList[var1.itemID].getContainerItemStack(brewingItemStacks[3]);
}
else
{
@@ -322,4 +325,16 @@
return var1;
}
+
+ @Override
+ public int getStartInventorySide(Orientation side)
+ {
+ return (side == Orientation.UP ? 3 : 0);
+ }
+
+ @Override
+ public int getSizeInventorySide(Orientation side)
+ {
+ return (side == Orientation.UP ? 1 : 3);
+ }
}