public BlockLivingSlab(boolean full, IBlockState state) { super(full, state.getMaterial(), state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Slab" + (full ? "Full" : "")); setSoundType(state.getBlock().getSoundType()); sourceState = state; }
private boolean placeBlock(ItemStack itemstack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float xOffset, float yOffset, float zOffset) { IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); if(!block.isReplaceable(world, pos)) { pos = pos.offset(side); } if(itemstack.isEmpty()) { return false; } else if(!player.canPlayerEdit(pos, side, itemstack)) { return false; } else if(world.mayPlace(Blocks.MOB_SPAWNER, pos, false, side, null)) { int meta = this.getMetadata(itemstack.getMetadata()); IBlockState iblockstate1 = Blocks.MOB_SPAWNER.getStateForPlacement(world, pos, side, xOffset, yOffset, zOffset, meta, player); if (placeBlockAt(itemstack, player, world, pos, side, xOffset, yOffset, zOffset, iblockstate1)) { world.playSound(null, pos, Blocks.MOB_SPAWNER.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (Blocks.MOB_SPAWNER.getSoundType().getVolume() + 1.0F) / 2.0F, Blocks.MOB_SPAWNER.getSoundType().getPitch() * 0.8F); player.renderBrokenItemStack(itemstack); itemstack.shrink(1); for(int i = 0; i < 100; i++) Botania.proxy.sparkleFX(pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), (float) Math.random(), (float) Math.random(), (float) Math.random(), 0.45F + 0.2F * (float) Math.random(), 6); } return true; } else { return false; } }
block1 = Blocks.FARMLAND; world.playSound(null, pos, block1.getSoundType().getStepSound(), SoundCategory.BLOCKS, (block1.getSoundType().getVolume() + 1.0F) / 2.0F, block1.getSoundType().getPitch() * 0.8F);
@SuppressWarnings("deprecation") @Override public SoundType getSoundType() { return modelBlock.getSoundType(); }
.playSound( new PositionedSoundRecord( block.getSoundType() .getBreakSound(), SoundCategory.BLOCKS, ( block.getSoundType().getVolume() + 1.0F ) / 2.0F, block.getSoundType() .getPitch() * 0.8F, (float) this.x + 0.5F, (float) this.y + 0.5F, (float) this.z + 0.5F ) );
event.getEntityPlayer().swingArm(event.getHand()); else { event.getWorld().playSound(null, event.getPos(), block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, block.getSoundType().getVolume() * 0.4F, block.getSoundType().getPitch() + (float) (Math.random() * 0.2 - 0.1));
@Nonnull @Override public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { // Copy of ItemBlock.onItemUse IBlockState iblockstate = world.getBlockState(pos); Block block = iblockstate.getBlock(); if (!block.isReplaceable(world, pos)) { pos = pos.offset(facing); } ItemStack stack = player.getHeldItem(hand); if (!stack.isEmpty() && player.canPlayerEdit(pos, facing, stack) && world.mayPlace(ModBlocks.buriedPetals, pos, false, facing, null)) { int i = this.getMetadata(stack.getMetadata()); IBlockState iblockstate1 = ModBlocks.buriedPetals.getStateForPlacement(world, pos, facing, hitX, hitY, hitZ, i, player); if (placeBlockAt(stack, player, world, pos, facing, hitX, hitY, hitZ, iblockstate1)) { SoundType soundtype = ModBlocks.buriedPetals.getSoundType(); world.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F); stack.shrink(1); } return EnumActionResult.SUCCESS; } else { return EnumActionResult.FAIL; } }
@SuppressWarnings("deprecation") @Override @Nonnull public SoundType getSoundType(@Nonnull IBlockState state, @Nonnull World world, @Nonnull BlockPos pos, @Nullable Entity entity) { IConduitBundle te = getTileEntitySafe(world, pos); if (te != null && te.hasFacade()) { return te.getPaintSourceNN().getBlock().getSoundType(); } return super.getSoundType(state, world, pos, entity); }
@SuppressWarnings("deprecation") public static void playPlaceSound(World world, BlockPos pos) { Block block = BlockCable.getInstance(); world.playSound((double) ((float) pos.getX() + 0.5F), (double) ((float) pos.getY() + 0.5F), (double) ((float) pos.getZ() + 0.5F), block.getSoundType().getPlaceSound(), SoundCategory.BLOCKS, (block.getSoundType().getVolume() + 1.0F) / 2.0F, block.getSoundType().getPitch() * 0.8F, false); }
@Override @SideOnly(Side.CLIENT) public void actionClient(World world, EntityPlayer player) { Block block = Block.getBlockById(blockID); world.playSound(x, y, z, block.getSoundType().getBreakSound(), SoundCategory.BLOCKS, 0.1F + world.rand.nextFloat() * 0.5F, 0.9F + world.rand.nextFloat() * 0.1F, false); ParticleBloodSplash.spawnParticles(world, new BlockPos((int) x, (int) y + 1, (int) z), 3 + world.rand.nextInt(2), 1 + world.rand.nextInt(2)); }
public BlockWallErebus(IBlockState state) { super(state.getMaterial()); setSoundType(state.getBlock().getSoundType()); setHardness(2.0F); this.setDefaultState(this.blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)) .withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); setCreativeTab(ModTabs.BLOCKS); baseBlockState = state; }
final SoundType ss = multiPartBlock.getSoundType( state, world, pos, player );
public BlockWoodFence(IBlockState state) { super(state.getMaterial(), state.getMaterial().getMaterialMapColor()); setSoundType(state.getBlock().getSoundType()); setHardness(2.0F); setDefaultState(this.blockState.getBaseState().withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); setCreativeTab(ModTabs.BLOCKS); }
public BlockWoodFenceGate(IBlockState state) { super(state.getMaterial(), state.getMaterial().getMaterialMapColor()); setSoundType(state.getBlock().getSoundType()); setHardness(2.0F); this.setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false))); this.setCreativeTab(ModTabs.BLOCKS); }
public BlockQuarkWall(String name, IBlockState state) { super(name, state.getMaterial()); setHardness(state.getBlockHardness(null, new BlockPos(0, 0, 0))); setResistance(state.getBlock().getExplosionResistance(null) * 5F / 3F); setSoundType(state.getBlock().getSoundType()); setDefaultState(blockState.getBaseState().withProperty(UP, Boolean.valueOf(false)).withProperty(NORTH, Boolean.valueOf(false)).withProperty(EAST, Boolean.valueOf(false)).withProperty(SOUTH, Boolean.valueOf(false)).withProperty(WEST, Boolean.valueOf(false))); setCreativeTab(CreativeTabs.DECORATIONS); }
private void playBlockSound(World world, RayTraceResult hit, IBlockState state) { SoundType sound = state.getBlock().getSoundType(state, world, hit.getBlockPos(), null); if (sound != null) { world.playSound(null, hit.getBlockPos(), sound.getPlaceSound(), SoundCategory.BLOCKS, sound.getVolume() * 0.5F, sound.getPitch() * 0.8F); } }
@SuppressWarnings("deprecation") public BlockSlabErebus(IBlockState state, String harvestType, int harvestLevel) { super(state.getMaterial(), harvestType, harvestLevel); setSoundType(state.getBlock().getSoundType()); setDefaultState(blockState.getBaseState().withProperty(HALF, EnumBlockHalf.BOTTOM)); setHardness(2.0F); setLightOpacity(0); setCreativeTab(ModTabs.BLOCKS); }
public BlockVanillaSlab(String name, IBlockState state, boolean doubleSlab) { super(name, state.getMaterial(), doubleSlab); setHardness(state.getBlockHardness(null, new BlockPos(0, 0, 0))); setResistance(state.getBlock().getExplosionResistance(null) * 5F / 3F); setSoundType(state.getBlock().getSoundType()); setCreativeTab(CreativeTabs.BUILDING_BLOCKS); }
@SuppressWarnings("deprecation") public BlockWallAA(String name, Block blocc){ super(blocc.getDefaultState().getMaterial(), name); this.setHardness(1.5F); this.setResistance(10F); this.setSoundType(blocc.getSoundType()); this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); }
@SubscribeEvent public void leftClick(PlayerInteractEvent.LeftClickBlock event) { if(event.getEntityPlayer().getHeldItemMainhand().isEmpty()) { IBlockState state = event.getWorld().getBlockState(event.getPos()); Block block = state.getBlock(); if(block instanceof BlockDoor && state.getMaterial() == Material.WOOD) event.getWorld().playSound(null, event.getPos().getX(), event.getPos().getY(), event.getPos().getZ(), block.getSoundType().getPlaceSound(), SoundCategory.PLAYERS, 1F, 1F); } }