use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.
the class BlockTieredEnergyStorage method getStateFromMeta.
@Override
public IBlockState getStateFromMeta(int meta) {
EnumFacing enumfacing = EnumFacing.getHorizontal(meta % 4);
BlockType type = BlockType.valuesCached()[(int) Math.floor(meta / 4)];
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(VARIANT, type);
}
use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.
the class BlockInfectedChest method getLockableContainer.
@Override
public ILockableContainer getLockableContainer(World world, BlockPos pos) {
TileEntity tileentity = world.getTileEntity(pos);
if (!(tileentity instanceof TileEntityInfectedChest)) {
return null;
} else {
Object object = tileentity;
if (this.isBlocked(world, pos)) {
return null;
} else {
Iterator iterator = EnumFacing.Plane.HORIZONTAL.iterator();
while (iterator.hasNext()) {
EnumFacing enumfacing = (EnumFacing) iterator.next();
BlockPos blockpos1 = pos.offset(enumfacing);
Block block = world.getBlockState(blockpos1).getBlock();
if (block == this) {
if (this.isBlocked(world, blockpos1)) {
return null;
}
TileEntity tileentity1 = world.getTileEntity(blockpos1);
if (tileentity1 instanceof TileEntityInfectedChest) {
if (enumfacing != EnumFacing.WEST && enumfacing != EnumFacing.NORTH) {
object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (ILockableContainer) object, (TileEntityInfectedChest) tileentity1);
} else {
object = new InventoryLargeChest(GCCoreUtil.translate("container.chestDouble"), (TileEntityInfectedChest) tileentity1, (ILockableContainer) object);
}
}
}
}
return (ILockableContainer) object;
}
}
}
use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.
the class BlockInfectedSponge method randomDisplayTick.
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) {
if (state.getValue(WET).booleanValue()) {
EnumFacing enumfacing = EnumFacing.random(rand);
if (enumfacing != EnumFacing.UP && !world.getBlockState(pos.offset(enumfacing)).isSideSolid(world, pos.offset(enumfacing), EnumFacing.UP)) {
double d0 = pos.getX();
double d1 = pos.getY();
double d2 = pos.getZ();
if (enumfacing == EnumFacing.DOWN) {
d1 -= 0.05D;
d0 += rand.nextDouble();
d2 += rand.nextDouble();
} else {
d1 += rand.nextDouble() * 0.8D;
if (enumfacing.getAxis() == EnumFacing.Axis.X) {
d2 += rand.nextDouble();
if (enumfacing == EnumFacing.EAST) {
++d0;
} else {
d0 += 0.05D;
}
} else {
d0 += rand.nextDouble();
if (enumfacing == EnumFacing.SOUTH) {
++d2;
} else {
d2 += 0.05D;
}
}
}
MorePlanetsCore.PROXY.spawnParticle(EnumParticleTypesMP.INFECTED_WATER_DRIP, d0, d1, d2);
}
}
}
use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.
the class BlockMultalicCrystal method getBoundingBox.
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) {
EnumFacing facing = state.getValue(BlockStateHelper.FACING_ALL);
double box = 0.0625D;
switch(facing) {
case NORTH:
default:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D);
case EAST:
return new AxisAlignedBB(0.0D, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D - box);
case WEST:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D, 1.0D - box, 1.0D - box);
case SOUTH:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D, 1.0D - box, 1.0D - box, 1.0D - box);
case UP:
return new AxisAlignedBB(0.0D + box, 0.0D, 0.0D + box, 1.0D - box, 1.0D - box, 1.0D - box);
case DOWN:
return new AxisAlignedBB(0.0D + box, 0.0D + box, 0.0D + box, 1.0D - box, 1.0D, 1.0D - box);
}
}
use of net.minecraft.util.EnumFacing in project MorePlanets by SteveKunG.
the class SpaceDoubleChestItemHandlerMP method get.
public static SpaceDoubleChestItemHandlerMP get(TileEntityChestMP chest) {
World world = chest.getWorld();
BlockPos pos = chest.getPos();
if (world == null || pos == null || !world.isBlockLoaded(pos)) {
return null;
}
Block blockType = chest.getBlockType();
EnumFacing[] horizontals = EnumFacing.HORIZONTALS;
for (int i = horizontals.length - 1; i >= 0; i--) {
EnumFacing enumfacing = horizontals[i];
BlockPos blockpos = pos.offset(enumfacing);
Block block = world.getBlockState(blockpos).getBlock();
if (block == blockType) {
TileEntity otherTE = world.getTileEntity(blockpos);
if (otherTE instanceof TileEntityChestMP) {
TileEntityChestMP otherChest = (TileEntityChestMP) otherTE;
return new SpaceDoubleChestItemHandlerMP(chest, otherChest, enumfacing != net.minecraft.util.EnumFacing.WEST && enumfacing != net.minecraft.util.EnumFacing.NORTH);
}
}
}
return NO_ADJACENT_CHESTS_INSTANCE;
}
Aggregations