From 7a6fda911f06a1e8f96124bf7ab4f94867169fe3 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sat, 23 Jan 2016 23:29:19 +0100 Subject: [PATCH] Use getStateID for playAuxSFX --- .../mod/items/ItemChestToCrateUpgrade.java | 2 +- .../actuallyadditions/mod/items/ItemLeafBlower.java | 8 ++++---- .../actuallyadditions/mod/items/lens/LensNone.java | 2 +- .../actuallyadditions/mod/tile/TileEntityBreaker.java | 2 +- .../mod/tile/TileEntityDirectionalBreaker.java | 3 +-- .../mod/tile/TileEntityLeafGenerator.java | 4 +--- .../actuallyadditions/mod/tile/TileEntityMiner.java | 2 +- .../mod/tile/TileEntityPhantomPlacer.java | 3 +-- .../de/ellpeck/actuallyadditions/mod/util/WorldUtil.java | 2 +- 9 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 89f748766..41ee8bbe8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -53,7 +53,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{ //Set New Block if(!ConfigValues.lessBlockBreakingEffects){ - world.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(PosUtil.getMetadata(pos, world) << 12)); + world.playAuxSFX(2001, pos, Block.getStateId(world.getBlockState(pos))); } PosUtil.setBlock(pos, world, InitBlocks.blockGiantChest, 0, 2); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index 77e77ab4e..82ac810a9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -106,17 +106,17 @@ public class ItemLeafBlower extends ItemBase{ Block theBlock = PosUtil.getBlock(theCoord, world); ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(theCoord, world); //Gets all of the Drops the Block should have drops.addAll(theBlock.getDrops(world, theCoord, world.getBlockState(theCoord), 0)); - //Deletes the Block - world.setBlockToAir(theCoord); //Plays the Breaking Sound if(!ConfigValues.lessBlockBreakingEffects){ - world.playAuxSFX(2001, theCoord, Block.getIdFromBlock(theBlock)+(meta << 12)); + world.playAuxSFX(2001, theCoord, Block.getStateId(world.getBlockState(theCoord))); } + //Deletes the Block + world.setBlockToAir(theCoord); + for(ItemStack theDrop : drops){ //Drops the Items into the World world.spawnEntityInWorld(new EntityItem(world, theCoord.getX()+0.5, theCoord.getY()+0.5, theCoord.getZ()+0.5, theDrop)); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java index d37d48401..c3c277920 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java @@ -47,7 +47,7 @@ public class LensNone extends Lens{ ItemStack output = outputs.get(0); if(output.getItem() instanceof ItemBlock){ if(!ConfigValues.lessBlockBreakingEffects){ - tile.getWorldObject().playAuxSFX(2001, pos, Block.getIdFromBlock(PosUtil.getBlock(pos, tile.getWorldObject()))+(PosUtil.getMetadata(pos, tile.getWorldObject()) << 12)); + tile.getWorldObject().playAuxSFX(2001, pos, Block.getStateId(tile.getWorldObject().getBlockState(pos))); } PosUtil.setBlock(pos, tile.getWorldObject(), Block.getBlockFromItem(output.getItem()), output.getItemDamage(), 2); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index 009675cbf..8085ae47d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -82,7 +82,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst if(WorldUtil.addToInventory(this, drops, false, true)){ if(!ConfigValues.lessBlockBreakingEffects){ - worldObj.playAuxSFX(2001, coordsBlock, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(worldObj.getBlockState(coordsBlock))); } WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.pos); WorldUtil.addToInventory(this, drops, true, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index b6afd0d03..b450e7f4d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -73,12 +73,11 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem Block blockToBreak = PosUtil.getBlock(coordsBlock, worldObj); if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(worldObj, pos) > -1.0F){ ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(coordsBlock, worldObj); drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ if(!ConfigValues.lessBlockBreakingEffects){ - worldObj.playAuxSFX(2001, coordsBlock, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(worldObj.getBlockState(coordsBlock))); } WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.getPos(), i); WorldUtil.addToInventory(this, drops, true, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index 25c61f61a..713f48334 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -65,10 +65,8 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr Collections.shuffle(breakPositions); BlockPos theCoord = breakPositions.get(0); - Block theBlock = PosUtil.getBlock(theCoord, worldObj); - int meta = PosUtil.getMetadata(theCoord, worldObj); if(!ConfigValues.lessBlockBreakingEffects){ - this.worldObj.playAuxSFX(2001, theCoord, Block.getIdFromBlock(theBlock)+(meta << 12)); + this.worldObj.playAuxSFX(2001, theCoord, Block.getStateId(worldObj.getBlockState(theCoord))); } this.worldObj.setBlockToAir(theCoord); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index 90039a7e2..d9e1b84ea 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -87,7 +87,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR if(WorldUtil.addToInventory(this, drops, false, true)){ if(!ConfigValues.lessBlockBreakingEffects){ - worldObj.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(meta << 12)); + worldObj.playAuxSFX(2001, pos, Block.getStateId(worldObj.getBlockState(pos))); } worldObj.setBlockToAir(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 3a18a51bb..d79cf8c6c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -102,12 +102,11 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements Block blockToBreak = PosUtil.getBlock(boundPosition, worldObj); if(blockToBreak != null && blockToBreak.getBlockHardness(worldObj, boundPosition) > -1.0F){ ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(boundPosition, worldObj); drops.addAll(blockToBreak.getDrops(worldObj, boundPosition, worldObj.getBlockState(boundPosition), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ if(!ConfigValues.lessBlockBreakingEffects){ - worldObj.playAuxSFX(2001, this.boundPosition, Block.getIdFromBlock(blockToBreak)+(meta << 12)); + worldObj.playAuxSFX(2001, this.boundPosition, Block.getStateId(worldObj.getBlockState(this.boundPosition))); } worldObj.setBlockToAir(this.boundPosition); WorldUtil.addToInventory(this, drops, true, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index 8ec780ae5..642563d5b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -366,7 +366,7 @@ public class WorldUtil{ } else{ //Shows the Harvest Particles and plays the Block's Sound - world.playAuxSFX(2001, pos, Block.getIdFromBlock(block)+(meta << 12)); + world.playAuxSFX(2001, pos, Block.getStateId(state)); } //If the Block was actually "removed", meaning it will drop an Item