minquist
-
Posts
7 -
Joined
-
Last visited
Posts posted by minquist
-
-
Yes, it is totally possible.
What are you doing wrong?
- How is the unlocalized name relevant here?
- Use
ModelLoader.setCustomModelResourceLocation
in preInit, not the
ItemModelMesher
.
- Why generate the ModelResourceLocation painfully manually like that?
new ModelResourceLocation(item.getRegistryName(), "inventory")
will work fine and allow you to use the same for every item.
- Why are you still on 1.8.9?
If that does not fix it, post more of your code.
Thanks, that helped a lot. Don't know really why it was a problem. ;-)
We are using 1.8.9 because we don't want to have some 1.9 and 1.10 features of Minecraft within our project.
- How is the unlocalized name relevant here?
-
Hi togehter,
In my mod I define an item-class which is used for several items with different properties.
Every single kind of this item has an own unlocalized name ("item_diarybook_digger_day_" + an integer) - but every kind of the item has the same texture.
Then I try to register the item using
Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(ModItems.item_diarybook_digger[i], 0, new ModelResourceLocation(modid + ":item_diarybook_digger", "inventory"));
I hoped that a single Model-Definition, named "item_diarybook_digger.json" can be used, but I get the model definition not found error
[Client thread/ERROR] [FML]: Exception loading model for variant testmod:item_diarybook_digger_day_365#inventory for item "testmod:item_diarybook_digger_day_365" java.lang.Exception: Could not load model definition for variant testmod:item_diarybook_digger_day_365#inventory
Is it possible to use one model-definition file for serveral items? If so: What I'm doing wrong?
Thanks and best,
minquist
-
Uuuuhhhh.... thats not what i wanted to hear... ;-)
Do you know a good method to debug pluginmessages?
Showing all incoming and outgoing plugin messages in forge and in spigot/bukkit?
-
Okay, thanks, i've corrected the byte[]-things. It totally clear.
But it doesn't solve my problem.
I do not receive any pluginmessages on both sides.
I changed it to outgoing only on bukkit-side to first get this way running.
Forge-Side:
@EventHandler public void preInit(FMLPreInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel("Channel"); network.registerMessage(CommunicationMessage.Handler.class, CommunicationMessage.class, 0, Side.CLIENT); System.out.println("Channel registered as CLIENT Side with 0"); }
public class CommunicationMessage implements IMessage { public CommunicationMessage() { } @Override public void fromBytes(ByteBuf byteBuf) { } @Override public void toBytes(ByteBuf byteBuf) { } public static class Handler implements IMessageHandler<CommunicationMessage, IMessage> { @Override public IMessage onMessage(CommunicationMessage message, MessageContext ctx) { System.out.println(String.format("Received")); return null; // no response in this case } } }
Bukkit-Side:
@Override public void onEnable() { Bukkit.getMessenger().registerOutgoingPluginChannel(this, "Channel"); //Bukkit.getMessenger().registerIncomingPluginChannel(this, "Channel", new PacketHandler(this)); this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this); }
public void onPluginMessageReceived(String channel, Player player, byte[] message) { if(channel.equalsIgnoreCase("Channel")) { System.out.println(message[0]); } }
JoinListener: event.getPlayer().sendPluginMessage(plugin, "Channel", new byte[]{0});
Any other ideas?
-
I've read this post and the other tutorial ~10 times.
I don't see any differences between my code and the code in the post you provided (except the discriminator, but there i tried both). Have I overlooked some thing?
-
Hello@all,
I'm Googling since yesterday morning and followed every interesting thread in this forum, the bukkit forum and many other sources, but my problem is not solved.
I want to communicate between a mod and my spigot server. But neither messages sent from forge nor the messages sent from spigot/bukkit are received on the other side.
What I do:
Forge-Side:
@EventHandler public void preInit(FMLPreInitializationEvent event) { network = NetworkRegistry.INSTANCE.newSimpleChannel("Channel"); network.registerMessage(CommunicationMessage.Handler.class, CommunicationMessage.class, 0, Side.CLIENT); System.out.println("Channel registered as CLIENT Side with 0"); }
public class CommunicationMessage implements IMessage { private String text; public CommunicationMessage() { } public CommunicationMessage(String text) { this.text = text; } @Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); } public static class Handler implements IMessageHandler<CommunicationMessage, IMessage> { @Override public IMessage onMessage(CommunicationMessage message, MessageContext ctx) { System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName())); return null; // no response in this case } } }
On the Spigot/Bukkit Side
@Override public void onEnable() { Bukkit.getMessenger().registerOutgoingPluginChannel(this, "Channel"); Bukkit.getMessenger().registerIncomingPluginChannel(this, "Channel", new PacketHandler(this)); this.getServer().getPluginManager().registerEvents(new PlayerLoginListener(this), this); }
public void onPluginMessageReceived(String channel, Player player, byte[] message) { if(channel.equalsIgnoreCase("Channel")) { Bukkit.broadcastMessage(message.toString()); if(message.toString().equalsIgnoreCase(((byte)0)+"reg")) { if(!plugin.players.contains(player)) plugin.players.add(player); } } }
So. What i want to do - i know that currently my forge mod have no code to answer ;-):
When the player joins the Spigot/Bukkit Server, Spigot/Bukkit sends "reg" over "Channel".
When forge receives "reg" over Channel it should answer with "reg" over channel. So, Spigot/Bukkit knows the players using the Forge Mod.
So. What i am doing wrong?
Should i to it another way?
Who can help?
Many thanks!
[1.8.9] Use one Model for different Items?
in Modder Support
Posted
Don't worry, I am using metadata for that. My question was a general question. ;-)