Fixed sounds

This commit is contained in:
Ellpeck 2016-05-01 22:26:26 +02:00
parent 61d7b783b3
commit a545eaa008
16 changed files with 97 additions and 60 deletions

View file

@ -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.blocks.base.ItemBlockBase;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
@ -24,13 +24,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand; 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.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List;
public class BlockSlabs extends BlockBase{ public class BlockSlabs extends BlockBase{
private static final PropertyInteger META = PropertyInteger.create("meta", 0, 1); 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){ 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.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)){ if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){
//TODO Fix sounds SoundType type = this.block.getSoundType();
//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); world.playSound(player, pos, type.getPlaceSound(), SoundCategory.BLOCKS, (type.getVolume()+1.0F)/2.0F, type.getPitch()*0.8F);
stack.stackSize--; stack.stackSize--;
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }

View file

@ -23,6 +23,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -69,12 +70,11 @@ public class BlockTreasureChest extends BlockBase{
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ 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){ if(!world.isRemote){
//TODO Fix sounds world.playSound(player, pos, SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
//world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
this.dropItems(world, pos); this.dropItems(world, pos);
world.setBlockToAir(pos); world.setBlockToAir(pos);
//player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach); player.addStat(TheAchievements.OPEN_TREASURE_CHEST.ach);
} }
return true; return true;
} }

View file

@ -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.booklet.entry.BookletEntryAllSearch;
import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration; import de.ellpeck.actuallyadditions.mod.config.GuiConfiguration;
import de.ellpeck.actuallyadditions.mod.items.ItemBooklet; 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.proxy.ClientProxy;
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker; import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; 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.FontRenderer;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.ITextComponent;
@ -162,8 +166,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
public void keyTyped(char theChar, int key){ public void keyTyped(char theChar, int key){
if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == 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){ if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){
//TODO Fix sound Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundHandler.duhDuhDuhDuuuh, 0.5F));
//Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID, "duhDuhDuhDuuuh")));
ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH"); ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH");
this.hisNameIsAt = 0; this.hisNameIsAt = 0;
} }
@ -427,8 +430,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{
if(mousePressed){ if(mousePressed){
BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true);
BookletUtils.openChapter(this, page.getChapter(), page); BookletUtils.openChapter(this, page.getChapter(), page);
//TODO Fix sound Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.UI_BUTTON_CLICK, 1.0F));
//Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F));
} }
} }
} }

View file

@ -39,11 +39,10 @@ public class HudEvent{
EntityPlayer player = minecraft.thePlayer; EntityPlayer player = minecraft.thePlayer;
RayTraceResult posHit = minecraft.objectMouseOver; RayTraceResult posHit = minecraft.objectMouseOver;
FontRenderer font = minecraft.fontRendererObj; FontRenderer font = minecraft.fontRendererObj;
ItemStack stack = player.getActiveItemStack(); ItemStack stack = player.getHeldItemMainhand();
profiler.startSection(ModUtil.MOD_ID+"Hud"); profiler.startSection(ModUtil.MOD_ID+"Hud");
//TODO Fix this not working because stack is always null for some reason
if(stack != null){ if(stack != null){
if(stack.getItem() instanceof IHudDisplay){ if(stack.getItem() instanceof IHudDisplay){
profiler.startSection("ItemHudDisplay"); profiler.startSection("ItemHudDisplay");

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.items.ItemDrillUpgrade;
import invtweaks.api.container.InventoryContainer; import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
@ -119,18 +120,15 @@ public class ContainerDrill extends Container{
return null; return null;
} }
//TODO Fix slotClick() @Override
/*@Override public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ if(clickTypeIn == ClickType.SWAP && dragType == inventory.currentItem){
//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){
return null; return null;
} }
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(slotId, dragType, clickTypeIn, player);
} }
}*/ }
@Override @Override
public void onContainerClosed(EntityPlayer player){ public void onContainerClosed(EntityPlayer player){

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityInputter;
import invtweaks.api.container.InventoryContainer; import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -61,7 +62,7 @@ public class ContainerInputter extends Container{
final int hotbarStart = inventoryEnd+1; final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8; final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot); Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){ if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack(); ItemStack newStack = theSlot.getStack();
@ -103,17 +104,16 @@ public class ContainerInputter extends Container{
return null; return null;
} }
//TODO slotClick() @Override
/*@Override public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function //Calls the Filter's SlotClick function
return ((SlotFilter)getSlot(par1)).slotClick(player); return ((SlotFilter)getSlot(slotId)).slotClick(player);
} }
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(slotId, dragType, clickTypeIn, player);
} }
}*/ }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(EntityPlayer player){

View file

@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector;
import invtweaks.api.container.InventoryContainer; import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -56,7 +57,7 @@ public class ContainerRangedCollector extends Container{
final int hotbarStart = inventoryEnd+1; final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8; final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot); Slot theSlot = this.inventorySlots.get(slot);
if(theSlot != null && theSlot.getHasStack()){ if(theSlot != null && theSlot.getHasStack()){
ItemStack newStack = theSlot.getStack(); ItemStack newStack = theSlot.getStack();
@ -98,17 +99,16 @@ public class ContainerRangedCollector extends Container{
return null; return null;
} }
//TODO Find a replacement for slotClick() @Override
/*@Override public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player){
public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ if(slotId >= 0 && slotId < this.inventorySlots.size() && this.getSlot(slotId) instanceof SlotFilter){
if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){
//Calls the Filter's SlotClick function //Calls the Filter's SlotClick function
return ((SlotFilter)getSlot(par1)).slotClick(player); return ((SlotFilter)getSlot(slotId)).slotClick(player);
} }
else{ else{
return super.slotClick(par1, par2, par3, player); return super.slotClick(slotId, dragType, clickTypeIn, player);
} }
}*/ }
@Override @Override
public boolean canInteractWith(EntityPlayer player){ public boolean canInteractWith(EntityPlayer player){

View file

@ -15,12 +15,10 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase;
import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult; import net.minecraft.util.*;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemHairyBall extends ItemBase{ public class ItemHairyBall extends ItemBase{
@ -40,8 +38,7 @@ public class ItemHairyBall extends ItemBase{
} }
stack.stackSize--; stack.stackSize--;
//TODO Sound world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
//world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F);
} }
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack); return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
} }

View file

@ -18,12 +18,14 @@ import net.minecraft.block.BlockBush;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; 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)); 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!) //Plays a Minecart sounds (It really sounds like a Leaf Blower!)
if(!ConfigValues.lessSound){ if(!ConfigValues.lessSound){
//TODO Fix sound player.worldObj.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_MINECART_RIDING, SoundCategory.PLAYERS, 0.3F, 0.001F);
//player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F);
} }
} }
} }

View file

@ -12,15 +12,18 @@ package de.ellpeck.actuallyadditions.mod.items;
import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy; import de.ellpeck.actuallyadditions.mod.items.base.ItemEnergy;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil;
import net.minecraft.block.SoundType;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand; import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -47,8 +50,7 @@ public class ItemTeleStaff extends ItemEnergy{
if(this.getEnergyStored(stack) >= use){ if(this.getEnergyStored(stack) >= use){
((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); ((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch);
player.dismountRidingEntity(); player.dismountRidingEntity();
//TODO Fix sound world.playSound(null, player.posX, player.posY, player.posZ, SoundEvents.ENTITY_ENDERMEN_TELEPORT, SoundCategory.PLAYERS, 1.0F, 1.0F);
//world.playSound(player, "mob.endermen.portal", 1.0F, 1.0F);
if(!player.capabilities.isCreativeMode){ if(!player.capabilities.isCreativeMode){
this.extractEnergy(stack, use, false); this.extractEnergy(stack, use, false);
this.setWaitTime(stack, 50); this.setWaitTime(stack, 50);

View file

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

View file

@ -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.config.values.ConfigBoolValues;
import de.ellpeck.actuallyadditions.mod.event.InitEvents; import de.ellpeck.actuallyadditions.mod.event.InitEvents;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; 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.misc.special.SpecialRenderInit;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost;
@ -108,6 +109,8 @@ public class ClientProxy implements IProxy{
this.registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil); this.registerCustomFluidBlockRenderer(InitFluids.fluidCanolaOil);
this.registerCustomFluidBlockRenderer(InitFluids.fluidOil); this.registerCustomFluidBlockRenderer(InitFluids.fluidOil);
SoundHandler.init();
IResourceManager manager = Minecraft.getMinecraft().getResourceManager(); IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
if(manager instanceof IReloadableResourceManager){ if(manager instanceof IReloadableResourceManager){
((IReloadableResourceManager)manager).registerReloadListener(new IResourceManagerReloadListener(){ ((IReloadableResourceManager)manager).registerReloadListener(new IResourceManagerReloadListener(){

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.api.lens.ILensItem;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.items.lens.Lenses; 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.PacketHandler;
import de.ellpeck.actuallyadditions.mod.network.PacketParticle; import de.ellpeck.actuallyadditions.mod.network.PacketParticle;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; 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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.NetworkRegistry; 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){ private void shootLaser(int endX, int endY, int endZ, Lens currentLens){
if(!ConfigValues.lessSound){ if(!ConfigValues.lessSound){
//TODO Fix sound System.out.println("SOUND!");
//this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID+":reconstructor", 0.35F, 1.0F); 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)); 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));
} }

View file

@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.InitItems;
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee; import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; 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.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.WorldUtil; 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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.fluids.*; import net.minecraftforge.fluids.*;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; 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.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.storage.getEnergyStored() >= ENERGY_USED){
if(this.brewTime%30 == 0 && !ConfigValues.lessSound){ if(this.brewTime%30 == 0 && !ConfigValues.lessSound){
//TODO Fix sound this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.coffeeMachine, SoundCategory.BLOCKS, 0.35F, 1.0F);
//this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID+":coffeeMachine", 0.35F, 1.0F);
} }
this.brewTime++; this.brewTime++;

View file

@ -14,6 +14,7 @@ package de.ellpeck.actuallyadditions.mod.tile;
import cofh.api.energy.EnergyStorage; import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver; import cofh.api.energy.IEnergyReceiver;
import de.ellpeck.actuallyadditions.mod.config.ConfigValues; 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.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil;
import de.ellpeck.actuallyadditions.mod.util.PosUtil; 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.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -164,8 +166,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
} }
if(shouldPlaySound && !ConfigValues.lessSound){ if(shouldPlaySound && !ConfigValues.lessSound){
//TODO Fix sound this.worldObj.playSound(null, this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), SoundHandler.crusher, SoundCategory.BLOCKS, 0.25F, 1.0F);
//this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID+":crusher", 0.25F, 1.0F);
} }
} }
} }

View file

@ -1,6 +1,6 @@
{ {
"duhDuhDuhDuuuh": { "category": "record", "sounds":["duhDuhDuhDuuuh"] }, "duhDuhDuhDuuuh": { "category": "record", "sounds":["actuallyadditions:duhDuhDuhDuuuh"] },
"coffeeMachine": { "category": "block", "sounds":["coffeeMachine"] }, "coffeeMachine": { "category": "block", "sounds":["actuallyadditions:coffeeMachine"] },
"reconstructor": { "category": "block", "sounds":["reconstructor"] }, "reconstructor": { "category": "block", "sounds":["actuallyadditions:reconstructor"] },
"crusher": { "category": "block", "sounds":["crusher"] } "crusher": { "category": "block", "sounds":["actuallyadditions:crusher"] }
} }