use of micdoodle8.mods.galacticraft.core.world.IChunkLoader in project Galacticraft by micdoodle8.
the class BlockMachineMars method onBlockPlacedBy.
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
int metadata = getMetaFromState(state);
final int angle = MathHelper.floor_double(placer.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
int change = EnumFacing.getHorizontal(angle).getOpposite().getHorizontalIndex();
worldIn.setBlockState(pos, getStateFromMeta((metadata & 12) + change), 3);
switch(metadata & 12) {
case BlockMachineMars.CRYOGENIC_CHAMBER_METADATA:
BlockMulti.onPlacement(worldIn, pos, placer, this);
break;
case BlockMachineMars.LAUNCH_CONTROLLER_METADATA:
WorldUtil.markAdjacentPadForUpdate(worldIn, pos);
TileEntity var8 = worldIn.getTileEntity(pos);
if (var8 instanceof IChunkLoader && !worldIn.isRemote && ConfigManagerMars.launchControllerChunkLoad && placer instanceof EntityPlayer) {
((IChunkLoader) var8).setOwnerName(((EntityPlayer) placer).getName());
((IChunkLoader) var8).onTicketLoaded(ForgeChunkManager.requestTicket(GalacticraftCore.instance, var8.getWorld(), Type.NORMAL), true);
} else if (var8 instanceof TileEntityLaunchController && placer instanceof EntityPlayer) {
((TileEntityLaunchController) var8).setOwnerName(((EntityPlayer) placer).getName());
}
break;
}
}
Aggregations