use of riskyken.armourersWorkshop.common.tileentities.TileEntitySkinnable in project Armourers-Workshop by RiskyKen.
the class BlockSkinnable method onBlockActivated.
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xHit, float yHit, float zHit) {
Skin skin = getSkin(world, x, y, z);
TileEntitySkinnable te = getTileEntity(world, x, y, z);
if (te == null) {
return false;
}
TileEntitySkinnable parentTe = te.getParent();
if (parentTe == null) {
return false;
}
if (parentTe.hasLinkedBlock()) {
BlockLocation loc = parentTe.getLinkedBlock();
Block block = world.getBlock(loc.x, loc.y, loc.z);
if (!(block instanceof BlockSkinnable)) {
return block.onBlockActivated(world, loc.x, loc.y, loc.z, player, side, xHit, yHit, zHit);
}
}
if (skin == null) {
return false;
}
if (SkinProperties.PROP_BLOCK_SEAT.getValue(skin.getProperties())) {
return sitOnSeat(world, parentTe.xCoord, parentTe.yCoord, parentTe.zCoord, player, skin);
}
if (SkinProperties.PROP_BLOCK_BED.getValue(skin.getProperties())) {
// return sleepInBed(world, parentTe.xCoord, parentTe.yCoord, parentTe.zCoord, player, skin, te.getRotation(), te);
}
if (SkinProperties.PROP_BLOCK_INVENTORY.getValue(skin.getProperties()) | SkinProperties.PROP_BLOCK_ENDER_INVENTORY.getValue(skin.getProperties())) {
if (!world.isRemote) {
FMLNetworkHandler.openGui(player, ArmourersWorkshop.instance, LibGuiIds.SKINNABLE, world, parentTe.xCoord, parentTe.yCoord, parentTe.zCoord);
}
return true;
}
return false;
}
Aggregations