Most of the 1.8 Port.
This commit is contained in:
@@ -19,17 +19,19 @@
|
||||
package appeng.tile.grindstone;
|
||||
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.gui.IUpdatePlayerListBox;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.helpers.ICustomCollision;
|
||||
import appeng.tile.AEBaseTile;
|
||||
@@ -38,7 +40,7 @@ import appeng.tile.events.TileEventType;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
public class TileCrank extends AEBaseTile implements ICustomCollision, IUpdatePlayerListBox
|
||||
{
|
||||
|
||||
final int ticksPerRotation = 18;
|
||||
@@ -78,8 +80,8 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
return null;
|
||||
}
|
||||
|
||||
ForgeDirection grinder = this.getUp().getOpposite();
|
||||
TileEntity te = this.worldObj.getTileEntity( this.xCoord + grinder.offsetX, this.yCoord + grinder.offsetY, this.zCoord + grinder.offsetZ );
|
||||
EnumFacing grinder = this.getUp().getOpposite();
|
||||
TileEntity te = this.worldObj.getTileEntity( pos.offset( grinder ) );
|
||||
if( te instanceof ICrankable )
|
||||
{
|
||||
return (ICrankable) te;
|
||||
@@ -101,10 +103,11 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
|
||||
IBlockState state = this.worldObj.getBlockState( pos );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,8 +143,7 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
this.hits++;
|
||||
if( this.hits > 10 )
|
||||
{
|
||||
this.worldObj.func_147480_a( this.xCoord, this.yCoord, this.zCoord, false );
|
||||
// worldObj.destroyBlock( xCoord, yCoord, zCoord, false );
|
||||
this.worldObj.destroyBlock( pos, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -151,21 +153,30 @@ public class TileCrank extends AEBaseTile implements ICustomCollision
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool( World w, int x, int y, int z, Entity e, boolean isVisual )
|
||||
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
Entity thePlayer,
|
||||
boolean b )
|
||||
{
|
||||
double xOff = -0.15 * this.getUp().offsetX;
|
||||
double yOff = -0.15 * this.getUp().offsetY;
|
||||
double zOff = -0.15 * this.getUp().offsetZ;
|
||||
return Collections.singletonList( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
double xOff = -0.15 * this.getUp().getFrontOffsetX();
|
||||
double yOff = -0.15 * this.getUp().getFrontOffsetY();
|
||||
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
|
||||
return Collections.singletonList( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addCollidingBlockToList( World w, int x, int y, int z, AxisAlignedBB bb, List<AxisAlignedBB> out, Entity e )
|
||||
public void addCollidingBlockToList(
|
||||
World w,
|
||||
BlockPos pos,
|
||||
AxisAlignedBB bb,
|
||||
List<AxisAlignedBB> out,
|
||||
Entity e )
|
||||
{
|
||||
double xOff = -0.15 * this.getUp().offsetX;
|
||||
double yOff = -0.15 * this.getUp().offsetY;
|
||||
double zOff = -0.15 * this.getUp().offsetZ;
|
||||
out.add( AxisAlignedBB.getBoundingBox( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
|
||||
double xOff = -0.15 * this.getUp().getFrontOffsetX();
|
||||
double yOff = -0.15 * this.getUp().getFrontOffsetY();
|
||||
double zOff = -0.15 * this.getUp().getFrontOffsetZ();
|
||||
out.add( AxisAlignedBB.fromBounds( xOff + 0.15, yOff + 0.15, zOff + 0.15,// ahh
|
||||
xOff + 0.85, yOff + 0.85, zOff + 0.85 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,14 +22,13 @@ package appeng.tile.grindstone;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.features.IGrinderEntry;
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.tile.AEBaseInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
@@ -47,10 +46,11 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
int points;
|
||||
|
||||
@Override
|
||||
public void setOrientation( ForgeDirection inForward, ForgeDirection inUp )
|
||||
public void setOrientation( EnumFacing inForward, EnumFacing inUp )
|
||||
{
|
||||
super.setOrientation( inForward, inUp );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, this.xCoord, this.yCoord, this.zCoord, Platform.AIR_BLOCK );
|
||||
IBlockState state = worldObj.getBlockState( pos );
|
||||
this.getBlockType().onNeighborBlockChange( this.worldObj, pos, state, state.getBlock() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -66,7 +66,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, int side )
|
||||
public boolean canInsertItem( int slotIndex, ItemStack insertingItem, EnumFacing side )
|
||||
{
|
||||
if( AEApi.instance().registries().grinder().getRecipeForInput( insertingItem ) == null )
|
||||
{
|
||||
@@ -77,13 +77,13 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, int side )
|
||||
public boolean canExtractItem( int slotIndex, ItemStack extractedItem, EnumFacing side )
|
||||
{
|
||||
return slotIndex >= 3 && slotIndex <= 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide( ForgeDirection side )
|
||||
public int[] getAccessibleSlotsBySide( EnumFacing side )
|
||||
{
|
||||
return this.sides;
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
}
|
||||
|
||||
this.points = 0;
|
||||
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), ForgeDirection.EAST );
|
||||
InventoryAdaptor sia = InventoryAdaptor.getAdaptor( new WrapperInventoryRange( this, 3, 3, true ), EnumFacing.EAST );
|
||||
|
||||
this.addItem( sia, r.getOutput() );
|
||||
|
||||
@@ -182,19 +182,15 @@ public class TileGrinder extends AEBaseInvTile implements ICrankable
|
||||
ItemStack notAdded = sia.addItems( output );
|
||||
if( notAdded != null )
|
||||
{
|
||||
WorldCoord wc = new WorldCoord( this.xCoord, this.yCoord, this.zCoord );
|
||||
|
||||
wc.add( this.getForward(), 1 );
|
||||
|
||||
List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
out.add( notAdded );
|
||||
|
||||
Platform.spawnDrops( this.worldObj, wc.x, wc.y, wc.z, out );
|
||||
Platform.spawnDrops( this.worldObj, pos.offset( this.getForward() ), out );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCrankAttach( ForgeDirection directionToCrank )
|
||||
public boolean canCrankAttach( EnumFacing directionToCrank )
|
||||
{
|
||||
return this.getUp() == directionToCrank;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user