Actually, that was the point i got to that is beyond me. I can debug, i can get console messages, i can check locals and function returns...
and while the message context says its on the server, but forge documentation says you can't use the in-code like Side or world.isRemote methods to double check that, and when i do use them they say its on the client
And i have made sure the message is being registered to execute on the server, and its only called in one place on the client
//registration
INSTANCE.registerMessage(MessageCustomButtonPressed.MessageCustonButtonPressedHandler.class, MessageCustomButtonPressed.class, 0, Side.SERVER);
//only on button press
ModNetworkHandler.sendToServer(new MessageCustomButtonPressed(GUIHandler.GuiIDs.DUPLICATIONTABLE.ordinal(), myTable.getPos()));
//message handling
@Override
public IMessage onMessage(MessageCustomButtonPressed message, MessageContext ctx) {
EntityPlayerMP serverPlayer = ctx.getServerHandler().playerEntity;
if(ctx.side == Side.SERVER) {
handleServerSide(message, serverPlayer);
}
return null;
}
public void handleServerSide(MessageCustomButtonPressed message, EntityPlayer player) {
switch(GUIHandler.GuiIDs.values()[message.guiID]){
case DUPLICATIONTABLE:
System.out.println("You pressed the dupe button");
final TileEntityDuplicationTable entity =((TileEntityDuplicationTable) Minecraft.getMinecraft().world.getTileEntity(message.blockPosition));
player.getServer().addScheduledTask(new Runnable() {
@Override
public void run() {
entity.duplicate();
}
});
break;
default:
break;
}
}
The entity duplicate function IS being called once, but like i said the methods i know of think its on the client side, while the message context ctx say its server side