Most of the 1.8 Port.

This commit is contained in:
AlgorithmX2
2015-06-15 19:44:59 -05:00
parent 17465e68e8
commit 38afde724b
824 changed files with 12120 additions and 9158 deletions
@@ -23,17 +23,15 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.Item;
import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.stats.AchievementList;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import cpw.mods.fml.common.FMLCommonHandler;
public class AppEngCraftingSlot extends AppEngSlot
@@ -120,7 +118,7 @@ public class AppEngCraftingSlot extends AppEngSlot
this.thePlayer.addStat( AchievementList.bakeCake, 1 );
}
if( par1ItemStack.getItem() instanceof ItemPickaxe && ( (ItemTool) par1ItemStack.getItem() ).func_150913_i() != Item.ToolMaterial.WOOD )
if( par1ItemStack.getItem() instanceof ItemPickaxe && ( (ItemTool) par1ItemStack.getItem() ).getToolMaterial() != Item.ToolMaterial.WOOD )
{
this.thePlayer.addStat( AchievementList.buildBetterPickaxe, 1 );
}
@@ -142,43 +140,45 @@ public class AppEngCraftingSlot extends AppEngSlot
}
@Override
public void onPickupFromSlot( EntityPlayer par1EntityPlayer, ItemStack par2ItemStack )
public void onPickupFromSlot( EntityPlayer playerIn, ItemStack stack )
{
FMLCommonHandler.instance().firePlayerCraftingEvent( par1EntityPlayer, par2ItemStack, this.craftMatrix );
this.onCrafting( par2ItemStack );
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, craftMatrix);
this.onCrafting(stack);
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
InventoryCrafting ic = new InventoryCrafting( this.myContainer, 3, 3 );
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(ic, playerIn.worldObj);
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) );
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
for( int i = 0; i < this.craftMatrix.getSizeInventory(); ++i )
{
ItemStack itemstack1 = this.craftMatrix.getStackInSlot( i );
for (int i = 0; i < aitemstack.length; ++i)
{
ItemStack itemstack1 = this.craftMatrix.getStackInSlot(i);
ItemStack itemstack2 = aitemstack[i];
if( itemstack1 != null )
{
this.craftMatrix.decrStackSize( i, 1 );
if (itemstack1 != null)
{
this.craftMatrix.decrStackSize(i, 1);
}
if( itemstack1.getItem().hasContainerItem( itemstack1 ) )
{
ItemStack itemstack2 = itemstack1.getItem().getContainerItem( itemstack1 );
if( itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage() )
{
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.thePlayer, itemstack2 ) );
continue;
}
if( !itemstack1.getItem().doesContainerItemLeaveCraftingGrid( itemstack1 ) || !this.thePlayer.inventory.addItemStackToInventory( itemstack2 ) )
{
if( this.craftMatrix.getStackInSlot( i ) == null )
{
this.craftMatrix.setInventorySlotContents( i, itemstack2 );
}
else
{
this.thePlayer.dropPlayerItemWithRandomChoice( itemstack2, false );
}
}
}
}
}
if (itemstack2 != null)
{
if (this.craftMatrix.getStackInSlot(i) == null)
{
this.craftMatrix.setInventorySlotContents(i, itemstack2);
}
else if (!this.thePlayer.inventory.addItemStackToInventory(itemstack2))
{
this.thePlayer.dropPlayerItemWithRandomChoice(itemstack2, false);
}
}
}
}
/**