本文整理汇总了Java中net.minecraft.block.BlockDynamicLiquid类的典型用法代码示例。如果您正苦于以下问题:Java BlockDynamicLiquid类的具体用法?Java BlockDynamicLiquid怎么用?Java BlockDynamicLiquid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockDynamicLiquid类属于net.minecraft.block包,在下文中一共展示了BlockDynamicLiquid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spreadWaterFromCenter
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
private boolean spreadWaterFromCenter(World world, EntityPlayer player, BlockPos posCenter) {
int count = 0;
for (BlockPos pos : UtilWorld.findBlocks(world, posCenter, Blocks.WATER, RADIUS)) {
// world.setBlockState(pos, Blocks.FLOWING_WATER.getDefaultState()); // , state.withProperty(LEVEL, 0)
//instead of just setBlockState, get the correct state for max level and for this fluid material, then schedule a tick update.
//this way, it sends correct block update and avoids 'stuck' water that doesnt flow
BlockDynamicLiquid blockdynamicliquid = BlockLiquid.getFlowingBlock(Material.WATER);
IBlockState state = blockdynamicliquid.getDefaultState();
world.setBlockState(pos, blockdynamicliquid.getDefaultState().withProperty(BlockLiquid.LEVEL, state.getValue(BlockLiquid.LEVEL)), 2);
world.scheduleUpdate(pos, blockdynamicliquid, blockdynamicliquid.tickRate(world));
UtilParticle.spawnParticle(world, EnumParticleTypes.WATER_SPLASH, pos);
UtilParticle.spawnParticle(world, EnumParticleTypes.WATER_SPLASH, pos.up());
count++;
}
boolean success = count > 0;
if (success) {//particles are on each location, sound is just once
player.getCooldownTracker().setCooldown(this, COOLDOWN);
UtilSound.playSound(player, SoundEvents.ENTITY_PLAYER_SPLASH);
}
return success;
}
示例2: handleFallingBlocks
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
private void handleFallingBlocks(World worldIn, BlockPos pos, IBlockState state)
{
if(worldIn.isRemote) return;
final BlockPos upPos = pos.up();
final IBlockState upState = worldIn.getBlockState(upPos);
final Block upBlock = upState.getBlock();
if(upBlock instanceof BlockFalling)
{
worldIn.setBlockToAir(upPos);
}
else if(upBlock == Blocks.FLOWING_WATER || upBlock == Blocks.FLOWING_LAVA)
{
if(upBlock instanceof BlockDynamicLiquid)
{
int level = upState.getValue(BlockLiquid.LEVEL);
if( level < 8)
{
worldIn.setBlockToAir(upPos);
}
}
}
}
示例3: onFlowIntoBlockFrom
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static boolean onFlowIntoBlockFrom(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int newFlowDecay, int flowDirection)
{
if (world == null)
return false;
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof IFluidFlowHandler)
{
return ((IFluidFlowHandler) tile).handleFlowIntoBlock(FluidHelper.getFluidTypeOfBlock(flowingBlock), newFlowDecay, ForgeDirection.getOrientation(flowDirection).getOpposite());
}
try
{
Wrappers.flowIntoBlock(flowingBlock, world, x, y, z, newFlowDecay);
return false;
}
catch (Exception e)
{
e.printStackTrace();
return true;
}
}
示例4: doesFlowGetBlockedBy
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static boolean doesFlowGetBlockedBy(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int flowDirection)
{
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof IFluidFlowHandler)
{
return ((IFluidFlowHandler) tile).doesFlowGetBlockedBySide(FluidHelper.getFluidTypeOfBlock(flowingBlock), ForgeDirection.getOrientation(flowDirection).getOpposite());
}
try
{
return Wrappers.doesFlowGetBlockedBy(flowingBlock, world, x, y, z);
}
catch (Exception e)
{
e.printStackTrace();
return true;
}
}
示例5: getSmallestFlowDecayTo
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static int getSmallestFlowDecayTo(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int curSmallest, int fromSide)
{
int flowDecay = Hooks.getFlowDecayTo(flowingBlock, world, x, y, z, fromSide);
if (flowDecay < 0)
{
return curSmallest;
}
else
{
if (flowDecay == 0)
{
int numAdjacentSources = ReflectionHelper.getPrivateValue(BlockDynamicLiquid.class, flowingBlock, "field_149815_a", "a");
ReflectionHelper.setPrivateValue(BlockDynamicLiquid.class, flowingBlock, numAdjacentSources+1, "field_149815_a", "a");
}
if (flowDecay >= 8)
{
flowDecay = 0;
}
return curSmallest >= 0 && flowDecay >= curSmallest ? curSmallest : flowDecay;
}
}
示例6: getEffectiveFlowDecay
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static int getEffectiveFlowDecay(BlockLiquid liquidBlock, World world, int x, int y, int z)
{
try
{
if (getEffectiveFlowDecay == null)
{
getEffectiveFlowDecay = BlockDynamicLiquid.class.getDeclaredMethod("getEffectiveFlowDecay", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
getEffectiveFlowDecay.setAccessible(true);
}
return (Integer) getEffectiveFlowDecay.invoke(liquidBlock, world, x, y, z);
}
catch (Exception e)
{
e.printStackTrace();
return -1;
}
}
示例7: canLiquidDisplaceBlock
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static boolean canLiquidDisplaceBlock(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z)
{
try
{
if (canLiquidDisplaceBlock == null)
{
canLiquidDisplaceBlock = BlockDynamicLiquid.class.getDeclaredMethod("func_149809_q", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE);
canLiquidDisplaceBlock.setAccessible(true);
}
return (Boolean) canLiquidDisplaceBlock.invoke(flowingBlock, world, x, y, z);
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
示例8: getSmallestFlowDecay
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static int getSmallestFlowDecay(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int curSmallest)
{
try
{
if (getSmallestFlowDecay == null)
{
getSmallestFlowDecay = BlockDynamicLiquid.class.getDeclaredMethod("func_149810_a", World.class, Integer.TYPE, Integer.TYPE, Integer.TYPE, Integer.TYPE);
getSmallestFlowDecay.setAccessible(true);
}
return (Integer) getSmallestFlowDecay.invoke(flowingBlock, world, x, y, z, curSmallest);
}
catch (Exception e)
{
e.printStackTrace();
return curSmallest;
}
}
示例9: isValidSpawnBlock
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static boolean isValidSpawnBlock(final BlockStateProvider provider, final BlockPos pos) {
if (provider.getBlockState(pos).getMaterial() != Material.WATER)
return false;
if (isUnboundedLiquid(provider, pos)) {
final BlockPos down = pos.down();
if (provider.getBlockState(down).getMaterial().isSolid())
return true;
return !isUnboundedLiquid(provider, down);
}
return provider.getBlockState(pos.up()).getBlock() instanceof BlockDynamicLiquid;
}
示例10: isSourceBlock
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
private boolean isSourceBlock( BlockPos coord){
IBlockState bs = getWorld().getBlockState(coord);
if(bs.getBlock() instanceof BlockLiquid){
return (Integer)bs.getValue(BlockDynamicLiquid.LEVEL) == 0;
} else if(bs.getBlock() instanceof BlockFluidClassic){
return ((BlockFluidClassic)bs.getBlock()).isSourceBlock(getWorld(), coord);
}else{
return false;
}
}
示例11: getFlowingBlock
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static BlockDynamicLiquid getFlowingBlock(Material materialIn)
{
if (materialIn == Material.WATER)
return (BlockDynamicLiquid) SCContent.bogusWaterFlowing;
else if (materialIn == Material.LAVA)
return (BlockDynamicLiquid) SCContent.bogusLavaFlowing;
else
throw new IllegalArgumentException("Invalid material");
}
示例12: getFlowingBlock
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static BlockDynamicLiquid getFlowingBlock(Material materialIn)
{
if (materialIn == Material.water)
return (BlockDynamicLiquid) SCContent.bogusWaterFlowing;
else if (materialIn == Material.lava)
return (BlockDynamicLiquid) SCContent.bogusLavaFlowing;
else
throw new IllegalArgumentException("Invalid material");
}
示例13: outputFluidFlowOnSide
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public void outputFluidFlowOnSide(FluidFlow flow, ForgeDirection side)
{
int x = xCoord + side.offsetX, y = yCoord + side.offsetY, z = zCoord + side.offsetZ;
int newFlowDecay = FluidHelper.getNextFlowDecay(flow.getFluid(), flow.getFlowDecay(), side);
if (newFlowDecay < 0)
return;
Hooks.onFlowIntoBlockFrom((BlockDynamicLiquid) FluidHelper.getFlowingFluidBlock(flow.getFluid()), worldObj, x, y, z, newFlowDecay, side.ordinal());
onFluidFlowOutOfSide(flow.getFluid(), side, flow.getFlowDecay());
}
示例14: onLiquidFlowFrom
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public void onLiquidFlowFrom(Block block, int flowDecay, ForgeDirection flowDirection)
{
// TODO: Water has no fluid for BlockDynamicFluid?
Fluid fluid = FluidRegistry.lookupFluidForBlock(block);
liquidFlows[flowDirection.ordinal()] = new LiquidFlowInfo(fluid, flowDecay);
Hooks.onFlowIntoBlockFrom((BlockDynamicLiquid) block, crate.getWorldObj(), crate.xCoord+flowDirection.offsetX, crate.yCoord+flowDirection.offsetY, crate.zCoord+flowDirection.offsetZ, flowDecay, flowDirection.ordinal());
recalculateFlowVector();
}
示例15: getFlowDecayTo
import net.minecraft.block.BlockDynamicLiquid; //导入依赖的package包/类
public static int getFlowDecayTo(BlockDynamicLiquid flowingBlock, World world, int x, int y, int z, int fromSide)
{
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null && tile instanceof IFluidFlowHandler)
{
return ((IFluidFlowHandler) tile).getFlowDecayTo(FluidHelper.getFluidTypeOfBlock(flowingBlock), ForgeDirection.getOrientation(fromSide).getOpposite());
}
return Wrappers.getFlowDecay(flowingBlock, world, x, y, z);
}