Jump to content

Gaktan

Members
  • Posts

    21
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Gaktan's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Sweet ! Now everything is working, thanks to you Mh, what is this ?
  2. 1. Yes, but how to I get the world then ? So I can get the villager by its ID ? 2. That makes sense 3. So I should remove isRemote ? (because the client IEEP is registered when the packet is received, as shown in the code above)
  3. Thank you very much, I can now send and receive messages yay ! But not everything is working, this is what happens when the client receives the message : public static class ClientHandler implements IMessageHandler<WatchPackets, IMessage> { @Override public IMessage onMessage(WatchPackets message, MessageContext ctx) { StringTokenizer st = new StringTokenizer(message.text, "\n"); int id = Integer.parseInt(st.nextToken()); EntityVillager villager = (EntityVillager) MinecraftServer.getServer().getEntityWorld().getEntityByID(id); EntityAdvancedVillager.register(villager); EntityAdvancedVillager eav = EntityAdvancedVillager.get(villager); eav.name = st.nextToken(); eav.surname = st.nextToken(); eav.info = st.nextToken(); eav.age = Integer.parseInt(st.nextToken()); eav.occupation = st.nextToken(); return null; } } Suprisingly, (with a bunch of sysos again) it turns out the client already has these infos... (it even says that the ri But when I check again in an other class : public void onVillagerRender(RenderLivingEvent.Post event){ if(event.entity.worldObj.isRemote){ if (event.entity instanceof EntityVillager) { EntityVillager villager = (EntityVillager) event.entity; EntityAdvancedVillager adv = EntityAdvancedVillager.get(villager); if(adv == null) return; if(adv.isRenderingInfos()){ EntityAdvancedVillager.renderLabel(villager, adv.toStringList(), villager.posX, villager.posY, villager.posZ, 5); } } } } EntityAdvancedVillager adv = EntityAdvancedVillager.get(villager) Always returns null... What the actual f**k
  4. Yes, that's what I said from the beginning But I'm still confused. The onMessage is called by the side receiving the packet, right ? I made a basic "I received a message", in the function. I made this little block of code in the onEntityConstructing : if(!e.worldObj.isRemote){ if (e instanceof EntityVillager){ EntityVillager villager = (EntityVillager) e; EntityAdvancedVillager.register(villager); WatchDogsMod.network.sendToAll(new WatchPackets("hi ")); WatchDogsMod.network.sendToServer(new WatchPackets("Hello ")); } } Only the sendToServer is showing in the console. And the sender indicated the player. But you can see in the code that I used "! is remote". I am very confused
  5. Ok, I wasn't sure which one was the good one. But still, I can't send packets to player. Or at least, they never receive them. THis is the handler class : @Override public IMessage onMessage(WatchPackets message, MessageContext ctx) { EntityPlayerMP player = ctx.getServerHandler().playerEntity; System.out.println(String.format("Received %s from %s", message.text, ctx.getServerHandler().playerEntity.getDisplayName())); } But now I'm thinking about it, it looks more like a function to send messages TO the server not from it. Since it's the only function available, how do I send retrieve packets FROM the client ?
  6. Mh, maybe. How do I make sure that only the client OR the server can do certain tasks ? Also, I tried to send packets to all and it doesn't work : WatchDogsMod.network.sendToAll(new WatchPackets("hi ")); Nothing is recieved. But I still can send packets to the server
  7. diesieben07> Thank you very much for your help. I tried to do that, but the event StartTracking is called before the event EntityConstruction, so what I try to send always returns null. I tried to set priorities but nope, doesn't work. lolgamerbob> Thanks, the rendering part works very well for now, you can have an idea of what it looks like on the first comment
  8. THank you very much, it worked. Now, the tough part : sending infos from the server to the client. I did as you said public void onPlayerStartTracking(PlayerEvent.StartTracking event){ Entity e = event.target; EntityPlayerMP player = (EntityPlayerMP) event.entityPlayer; if (e instanceof EntityVillager && EntityAdvancedVillager.get((EntityVillager) e) == null){ EntityVillager villager = (EntityVillager) e; EntityAdvancedVillager eav = EntityAdvancedVillager.get(villager); } } I believe this is happening server side, right ? But I'm not sure how to send the EntityAvancedVillager (which is the IEEP) to the client. And also how are they supposed to receive this data and know where it belongs ? Because all I have right now is this : @Override public void fromBytes(ByteBuf buf) { text = ByteBufUtils.readUTF8String(buf); } @Override public void toBytes(ByteBuf buf) { ByteBufUtils.writeUTF8String(buf, text); }
  9. Nevermind, I updated JDK 6 to JDK 7, that was the issue. Now everything is up to date. But, the mod doesn't want to compile at all.
  10. Oh, I'm sorry. I didn't pay attention to that But the thing is that gradle doesn't want to update. The compilation fails at the recompile I change the build.gradle file and change the version to "1.7.10-10.13.0.1180" I run the command "gradlew.bat setupDecompWorkspace --stacktrace --info" and it fails. Here is the log http://pastebin.com/M1kcvs7K
  11. I already checked both. All I have is breakSpeed, HarvestCheck and nameformat Also, my network is crashing. I CTRL+C CTRL+V the tutorial code and game crashes at start anyway. http://pastebin.com/X7LUzCn5
  12. Weird, I can't find PlayerEvent.StartTracking, even in the javadoc
  13. No, the data never changes. Only once it's created.
×
×
  • Create New...

Important Information

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