sounds not working

This commit is contained in:
Mohammad-Ali Minaie
2017-03-24 01:19:48 -04:00
parent c0617b4931
commit 51499b9348
5 changed files with 25 additions and 8 deletions

View File

@@ -9,7 +9,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; 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.init.ModEvents;
import nmd.primal.forgecraft.compat.ModDictionary; import nmd.primal.forgecraft.compat.ModDictionary;
import nmd.primal.forgecraft.gui.GuiHandler; import nmd.primal.forgecraft.gui.GuiHandler;

View File

@@ -0,0 +1,12 @@
package nmd.primal.forgecraft.api;
import net.minecraft.util.SoundEvent;
/**
* Created by mminaie on 3/24/17.
*/
public class ForgecraftSounds {
}

View File

@@ -17,6 +17,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.api.ForgecraftSounds;
import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModSounds; import nmd.primal.forgecraft.init.ModSounds;
import nmd.primal.forgecraft.tiles.TileBloomery; import nmd.primal.forgecraft.tiles.TileBloomery;
@@ -72,7 +73,9 @@ public class PistonBellows extends CustomContainerFacing {
//System.out.println(state.getValue(PistonBellows.FACING)); //System.out.println(state.getValue(PistonBellows.FACING));
if(state.getValue(this.ACTIVE) == false) { if(state.getValue(this.ACTIVE) == false) {
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2); 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) { if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) {
BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ());
if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) {

View File

@@ -3,13 +3,17 @@ package nmd.primal.forgecraft.init;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries; 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. * Created by mminaie on 3/24/17.
*/ */
public class ModSounds { public class ModSounds {
public static SoundEvent PISTON_BELLOWS; public static SoundEvent PISTON_BELLOWS;
public static void registerSounds() public static void registerSounds()
{ {
PISTON_BELLOWS = registerSound("piston_bellows"); PISTON_BELLOWS = registerSound("piston_bellows");

View File

@@ -1,9 +1,7 @@
{ {
"piston_bellows": { "piston_bellows": {
"category": "blocks", "category": "block",
"sounds": [ "subtitle": "forgecraft.subtitle.piston_bellows",
"forgecraft:piston_bellows" "sounds": [ "forgecraft:piston_bellows" ]
],
"subtitle": "forgecraft.subtitle.piston_bellows"
} }
} }