Jump to content

Sounds through Packets


Briggybros

Recommended Posts

Hello, I am currently having problems sending a sound request through a packet system. I am constructing the packet as so;

    private void sendSoundPacket(int x, int y, int z, int sound)
    {
    	
    	ByteArrayOutputStream bos = new ByteArrayOutputStream(16);
    	DataOutputStream outputStream = new DataOutputStream(bos);
    	try
    	{
    		outputStream.writeInt(x);
    		outputStream.writeInt(y);
    		outputStream.writeInt(z);
    		outputStream.writeInt(sound);
    		outputStream.writeInt(mc.thePlayer.entityId);
    	}
    	catch (Exception ex)
    	{
    		ex.printStackTrace();
    	}

    	Packet250CustomPayload packet = new Packet250CustomPayload();
    	packet.channel = "SaberSound";
    	packet.data = bos.toByteArray();
    	packet.length = bos.size();
    	PacketDispatcher.sendPacketToServer(packet);
    }

 

Then handling it with;

	private void handleSoundPacket(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

    	int x;
    	int y;
    	int z;
    	int sound;
    	int playerID;
    	
	try
	{
		x = inputStream.readInt();
		y = inputStream.readInt();
		z = inputStream.readInt();
		sound = inputStream.readInt();
		playerID = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}

	Side side = FMLCommonHandler.instance().getEffectiveSide();
	if (side == Side.SERVER)
	{
		sendSoundPacket(x, y, z, sound, (EntityPlayerMP)player);
	}
	else if (side == Side.CLIENT)
	{
		this.playSound(x, y, z , sound, ((EntityClientPlayerMP)mc.theWorld.getEntityByID(playerID)).worldObj); //PacketHandler.java:120
	}
}

 

The playSound method is;

    private void playSound(int x, int y, int z, int sound, World world)
    {
    	if(sound == 0)
    	{
    		world.playSoundEffect(x, y, z, "sabermod.saberoff", 1F, 1F);
    	}
    	
    	if(sound == 1)
    	{
    		world.playSoundEffect(x, y, z, "sabermod.saberon", 1F, 1F);
    	}
    	
    	if(sound == 2)
    	{
    		world.playSoundEffect(x, y, z, "sabermod.saberswing", 1F, 1F);
    	}
    }

 

and the server side sendSoundPacket is;

    private void sendSoundPacket(int x, int y, int z, int sound, EntityPlayerMP player)
    {
    	int playerID = player.entityId;
    	
    	ByteArrayOutputStream bos = new ByteArrayOutputStream(20);
    	DataOutputStream outputStream = new DataOutputStream(bos);
    	try
    	{
    		outputStream.writeInt(x);
    		outputStream.writeInt(y);
    		outputStream.writeInt(z);
    		outputStream.writeInt(sound);
    		outputStream.writeInt(playerID);
    	}
    	catch (Exception ex)
    	{
    		ex.printStackTrace();
    	}

    	Packet250CustomPayload packet = new Packet250CustomPayload();
    	packet.channel = "SaberSound";
    	packet.data = bos.toByteArray();
    	packet.length = bos.size();
    	PacketDispatcher.sendPacketToAllPlayers(packet);
    }

 

The sounds are registered with;

@ForgeSubscribe
    public void onSound(SoundLoadEvent event)
    {
        try 
        {
            event.manager.soundPoolSounds.addSound("sabermod/saberoff.ogg", SaberMod.class.getResource("/SaberMod/sound/saberoff.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberoff.ogg", SaberMod.class.getResource("/SaberMod/sound/saberoff.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing0.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing0.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing1.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing1.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing2.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing2.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing3.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing3.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing4.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing4.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing5.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing5.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing6.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing6.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing7.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing7.ogg"));
        } 
        catch (Exception e)
        {
            System.err.println("Failed to register one or more sounds.");
        }
    }

 

The error I get is;

2012-11-21 00:13:00 [iNFO] [sTDERR] net.minecraft.src.ReportedException: Exception in world tick
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1892)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:858)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:783)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2012-11-21 00:13:00 [iNFO] [sTDERR] Caused by: java.lang.NullPointerException
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at uk.co.toomuchminecraft.sabermod.PacketHandler.handleSoundPacket(PacketHandler.java:120)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at uk.co.toomuchminecraft.sabermod.PacketHandler.onPacketData(PacketHandler.java:43)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handlePacket(NetworkRegistry.java:249)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handleCustomPacket(NetworkRegistry.java:239)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.FMLNetworkHandler.handlePacket250Packet(FMLNetworkHandler.java:78)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.src.NetClientHandler.handleCustomPayload(NetClientHandler.java:1344)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.src.Packet250CustomPayload.processPacket(Packet250CustomPayload.java:70)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:79)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:104)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.src.WorldClient.tick(WorldClient.java:72)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1876)
2012-11-21 00:13:00 [iNFO] [sTDERR] 	... 3 more

 

I have marked the error location from the log in the src. What is going wrong with this? I think it's possibly the worlds, but I can't seem to be able to fix it whatever it is.

Link to comment
Share on other sites

I was debating that, but surely, typecasting the player to EntityClientPlayerMP wouldn't return a player it would return CONSOLE as if it's being handled on the client it was sent from the server.

 

EDIT: Edited the PacketHandler;

package uk.co.toomuchminecraft.sabermod;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityClientPlayerMP;
import net.minecraft.src.EntityList;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.EntityPlayerSP;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.World;
import net.minecraft.src.WorldClient;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;

public class PacketHandler implements IPacketHandler
{
@SideOnly(Side.CLIENT)
Minecraft mc;

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
	if (packet.channel.equals("SaberExtend"))
	{
		handleExtendPacket(packet, player);
	}

	if (packet.channel.equals("SaberSound"))
	{
		handleSoundPacket(packet, player);
	}
}

private void handleExtendPacket(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

    	int itemID;
    	int itemDamage;
    	int slot;
    	int action;
    	int saberID;
    	
	try
	{
		itemID = inputStream.readInt();
		itemDamage = inputStream.readInt();
		slot = inputStream.readInt();
		action = inputStream.readInt();
		saberID = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}

	Side side = FMLCommonHandler.instance().getEffectiveSide();
	if (side == Side.SERVER)
	{
		EntityPlayerMP executingPlayer = (EntityPlayerMP)player;
		extendSaber(saberID, action, executingPlayer);
		PacketDispatcher.sendPacketToAllPlayers(packet);
		closeInventoryChange(executingPlayer);
	}
	else if (side == Side.CLIENT)
	{
		EntityClientPlayerMP executingPlayer = (EntityClientPlayerMP)player;
		extendSaber(saberID, action, executingPlayer);
		closeInventoryChange(executingPlayer);
	}
}

private void handleSoundPacket(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

    	int x;
    	int y;
    	int z;
    	int sound;
    	
	try
	{
		x = inputStream.readInt();
		y = inputStream.readInt();
		z = inputStream.readInt();
		sound = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}

	Side side = FMLCommonHandler.instance().getEffectiveSide();
	if (side == Side.SERVER)
	{
		PacketDispatcher.sendPacketToAllPlayers(packet);
		playSound(x, y, z, sound, (EntityPlayerMP)player);
	}
	else if (side == Side.CLIENT)
	{
		this.playSound(x, y, z , sound, (EntityClientPlayerMP)player);
	}
}

private void closeInventoryChange(EntityClientPlayerMP player)
{
	player.inventory.inventoryChanged = false;
}

private void closeInventoryChange(EntityPlayerMP player)
{
	player.inventory.inventoryChanged = false;
}
    
    private void playSound(int x, int y, int z, int sound, EntityClientPlayerMP player)
    {
    	if(sound == 0)
    	{
    		player.worldObj.playSoundEffect(x, y, z, "sabermod.saberoff", 1F, 1F);
    	}
    	
    	if(sound == 1)
    	{
    		player.worldObj.playSoundEffect(x, y, z, "sabermod.saberon", 1F, 1F);
    	}
    	
    	if(sound == 2)
    	{
    		player.worldObj.playSoundEffect(x, y, z, "sabermod.saberswing", 1F, 1F);
    	}
    }
    
    private void playSound(int x, int y, int z, int sound, EntityPlayerMP player)
    {
    	if(sound == 0)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber retract sound");
    	}
    	
    	if(sound == 1)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber extend sound");
    	}
    	
    	if(sound == 2)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber swing sound");
    	}
    }
    
    private void extendSaber(int saberID, int action, EntityPlayerMP player)
    {
    	if(saberID == 0)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 1)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 2)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 3)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 4)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 5)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 6)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 7)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    }
    
    private void extendSaber(int saberID, int action, EntityClientPlayerMP player)
    {
    	if(saberID == 0)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 1)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 2)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 3)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 4)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 5)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 6)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 7)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    }
}

 

EDIT: The system outputs the system messages for the extend sabers methods twice - not a problem, just can get cluttered. Also, the system output for the sound playing is working without error, however the sound itself isn't actually playing. I register the sounds with this clientside and play them as you can see in the PacketHandler.

package uk.co.toomuchminecraft.sabermod.client;

import uk.co.toomuchminecraft.sabermod.SaberMod;
import net.minecraft.client.Minecraft;
import net.minecraft.src.World;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.event.ForgeSubscribe;

public class SaberSounds
{
    @ForgeSubscribe
    public void onSound(SoundLoadEvent event)
    {
        try 
        {
            event.manager.soundPoolSounds.addSound("sabermod/saberoff.ogg", SaberMod.class.getResource("/SaberMod/sound/saberoff.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberoff.ogg", SaberMod.class.getResource("/SaberMod/sound/saberoff.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing0.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing0.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing1.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing1.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing2.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing2.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing3.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing3.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing4.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing4.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing5.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing5.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing6.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing6.ogg"));
            event.manager.soundPoolSounds.addSound("sabermod/saberswing7.ogg", SaberMod.class.getResource("/SaberMod/sound/saberswing7.ogg"));
        } 
        catch (Exception e)
        {
            System.err.println("Failed to register one or more sounds.");
        }
    }
}

Link to comment
Share on other sites

That's a bit nuts... although client to server packets get you kicked without your own packet handler, it usually is not necessary. If the method runs client and server side, just do this:

 

if(!world.isRemote()){

world.playerSoundAtEntity(player, ...etc);

}

 

If you need to play a sound but you are in a client side environment, just send the dimension and the entity ID that the sound originates and do a:

WorldServer world = FMLCommonHandler.getInstance().getServerInstance().getWorldServerByDimensionID(dimSentToSever);

Entity entity = world.getEntityByID(idSentToServer);

world.playSoundAtEntity(entity, ...);

 

 

I just typed that out by memory, so don't copy and paste it, it is just to give you an idea of how its normally done.

Link to comment
Share on other sites

I've split my packet methods into the common and client proxy, thinking that if it were serverside then it would only run the CommonProxy and clientside, it would be overridden by the ClientProxy. So my PacketHandler now looks like this;

package uk.co.toomuchminecraft.sabermod;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityPlayerMP;
import net.minecraft.src.INetworkManager;
import net.minecraft.src.InventoryPlayer;
import net.minecraft.src.ItemStack;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.World;
import net.minecraft.src.WorldClient;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Side;
import cpw.mods.fml.common.asm.SideOnly;
import cpw.mods.fml.common.network.IPacketHandler;
import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.common.network.Player;

public class PacketHandler implements IPacketHandler
{
@SideOnly(Side.CLIENT)
Minecraft mc;

@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
	if (packet.channel.equals("SaberExtend"))
	{
		handleExtendPacket(packet, player);
	}

	if (packet.channel.equals("SaberSound"))
	{
		handleSoundPacket(packet, player);
	}
}

private void handleExtendPacket(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

    	int itemID;
    	int itemDamage;
    	int slot;
    	int action;
    	int saberID;
    	
	try
	{
		itemID = inputStream.readInt();
		itemDamage = inputStream.readInt();
		slot = inputStream.readInt();
		action = inputStream.readInt();
		saberID = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}

	Side side = FMLCommonHandler.instance().getEffectiveSide();
	if (side == Side.SERVER)
	{
		SaberMod.proxy.extendSaber(saberID, action, player);
		PacketDispatcher.sendPacketToAllPlayers(packet);
		SaberMod.proxy.closeInventoryChange(player);
	}
	else if (side == Side.CLIENT)
	{
		SaberMod.proxy.extendSaber(saberID, action, player);
		SaberMod.proxy.closeInventoryChange(player);
	}
}

private void handleSoundPacket(Packet250CustomPayload packet, Player player)
{
	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));

    	int sound;
    	
	try
	{
		sound = inputStream.readInt();
	}
	catch (IOException e)
	{
		e.printStackTrace();
		return;
	}

	Side side = FMLCommonHandler.instance().getEffectiveSide();
	if (side == Side.SERVER)
	{
		PacketDispatcher.sendPacketToAllPlayers(packet);
		SaberMod.proxy.playSound(sound, player);
	}
	else if (side == Side.CLIENT)
	{
		SaberMod.proxy.playSound(sound, player);
	}
}
}

 

The CommonProxy methods are;

    public void playSound(int sound, Player p)
    {
    	EntityClientPlayerMP player = (EntityClientPlayerMP)p;
    	if(sound == 0)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber retract sound");
    	}
    	
    	if(sound == 1)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber extend sound");
    	}
    	
    	if(sound == 2)
    	{
    		System.out.println("SaberMod: " + player.username + " playing lightsaber swing sound");
    	}
    }
    
public void closeInventoryChange(Player p)
{
	EntityPlayerMP player = (EntityPlayerMP)p;
	player.inventory.inventoryChanged = false;
}
    
    public void extendSaber(int saberID, int action, Player p)
    {
    	EntityPlayerMP player = (EntityPlayerMP)p;
    	if(saberID == 0)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 1)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 2)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 3)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 4)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 5)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 6)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 7)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    	if(saberID == 
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " retracting lightsaber");
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    			System.out.println("SaberMod: " + player.username + " extending lightsaber");
    		}
    	}
    }

 

and my ClientProxy methods are;

@Override
    public void playSound(int sound, Player p)
    {
    	EntityPlayerMP player = (EntityPlayerMP)p;
    	if(sound == 0)
    	{
    		player.worldObj.playSoundAtEntity((Entity)player, "sabermod.saberoff", 1F, 1F);
    	}
    	
    	if(sound == 1)
    	{
    		player.worldObj.playSoundAtEntity((Entity)player, "sabermod.saberon", 1F, 1F);
    	}
    	
    	if(sound == 2)
    	{
    		player.worldObj.playSoundAtEntity((Entity)player, "sabermod.saberswing", 1F, 1F);
    	}
    }

@Override
public void closeInventoryChange(Player p)
{
	EntityPlayerMP player = (EntityPlayerMP)p;
	player.inventory.inventoryChanged = false;
}

@Override
    public void extendSaber(int saberID, int action, Player p)
    {
	EntityPlayerMP player = (EntityPlayerMP)p; // ClientProxy(303)
	if(saberID == 0)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberPurpleOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 1)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberRedOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 2)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberYellowOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 3)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGreenOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 4)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberBlackOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 5)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberIndigoOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 6)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberDarkBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 7)
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberGoldOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    	if(saberID == 
    	{
    		if(action == 0)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOff.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    		if(action == 1)
    		{
    			InventoryPlayer inventoryplayer = player.inventory;
    			inventoryplayer.setInventorySlotContents(inventoryplayer.currentItem, new ItemStack(SaberMod.saberLightBlueOn.shiftedIndex, 1, inventoryplayer.getCurrentItem().getItemDamage()));
    			player.inventory.inventoryChanged = true;
    		}
    	}
    }

 

However, when I run the game the when calling one of these methods the client throws this error;

2012-11-23 18:26:10 [iNFO] [sTDERR] net.minecraft.src.ReportedException: Exception in world tick
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1892)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:858)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.run(Minecraft.java:783)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at java.lang.Thread.run(Unknown Source)
2012-11-23 18:26:10 [iNFO] [sTDERR] Caused by: java.lang.ClassCastException: net.minecraft.src.EntityClientPlayerMP cannot be cast to net.minecraft.src.EntityPlayerMP
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at uk.co.toomuchminecraft.sabermod.client.ClientProxy.extendSaber(ClientProxy.java:303)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at uk.co.toomuchminecraft.sabermod.PacketHandler.handleExtendPacket(PacketHandler.java:76)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at uk.co.toomuchminecraft.sabermod.PacketHandler.onPacketData(PacketHandler.java:34)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handlePacket(NetworkRegistry.java:249)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.NetworkRegistry.handleCustomPacket(NetworkRegistry.java:239)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at cpw.mods.fml.common.network.FMLNetworkHandler.handlePacket250Packet(FMLNetworkHandler.java:78)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.src.NetClientHandler.handleCustomPayload(NetClientHandler.java:1344)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.src.Packet250CustomPayload.processPacket(Packet250CustomPayload.java:70)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.src.MemoryConnection.processReadPackets(MemoryConnection.java:79)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.src.NetClientHandler.processReadPackets(NetClientHandler.java:104)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.src.WorldClient.tick(WorldClient.java:72)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1876)
2012-11-23 18:26:10 [iNFO] [sTDERR] 	... 3 more

Again I have marked the line in the code. I'm really stumped with this, can someone help?

Link to comment
Share on other sites

Use EntityPlayer references, not EntityPlayerMP(server only) or EntityClientPlayerMP(ClientSide), they BOTH inherit Entity Player, so that declaration is safe.

 

If you make sure it is serverside when you play sound at entity, the built in event bus will send the necessary packets to the clients to play sounds.

 

A client cannot tell the server to play a sound without a custom packet handler, and unless the server knows to play the sound too, you may not hear it at all, and definitely other players will not.

 

Most of the time, your methods can be accessed both by server and client, and you need to make sure which side you are on to prevent undesired packet duplication.(Servers CAN send packets to themselves.)

 

But as I said, all this is unnecessary 99% of the time, as most of your code can be accessed by the server and client.

 

You need to be careful setting up a packet handler to play sounds, because a clever coder could abuse it, spamming everyone with sounds. It is ideal to do the sound playing within the method, and avoid a packet handler when possible.

 

As I said, if the server side gets told to play a sound, it will automatically register the event and will deliver it with the built in packet handler.

Link to comment
Share on other sites

Sorry for slight necro. I'm doing some sounds using packets because I wasn't aware of what rich1051414 is saying.

 

Does that apply for simple world.playsound(...) calls, rich105? I had tried that originally with no luck, so I did the packet sending myself.

Link to comment
Share on other sites

Sorry for slight necro. I'm doing some sounds using packets because I wasn't aware of what rich1051414 is saying.

 

Does that apply for simple world.playsound(...) calls, rich105? I had tried that originally with no luck, so I did the packet sending myself.

 

Depends on the method, some methods execute client side only, i dont play sounds at all in these, but in one situation, I did need to play a sound via a packet. In onItemUseFirst overrides, if you return false to prevent a menu from opening, it will not run server side. I made a packet to handle this request, but as it also consumed items, I felt it was a low risk of abuse.

 

And yes, all my sounds are played in a "if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {}" block, and they all work great, and as an added bonus, it is inherently multiplayer compatible, other players will hear it too.

 

When I had problems playing sounds, it was when I did not put world.playSoundAtEntity calls within a server check block. This is probably your issue.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hey, Me and my friends decided to start up a Server with "a few" mods, the last few days everything went well we used all the items we wanted. Now our Game crashes the moment we touch a Lava Bucket inside our Inventory. It just instantly closes and gives me an "Alc Cleanup"  Crash screen (Using GDLauncher). I honestly dont have a clue how to resolve this error. If anyone could help id really appreciate it, I speak German and Englisch so you can choose whatever you speak more fluently. Thanks in Advance. Plus I dont know how to link my Crash Report help for that would be nice too whoops
    • I hosted a minecraft server and I modded it, and there is always an error on the console which closes the server. If someone knows how to repair it, it would be amazing. Thank you. I paste the crash report down here: ---- Minecraft Crash Report ---- WARNING: coremods are present:   llibrary (llibrary-core-1.0.11-1.12.2.jar)   WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)   AstralCore (astralsorcery-1.12.2-1.10.27.jar)   CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)   SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)   ForgelinPlugin (Forgelin-1.8.4.jar)   midnight (themidnight-0.3.5.jar)   FutureMC (Future-MC-0.2.19.jar)   SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)   Backpacked (backpacked-1.4.3-1.12.2.jar)   LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar) Contact their authors BEFORE contacting forge // There are four lights! Time: 3/28/24 12:17 PM Description: Exception in server tick loop net.minecraftforge.fml.common.LoaderException: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:89)     at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:612)     at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:219)     at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:197)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at com.google.common.eventbus.Subscriber.invokeSubscriberMethod(Subscriber.java:91)     at com.google.common.eventbus.Subscriber$SynchronizedSubscriber.invokeSubscriberMethod(Subscriber.java:150)     at com.google.common.eventbus.Subscriber$1.run(Subscriber.java:76)     at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:399)     at com.google.common.eventbus.Subscriber.dispatchEvent(Subscriber.java:71)     at com.google.common.eventbus.Dispatcher$PerThreadQueuedDispatcher.dispatch(Dispatcher.java:116)     at com.google.common.eventbus.EventBus.post(EventBus.java:217)     at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:136)     at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:595)     at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:98)     at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:333)     at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125)     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:486)     at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.NoClassDefFoundError: net/minecraft/client/multiplayer/WorldClient     at java.lang.Class.getDeclaredMethods0(Native Method)     at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)     at java.lang.Class.privateGetPublicMethods(Class.java:2902)     at java.lang.Class.getMethods(Class.java:1615)     at net.minecraftforge.fml.common.eventhandler.EventBus.register(EventBus.java:82)     at net.minecraftforge.fml.common.AutomaticEventSubscriber.inject(AutomaticEventSubscriber.java:82)     ... 31 more Caused by: java.lang.ClassNotFoundException: net.minecraft.client.multiplayer.WorldClient     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:418)     at java.lang.ClassLoader.loadClass(ClassLoader.java:351)     ... 37 more Caused by: net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerException: Exception in class transformer net.minecraftforge.fml.common.asm.transformers.SideTransformer@4e558728 from coremod FMLCorePlugin     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:260)     at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)     ... 39 more Caused by: java.lang.RuntimeException: Attempted to load class bsb for invalid side SERVER     at net.minecraftforge.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:62)     at net.minecraftforge.fml.common.asm.ASMTransformerWrapper$TransformerWrapper.transform(ASMTransformerWrapper.java:256)     ... 41 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details:     Minecraft Version: 1.12.2     Operating System: Linux (amd64) version 5.10.0-28-cloud-amd64     Java Version: 1.8.0_382, Temurin     Java VM Version: OpenJDK 64-Bit Server VM (mixed mode), Temurin     Memory: 948745536 bytes (904 MB) / 1564999680 bytes (1492 MB) up to 7635730432 bytes (7282 MB)     JVM Flags: 2 total; -Xmx8192M -Xms256M     IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0     FML: MCP 9.42 Powered by Forge 14.23.5.2860 63 mods loaded, 63 mods active     States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored     | State | ID                 | Version                 | Source                                                | Signature                                |     |:----- |:------------------ |:----------------------- |:----------------------------------------------------- |:---------------------------------------- |     | LC    | minecraft          | 1.12.2                  | minecraft.jar                                         | None                                     |     | LC    | mcp                | 9.42                    | minecraft.jar                                         | None                                     |     | LC    | FML                | 8.0.99.99               | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | forge              | 14.23.5.2860            | forge-1.12.2-14.23.5.2860.jar                         | e3c3d50c7c986df74c645c0ac54639741c90a557 |     | LC    | creativecoredummy  | 1.0.0                   | minecraft.jar                                         | None                                     |     | LC    | backpacked         | 1.4.2                   | backpacked-1.4.3-1.12.2.jar                           | None                                     |     | LC    | itemblacklist      | 1.4.3                   | ItemBlacklist-1.4.3.jar                               | None                                     |     | LC    | securitycraft      | v1.9.8                  | [1.12.2] SecurityCraft v1.9.8.jar                     | None                                     |     | LC    | aiimprovements     | 0.0.1.3                 | AIImprovements-1.12-0.0.1b3.jar                       | None                                     |     | LC    | jei                | 4.16.1.301              | jei_1.12.2-4.16.1.301.jar                             | None                                     |     | LC    | appleskin          | 1.0.14                  | AppleSkin-mc1.12-1.0.14.jar                           | None                                     |     | LC    | baubles            | 1.5.2                   | Baubles-1.12-1.5.2.jar                                | None                                     |     | LC    | astralsorcery      | 1.10.27                 | astralsorcery-1.12.2-1.10.27.jar                      | a0f0b759d895c15ceb3e3bcb5f3c2db7c582edf0 |     | LC    | attributefix       | 1.0.12                  | AttributeFix-Forge-1.12.2-1.0.12.jar                  | None                                     |     | LC    | atum               | 2.0.20                  | Atum-1.12.2-2.0.20.jar                                | None                                     |     | LC    | bloodmoon          | 1.5.3                   | Bloodmoon-MC1.12.2-1.5.3.jar                          | d72e0dd57935b3e9476212aea0c0df352dd76291 |     | LC    | forgelin           | 1.8.4                   | Forgelin-1.8.4.jar                                    | None                                     |     | LC    | bountiful          | 2.2.2                   | Bountiful-2.2.2.jar                                   | None                                     |     | LC    | camera             | 1.0.10                  | camera-1.0.10.jar                                     | None                                     |     | LC    | chisel             | MC1.12.2-1.0.2.45       | Chisel-MC1.12.2-1.0.2.45.jar                          | None                                     |     | LC    | collective         | 3.0                     | collective-1.12.2-3.0.jar                             | None                                     |     | LC    | reskillable        | 1.12.2-1.13.0           | Reskillable-1.12.2-1.13.0.jar                         | None                                     |     | LC    | compatskills       | 1.12.2-1.17.0           | CompatSkills-1.12.2-1.17.0.jar                        | None                                     |     | LC    | creativecore       | 1.10.0                  | CreativeCore_v1.10.71_mc1.12.2.jar                    | None                                     |     | LC    | customnpcs         | 1.12                    | CustomNPCs_1.12.2-(05Jul20).jar                       | None                                     |     | LC    | darknesslib        | 1.1.2                   | DarknessLib-1.12.2-1.1.2.jar                          | 220f10d3a93b3ff5fbaa7434cc629d863d6751b9 |     | LC    | dungeonsmod        | @VERSION@               | DungeonsMod-1.12.2-1.0.8.jar                          | None                                     |     | LC    | enhancedvisuals    | 1.3.0                   | EnhancedVisuals_v1.4.4_mc1.12.2.jar                   | None                                     |     | LC    | extrautils2        | 1.0                     | extrautils2-1.12-1.9.9.jar                            | None                                     |     | LC    | futuremc           | 0.2.6                   | Future-MC-0.2.19.jar                                  | None                                     |     | LC    | geckolib3          | 3.0.30                  | geckolib-forge-1.12.2-3.0.31.jar                      | None                                     |     | LC    | gottschcore        | 1.15.1                  | GottschCore-mc1.12.2-f14.23.5.2859-v1.15.1.jar        | None                                     |     | LC    | hardcorerevival    | 1.2.0                   | HardcoreRevival_1.12.2-1.2.0.jar                      | None                                     |     | LC    | waila              | 1.8.26                  | Hwyla-1.8.26-B41_1.12.2.jar                           | None                                     |     | LE    | imsm               | 1.12                    | Instant Massive Structures Mod 1.12.2.jar             | None                                     |     | L     | journeymap         | 1.12.2-5.7.1p2          | journeymap-1.12.2-5.7.1p2.jar                         | None                                     |     | L     | mobsunscreen       | @version@               | mobsunscreen-1.12.2-3.1.5.jar                         | None                                     |     | L     | morpheus           | 1.12.2-3.5.106          | Morpheus-1.12.2-3.5.106.jar                           | None                                     |     | L     | llibrary           | 1.7.20                  | llibrary-1.7.20-1.12.2.jar                            | None                                     |     | L     | mowziesmobs        | 1.5.8                   | mowziesmobs-1.5.8.jar                                 | None                                     |     | L     | nocubessrparmory   | 3.0.0                   | NoCubes_SRP_Combat_Addon_3.0.0.jar                    | None                                     |     | L     | nocubessrpnests    | 3.0.0                   | NoCubes_SRP_Nests_Addon_3.0.0.jar                     | None                                     |     | L     | nocubessrpsurvival | 3.0.0                   | NoCubes_SRP_Survival_Addon_3.0.0.jar                  | None                                     |     | L     | nocubesrptweaks    | V4.1                    | nocubesrptweaks-V4.1.jar                              | None                                     |     | L     | patchouli          | 1.0-23.6                | Patchouli-1.0-23.6.jar                                | None                                     |     | L     | artifacts          | 1.1.2                   | RLArtifacts-1.1.2.jar                                 | None                                     |     | L     | rsgauges           | 1.2.8                   | rsgauges-1.12.2-1.2.8.jar                             | None                                     |     | L     | rustic             | 1.1.7                   | rustic-1.1.7.jar                                      | None                                     |     | L     | silentlib          | 3.0.13                  | SilentLib-1.12.2-3.0.14+168.jar                       | None                                     |     | L     | scalinghealth      | 1.3.37                  | ScalingHealth-1.12.2-1.3.42+147.jar                   | None                                     |     | L     | lteleporters       | 1.12.2-3.0.2            | simpleteleporters-1.12.2-3.0.2.jar                    | None                                     |     | L     | spartanshields     | 1.5.5                   | SpartanShields-1.12.2-1.5.5.jar                       | None                                     |     | L     | spartanweaponry    | 1.5.3                   | SpartanWeaponry-1.12.2-1.5.3.jar                      | None                                     |     | L     | srparasites        | 1.9.18                  | SRParasites-1.12.2v1.9.18.jar                         | None                                     |     | L     | treasure2          | 2.2.0                   | Treasure2-mc1.12.2-f14.23.5.2859-v2.2.1.jar           | None                                     |     | L     | treeharvester      | 4.0                     | treeharvester_1.12.2-4.0.jar                          | None                                     |     | L     | twilightforest     | 3.11.1021               | twilightforest-1.12.2-3.11.1021-universal.jar         | None                                     |     | L     | variedcommodities  | 1.12.2                  | VariedCommodities_1.12.2-(31Mar23).jar                | None                                     |     | L     | voicechat          | 1.12.2-2.4.32           | voicechat-forge-1.12.2-2.4.32.jar                     | None                                     |     | L     | wolfarmor          | 3.8.0                   | WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar | None                                     |     | L     | worldborder        | 2.3                     | worldborder_1.12.2-2.3.jar                            | None                                     |     | L     | midnight           | 0.3.5                   | themidnight-0.3.5.jar                                 | None                                     |     | L     | structurize        | 1.12.2-0.10.277-RELEASE | structurize-1.12.2-0.10.277-RELEASE.jar               | None                                     |     Loaded coremods (and transformers):  llibrary (llibrary-core-1.0.11-1.12.2.jar)   net.ilexiconn.llibrary.server.core.plugin.LLibraryTransformer   net.ilexiconn.llibrary.server.core.patcher.LLibraryRuntimePatcher WolfArmorCore (WolfArmorAndStorage-1.12.2-3.8.0-universal-signed.jar)    AstralCore (astralsorcery-1.12.2-1.10.27.jar)    CreativePatchingLoader (CreativeCore_v1.10.71_mc1.12.2.jar)    SecurityCraftLoadingPlugin ([1.12.2] SecurityCraft v1.9.8.jar)    ForgelinPlugin (Forgelin-1.8.4.jar)    midnight (themidnight-0.3.5.jar)   com.mushroom.midnight.core.transformer.MidnightClassTransformer FutureMC (Future-MC-0.2.19.jar)   thedarkcolour.futuremc.asm.CoreTransformer SpartanWeaponry-MixinLoader (SpartanWeaponry-1.12.2-1.5.3.jar)    Backpacked (backpacked-1.4.3-1.12.2.jar)   com.mrcrayfish.backpacked.asm.BackpackedTransformer LoadingPlugin (Reskillable-1.12.2-1.13.0.jar)   codersafterdark.reskillable.base.asm.ClassTransformer LoadingPlugin (Bloodmoon-MC1.12.2-1.5.3.jar)   lumien.bloodmoon.asm.ClassTransformer     Profiler Position: N/A (disabled)     Is Modded: Definitely; Server brand changed to 'fml,forge'     Type: Dedicated Server (map_server.txt)
    • When i add mods like falling leaves, visuality and kappas shaders, even if i restart Minecraft they dont show up in the mods menu and they dont work
    • Delete the forge-client.toml file in your config folder  
    • If you are using AMD/ATI, get the latest drivers from their website - do not update via system  
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.