use of net.minecraft.block.BlockAir in project Galacticraft by micdoodle8.
the class RedstoneUtil method getRedstonePowerIndirect.
public static int getRedstonePowerIndirect(World w, BlockPos pos, EnumFacing facing) {
IBlockState bs = w.getBlockState(pos);
Block block = bs.getBlock();
if (block instanceof BlockAir) {
return 0;
}
return block.shouldCheckWeakPower(bs, w, pos, facing) ? getNeighbourPower_NoChunkLoad(w, pos, facing.getOpposite()) : bs.getWeakPower(w, pos, facing);
}
use of net.minecraft.block.BlockAir in project Trains-In-Motion-1.7.10 by EternalBlueFlame.
the class EntityBogie method minecartMove.
/**
* <h2> movement management</h2>
* this is modified movement from the super class, should be more efficient, and reliable, but generally does the same thing, minus ability to collide.
* @see EntityMinecart#onUpdate()
* Some features are replaced using our own for compatibility with ZoraNoDensha
* @see RailUtility
*/
public void minecartMove(float yaw, float pitch, boolean brake, boolean isRunning, boolean isTrain) {
//define the yaw from the super
this.setRotation(yaw, pitch);
//client only, update position
if (this.worldObj.isRemote) {
if (motionProgress > 0) {
this.posX += (prevPosX - this.posX) / motionProgress;
this.posY += (((prevPosY - this.posY) + yOffset) / motionProgress);
this.posZ += (prevPosZ - this.posZ) / motionProgress;
--motionProgress;
}
} else //server only
{
//update old position, add the gravity, and get the block below this,
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
int floorX = MathHelper.floor_double(this.posX);
int floorY = MathHelper.floor_double(this.posY);
int floorZ = MathHelper.floor_double(this.posZ);
//compensate for y offsets based on current position, just in case the movement is too steep.
if (!BlockRailBase.func_150049_b_(this.worldObj, floorX, floorY, floorZ)) {
if (BlockRailBase.func_150049_b_(this.worldObj, floorX, floorY - 1, floorZ)) {
--floorY;
} else if (worldObj.getBlock(floorX, floorY, floorZ) instanceof BlockAir && worldObj.getBlock(floorX, floorY - 1, floorZ) instanceof BlockAir && posY > -64) {
posY -= 0.1D;
}
}
//apply brake
if (brake) {
if (motionX < 0.1 && motionX > -0.1) {
motionX = 0;
this.cartVelocityX = 0;
} else {
this.motionX *= 0.75;
this.cartVelocityX *= 0.75;
}
if (motionZ < 0.1 && motionZ > -0.1) {
motionZ = 0;
this.cartVelocityZ = 0;
} else {
this.motionZ *= 0.75;
this.cartVelocityZ *= 0.75;
}
} else if (isRunning && !isTrain) {
if (motionX < 0.05 && motionX > -0.05) {
motionX = 0;
this.cartVelocityX = 0;
} else {
this.motionX *= 0.75;
this.cartVelocityX *= 0.75;
}
if (motionZ < 0.05 && motionZ > -0.05) {
motionZ = 0;
this.cartVelocityZ = 0;
} else {
this.motionZ *= 0.75;
this.cartVelocityZ *= 0.75;
}
}
//update on normal rails
if (worldObj.getBlock(floorX, floorY, floorZ) instanceof BlockRailBase) {
Block block = this.worldObj.getBlock(floorX, floorY, floorZ);
moveBogie(this.motionX, this.motionZ, floorX, floorY, floorZ, block);
this.fallDistance = 0.0F;
if (block == Blocks.activator_rail) {
this.onActivatorRailPass(floorX, floorY, floorZ, (worldObj.getBlockMetadata(floorX, floorY, floorZ) & 8) != 0);
}
//update on ZnD rails, and ones that don't extend block rail base.
} else {
super.onUpdate();
}
}
}
use of net.minecraft.block.BlockAir in project RFToolsDimensions by McJty.
the class GenericWorldGenerator method createModularStorage.
private void createModularStorage(Random random, World world, BlockPos pos) {
Block storageBlock = ForgeRegistries.BLOCKS.getValue(new ResourceLocation("rftools", "modular_storage"));
if (storageBlock instanceof BlockAir)
return;
ItemStack module = new ItemStack(ForgeRegistries.ITEMS.getValue(new ResourceLocation("rftools", "storage_module")));
world.setBlockState(pos, storageBlock.getDefaultState().withProperty(BaseBlock.FACING, EnumFacing.HORIZONTALS[random.nextInt(EnumFacing.HORIZONTALS.length)]), 18);
TileEntity te = world.getTileEntity(pos);
if (te instanceof ModularStorageTileEntity) {
ModularStorageTileEntity storage = (ModularStorageTileEntity) te;
storage.setInventorySlotContents(ModularStorageContainer.SLOT_STORAGE_MODULE, module);
for (int i = 0; i < 5 + random.nextInt(10); i++) {
storage.setInventorySlotContents(i + ModularStorageContainer.SLOT_STORAGE, randomLoot(random));
}
}
}
use of net.minecraft.block.BlockAir in project MorePlanets by SteveKunG.
the class EntityKoentusMeteor method onImpact.
private void onImpact(RayTraceResult result) {
if (!this.world.isRemote) {
if (result != null) {
BlockPos pos = result.getBlockPos();
if (pos == null) {
if (result.entityHit != null) {
pos = this.world.getTopSolidOrLiquidBlock(result.entityHit.getPosition());
} else {
pos = this.world.getTopSolidOrLiquidBlock(this.getPosition());
}
}
BlockPos above = pos.up();
if (this.world.getBlockState(above).getBlock() instanceof BlockAir) {
this.world.setBlockState(above, MPBlocks.FALLEN_KOENTUS_METEOR.getDefaultState(), 3);
}
if (result.entityHit != null) {
result.entityHit.attackEntityFrom(this.causeMeteorDamage(this, this.shootingEntity), ConfigManagerCore.hardMode ? 12.0F : 6.0F);
}
}
this.world.playEvent(2001, this.getPosition(), Block.getStateId(MPBlocks.FALLEN_KOENTUS_METEOR.getDefaultState()));
this.world.newExplosion(this, this.posX, this.posY, this.posZ, this.size / 3 + 2, false, true);
}
this.setDead();
}
use of net.minecraft.block.BlockAir in project Fracture by HellFirePvP.
the class TranslucentFissureFX method batchRender.
private static void batchRender(float pTicks, Map<BlockPos, Tuple<FissureData, FissureData>> fissures, IBlockAccess iba) {
BlockRendererDispatcher brd = Minecraft.getMinecraft().getBlockRendererDispatcher();
batchDList = GLAllocation.generateDisplayLists(1);
GlStateManager.enableBlend();
Blending.OVERLAYDARK.applyStateManager();
Blending.OVERLAYDARK.apply();
GlStateManager.glNewList(batchDList, GL11.GL_COMPILE);
Tessellator tes = Tessellator.getInstance();
BufferBuilder vb = tes.getBuffer();
vb.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
// Overlap....
List<BlockPos> rendered = new ArrayList<>();
for (Map.Entry<BlockPos, Tuple<FissureData, FissureData>> fissureData : fissures.entrySet()) {
FissureData limiter = fissureData.getValue().getSecond();
for (BlockPos offset : BlockPos.getAllInBox(limiter.getMin().add(fissureData.getKey()), limiter.getMax().add(fissureData.getKey()))) {
if (offset.equals(fissureData.getKey()))
continue;
IBlockState real = Minecraft.getMinecraft().world.getBlockState(offset);
IBlockState state = iba.getBlockState(offset);
if (real.getBlock() instanceof BlockAir) {
rendered.add(offset);
} else if ((state.getBlock() instanceof BlockAir) && !rendered.contains(offset)) {
rendered.add(offset);
try {
brd.renderBlock(real, offset, Minecraft.getMinecraft().world, vb);
} catch (Exception ignored) {
}
}
}
}
vb.sortVertexData((float) TileEntityRendererDispatcher.staticPlayerX, (float) TileEntityRendererDispatcher.staticPlayerY, (float) TileEntityRendererDispatcher.staticPlayerZ);
tes.draw();
GlStateManager.glEndList();
Blending.DEFAULT.applyStateManager();
Blending.DEFAULT.apply();
GlStateManager.color(1F, 1F, 1F, 1F);
GL11.glColor4f(1F, 1F, 1F, 1F);
}
Aggregations