use of net.minecraft.block.BlockLiquid in project Railcraft by Railcraft.
the class FluidTools method drainVanillaFluid.
@Nullable
private static FluidStack drainVanillaFluid(IBlockState state, World world, BlockPos pos, boolean doDrain, Fluids fluid, Block... blocks) {
boolean matches = false;
for (Block block : blocks) {
if (state.getBlock() == block)
matches = true;
}
if (!matches)
return null;
if (!(state.getBlock() instanceof BlockLiquid))
return null;
int level = state.getValue(BlockLiquid.LEVEL);
if (level != 0)
return null;
if (doDrain)
WorldPlugin.isBlockAir(world, pos);
return fluid.getBucket();
}
use of net.minecraft.block.BlockLiquid in project Railcraft by Railcraft.
the class ParticleDrip method onUpdate.
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = posX;
this.prevPosY = posY;
this.prevPosZ = posZ;
this.motionY -= (double) particleGravity;
if (bobTimer > 0) {
this.motionX *= 0.02D;
this.motionY *= 0.02D;
this.motionZ *= 0.02D;
setParticleTextureIndex(113);
} else
setParticleTextureIndex(112);
this.bobTimer--;
move(motionX, motionY, motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (particleMaxAge <= 0)
setExpired();
this.particleMaxAge--;
if (onGround) {
setParticleTextureIndex(114);
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos pos = new BlockPos(posX, posY, posZ);
IBlockState blockState = world.getBlockState(pos);
Material material = blockState.getMaterial();
if (material.isLiquid() || material.isSolid()) {
double filledPercent = 0.0D;
if (blockState.getBlock() instanceof BlockLiquid) {
filledPercent = (double) BlockLiquid.getLiquidHeightPercent(blockState.getValue(BlockLiquid.LEVEL));
}
double surfaceY = (double) (MathHelper.floor(posY) + 1) - filledPercent;
if (posY < surfaceY) {
setExpired();
}
}
}
use of net.minecraft.block.BlockLiquid in project ImmersiveEngineering by BluSunrize.
the class ParticleFluidSplash method onUpdate.
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double) this.particleGravity;
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) {
if (Math.random() < 0.5D)
this.setExpired();
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;
if (iblockstate.getBlock() instanceof BlockLiquid)
d0 = (double) (1.0F - BlockLiquid.getLiquidHeightPercent(iblockstate.getValue(BlockLiquid.LEVEL).intValue()));
else
d0 = iblockstate.getBoundingBox(this.world, blockpos).maxY;
double d1 = (double) MathHelper.floor(this.posY) + d0;
if (this.posY < d1)
this.setExpired();
}
}
use of net.minecraft.block.BlockLiquid in project Engine by VoltzEngine-Project.
the class FluidUtility method isFillableBlock.
/**
* Checks to see if a non-fluid block is able to be filled with fluid
*/
public static boolean isFillableBlock(World world, Pos node) {
if (world == null || node == null) {
return false;
}
Block block = node.getBlock(world);
int meta = node.getBlockMetadata(world);
if (drainBlock(world, node, false) != null) {
return false;
} else if (block.isAir(world, node.xi(), node.yi(), node.zi())) {
return true;
} else if (!(block instanceof IFluidBlock || block instanceof BlockLiquid) && block.isReplaceable(world, node.xi(), node.yi(), node.zi()) || replacableBlockMeta.contains(new Pair(block, meta)) || replacableBlocks.contains(block)) {
return true;
}
return false;
}
use of net.minecraft.block.BlockLiquid in project RFToolsDimensions by McJty.
the class DimletDebug method dumpBlock.
private static void dumpBlock(Block block) {
if (block instanceof BlockLiquid) {
return;
}
Set<Filter.Feature> features = KnownDimletConfiguration.getBlockFeatures(block);
String mod = Block.blockRegistry.getNameForObject(block).getResourceDomain();
for (IBlockState state : block.getBlockState().getValidStates()) {
int meta = state.getBlock().getMetaFromState(state);
List<IProperty> propertyNames = new ArrayList<>(state.getPropertyNames());
propertyNames.sort((o1, o2) -> o1.getName().compareTo(o2.getName()));
ImmutableMap<IProperty, Comparable> properties = state.getProperties();
Map<String, String> props = new HashMap<>();
for (Map.Entry<IProperty, Comparable> entry : properties.entrySet()) {
props.put(entry.getKey().getName(), entry.getValue().toString());
}
DimletKey key = new DimletKey(DimletType.DIMLET_MATERIAL, block.getRegistryName() + "@" + meta);
Settings settings = DimletRules.getSettings(key, mod, features, props);
Logging.log(key + " (" + state.toString() + "): " + settings.toString());
}
}
Aggregations