Jump to content

CoderAce_

Members
  • Posts

    17
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

CoderAce_'s Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. I register my events using this code; MinecraftForge.EVENT_BUS.register(new ItemPickupHandler()); Maybe try that? It seems like it goes wrong at the registring part.
  2. Also, you should note that the if-statement contains unnecessery code. The entity is already an EntityLiving, so you should only check if event.entity instanceof EntityPlayer.
  3. Hello sep87x, You are using the wrong event. To see al entityLiving events, go to the package called net.minecraftforge.event.entity.living. To check if an entity has been murdered, you should use the LivingDeathEvent event. The LivingHurtEvent event only fires when an entity is hurt, not killed. Also, make sure that the event only runs on the server side using; if(event.entityPlayer.worldObj.isRemote) return; Hope this helps you!
  4. For an example of sending/receiving packets, take a look at my network code; https://github.com/wiggertolsma/usefullstuff/tree/master/src/main/java/ace/usefullstuff/packets This code comes from the wiki, and works perfectly. To send a packet, you use ModInstance.packetPipeline.sendTo(new -packetClass-, player). Hope this helps you! It's fully 1.7.4 compatible
  5. Hello, The event PlayerInteractEvent is running multiple times. I want it to only show the message it says on right click once. Do I have to setup a cooldown or is there an easier way? (Code: https://github.com/wiggertolsma/usefullstuff/blob/master/src/main/java/ace/usefullstuff/events/ItemPickupHandler.java) Thanks!
  6. Hi, So I am implementing the network stuff, from the <a href="http://www.minecraftforge.net/wiki/Netty_Packet_Handling">wiki</a>, and I've got everything setup. The code is here: <a href="https://github.com/wiggertolsma/usefullstuff/blob/master/src/main/java/ace/usefullstuff/packets/PacketParticle.java">code </a>. The handleClient() method is never being called. Do I have to send the packet after encoding it somehow? Please help! Thanks!
  7. This is my current PacketParticle class: https://github.com/wiggertolsma/usefullstuff/blob/master/src/main/java/ace/usefullstuff/packets/PacketParticle.java Ive registered it in the PacketPipeline class, and the PacketPipline is initialised on startup. Still, the handleClientside() method isn't being called? How is this method called?
  8. Haha, I just went there So I got everything setup, a class called PacketParticle and the PacketPipeline. Now how do I send the packet? Because it doesn't automatically send it right? It just encodes the data in a buffer, but now how do I flush it? I did setup the handleClientSide() method. Thanks
  9. Is there a good way to find out how to port? Or is it randomly looking through every networking class?
  10. Okay, so the code you provided is completely outdated. I've managed to put the client-side together, something like this; @Override protected void channelRead0(ChannelHandlerContext ctx, FMLProxyPacket packet) throws Exception { if (packet.channel().equals("UsefullStuff")) { ByteBuf payload = packet.payload(); if (payload.readableBytes() == 4) { x = payload.readDouble(); y = payload.readDouble(); z = payload.readDouble(); r = payload.readFloat(); } } } Ill post more when its done. Thanks
  11. Thanks! I will try your code. One weird thing is though, that this code runs perfectly fine.. @SubscribeEvent public void onItemUse(UseHoeEvent event){ double x = event.entityPlayer.posX ; double y = event.entityPlayer.posY; double z = event.entityPlayer.posZ; event.entityPlayer.addChatMessage(new ChatComponentText("Particle spawned")); for(int i = 0; i <= 30; i++){ event.entityPlayer.worldObj.spawnParticle("portal", x,y,z, 1D, 1D,1D); } } That's kind of odd right? Using a hoe on grass does spawn the particles.. Maybe it's send within the same packet?
  12. Okay, I've added this piece of code; if(event.entity.worldObj.isRemote){ event.entityPlayer.worldObj.spawnParticle("portal", x,y,z, 1D, 1D,1D); } and nothing seems to have changed.. ;( Any other things that might cause the problem?
  13. Hello, I am making an item that destroys every item that you pick up. I want to spawn portal particles around the player whenever he tries to pick something up. I've written this method; https://gist.github.com/anonymous/9305890 The method does run, but it's not spawning the particles. It has something to do with the coordinates, because when I try to spawn particles in another event it does work. I've tried the coordinates of the entity, entityLiving and the entityPlayer, and they all failed. When I print the coords they show up just fine as doubles. Does someone have a solution to this problem? Thanks a lot! *EDIT* I solved this problem by sending a packet to the client that spawns the particles. If you want to see my code visit this link; https://github.com/wiggertolsma/usefullstuff/tree/master/src/main/java/ace/usefullstuff I've used help from the wiki and you guys, thanks!
  14. Gee, thank you for offering your time for this simplistic but very usefull answer
  15. Hello, I am trying to display a chat message, and I'm using the following code; https://gist.github.com/anonymous/9305785 It is telling me that I need to use an IChatComponent argument, but it should be a String right? I am using the current recommended 1.7.2 build. Thanks in advance!
×
×
  • Create New...

Important Information

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