Port to 1.11
This commit is contained in:
@@ -32,6 +32,7 @@ import net.minecraft.item.ItemSword;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.stats.AchievementList;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
|
||||
public class AppEngCraftingSlot extends AppEngSlot
|
||||
@@ -85,7 +86,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
@Override
|
||||
protected void onCrafting( final ItemStack par1ItemStack )
|
||||
{
|
||||
par1ItemStack.onCrafting( this.thePlayer.worldObj, this.thePlayer, this.amountCrafted );
|
||||
par1ItemStack.onCrafting( this.thePlayer.world, this.thePlayer, this.amountCrafted );
|
||||
this.amountCrafted = 0;
|
||||
|
||||
if( par1ItemStack.getItem() == Item.getItemFromBlock( Blocks.CRAFTING_TABLE ) )
|
||||
@@ -140,7 +141,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot( final EntityPlayer playerIn, final ItemStack stack )
|
||||
public ItemStack onTake( final EntityPlayer playerIn, final ItemStack stack )
|
||||
{
|
||||
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent( playerIn, stack, this.craftMatrix );
|
||||
this.onCrafting( stack );
|
||||
@@ -152,7 +153,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
final ItemStack[] aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.worldObj );
|
||||
final NonNullList<ItemStack> aitemstack = CraftingManager.getInstance().getRemainingItems( ic, playerIn.world );
|
||||
|
||||
for( int x = 0; x < this.craftMatrix.getSizeInventory(); x++ )
|
||||
{
|
||||
@@ -161,10 +162,10 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
|
||||
net.minecraftforge.common.ForgeHooks.setCraftingPlayer( null );
|
||||
|
||||
for( int i = 0; i < aitemstack.length; ++i )
|
||||
for( int i = 0; i < aitemstack.size(); ++i )
|
||||
{
|
||||
final ItemStack itemstack1 = this.craftMatrix.getStackInSlot( i );
|
||||
final ItemStack itemstack2 = aitemstack[i];
|
||||
final ItemStack itemstack2 = aitemstack.get( i );
|
||||
|
||||
if( itemstack1 != null )
|
||||
{
|
||||
@@ -183,6 +184,8 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return stack;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,7 +197,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
{
|
||||
if( this.getHasStack() )
|
||||
{
|
||||
this.amountCrafted += Math.min( par1, this.getStack().stackSize );
|
||||
this.amountCrafted += Math.min( par1, this.getStack().getCount() );
|
||||
}
|
||||
|
||||
return super.decrStackSize( par1 );
|
||||
|
||||
@@ -40,9 +40,9 @@ public class NullSlot extends Slot
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
|
||||
public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
|
||||
{
|
||||
|
||||
return par2ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,13 +37,13 @@ public class OptionalSlotFakeTypeOnly extends OptionalSlotFake
|
||||
if( is != null )
|
||||
{
|
||||
is = is.copy();
|
||||
if( is.stackSize > 1 )
|
||||
if( is.getCount() > 1 )
|
||||
{
|
||||
is.stackSize = 1;
|
||||
is.setCount( 1 );
|
||||
}
|
||||
else if( is.stackSize < -1 )
|
||||
else if( is.getCount() < -1 )
|
||||
{
|
||||
is.stackSize = -1;
|
||||
is.setCount( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot( final EntityPlayer p, final ItemStack is )
|
||||
public ItemStack onTake( final EntityPlayer p, final ItemStack is )
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
public void doClick( final InventoryAction action, final EntityPlayer who )
|
||||
@@ -97,7 +98,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
|
||||
final IMEMonitor<IAEItemStack> inv = this.storage.getItemInventory();
|
||||
final int howManyPerCraft = this.getStack().stackSize;
|
||||
final int howManyPerCraft = this.getStack().getCount();
|
||||
int maxTimesToCraft = 0;
|
||||
|
||||
InventoryAdaptor ia = null;
|
||||
@@ -141,7 +142,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
{
|
||||
final List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
drops.add( extra );
|
||||
Platform.spawnDrops( who.worldObj, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
|
||||
Platform.spawnDrops( who.world, new BlockPos( (int) who.posX, (int) who.posY, (int) who.posZ ), drops );
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -171,7 +172,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
|
||||
}
|
||||
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
|
||||
final IRecipe r = Platform.findMatchingRecipe( ic, p.world );
|
||||
|
||||
if( r == null )
|
||||
{
|
||||
@@ -193,7 +194,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
}
|
||||
if( !isBad )
|
||||
{
|
||||
super.onPickupFromSlot( p, is );
|
||||
super.onTake( p, is );
|
||||
// actually necessary to cleanup this case...
|
||||
p.openContainer.onCraftMatrixChanged( this.craftInv );
|
||||
return request;
|
||||
@@ -210,7 +211,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
{
|
||||
if( this.getPattern().getStackInSlot( x ) != null )
|
||||
{
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.world, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
ic.setInventorySlotContents( x, set[x] );
|
||||
}
|
||||
}
|
||||
@@ -240,7 +241,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
private void makeItem( final EntityPlayer p, final ItemStack is )
|
||||
{
|
||||
super.onPickupFromSlot( p, is );
|
||||
super.onTake( p, is );
|
||||
}
|
||||
|
||||
private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
|
||||
@@ -271,7 +272,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
if( drops.size() > 0 )
|
||||
{
|
||||
Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
|
||||
Platform.spawnDrops( p.world, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,9 @@ public class SlotFake extends AppEngSlot
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPickupFromSlot( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
|
||||
public ItemStack onTake( final EntityPlayer par1EntityPlayer, final ItemStack par2ItemStack )
|
||||
{
|
||||
return par2ItemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SlotFakeBlacklist extends SlotFakeTypeOnly
|
||||
{
|
||||
if( this.getHasStack() )
|
||||
{
|
||||
return this.getStack().stackSize > 0 ? 16 + 14 : 14;
|
||||
return this.getStack().getCount() > 0 ? 16 + 14 : 14;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ public class SlotFakeTypeOnly extends SlotFake
|
||||
if( is != null )
|
||||
{
|
||||
is = is.copy();
|
||||
if( is.stackSize > 1 )
|
||||
if( is.getCount() > 1 )
|
||||
{
|
||||
is.stackSize = 1;
|
||||
is.setCount( 1 );
|
||||
}
|
||||
else if( is.stackSize < -1 )
|
||||
else if( is.getCount() < -1 )
|
||||
{
|
||||
is.stackSize = -1;
|
||||
is.setCount( -1 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
if( i.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
final ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
|
||||
final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj );
|
||||
final ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.world );
|
||||
if( de != null )
|
||||
{
|
||||
return de.isCraftable();
|
||||
|
||||
Reference in New Issue
Block a user