• 0

    posted a message on player kicked by clicking button in item gui

    Thanks Heaps for all your help

    Posted in: Modification Development
  • 0

    posted a message on Make player chat message
    Quote from CosmicDan»

    Packets were a bit of a PITA when I first got used to them, so fair enough. But I really do need to stress how important they are - there's no getting around them I'm afraid.


    I'm not sure I understand your goal, so I can't say whether you can get away without using packets in this particular case. But you eventually will need to.


    Mind linking me to that thread? I can't find it. Maybe I can help. My first packet work was in 1.7.10 and I still have the source on GitHub for it, so it'll be easy for me to share by example.


    Sorry for slow reply fell asleep haha.


    Yeah you can say that again, certainly are a little hard to get your head around, I agree it would be preferable to have the intended packets working properly.


    My goal for this thread (even if I get packets working it's still a point of interest) was to see if you could send a message as if it had been typed by a player triggered by the player in another way like clicking a button/ standing or clicking a block ect. and have it be treated exactly the same as a normal message typed and sent by that player.


    Here is a link to the open thread about packet issues. It's titled about and shows examples of a particular item but the issue relates to all cases where a custom packet is triggered by a player other then the one who started off in single player (host in multiplayer).

    Any Help you could provide would be greatly appreciated.

    Posted in: Modification Development
  • 0

    posted a message on Make player chat message

    yeah I understand they are meant to work for multiplayer. I have followed a couple tutorials and thought i had everything working until the first time i actually used them in multiplayer... worked just fine for me as the hosting pc on lan network... but any time a packet was sent for any other player they are kicked by server, there is an open thread and have been trying to figure out myself but with no luck...


    This was more an experiment to see if I could get it done another way as have already spent more hours than id like to count on this packet code that only works in single player or for the hosting PC

    Posted in: Modification Development
  • 0

    posted a message on Make player chat message

    well considering it took at least 2 hours to add this to my code i don't know that lazy is the right word, but packets do not work with multiplayer so had to come up with something else.

    Posted in: Modification Development
  • 0

    posted a message on Make player chat message
    Quote from CosmicDan»

    I smell malicious intent, so I'm only going to be vague. Look for the code for death messages, they're "announced" to all players and don't show the [CHAT] prefix.


    One thing though, if this is designed for mod-related feedback, using the chat window is a really lazy and annoying way to do it. I don't know what you're trying to do but consider using the "Achievement notification" method instead.


    No malicious intent just investigating weather this could be used as a work around for the million problems I'v had trying to work out how to use packets.


    The Event I have set up allows me to set NBT values of custom items in hand and nearby custom tile entities (within 32 blocks + or - on x/zaxis and within 6 blocks + or - on yaxis) works as intended with manual input from player. I made this because players couldn't use GUI's i made in multiplayer because of problematic packet code, if i can "spam" a player chat message as if the player themselves had typed out the message and trigger the event I will be able to re-enable the GUI's and it will be a complete work around... no more Packets so no more problems

    Posted in: Modification Development
  • 0

    posted a message on Make player chat message

    I'm looking for a way to have my code generate a chat message that will act as though it was typed and sent by the player.

    I already know how to print strings to the chat field, though that doesn't achieve what i'm going for.


    I have a ServerChatEvent registered that i would like to trigger automatically from somewhere else by faking a user message to trigger it, though the methods I'm aware of to add chat text don't seem to trigger the event and are logged in the console as [CHAT] "message" when legitimate player chat logs as <player> "message"


    Ideally the generated message will never actually be displayed, but instead be cancelled and replaced by the ServerChatEvent


    Thanks for any advise you guys can provide

    Posted in: Modification Development
  • 0

    posted a message on player kicked by clicking button in item gui
    Quote from jabelar»

    The error specifically says that the string length is longer than allowed (256). Trace the generation of whatever that string is and see why it is so long.


    I am trying but It's very confusing that is why i am asking for help, I have tried reducing the amount of information my packets contain to just one value still this occurs even though from what i could gather the number of readable bytes directly effects this error does that imply just an empty packet is too many readable bytes? and if so how can that be fixed


    Is it possible for me to somehow add console prints to the sections of source code this is using to help further investigate this myself, i don't seem to just be able to edit code in those classes freely


    Thanks

    Posted in: Modification Development
  • 0

    posted a message on player kicked by clicking button in item gui

    Anyone?????

    Posted in: Modification Development
  • 0

    posted a message on player kicked by clicking button in item gui

    Has Anyone had this problem before or maybe know whats causing this?

    Posted in: Modification Development
  • 0

    posted a message on Event issues

    Thank you so much. Now my potion effects won't be cleared unnecessarily! :D


    np

    Posted in: Modification Development
  • 1

    posted a message on Event issues

    I think issue is using player method to try to cancel the event.

    also not sure if player.isEating() will return true at the point this is called.

    event.setCanceled(true); works have tested bellow code with 1.7.10


    @SubscribeEvent
    public void eatFish(PlayerUseItemEvent.Start event){
    Item item = event.item.getItem();
    if(item == Items.fish || item == Items.cooked_fished){
    event.setCanceled(true);
    }
    }

    Posted in: Modification Development
  • 0

    posted a message on Ticking Entity (player) crash
    ec3

    best guess looking at names in your mod list this could be in essentialcraft3?

    Caused by EntityPlayerClientMP returning null
    Posted in: Java Edition Support
  • 0

    posted a message on player kicked by clicking button in item gui

    OK that gave me a little more info but still stuck.


    Edit - here are logs for Kicked player, Hosting Player and Single Player

    Kicked log


    [02:41:38] [Client thread/INFO]: [CHAT] Player934 has just earned the achievement [Taking Inventory] // get out item
    [02:48:48] [Client] [gui.GuiBuildTool:actionPerformed:151]: SEND is TRUE - Generate Packet - CLIENT >> SERVER
    [02:41:50] [Client] [network.BuildPacket:<init>:26]: Constructing Packet
    [02:41:50] [Client] [network.PacketHandler:sendToServer:31]: Sending Packet To Server
    [02:41:50] [Client] [network.BuildPacket:toBytes:44]: Writing To Bytes
    [02:41:50] [Client thread/INFO] [FML]: Applying holder lookups // Connection lost/kicked
    [02:41:50] [Client thread/INFO] [FML]: Holder lookups applied


    Host log


    [02:29:38] [Netty IO #3/ERROR] [FML]: NetworkDispatcher exception
    io.netty.handler.codec.DecoderException: java.io.IOException: The received string length is longer than maximum allowed (25 > 20)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[ByteToMessageDecoder.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:131) ~[ByteToMessageDecoder.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:173) [ByteToMessageDecoder.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103) [MessageToMessageDecoder.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.timeout.ReadTimeoutHandler.channelRead(ReadTimeoutHandler.java:149) [ReadTimeoutHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(DefaultChannelHandlerContext.java:337) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:323) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:785) [DefaultChannelPipeline.class:?]
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:100) [AbstractNioByteChannel$NioByteUnsafe.class:?]
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:480) [NioEventLoop.class:?]
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:447) [NioEventLoop.class:?]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:341) [NioEventLoop.class:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
    Caused by: java.io.IOException: The received string length is longer than maximum allowed (25 > 20)
    at net.minecraft.network.PacketBuffer.readStringFromBuffer(PacketBuffer.java:185) ~[PacketBuffer.class:?]
    at net.minecraft.network.play.client.C17PacketCustomPayload.readPacketData(C17PacketCustomPayload.java:49) ~[C17PacketCustomPayload.class:?]
    at net.minecraft.util.MessageDeserializer.decode(MessageDeserializer.java:46) ~[MessageDeserializer.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232) ~[ByteToMessageDecoder.class:?]
    ... 19 more
    [02:29:38] [Netty IO #3/ERROR] [FML]: NetworkDispatcher exception
    io.netty.handler.codec.DecoderException: java.io.IOException: Packet was larger than I expected, found 11 bytes extra whilst reading packet 0
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:263) ~[ByteToMessageDecoder.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:196) ~[ByteToMessageDecoder.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.channelInactive(ByteToMessageDecoder.java:214) [ByteToMessageDecoder.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75) [ChannelInboundHandlerAdapter.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.ChannelInboundHandlerAdapter.channelInactive(ChannelInboundHandlerAdapter.java:75) [ChannelInboundHandlerAdapter.class:?]
    at io.netty.handler.timeout.ReadTimeoutHandler.channelInactive(ReadTimeoutHandler.java:143) [ReadTimeoutHandler.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.invokeChannelInactive(DefaultChannelHandlerContext.java:237) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelHandlerContext.fireChannelInactive(DefaultChannelHandlerContext.java:223) [DefaultChannelHandlerContext.class:?]
    at io.netty.channel.DefaultChannelPipeline.fireChannelInactive(DefaultChannelPipeline.java:767) [DefaultChannelPipeline.class:?]
    at io.netty.channel.AbstractChannel$AbstractUnsafe$5.run(AbstractChannel.java:558) [AbstractChannel$AbstractUnsafe$5.class:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:354) [SingleThreadEventExecutor.class:?]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:348) [NioEventLoop.class:?]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:101) [SingleThreadEventExecutor$2.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_45]
    Caused by: java.io.IOException: Packet was larger than I expected, found 11 bytes extra whilst reading packet 0
    at net.minecraft.util.MessageDeserializer.decode(MessageDeserializer.java:50) ~[MessageDeserializer.class:?]
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:232) ~[ByteToMessageDecoder.class:?]
    ... 19 more
    [02:29:38] [Server thread/INFO]: Player160 lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.DecoderException: java.io.IOException: The received string length is longer than maximum allowed (25 > 20)], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null}}
    [02:29:38] [Server thread/INFO]: Player160 left the game
    [02:29:38] [Client thread/INFO]: [CHAT] Player160 left the game


    Single player log


    [02:48:48] [Client] [gui.GuiBuildTool:actionPerformed:151]: SEND is TRUE - Generate Packet - CLIENT >> SERVER
    [02:36:23] [Client] [network.BuildPacket:<init>:26]: Constructing Packet
    [02:36:23] [Client] [network.PacketHandler:sendToServer:31]: Sending Packet To Server
    [02:36:23] [Client] [network.BuildPacket:toBytes:44]: Writing To Bytes
    [02:36:37] [Server] [network.BuildPacket:fromBytes:35]: Reading fromBytes
    [02:36:37] [Server] [network.BasePacket:onMessage:21]: Base Packet onMessage called
    [02:36:37] [Server] [network.BasePacket:onMessage:26]: Hand OFF Side is SERVER
    [02:36:37] [Server] [proxies.ClientProxy:getPlayerEntity:10]: Attempting to get client Player
    [02:36:37] [Server] [proxies.ClientProxy:getPlayerEntity:11]: #FAILED# : Side is not Client Getting SERVER player instead
    [02:36:37] [Server] [proxies.CommonProxy:getPlayerEntity:12]: Attempting to get SERVER Player
    [02:36:37] [Server] [network.BuildPacket$BPacketHandler:handleServerMessage:56]: Applying Packet Data

    Posted in: Modification Development
  • 0

    posted a message on player kicked by clicking button in item gui
    Quote from Choonster»

    You can either launch two clients or a client and a server.




    Thanks I didn't know this would work

    Posted in: Modification Development
  • 0

    posted a message on player kicked by clicking button in item gui
    Quote from Eladkay»

    "IDE" is very general. What IDE are you using?


    Eclipse

    Posted in: Modification Development
  • To post a comment, please or register a new account.