mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-22 13:09:44 +00:00
Started work on Levers
Made part conversion send the desc packet to the client rather than do a local conversion
This commit is contained in:
1 parent
ae74440783
commit
931da01077
10 files changed
+246
-91
No files matched your search
@@ -0,0 +1,39 @@
|
||||
package codechicken.multipart.minecraft;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import codechicken.core.vec.BlockCoord;
|
||||
import codechicken.core.vec.Vector3;
|
||||
import codechicken.multipart.TileMultipartObj;
|
||||
|
||||
public abstract class McSidedMetaPart extends McMetaPart
|
||||
{
|
||||
public McSidedMetaPart()
|
||||
{
|
||||
}
|
||||
|
||||
public McSidedMetaPart(int meta)
|
||||
{
|
||||
super(meta);
|
||||
}
|
||||
|
||||
public abstract int sideForMeta(int meta);
|
||||
|
||||
public void onNeighbourChanged()
|
||||
{
|
||||
TileEntity tile = getTile();
|
||||
if(!tile.worldObj.isRemote)
|
||||
{
|
||||
BlockCoord pos = new BlockCoord(tile).offset(sideForMeta(meta));
|
||||
if(!tile.worldObj.isBlockSolidOnSide(pos.x, pos.y, pos.z, ForgeDirection.getOrientation(sideForMeta(meta)^1)))
|
||||
drop();
|
||||
}
|
||||
}
|
||||
|
||||
public void drop()
|
||||
{
|
||||
tile().remPart(this);
|
||||
TileMultipartObj.dropItem(new ItemStack(getBlock()), getTile().worldObj, Vector3.fromTileEntityCenter(getTile()));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user