use of net.minecraft.block.BlockLiquid in project BuildCraft by BuildCraft.
the class TileQuarry method createColumnVisitList.
/**
* Make the column visit list: called once per layer
*/
private void createColumnVisitList() {
visitList.clear();
boolean[][] blockedColumns = new boolean[builder.blueprint.size.getX() - 2][builder.blueprint.size.getZ() - 2];
for (int searchY = pos.getY() + 3; searchY >= 1; --searchY) {
int startX, endX, incX;
if (searchY % 2 == 0) {
startX = 0;
endX = builder.blueprint.size.getX() - 2;
incX = 1;
} else {
startX = builder.blueprint.size.getX() - 3;
endX = -1;
incX = -1;
}
for (int searchX = startX; searchX != endX; searchX += incX) {
int startZ, endZ, incZ;
if (searchX % 2 == searchY % 2) {
startZ = 0;
endZ = builder.blueprint.size.getZ() - 2;
incZ = 1;
} else {
startZ = builder.blueprint.size.getZ() - 3;
endZ = -1;
incZ = -1;
}
for (int searchZ = startZ; searchZ != endZ; searchZ += incZ) {
if (!blockedColumns[searchX][searchZ]) {
int bx = box.min().getX() + searchX + 1;
int by = searchY;
int bz = box.min().getZ() + searchZ + 1;
BlockPos pos = new BlockPos(bx, by, bz);
IBlockState state = worldObj.getBlockState(pos);
Block block = state.getBlock();
if (!BlockUtil.canChangeBlock(state, worldObj, pos)) {
blockedColumns[searchX][searchZ] = true;
} else if (!BuildCraftAPI.isSoftBlock(worldObj, pos) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock)) {
visitList.add(new int[] { bx, by, bz });
}
// recompute prior to this
if (visitList.size() > builder.blueprint.size.getZ() * builder.blueprint.size.getX() * 2) {
return;
}
}
}
}
}
}
use of net.minecraft.block.BlockLiquid in project BuildCraft by BuildCraft.
the class TileQuarry method isQuarriableBlock.
private boolean isQuarriableBlock(BlockPos pos) {
IBlockState state = worldObj.getBlockState(pos);
Block block = state.getBlock();
return BlockUtil.canChangeBlock(state, worldObj, pos) && !BuildCraftAPI.isSoftBlock(worldObj, pos) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock);
}
use of net.minecraft.block.BlockLiquid in project BuildCraft by BuildCraft.
the class PipeItemsStripes method updateEntity.
@Override
public void updateEntity() {
super.updateEntity();
if (container.getWorld().isRemote) {
return;
}
if (battery.getEnergyStored() >= 10) {
EnumPipePart o = actionDir;
if (o == EnumPipePart.CENTER) {
o = EnumPipePart.fromFacing(getOpenOrientation());
}
if (o != EnumPipePart.CENTER) {
Vec3d vec = Utils.convert(container.getPos()).add(Utils.convert(o.face));
BlockPos veci = Utils.convertFloor(vec);
if (!BlockUtil.isUnbreakableBlock(getWorld(), Utils.convertFloor(vec))) {
IBlockState state = getWorld().getBlockState(Utils.convertFloor(vec));
Block block = state.getBlock();
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
return;
}
ItemStack stack = new ItemStack(block, 1, block.getMetaFromState(state));
EntityPlayer player = CoreProxy.proxy.getBuildCraftPlayer((WorldServer) getWorld(), veci).get();
if (battery.useEnergy(10, 10, false) != 10) {
return;
}
for (IStripesHandler handler : PipeManager.stripesHandlers) {
if (handler.getType() == StripesHandlerType.BLOCK_BREAK && handler.shouldHandle(stack)) {
if (handler.handle(getWorld(), veci, o.face, stack, player, this)) {
return;
}
}
}
List<ItemStack> stacks = block.getDrops(getWorld(), veci, state, 0);
if (stacks != null) {
for (ItemStack s : stacks) {
if (s != null) {
sendItem(s, o.opposite().face);
}
}
}
getWorld().setBlockToAir(veci);
}
}
return;
}
}
use of net.minecraft.block.BlockLiquid in project TUMAT by canitzp.
the class RenderOverlay method renderMiss.
private static TooltipComponent renderMiss(WorldClient world, EntityPlayerSP player, RayTraceResult trace, boolean shouldCalculate) {
TooltipComponent component = new TooltipComponent();
if (!world.isAirBlock(trace.getBlockPos())) {
IBlockState state = world.getBlockState(trace.getBlockPos());
if (state.getBlock() instanceof BlockLiquid || state.getBlock() instanceof BlockFluidBase) {
component.setName(new TextComponent(state.getBlock().getLocalizedName()));
component.setModName(new TextComponent(InfoUtil.getModName(state.getBlock())));
IconRenderer renderer;
if (bucketCache.containsKey(state.getBlock().getRegistryName())) {
component.setIconRenderer(bucketCache.get(state.getBlock().getRegistryName()));
} else {
Fluid fluid = FluidRegistry.lookupFluidForBlock(state.getBlock());
if (fluid != null) {
renderer = new IconRenderer(FluidUtil.getFilledBucket(new FluidStack(fluid, 1000)));
bucketCache.put(state.getBlock().getRegistryName(), renderer);
component.setIconRenderer(renderer);
}
}
}
for (IWorldRenderer renderer : TUMATApi.getRegisteredComponents()) {
if (renderer.shouldBeActive()) {
renderer.renderMiss(world, player, trace, component, shouldCalculate);
}
}
}
return component;
}
use of net.minecraft.block.BlockLiquid in project ForestryMC by ForestryMC.
the class ParticleColoredDripParticle method onUpdate.
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= this.particleGravity;
if (this.bobTimer-- > 0) {
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
this.setParticleTextureIndex(113);
} else {
this.setParticleTextureIndex(112);
}
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0) {
this.setExpired();
}
if (this.onGround) {
this.setParticleTextureIndex(114);
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this.posX, this.posY, this.posZ);
IBlockState iblockstate = this.world.getBlockState(blockpos);
Material material = iblockstate.getMaterial();
if (material.isLiquid() || material.isSolid()) {
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid) {
d0 = BlockLiquid.getLiquidHeightPercent(iblockstate.getValue(BlockLiquid.LEVEL));
}
double d1 = MathHelper.floor(this.posY) + 1 - d0;
if (this.posY < d1) {
this.setExpired();
}
}
}
Aggregations