diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index a12121528..bd2910dcc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.blocks.base.ItemBlockBase; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; @@ -24,13 +24,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; -import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class BlockSlabs extends BlockBase{ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); @@ -111,8 +108,8 @@ public class BlockSlabs extends BlockBase{ public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){ if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){ if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){ - //TODO Fix sounds - //world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F); + SoundType type = this.block.getSoundType(); + world.playSound(player, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume()+1.0F)/2.0F, type.getPitch()*0.8F); stack.stackSize--; return EnumActionResult.SUCCESS; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index 229d1b40f..00ae0bf22 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -23,6 +23,7 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -69,12 +70,11 @@ public class BlockTreasureChest extends BlockBase{ @Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ - //TODO Fix sounds - //world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); + world.playSound(player, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); this.dropItems(world, pos); world.setBlockToAir(pos); - //player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach); + player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach); } return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index 03edd3adf..405587c5a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -20,17 +20,21 @@ import de.ellpeck.actuallyadditions.mod.booklet.button.TexturedButton; import de.ellpeck.actuallyadditions.mod.booklet.entry.BookletEntryAllSearch; import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration; import de.ellpeck.actuallyadditions.mod.items.ItemBooklet; +import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; +import net.minecraft.client.Minecraft; +import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; @@ -162,8 +166,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ public void keyTyped(char theChar, int key){ if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){ if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){ - //TODO Fix sound - //Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID, "duhDuhDuhDuuuh"))); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundHandler.duhDuhDuhDuuuh, 0.5F)); ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH"); this.hisNameIsAt = 0; } @@ -427,8 +430,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ if(mousePressed){ BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); BookletUtils.openChapter(this, page.getChapter(), page); - //TODO Fix sound - //Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java index 4173ddbb8..9d5dbd8dd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java @@ -39,11 +39,10 @@ public class HudEvent{ EntityPlayer player = minecraft.thePlayer; RayTraceResult posHit = minecraft.objectMouseOver; FontRenderer font = minecraft.fontRendererObj; - ItemStack stack = player.getActiveItemStack(); + ItemStack stack = player.getHeldItemMainhand(); profiler.startSection(ModUtil.MOD_ID+"Hud"); - //TODO Fix this not working because stack is always null for some reason if(stack != null){ if(stack.getItem() instanceof IHudDisplay){ profiler.startSection("ItemHudDisplay"); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index f2b8a0d83..a7ee9fb02 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade; import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; @@ -119,18 +120,15 @@ public class ContainerDrill extends Container{ return null; } - //TODO Fix slotClick() - /*@Override - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ - //par3 appears to be the type of clicking - //par3 == 2 appears to be one of the number keys being hit - if(par3 == 2 && par2 == inventory.currentItem){ + @Override + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){ + if(clickTypeIn == ClickType.SWAP && dragType == inventory.currentItem){ return null; } else{ - return super.slotClick(par1, par2, par3, player); + return super.slotClick(slotId, dragType, clickTypeIn, player); } - }*/ + } @Override public void onContainerClosed(EntityPlayer player){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java index 0567c9b1e..a0d3a606e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter; import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -61,7 +62,7 @@ public class ContainerInputter extends Container{ final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; - Slot theSlot = (Slot)this.inventorySlots.get(slot); + Slot theSlot = this.inventorySlots.get(slot); if(theSlot != null && theSlot.getHasStack()){ ItemStack newStack = theSlot.getStack(); @@ -103,17 +104,16 @@ public class ContainerInputter extends Container{ return null; } - //TODO slotClick() - /*@Override - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ - if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ + @Override + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){ + if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){ //Calls the Filter's SlotClick function - return ((SlotFilter)getSlot(par1)).slotClick(player); + return ((SlotFilter)getSlot(slotId)).slotClick(player); } else{ - return super.slotClick(par1, par2, par3, player); + return super.slotClick(slotId, dragType, clickTypeIn, player); } - }*/ + } @Override public boolean canInteractWith(EntityPlayer player){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java index dd2273110..5ff272472 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; @@ -56,7 +57,7 @@ public class ContainerRangedCollector extends Container{ final int hotbarStart = inventoryEnd+1; final int hotbarEnd = hotbarStart+8; - Slot theSlot = (Slot)this.inventorySlots.get(slot); + Slot theSlot = this.inventorySlots.get(slot); if(theSlot != null && theSlot.getHasStack()){ ItemStack newStack = theSlot.getStack(); @@ -98,17 +99,16 @@ public class ContainerRangedCollector extends Container{ return null; } - //TODO Find a replacement for slotClick() - /*@Override - public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ - if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ + @Override + public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){ + if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){ //Calls the Filter's SlotClick function - return ((SlotFilter)getSlot(par1)).slotClick(player); + return ((SlotFilter)getSlot(slotId)).slotClick(player); } else{ - return super.slotClick(par1, par2, par3, player); + return super.slotClick(slotId, dragType, clickTypeIn, player); } - }*/ + } @Override public boolean canInteractWith(EntityPlayer player){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java index 3c1669825..c8cbcc13f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java @@ -15,12 +15,10 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; -import net.minecraft.util.WeightedRandom; +import net.minecraft.util.*; import net.minecraft.world.World; public class ItemHairyBall extends ItemBase{ @@ -40,8 +38,7 @@ public class ItemHairyBall extends ItemBase{ } stack.stackSize--; - //TODO Sound - //world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); } return new ActionResult(EnumActionResult.SUCCESS, stack); } 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 32f9a300a..276a38760 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -18,12 +18,14 @@ import net.minecraft.block.BlockBush; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; @@ -71,8 +73,7 @@ public class ItemLeafBlower extends ItemBase{ this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) if(!ConfigValues.lessSound){ - //TODO Fix sound - //player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); + player.worldObj.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index 043d24e97..dc73bf59c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -12,15 +12,18 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; +import net.minecraft.block.SoundType; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.init.SoundEvents; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ActionResult; import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumHand; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; @@ -47,8 +50,7 @@ public class ItemTeleStaff extends ItemEnergy{ if(this.getEnergyStored(stack) >= use){ ((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); player.dismountRidingEntity(); - //TODO Fix sound - //world.playSound(player, "mob.endermen.portal", 1.0F, 1.0F); + world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F); if(!player.capabilities.isCreativeMode){ this.extractEnergy(stack, use, false); this.setWaitTime(stack, 50); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/SoundHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/SoundHandler.java new file mode 100644 index 000000000..3c188adcd --- /dev/null +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/SoundHandler.java @@ -0,0 +1,34 @@ +package de.ellpeck.actuallyadditions.mod.misc; + +import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.SoundEvent; + +public class SoundHandler{ + + public static SoundEvent duhDuhDuhDuuuh; + public static SoundEvent coffeeMachine; + public static SoundEvent reconstructor; + public static SoundEvent crusher; + + private static int size = 0; + + public static void init(){ + size = SoundEvent.REGISTRY.getKeys().size(); + + duhDuhDuhDuuuh = registerSound("duhDuhDuhDuuuh"); + coffeeMachine = registerSound("coffeeMachine"); + reconstructor = registerSound("reconstructor"); + crusher = registerSound("crusher"); + } + + private static SoundEvent registerSound(String name){ + ResourceLocation resLoc = new ResourceLocation(ModUtil.MOD_ID, name); + + SoundEvent event = new SoundEvent(resLoc); + SoundEvent.REGISTRY.register(size, resLoc, event); + + size++; + return event; + } +} diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index a026d55ce..cb1715f75 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -21,6 +21,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.render.RenderSmileyCloud; import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.event.InitEvents; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; +import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; @@ -108,6 +109,8 @@ public class ClientProxy implements IProxy{ this.registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil); this.registerCustomFluidBlockRenderer(InitFluids.fluidOil); + SoundHandler.init(); + IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); if(manager instanceof IReloadableResourceManager){ ((IReloadableResourceManager)manager).registerReloadListener(new IResourceManagerReloadListener(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index c278fa0b2..5688d9d96 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.api.lens.ILensItem; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; +import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.network.PacketHandler; import de.ellpeck.actuallyadditions.mod.network.PacketParticle; import de.ellpeck.actuallyadditions.mod.util.ModUtil; @@ -25,6 +26,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; @@ -120,8 +122,8 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple private void shootLaser(int endX, int endY, int endZ, Lens currentLens){ if(!ConfigValues.lessSound){ - //TODO Fix sound - //this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID+":reconstructor", 0.35F, 1.0F); + System.out.println("SOUND!"); + this.worldObj.playSound(null, this.getX(), this.getY(), this.getZ(), SoundHandler.reconstructor, SoundCategory.BLOCKS, 0.35F, 1.0F); } PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getX(), this.getY(), this.getZ(), endX, endY, endZ, currentLens.getColor(), ConfigValues.lessParticles ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimension(), this.getX(), this.getY(), this.getZ(), 64)); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 90549b524..704bed081 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; +import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; @@ -24,6 +25,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -135,8 +137,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){ if(this.storage.getEnergyStored() >= ENERGY_USED){ if(this.brewTime%30 == 0 && !ConfigValues.lessSound){ - //TODO Fix sound - //this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID+":coffeeMachine", 0.35F, 1.0F); + this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.35F, 1.0F); } this.brewTime++; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index dad289c87..8815a3bc4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.tile; import cofh.api.energy.EnergyStorage; import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; +import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; @@ -21,6 +22,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumFacing; +import net.minecraft.util.SoundCategory; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -164,8 +166,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } if(shouldPlaySound && !ConfigValues.lessSound){ - //TODO Fix sound - //this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID+":crusher", 0.25F, 1.0F); + this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.25F, 1.0F); } } } diff --git a/src/main/resources/assets/actuallyadditions/sounds.json b/src/main/resources/assets/actuallyadditions/sounds.json index 3fbd30a78..aedb30d28 100644 --- a/src/main/resources/assets/actuallyadditions/sounds.json +++ b/src/main/resources/assets/actuallyadditions/sounds.json @@ -1,6 +1,6 @@ { - "duhDuhDuhDuuuh": { "category": "record", "sounds":["duhDuhDuhDuuuh"] }, - "coffeeMachine": { "category": "block", "sounds":["coffeeMachine"] }, - "reconstructor": { "category": "block", "sounds":["reconstructor"] }, - "crusher": { "category": "block", "sounds":["crusher"] } + "duhDuhDuhDuuuh": { "category": "record", "sounds":["actuallyadditions:duhDuhDuhDuuuh"] }, + "coffeeMachine": { "category": "block", "sounds":["actuallyadditions:coffeeMachine"] }, + "reconstructor": { "category": "block", "sounds":["actuallyadditions:reconstructor"] }, + "crusher": { "category": "block", "sounds":["actuallyadditions:crusher"] } } \ No newline at end of file