Jump to content

DoctorOne

Members
  • Posts

    15
  • Joined

  • Last visited

Everything posted by DoctorOne

  1. Fuck me. Its all about that gradle Thank you for all the help.
  2. Exported from Eclipse Fuck do I need the gradle build that ? Let me test that
  3. Here [19:15:38] [Netty Server IO #6/ERROR] [FML]: There was a critical exception handling a packet on channel mkrex java.lang.NoSuchFieldError: player at com.mahmudkocas.realextras.MyMessageHandler.onMessage(MyMessageHandler.java:32) ~[MyMessageHandler.class:?] at com.mahmudkocas.realextras.MyMessageHandler.onMessage(MyMessageHandler.java:1) ~[MyMessageHandler.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:56) ~[SimpleChannelHandlerWrapper.class:?] at net.minecraftforge.fml.common.network.simpleimpl.SimpleChannelHandlerWrapper.channelRead0(SimpleChannelHandlerWrapper.java:36) ~[SimpleChannelHandlerWrapper.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) ~[SimpleChannelInboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:?] at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102) ~[MessageToMessageDecoder.class:?] at io.netty.handler.codec.MessageToMessageCodec.channelRead(MessageToMessageCodec.java:111) ~[MessageToMessageCodec.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) ~[DefaultChannelPipeline$HeadContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) ~[AbstractChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) ~[DefaultChannelPipeline.class:?] at io.netty.channel.embedded.EmbeddedChannel.writeInbound(EmbeddedChannel.java:274) ~[EmbeddedChannel.class:?] at net.minecraftforge.fml.common.network.internal.FMLProxyPacket.func_148833_a(FMLProxyPacket.java:99) [FMLProxyPacket.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:147) [gw.class:?] at net.minecraft.network.NetworkManager.channelRead0(NetworkManager.java:49) [gw.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.handleServerSideCustomPacket(NetworkDispatcher.java:452) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:264) [NetworkDispatcher.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.channelRead0(NetworkDispatcher.java:72) [NetworkDispatcher.class:?] at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [SimpleChannelInboundHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [ByteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [ByteToMessageDecoder.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [ByteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [ByteToMessageDecoder.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:293) [ByteToMessageDecoder.class:?] at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:267) [ByteToMessageDecoder.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287) [IdleStateHandler.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340) [AbstractChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1334) [DefaultChannelPipeline$HeadContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362) [AbstractChannelHandlerContext.class:?] at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348) [AbstractChannelHandlerContext.class:?] at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:926) [DefaultChannelPipeline.class:?] at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:134) [AbstractNioByteChannel$NioByteUnsafe.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476) [NioEventLoop.class:?] at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) [NioEventLoop.class:?] at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_201]
  4. Well, I forget to edit that. I changed code, I am only using this class at client. And I changed the SideOnly to EventBusSubscriber but still getting the error. Code @EventBusSubscriber(modid = Main.MODID, value = Side.CLIENT) public class EventsClientSide {
  5. Now I am getting different error, and what is with this The Code is as below public IMessage onMessage(MyMessage message, MessageContext ctx) { if(Main.SIDE == Side.SERVER) { if(Main.SHOULD_KICK) { try { ctx.getServerHandler().player.getServerWorld().addScheduledTask(()-> { //Thats where error refers, the player object. What could be the possible problem here ? Like how the hell is this not getting player?
  6. I need that class to load tho. And crash happens at client-side.
  7. Yes, but I want to put more in it. Its not that annoying. Hahaha, this really got me.
  8. Noice I just started to Forge API. But I was gonna say, put the information tab left side.
  9. But if you still wanna do networking for something else, The Documentation is located at: https://mcforge.readthedocs.io/en/latest/networking/simpleimpl/ . All I can say about it is: "It is pain in the ass." Don't even go for it unless, you really need it. Just saying.
  10. if(SIDE == Side.SERVER) { EventsServerSide eventsServerSide = new EventsServerSide(); } else { EventsClientSide eventsClientSide = new EventsClientSide(); } I am checking that before hand. I am getting side in PreInit @EventHandler public void preInit(FMLPreInitializationEvent event) { SIDE = event.getSide(); } Edit: Wait, can't I use this at client? I thought I can't use it at Server
  11. I am trying to send client only message. The code itself works when I run my client with Eclipse. But when I put my mod in a mod pack, it just doesn't. Also I am calling "getMinecraft()" at client not server. And crashing side is also client. The Code @SideOnly(Side.CLIENT) public class EventsClientSide { public EventsClientSide() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void clientTick(ClientTickEvent event) { if(Main.MESSAGE_RECEIVED_CLIENT) { Minecraft.getMinecraft().player.sendMessage(new TextComponentString("You have joined to server!")); Main.MESSAGE_RECEIVED_CLIENT = false; } } } The error I don't know whats wrong. I tried both Forge builds[Recommended and Latest]. It just denies to work. I am new to Forge API. It's been 3 days, I am working on it. Everything was fine and working at test phase. Then I put the mod inside a mod pack, it started to give me errors. Solid red pages. Then booom client crashes.
  12. So if anyone needs in the future, below is the way I solved my problem. @SubscribeEvent public static void mouseEvent(MouseEvent event) { if(Main.SIDE == Side.CLIENT && Main.IS_PLAYER_IN_SERVER) { Main.IS_PLAYER_IN_SERVER = false; Minecraft.getMinecraft().addScheduledTask(() -> { Main.network.sendToServer(new MyMessage("Message")); }); } } @SubscribeEvent public static void clientSideJoin(ClientConnectedToServerEvent event) { Main.IS_PLAYER_IN_SERVER = true; } @SubscribeEvent public static void clientSideDisconnect(ClientDisconnectionFromServerEvent event) { Main.IS_PLAYER_IN_SERVER = false; } If anyone wonders where I get SIDE from, I get "SIDE" in PreInit: @EventHandler public static void PreInit(FMLPreInitializationEvent event) { SIDE = event.getSide(); }
  13. What a bitch. Yeah, I have some experience with that. You guys are right at that point. But I am thinking this will be the case if I publish the mod publicly. I am running small server, generally kids are playing in. They know how to install the mod but i don't think if they know how to bypass. Well, if they know how to bypass then "You can cheat, but don't get caught!" rule works. Anyway I am still gonna try and make this mod. Thx all of you!
  14. Yeah.. I know that much, but I wanna do what I can. And if client doesn't send the message or sends inappropriate message, I am thinking "kick the client" anyway. So whole "if else" is unnecessary. Because it has to be registered both sides. And I can't use the "onMessage" becuz Minecraft just doesn't work like that. Also I can't send messages with "ClientConnectedToServerEvent" since its too early for that. So I need to use an event like, walking and kind of that things. Hopefully those work. Thx!
  15. First of all, I am new to Forge API(3-4 Hours) but I have some experiences with Java. So here is my purpose: I want to make a mod that checks all the mods client has at the folder and sends the list to Server. Than server kicks if anyone changed the mods or added any new the mods. My Question is: How do I send message to Server. I followed this tutorial and checked this one. They helped quite a lot. But I can't send the data pack to Server. Client receives the pack and according to debug I have done, its also sending the packet but Server is not reading it. I don't know if I am doing something wrong, is there a way to force Server to read the message? Here is the code: Initialization(in-it) @EventHandler public static void init(FMLInitializationEvent event) { if(SIDE == Side.CLIENT) { network.registerMessage(MyMessageHandler.class, MyMessage.class, PACKET_ID, Side.CLIENT); System.out.println("LOOK ITS CLIENT!"); } if(SIDE == Side.SERVER) { network.registerMessage(MyMessageHandler.class, MyMessage.class, PACKET_ID, Side.SERVER); System.out.println("LOOK ITS SERVER!"); } MinecraftForge.EVENT_BUS.register(ServerSideJoin.class); My Message.Class public class MyMessage implements IMessage { public MyMessage(){} public CharSequence toSend; public MyMessage(String toSend) { this.toSend = toSend; Main.PACKET_ID++; } @Override public void toBytes(ByteBuf buf) { System.out.println("TO BYTESS!!!!!!!!!"); buf.writeCharSequence(toSend, Charset.defaultCharset()); registerMessage(); } @Override public void fromBytes(ByteBuf buf) { System.out.println("FROM BYTESS!!!!!!!!!"); toSend = buf.readCharSequence(buf.readableBytes(), Charset.defaultCharset()); registerMessage(); } public void registerMessage() { if(Main.SIDE == Side.CLIENT) { Main.PACKET_ID++; Main.network.registerMessage(MyMessageHandler.class, MyMessage.class, Main.PACKET_ID, Side.CLIENT); System.out.println("LOOK ITS CLIENT!"); } if(Main.SIDE == Side.SERVER) { Main.PACKET_ID++; Main.network.registerMessage(MyMessageHandler.class, MyMessage.class, Main.PACKET_ID, Side.SERVER); System.out.println("LOOK ITS SERVER!"); } } } Handler public class MyMessageHandler implements IMessageHandler<MyMessage, IMessage> { // Do note that the default constructor is required, but implicitly defined in this case public MyMessageHandler() { // TODO Auto-generated constructor stub } @Override public IMessage onMessage(MyMessage message, MessageContext ctx) { System.out.println("RECEIVED!!!"); System.out.println("THE MESSAGE : " + message.toSend); if(Main.SIDE == Side.CLIENT) { Main.network.sendToServer(new MyMessage("MESSAGE FROM CLIENT!!!!")); } return null; } } When Player Joins, Server Sends the Packet public class ServerSideJoin { @SubscribeEvent public static void onPlayerJoin(EntityJoinWorldEvent event) { if(event.getEntity() instanceof EntityPlayerMP) { Main.network.sendTo(new MyMessage("THE MESSAGE FROM SERVER"), (EntityPlayerMP) event.getEntity()); } } } Thx
×
×
  • Create New...

Important Information

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