• Recently Browsing

    No registered users viewing this page.

  • Posts

    • I upload the log. Here is one part of the log, it appears when I join the game. It starts at line 16620. [22一月2020 19:05:17.222] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Dev加入了游戏 [22一月2020 19:05:17.344] [Render thread/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index -1 [22一月2020 19:05:17.344] [Render thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake [22一月2020 19:05:18.760] [Server thread/INFO] [net.minecraft.server.integrated.IntegratedServer/]: Saving and pausing game... [22一月2020 19:05:18.985] [Render thread/INFO] [net.minecraft.advancements.AdvancementList/]: Loaded 12 advancements [22一月2020 19:05:19.007] [Server thread/INFO] [net.minecraft.server.MinecraftServer/]: Saving chunks for level 'RhodesIsland'/minecraft:overworld [22一月2020 19:05:19.683] [Server thread/DEBUG] [net.minecraftforge.fml.FMLWorldPersistenceHook/WP]: Gathering id map for writing to world save RhodesIsland [22一月2020 19:05:19.881] [Server thread/DEBUG] [net.minecraftforge.fml.network.FMLLoginWrapper/FMLHANDSHAKE]: Recieved login wrapper packet event for channel fml:handshake with index -1 [22一月2020 19:05:19.881] [Server thread/ERROR] [net.minecraftforge.fml.network.simple.IndexedMessageCodec/SIMPLENET]: Received empty payload on channel fml:handshake   The item will send a packet to server when it is left clicked. The method is in BaseItem.java public void emptyLeftClick(PlayerInteractEvent.LeftClickEmpty event){ PacketHandler.HANDLER.sendToServer(new LeftClickPacket()); }   And "leftclick" method will be called like this: LeftClickPacket.java package arknights.network.packets; import arknights.item.BaseItem; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.network.PacketBuffer; import net.minecraftforge.fml.network.NetworkEvent; import java.util.function.Supplier; public class LeftClickPacket { public static void encode(LeftClickPacket msg, PacketBuffer buf){ } public static LeftClickPacket decode(PacketBuffer buf){ return new LeftClickPacket(); } public static class Handler { public static void handle(LeftClickPacket msg, Supplier<NetworkEvent.Context> ctx){ ctx.get().enqueueWork(() -> { PlayerEntity player = ctx.get().getSender(); ItemStack item = player.getHeldItemMainhand(); if(!item.isEmpty() && (item.getItem() instanceof BaseItem)){ ((BaseItem) item.getItem()).leftClick(player, player.getEntityWorld(), item); } }); ctx.get().setPacketHandled(true); } } } leftClick method (inside my item class): public void leftClick(LivingEntity livingEntity, World worldIn, ItemStack stack){ System.out.print("A"); } Does it mean the packet is successfully sent?
    • Then when you have to work with GUIs are you building your own system that extends the usual screen and screenContainer class or are you still using the Minecraft's one and just keep the "messyness"?
    • That depends on what the register method does. If all other code is unchanged then this still applies:   Post the complete debug.log.   How would it? Printing "A" to the console does not tell you anything about the state of your packet.
    • I hate bumping topics, but I'm genuinely curious about this.   No input from anyone huh?
    • Make sure it's the latest Java 8, and not the latest version of Java (Which I believe is Java 13)  
  • Topics

  • Who's Online (See full list)