-
[1.7.2] LivingHurtEvent doesn't work?
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.
-
[1.7.2] LivingHurtEvent doesn't work?
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.
-
[1.7.2] LivingHurtEvent doesn't work?
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!
-
[1.7.2]Packet data not persisting
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
-
[1.7.4][solved] Event runs multiple times
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!
-
[1.7.4][SOLVED]How to send packets?
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!
-
[1.7.2][SOLVED]SpawnParticle not working
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?
-
[1.7.2][SOLVED]SpawnParticle not working
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
-
[1.7.2][SOLVED]SpawnParticle not working
Is there a good way to find out how to port? Or is it randomly looking through every networking class?
-
[1.7.2][SOLVED]SpawnParticle not working
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
-
[1.7.2][SOLVED]SpawnParticle not working
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?
-
[1.7.2][SOLVED]SpawnParticle not working
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?
-
[1.7.2][SOLVED]SpawnParticle not working
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!
-
[1.7.2][SOLVED] How to display a message in chat?
Gee, thank you for offering your time for this simplistic but very usefull answer
-
[1.7.2][SOLVED] How to display a message in chat?
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!
IPS spam blocked by CleanTalk.