Use getStateID for playAuxSFX

This commit is contained in:
Ellpeck 2016-01-23 23:29:19 +01:00
parent fbc5c5240d
commit 7a6fda911f
9 changed files with 12 additions and 16 deletions

View file

@ -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);

View file

@ -106,17 +106,17 @@ public class ItemLeafBlower extends ItemBase{
Block theBlock = PosUtil.getBlock(theCoord, world);
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
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));

View file

@ -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);
}

View file

@ -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);

View file

@ -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<ItemStack> drops = new ArrayList<ItemStack>();
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);

View file

@ -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);

View file

@ -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);

View file

@ -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<ItemStack> drops = new ArrayList<ItemStack>();
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);

View file

@ -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