use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.
the class EventHandlerMars method onPlayerRotate.
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onPlayerRotate(RenderPlayerGC.RotatePlayerEvent event) {
BlockPos blockPos = event.entityPlayer.playerLocation;
IBlockState state = event.entityPlayer.worldObj.getBlockState(blockPos);
if (state.getBlock() == GCBlocks.fakeBlock && state.getValue(BlockMulti.MULTI_TYPE) == BlockMulti.EnumBlockMultiType.CRYO_CHAMBER) {
TileEntity tile = event.entityPlayer.worldObj.getTileEntity(blockPos);
if (tile instanceof TileEntityMulti) {
state = event.entityPlayer.worldObj.getBlockState(((TileEntityMulti) tile).mainBlockPosition);
}
}
if (state.getBlock() == MarsBlocks.machine && state.getValue(BlockMachineMars.TYPE) == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
event.shouldRotate = true;
event.vanillaOverride = true;
}
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.
the class RenderPlayerGC method rotateCorpse.
@Override
protected void rotateCorpse(AbstractClientPlayer abstractClientPlayer, float par2, float par3, float par4) {
if (abstractClientPlayer.isEntityAlive() && abstractClientPlayer.isPlayerSleeping()) {
RotatePlayerEvent event = new RotatePlayerEvent(abstractClientPlayer);
MinecraftForge.EVENT_BUS.post(event);
if (!event.vanillaOverride) {
super.rotateCorpse(abstractClientPlayer, par2, par3, par4);
} else if (event.shouldRotate == null) {
GL11.glRotatef(abstractClientPlayer.getBedOrientationInDegrees(), 0.0F, 1.0F, 0.0F);
} else if (event.shouldRotate) {
float rotation = 0.0F;
if (abstractClientPlayer.playerLocation != null) {
IBlockState bed = abstractClientPlayer.worldObj.getBlockState(abstractClientPlayer.playerLocation);
if (bed.getBlock().isBed(abstractClientPlayer.worldObj, abstractClientPlayer.playerLocation, abstractClientPlayer)) {
if (bed.getBlock() == GCBlocks.fakeBlock && bed.getValue(BlockMulti.MULTI_TYPE) == BlockMulti.EnumBlockMultiType.CRYO_CHAMBER) {
TileEntity tile = event.entityPlayer.worldObj.getTileEntity(abstractClientPlayer.playerLocation);
if (tile instanceof TileEntityMulti) {
bed = event.entityPlayer.worldObj.getBlockState(((TileEntityMulti) tile).mainBlockPosition);
}
}
if (bed.getBlock() == MarsBlocks.machine && bed.getValue(BlockMachineMars.TYPE) == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
switch(bed.getValue(BlockMachineMars.FACING)) {
case NORTH:
rotation = 0.0F;
break;
case EAST:
rotation = 270.0F;
break;
case SOUTH:
rotation = 180.0F;
break;
case WEST:
rotation = 90.0F;
break;
}
}
}
}
GL11.glRotatef(rotation, 0.0F, 1.0F, 0.0F);
}
} else {
if (Minecraft.getMinecraft().gameSettings.thirdPersonView != 0) {
final EntityPlayer player = (EntityPlayer) abstractClientPlayer;
if (player.ridingEntity instanceof ICameraZoomEntity) {
Entity rocket = player.ridingEntity;
float rotateOffset = ((ICameraZoomEntity) rocket).getRotateOffset();
if (rotateOffset > -10F) {
GL11.glTranslatef(0, -rotateOffset, 0);
float anglePitch = rocket.prevRotationPitch;
float angleYaw = rocket.prevRotationYaw;
GL11.glRotatef(-angleYaw, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(anglePitch, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0, rotateOffset, 0);
}
}
}
super.rotateCorpse(abstractClientPlayer, par2, par3, par4);
}
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.
the class BlockMulti method getActualState.
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
EnumBlockMultiType type = state.getValue(MULTI_TYPE);
int renderType = 0;
switch(type) {
case CRYO_CHAMBER:
IBlockState stateAbove = worldIn.getBlockState(pos.up());
TileEntityMulti tile = (TileEntityMulti) worldIn.getTileEntity(pos);
if (stateAbove.getBlock() == this && (stateAbove.getValue(MULTI_TYPE)) == EnumBlockMultiType.CRYO_CHAMBER) {
renderType = 0;
} else {
renderType = 4;
}
if (tile != null && tile.mainBlockPosition != null && GalacticraftCore.isPlanetsLoaded) {
IBlockState stateMain = worldIn.getBlockState(tile.mainBlockPosition);
if (stateMain.getBlock() == MarsBlocks.machine && stateMain.getValue(BlockMachineMars.TYPE) == BlockMachineMars.EnumMachineType.CRYOGENIC_CHAMBER) {
EnumFacing dir = stateMain.getValue(BlockMachineMars.FACING);
renderType += dir.getHorizontalIndex();
}
}
break;
default:
break;
}
return state.withProperty(RENDER_TYPE, renderType);
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.
the class BlockMulti method makeFakeBlock.
public void makeFakeBlock(World worldObj, BlockPos pos, BlockPos mainBlock, int meta) {
worldObj.setBlockState(pos, GCBlocks.fakeBlock.getStateFromMeta(meta), meta == 5 ? 3 : 0);
worldObj.setTileEntity(pos, new TileEntityMulti(mainBlock));
}
use of micdoodle8.mods.galacticraft.core.tile.TileEntityMulti in project Galacticraft by micdoodle8.
the class TileEntityCargoUnloader method checkForCargoEntity.
public void checkForCargoEntity() {
boolean foundFuelable = false;
BlockVec3 thisVec = new BlockVec3(this);
for (final EnumFacing dir : EnumFacing.VALUES) {
final TileEntity pad = thisVec.getTileEntityOnSide(this.worldObj, dir);
if (pad != null && pad instanceof TileEntityMulti) {
final TileEntity mainTile = ((TileEntityMulti) pad).getMainBlockTile();
if (mainTile instanceof ICargoEntity) {
this.attachedFuelable = (ICargoEntity) mainTile;
foundFuelable = true;
break;
}
} else if (pad != null && pad instanceof ICargoEntity) {
this.attachedFuelable = (ICargoEntity) pad;
foundFuelable = true;
break;
}
}
if (!foundFuelable) {
this.attachedFuelable = null;
}
}
Aggregations