本文整理汇总了Java中net.minecraft.world.World.newExplosion方法的典型用法代码示例。如果您正苦于以下问题:Java World.newExplosion方法的具体用法?Java World.newExplosion怎么用?Java World.newExplosion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.newExplosion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performEffect
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void performEffect(RayTraceResult rtrace, EntityLivingBase caster, World world) {
world.newExplosion(caster, rtrace.hitVec.x, rtrace.hitVec.y + 0.5, rtrace.hitVec.z, 0.3f, false, true);
}
示例2: onBlockActivated
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
{
pos = pos.offset((EnumFacing)state.getValue(FACING));
state = worldIn.getBlockState(pos);
if (state.getBlock() != this)
{
return true;
}
}
if (worldIn.provider.canRespawnHere() && worldIn.getBiomeGenForCoords(pos) != BiomeGenBase.hell)
{
if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
{
EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);
if (entityplayer != null)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0]));
return true;
}
state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
worldIn.setBlockState(pos, state, 4);
}
EntityPlayer.EnumStatus entityplayer$enumstatus = playerIn.trySleep(pos);
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.OK)
{
state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
worldIn.setBlockState(pos, state, 4);
return true;
}
else
{
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0]));
}
else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE)
{
playerIn.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
}
return true;
}
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
if (worldIn.getBlockState(blockpos).getBlock() == this)
{
worldIn.setBlockToAir(blockpos);
}
worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
return true;
}
}
}
示例3: vaporize
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void vaporize(EntityPlayer player, World worldIn, BlockPos pos, FluidStack fluidStack) {
worldIn.newExplosion(player, pos.getX(), pos.getY(), pos.getZ(), 1, true, true);
}
示例4: onBlockActivated
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
if (worldIn.isRemote)
{
return true;
}
else
{
if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
{
pos = pos.offset((EnumFacing)state.getValue(FACING));
state = worldIn.getBlockState(pos);
if (state.getBlock() != this)
{
return true;
}
}
if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL)
{
if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
{
EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);
if (entityplayer != null)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]), true);
return true;
}
state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
worldIn.setBlockState(pos, state, 4);
}
EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);
if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK)
{
state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
worldIn.setBlockState(pos, state, 4);
return true;
}
else
{
if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]), true);
}
else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]), true);
}
else if (entityplayer$sleepresult == EntityPlayer.SleepResult.TOO_FAR_AWAY)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.tooFarAway", new Object[0]), true);
}
return true;
}
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
if (worldIn.getBlockState(blockpos).getBlock() == this)
{
worldIn.setBlockToAir(blockpos);
}
worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
return true;
}
}
}
示例5: onBlockActivated
import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (worldIn.isRemote)
{
return true;
}
else
{
if (state.getValue(PART) != BlockBed.EnumPartType.HEAD)
{
pos = pos.offset((EnumFacing)state.getValue(FACING));
state = worldIn.getBlockState(pos);
if (state.getBlock() != this)
{
return true;
}
}
if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL)
{
if (((Boolean)state.getValue(OCCUPIED)).booleanValue())
{
EntityPlayer entityplayer = this.getPlayerInBed(worldIn, pos);
if (entityplayer != null)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]));
return true;
}
state = state.withProperty(OCCUPIED, Boolean.valueOf(false));
worldIn.setBlockState(pos, state, 4);
}
EntityPlayer.SleepResult entityplayer$sleepresult = playerIn.trySleep(pos);
if (entityplayer$sleepresult == EntityPlayer.SleepResult.OK)
{
state = state.withProperty(OCCUPIED, Boolean.valueOf(true));
worldIn.setBlockState(pos, state, 4);
return true;
}
else
{
if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]));
}
else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE)
{
playerIn.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]));
}
return true;
}
}
else
{
worldIn.setBlockToAir(pos);
BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());
if (worldIn.getBlockState(blockpos).getBlock() == this)
{
worldIn.setBlockToAir(blockpos);
}
worldIn.newExplosion((Entity)null, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, 5.0F, true, true);
return true;
}
}
}