Fixed placement rotation!

This commit is contained in:
Aidan Brady 2013-08-03 14:36:48 -04:00
parent 4f74f65907
commit 3209d1c671
3 changed files with 17 additions and 21 deletions

View file

@ -31,26 +31,6 @@ public class BlockEMContractor extends BlockBase implements ITileEntityProvider
return BlockRenderingHandler.INSTANCE.getRenderId(); return BlockRenderingHandler.INSTANCE.getRenderId();
} }
@Override
public void onBlockAdded(World world, int x, int y, int z)
{
TileEntityEMContractor tileContractor = (TileEntityEMContractor)world.getBlockTileEntity(x, y, z);
if(!tileContractor.isLatched())
{
for(ForgeDirection side : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = world.getBlockTileEntity(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
if(tileEntity instanceof IInventory)
{
tileContractor.setFacing(side.getOpposite());
return;
}
}
}
}
@Override @Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
{ {

View file

@ -1,8 +1,10 @@
package resonantinduction.contractor; package resonantinduction.contractor;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
@ -22,6 +24,20 @@ public class ItemBlockContractor extends ItemBlock
{ {
TileEntityEMContractor tileContractor = (TileEntityEMContractor)world.getBlockTileEntity(x, y, z); TileEntityEMContractor tileContractor = (TileEntityEMContractor)world.getBlockTileEntity(x, y, z);
tileContractor.setFacing(ForgeDirection.getOrientation(side)); tileContractor.setFacing(ForgeDirection.getOrientation(side));
if(!tileContractor.isLatched())
{
for(ForgeDirection side1 : ForgeDirection.VALID_DIRECTIONS)
{
TileEntity tileEntity = world.getBlockTileEntity(x+side1.offsetX, y+side1.offsetY, z+side1.offsetZ);
if(tileEntity instanceof IInventory)
{
tileContractor.setFacing(side1.getOpposite());
break;
}
}
}
} }
return place; return place;

View file

@ -242,7 +242,7 @@ public class TileEntityEMContractor extends TileEntity implements IPacketReceive
if(!worldObj.isRemote) if(!worldObj.isRemote)
{ {
PacketHandler.sendTileEntityPacketToClients(this, getNetworkedData(new ArrayList())); PacketHandler.sendTileEntityPacketToClients(this, getNetworkedData(new ArrayList()).toArray());
} }
updateBounds(); updateBounds();