use of net.minecraft.block.BlockLiquid in project Gaia-Dimension by Andromander.
the class GDLiquidBismuth method mixFluids.
@Override
public void mixFluids(World world, BlockPos pos) {
for (EnumFacing side : EnumFacing.VALUES) {
if (side != EnumFacing.DOWN) {
IBlockState offset = world.getBlockState(pos.offset(side));
if (offset.getMaterial().isLiquid()) {
if (offset.getBlock() == GDBlocks.sweet_muck_block || offset.getBlock() == GDBlocks.superhot_magma_block) {
world.setBlockState(pos, GDBlocks.active_rock.getDefaultState());
this.playSound(world, pos);
break;
} else if (offset.getBlock() instanceof BlockFluidBase || offset.getBlock() instanceof BlockLiquid) {
if (offset.getMaterial() == Material.WATER) {
world.setBlockState(pos, GDBlocks.impure_rock.getDefaultState());
this.playSound(world, pos);
break;
}
}
}
}
}
}
use of net.minecraft.block.BlockLiquid in project Wurst-MC-1.12 by Wurst-Imperium.
the class GlideMod method onUpdate.
@Override
public void onUpdate() {
EntityPlayerSP player = WMinecraft.getPlayer();
if (!player.isAirBorne || player.isInWater() || player.isInLava() || player.isOnLadder() || player.motionY >= 0)
return;
if (minHeight.getValue() > 0) {
AxisAlignedBB box = player.getEntityBoundingBox();
box = box.expand(0, -minHeight.getValue(), 0);
if (WWorld.collidesWithAnyBlock(box))
return;
BlockPos min = new BlockPos(new Vec3d(box.minX, box.minY, box.minZ));
BlockPos max = new BlockPos(new Vec3d(box.maxX, box.maxY, box.maxZ));
Stream<BlockPos> stream = StreamSupport.stream(BlockPos.getAllInBox(min, max).spliterator(), true);
// manual collision check, since liquids don't have bounding boxes
if (stream.map(WBlock::getBlock).anyMatch(b -> b instanceof BlockLiquid))
return;
}
player.motionY = Math.max(player.motionY, -fallSpeed.getValue());
player.jumpMovementFactor *= moveSpeed.getValueF();
}
use of net.minecraft.block.BlockLiquid in project RFTools by McJty.
the class SensorTileEntity method checkFluid.
private boolean checkFluid(BlockPos newpos) {
IBlockState state = getWorld().getBlockState(newpos);
ItemStack matcher = inventoryHelper.getStackInSlot(0);
Block block = state.getBlock();
if (matcher.isEmpty()) {
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
return !block.isAir(state, getWorld(), newpos);
}
return false;
}
ItemStack stack = block.getItem(getWorld(), newpos, state);
Item matcherItem = matcher.getItem();
FluidStack matcherFluidStack = null;
// }
if (matcherItem instanceof ItemBucket || matcherItem instanceof UniversalBucket) {
matcherFluidStack = new FluidBucketWrapper(matcher).getFluid();
return checkFluid(block, matcherFluidStack, state, newpos);
}
return false;
}
use of net.minecraft.block.BlockLiquid in project RFTools by McJty.
the class ScannerTileEntity method mapState.
private IBlockState mapState(List<ModifierEntry> modifiers, Map<IBlockState, IBlockState> modifierMapping, BlockPos pos, IBlockState inState) {
if (modifiers.isEmpty()) {
return inState;
}
if (!modifierMapping.containsKey(inState)) {
IBlockState outState = inState;
boolean stop = false;
for (ModifierEntry modifier : modifiers) {
if (stop) {
break;
}
switch(modifier.getType()) {
case FILTER_SLOT:
{
ItemStack inputItem = inState.getBlock().getItem(getWorld(), pos, inState);
if (!modifier.getIn().isEmpty() && modifier.getIn().getItem() == ModularStorageSetup.storageFilterItem) {
StorageFilterCache filter = StorageFilterItem.getCache(modifier.getIn());
if (filter.match(inputItem)) {
outState = getOutput(inState, modifier);
stop = true;
}
} else {
// Empty input stack in modifier also matches
if (modifier.getIn().isEmpty() || ItemStack.areItemsEqual(inputItem, modifier.getIn())) {
outState = getOutput(inState, modifier);
stop = true;
}
}
break;
}
case FILTER_ORE:
{
ItemStack inputItem = inState.getBlock().getItem(getWorld(), pos, inState);
if (!inputItem.isEmpty()) {
int[] oreIDs = OreDictionary.getOreIDs(inputItem);
for (int id : oreIDs) {
if (OreDictionary.getOreName(id).startsWith("ore")) {
outState = getOutput(inState, modifier);
stop = true;
break;
}
}
}
break;
}
case FILTER_LIQUID:
if (inState.getBlock() instanceof BlockLiquid) {
outState = getOutput(inState, modifier);
stop = true;
}
break;
case FILTER_TILEENTITY:
if (getWorld().getTileEntity(pos) != null) {
outState = getOutput(inState, modifier);
stop = true;
}
break;
}
}
modifierMapping.put(inState, outState);
}
return modifierMapping.get(inState);
}
use of net.minecraft.block.BlockLiquid in project Galacticraft by micdoodle8.
the class EntityBacterialDripFX method onUpdate.
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.particleRed = 0.0F;
this.particleGreen = 0.2F;
this.particleBlue = 0.1F;
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.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (this.particleMaxAge-- <= 0) {
this.setDead();
}
if (this.onGround) {
this.setDead();
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos pos = new BlockPos(this);
IBlockState state = this.worldObj.getBlockState(pos);
Material material = state.getBlock().getMaterial();
if (material.isLiquid() || material.isSolid()) {
double d0 = 0.0D;
if (state.getBlock() instanceof BlockLiquid) {
d0 = BlockLiquid.getLiquidHeightPercent(((Integer) state.getValue(BlockLiquid.LEVEL)).intValue());
}
double d1 = MathHelper.floor_double(this.posY) + 1 - d0;
if (this.posY < d1) {
this.setDead();
}
}
}
Aggregations