本文整理汇总了Java中net.minecraft.block.Block.setBlockBoundsBasedOnState方法的典型用法代码示例。如果您正苦于以下问题:Java Block.setBlockBoundsBasedOnState方法的具体用法?Java Block.setBlockBoundsBasedOnState怎么用?Java Block.setBlockBoundsBasedOnState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.block.Block
的用法示例。
在下文中一共展示了Block.setBlockBoundsBasedOnState方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spawnBonemealParticles
import net.minecraft.block.Block; //导入方法依赖的package包/类
public static void spawnBonemealParticles(World worldIn, BlockPos pos, int amount)
{
if (amount == 0)
{
amount = 15;
}
Block block = worldIn.getBlockState(pos).getBlock();
if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(worldIn, pos);
for (int i = 0; i < amount; ++i)
{
double d0 = itemRand.nextGaussian() * 0.02D;
double d1 = itemRand.nextGaussian() * 0.02D;
double d2 = itemRand.nextGaussian() * 0.02D;
worldIn.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, (double)((float)pos.getX() + itemRand.nextFloat()), (double)pos.getY() + (double)itemRand.nextFloat() * block.getBlockBoundsMaxY(), (double)((float)pos.getZ() + itemRand.nextFloat()), d0, d1, d2, new int[0]);
}
}
}
示例2: drawSelectionBox
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Draws the selection box for the player. Args: entityPlayer, rayTraceHit, i, itemStack, partialTickTime
*/
public void drawSelectionBox(EntityPlayer player, MovingObjectPosition movingObjectPositionIn, int p_72731_3_, float partialTicks)
{
if (p_72731_3_ == 0 && movingObjectPositionIn.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F);
GL11.glLineWidth(2.0F);
GlStateManager.disableTexture2D();
GlStateManager.depthMask(false);
float f = 0.002F;
BlockPos blockpos = movingObjectPositionIn.getBlockPos();
Block block = this.theWorld.getBlockState(blockpos).getBlock();
if (block.getMaterial() != Material.air && this.theWorld.getWorldBorder().contains(blockpos))
{
block.setBlockBoundsBasedOnState(this.theWorld, blockpos);
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
func_181561_a(block.getSelectedBoundingBox(this.theWorld, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2));
}
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
}
示例3: onUpdate
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.motionY -= (double)this.particleGravity;
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)
{
if (Math.random() < 0.5D)
{
this.setDead();
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
BlockPos blockpos = new BlockPos(this);
IBlockState iblockstate = this.worldObj.getBlockState(blockpos);
Block block = iblockstate.getBlock();
block.setBlockBoundsBasedOnState(this.worldObj, blockpos);
Material material = iblockstate.getBlock().getMaterial();
if (material.isLiquid() || material.isSolid())
{
double d0 = 0.0D;
if (iblockstate.getBlock() instanceof BlockLiquid)
{
d0 = (double)(1.0F - BlockLiquid.getLiquidHeightPercent(((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue()));
}
else
{
d0 = block.getBlockBoundsMaxY();
}
double d1 = (double)MathHelper.floor_double(this.posY) + d0;
if (this.posY < d1)
{
this.setDead();
}
}
}
示例4: addRainParticles
import net.minecraft.block.Block; //导入方法依赖的package包/类
private void addRainParticles()
{
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!this.mc.gameSettings.fancyGraphics)
{
f /= 2.0F;
}
if (f != 0.0F)
{
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
World world = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
int i = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int j = 0;
int k = (int)(100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1)
{
k >>= 1;
}
else if (this.mc.gameSettings.particleSetting == 2)
{
k = 0;
}
for (int l = 0; l < k; ++l)
{
BlockPos blockpos1 = world.getPrecipitationHeight(blockpos.add(this.random.nextInt(i) - this.random.nextInt(i), 0, this.random.nextInt(i) - this.random.nextInt(i)));
BiomeGenBase biomegenbase = world.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = world.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + i && blockpos1.getY() >= blockpos.getY() - i && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
{
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava)
{
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
else if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(world, blockpos2);
++j;
if (this.random.nextInt(j) == 0)
{
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (j > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
{
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && world.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
}
else
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}
示例5: renderModel
import net.minecraft.block.Block; //导入方法依赖的package包/类
public boolean renderModel(IBlockAccess blockAccessIn, IBakedModel modelIn, IBlockState blockStateIn, BlockPos blockPosIn, WorldRenderer worldRendererIn)
{
Block block = blockStateIn.getBlock();
block.setBlockBoundsBasedOnState(blockAccessIn, blockPosIn);
return this.renderModel(blockAccessIn, modelIn, blockStateIn, blockPosIn, worldRendererIn, true);
}
示例6: addRainParticles
import net.minecraft.block.Block; //导入方法依赖的package包/类
private void addRainParticles()
{
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!Config.isRainFancy())
{
f /= 2.0F;
}
if (f != 0.0F && Config.isRainSplash())
{
this.random.setSeed((long)this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int)(100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1)
{
j >>= 1;
}
else if (this.mc.gameSettings.particleSetting == 2)
{
j = 0;
}
for (int k = 0; k < j; ++k)
{
BlockPos blockpos1 = worldclient.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0, this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0 && biomegenbase.canSpawnLightningBolt() && biomegenbase.getFloatTemperature(blockpos1) >= 0.15F)
{
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava)
{
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double)blockpos1.getX() + d3, (double)((float)blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(), (double)blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
else if (block.getMaterial() != Material.air)
{
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0)
{
d0 = (double)blockpos2.getX() + d3;
d1 = (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double)blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double)blockpos2.getX() + d3, (double)((float)blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(), (double)blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++)
{
this.rainSoundCounter = 0;
if (d1 > (double)(blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos).getY() > MathHelper.floor_float((float)blockpos.getY()))
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
}
else
{
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}
示例7: drawSelectionBox
import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
* Draws the selection box for the player. Args: entityPlayer, rayTraceHit, i, itemStack, partialTickTime
*/
public void drawSelectionBox(EntityPlayer player, MovingObjectPosition movingObjectPositionIn, int p_72731_3_, float partialTicks)
{
if (p_72731_3_ == 0 && movingObjectPositionIn.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
{
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.color(0.0F, 0.0F, 0.0F, 0.4F);
GL11.glLineWidth(2.0F);
GlStateManager.disableTexture2D();
if (Config.isShaders())
{
Shaders.disableTexture2D();
}
GlStateManager.depthMask(false);
float f = 0.002F;
BlockPos blockpos = movingObjectPositionIn.getBlockPos();
Block block = this.theWorld.getBlockState(blockpos).getBlock();
if (block.getMaterial() != Material.air && this.theWorld.getWorldBorder().contains(blockpos))
{
block.setBlockBoundsBasedOnState(this.theWorld, blockpos);
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
func_181561_a(block.getSelectedBoundingBox(this.theWorld, blockpos).expand(0.0020000000949949026D, 0.0020000000949949026D, 0.0020000000949949026D).offset(-d0, -d1, -d2));
}
GlStateManager.depthMask(true);
GlStateManager.enableTexture2D();
if (Config.isShaders())
{
Shaders.enableTexture2D();
}
GlStateManager.disableBlend();
}
}
示例8: addRainParticles
import net.minecraft.block.Block; //导入方法依赖的package包/类
private void addRainParticles() {
float f = this.mc.theWorld.getRainStrength(1.0F);
if (!Config.isRainFancy()) {
f /= 2.0F;
}
if (f != 0.0F && Config.isRainSplash()) {
this.random.setSeed((long) this.rendererUpdateCount * 312987231L);
Entity entity = this.mc.getRenderViewEntity();
WorldClient worldclient = this.mc.theWorld;
BlockPos blockpos = new BlockPos(entity);
byte b0 = 10;
double d0 = 0.0D;
double d1 = 0.0D;
double d2 = 0.0D;
int i = 0;
int j = (int) (100.0F * f * f);
if (this.mc.gameSettings.particleSetting == 1) {
j >>= 1;
} else if (this.mc.gameSettings.particleSetting == 2) {
j = 0;
}
for (int k = 0; k < j; ++k) {
BlockPos blockpos1 = worldclient
.getPrecipitationHeight(blockpos.add(this.random.nextInt(b0) - this.random.nextInt(b0), 0,
this.random.nextInt(b0) - this.random.nextInt(b0)));
BiomeGenBase biomegenbase = worldclient.getBiomeGenForCoords(blockpos1);
BlockPos blockpos2 = blockpos1.down();
Block block = worldclient.getBlockState(blockpos2).getBlock();
if (blockpos1.getY() <= blockpos.getY() + b0 && blockpos1.getY() >= blockpos.getY() - b0
&& biomegenbase.canSpawnLightningBolt()
&& biomegenbase.getFloatTemperature(blockpos1) >= 0.15F) {
double d3 = this.random.nextDouble();
double d4 = this.random.nextDouble();
if (block.getMaterial() == Material.lava) {
this.mc.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, (double) blockpos1.getX() + d3,
(double) ((float) blockpos1.getY() + 0.1F) - block.getBlockBoundsMinY(),
(double) blockpos1.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
} else if (block.getMaterial() != Material.air) {
block.setBlockBoundsBasedOnState(worldclient, blockpos2);
++i;
if (this.random.nextInt(i) == 0) {
d0 = (double) blockpos2.getX() + d3;
d1 = (double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY() - 1.0D;
d2 = (double) blockpos2.getZ() + d4;
}
this.mc.theWorld.spawnParticle(EnumParticleTypes.WATER_DROP, (double) blockpos2.getX() + d3,
(double) ((float) blockpos2.getY() + 0.1F) + block.getBlockBoundsMaxY(),
(double) blockpos2.getZ() + d4, 0.0D, 0.0D, 0.0D, new int[0]);
}
}
}
if (i > 0 && this.random.nextInt(3) < this.rainSoundCounter++) {
this.rainSoundCounter = 0;
if (d1 > (double) (blockpos.getY() + 1) && worldclient.getPrecipitationHeight(blockpos)
.getY() > MathHelper.floor_float((float) blockpos.getY())) {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.1F, 0.5F, false);
} else {
this.mc.theWorld.playSound(d0, d1, d2, "ambient.weather.rain", 0.2F, 1.0F, false);
}
}
}
}