From 51499b9348b475e1236d75bfff21d799868db131 Mon Sep 17 00:00:00 2001 From: Mohammad-Ali Minaie Date: Fri, 24 Mar 2017 01:19:48 -0400 Subject: [PATCH] sounds not working --- .../main/java/nmd/primal/forgecraft/ForgeCraft.java | 2 +- .../nmd/primal/forgecraft/api/ForgecraftSounds.java | 12 ++++++++++++ .../nmd/primal/forgecraft/blocks/PistonBellows.java | 5 ++++- .../java/nmd/primal/forgecraft/init/ModSounds.java | 6 +++++- .../src/main/resources/assets/forgecraft/sounds.json | 8 +++----- 5 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 1.11/src/main/java/nmd/primal/forgecraft/api/ForgecraftSounds.java diff --git a/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java b/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java index a5503be3..39f8802c 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/ForgeCraft.java @@ -9,7 +9,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import nmd.primal.core.common.init.ModSounds; +import nmd.primal.forgecraft.init.ModSounds; import nmd.primal.forgecraft.init.ModEvents; import nmd.primal.forgecraft.compat.ModDictionary; import nmd.primal.forgecraft.gui.GuiHandler; diff --git a/1.11/src/main/java/nmd/primal/forgecraft/api/ForgecraftSounds.java b/1.11/src/main/java/nmd/primal/forgecraft/api/ForgecraftSounds.java new file mode 100644 index 00000000..35eaa87a --- /dev/null +++ b/1.11/src/main/java/nmd/primal/forgecraft/api/ForgecraftSounds.java @@ -0,0 +1,12 @@ +package nmd.primal.forgecraft.api; + +import net.minecraft.util.SoundEvent; + +/** + * Created by mminaie on 3/24/17. + */ +public class ForgecraftSounds { + + + +} diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java index e98efa4e..b36bde1e 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java @@ -17,6 +17,7 @@ import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import nmd.primal.forgecraft.ModInfo; +import nmd.primal.forgecraft.api.ForgecraftSounds; import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModSounds; import nmd.primal.forgecraft.tiles.TileBloomery; @@ -72,7 +73,9 @@ public class PistonBellows extends CustomContainerFacing { //System.out.println(state.getValue(PistonBellows.FACING)); if(state.getValue(this.ACTIVE) == false) { world.setBlockState(pos, state.withProperty(ACTIVE, true), 2); - world.playSound(player, pos, ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f); + //world.playSound(pos, ForgecraftSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f); + world.playSound((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), ModSounds.PISTON_BELLOWS, SoundCategory.BLOCKS, 1.0f, 1.0f, true); + if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) { BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModSounds.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModSounds.java index f381c7e3..b47544fb 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModSounds.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModSounds.java @@ -3,13 +3,17 @@ package nmd.primal.forgecraft.init; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraftforge.fml.common.registry.ForgeRegistries; -import nmd.primal.core.common.init.ModInfo; + +import nmd.primal.forgecraft.ModInfo; +import nmd.primal.forgecraft.api.ForgecraftSounds; /** * Created by mminaie on 3/24/17. */ public class ModSounds { + public static SoundEvent PISTON_BELLOWS; + public static void registerSounds() { PISTON_BELLOWS = registerSound("piston_bellows"); diff --git a/1.11/src/main/resources/assets/forgecraft/sounds.json b/1.11/src/main/resources/assets/forgecraft/sounds.json index 07c3ab98..edcdb08b 100644 --- a/1.11/src/main/resources/assets/forgecraft/sounds.json +++ b/1.11/src/main/resources/assets/forgecraft/sounds.json @@ -1,9 +1,7 @@ { "piston_bellows": { - "category": "blocks", - "sounds": [ - "forgecraft:piston_bellows" - ], - "subtitle": "forgecraft.subtitle.piston_bellows" + "category": "block", + "subtitle": "forgecraft.subtitle.piston_bellows", + "sounds": [ "forgecraft:piston_bellows" ] } } \ No newline at end of file