Java Code Examples for net.minecraft.world.World#newExplosion()
The following examples show how to use
net.minecraft.world.World#newExplosion() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ComponentExplosive.java From Artifacts with MIT License | 5 votes |
@Override public boolean onBlockDestroyed(ItemStack par1ItemStack, World world, Block block, int x, int y, int z, EntityLivingBase par7EntityLivingBase) { Block i = world.getBlock(x, y, z); int m = world.getBlockMetadata(x, y, z); i.dropBlockAsItem(world, x, y, z, m, 0); world.setBlockToAir(x, y, z); world.newExplosion(par7EntityLivingBase, x, y, z, 3F, false, true); par1ItemStack.damageItem(3, par7EntityLivingBase); return false; }
Example 2
Source File: BlockFuton.java From Sakura_mod with MIT License | 4 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } if (state.getValue(PART) != EnumPartType.HEAD) { pos = pos.offset(state.getValue(FACING)); state = worldIn.getBlockState(pos); if (state.getBlock() != this) { return true; } } if (worldIn.provider.canRespawnHere() && worldIn.getBiome(pos) != Biomes.HELL) { if (state.getValue(OCCUPIED).booleanValue()) { EntityPlayer entityplayer = this.getPlayerInBlanket(worldIn, pos); if (entityplayer != null) { playerIn.sendMessage(new TextComponentTranslation("tile.bed.occupied")); 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; } if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_POSSIBLE_NOW) { playerIn.sendMessage(new TextComponentTranslation("tile.bed.noSleep")); } else if (entityplayer$sleepresult == EntityPlayer.SleepResult.NOT_SAFE) { playerIn.sendMessage(new TextComponentTranslation("tile.bed.notSafe")); } return true; } worldIn.setBlockToAir(pos); BlockPos blockpos = pos.offset(state.getValue(FACING).getOpposite()); if (worldIn.getBlockState(blockpos).getBlock() == this) { worldIn.setBlockToAir(blockpos); } worldIn.newExplosion(null, pos.getX() + 0.5D, pos.getY() + 0.5D, pos.getZ() + 0.5D, 5.0F, true, true); return true; }
Example 3
Source File: BlockSurgeryTable.java From Cyberware with MIT License | 4 votes |
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.getBiomeGenForCoords(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; } } }