Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

hetRemis

Members
  • Posts

    3
  • Joined

  • Last visited

hetRemis's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I found the issue. Apparently it had nothing to do with my packets but with my custom recipe type. I didn't read everything from the buffer which was causing the issue.
  2. Init is called from my main class like this public static void setup(FMLCommonSetupEvent event) { event.enqueueWork(()->{ PacketHandler.init(); }); } I also changed my encode and decode to static but that didn't change anything
  3. I have a tile entity that is used for crafting but I don't want it to craft things every tick. To achieve this I added a button that sends a package to the server whenever it needs to do the crafting. I have no idea what I am doing wrong at this point and I cannot find the cause of the issue in the minecraft code because the exception stack does not reference any of my classes. I am relatively new to minecraft modding and java in general which also isn't very helpful. However I have done my homework and have enough knowledge to know what I actually am doing and not just blindly copy pasting code from tutorials so calling me out to learn java will not help me in any capacity. I am stuck with this problem for about a week now and this is the last place I can think of that can help me It works flawlessly in singleplayer but whenever I try to join a server with this mod installed I get an error message on my screen saying Inside Debug.log it says I have compared my way of making the packets with multiple mods I found on curseforge most are the same way as I do it. I have asked around in multiple forge and modding related discord servers but no one was able to help me with my problem. All tutorials on youtube did the same as I did. My PacketHandler class looks like this: public static final String PROTOCOL_VERSION = "1"; public static SimpleChannel CHANNEL; public static void init() { int index =0; CHANNEL = NetworkRegistry.ChannelBuilder .named(new ResourceLocation("pepsimc","simple_network")) .clientAcceptedVersions(PROTOCOL_VERSION::equals) .serverAcceptedVersions(PROTOCOL_VERSION::equals) .networkProtocolVersion(()->PROTOCOL_VERSION) .simpleChannel(); CHANNEL.messageBuilder(ProcessingCraftPacket.class, index++, NetworkDirection.PLAY_TO_SERVER) .encoder(ProcessingCraftPacket::encode) .decoder(ProcessingCraftPacket::new) .consumer(ProcessingCraftPacket::handle) .add(); LogManager.getLogger().debug(CHANNEL); } My packet class looks like this: public final BlockPos Pos; public ProcessingCraftPacket(BlockPos Pos) { this.Pos = Pos; } public ProcessingCraftPacket(PacketBuffer buffer) { this(buffer.readBlockPos()); } public void encode(PacketBuffer buffer) { buffer.writeBlockPos(this.Pos); } public static void handle(ProcessingCraftPacket message, Supplier<NetworkEvent.Context> ctx) { ctx.get().enqueueWork(()->{ final TileEntity TE = ctx.get().getSender().level.getBlockEntity(message.Pos); if(TE instanceof ProcessingTile) { final ProcessingTile PT = (ProcessingTile) TE; PT.process(ctx.get().getSender().level); } }); ctx.get().setPacketHandled(true); } Thanks alot in advance.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.