Jump to content

njny

Members
  • Posts

    7
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

njny's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. It seems to be called in the constructor using information from the shooter, which I can't get. What else could I do?
  2. Hello, thanks for the info. I'll set it as 0 then because this mod registers nothing else. 43 is replacement.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); Sorry about that, I really should have specified (wasn't thinking). Not sure what you mean server-side/client-side. Still very new to client modding, I was under the impression that all the work I'm doing right now is client side changes. I'll try to replicate the error right now. Here's the stack of the error: [23:38:39] [server thread/ERROR] [FML]: Index: 3 Listeners: [23:38:39] [server thread/ERROR] [FML]: 0: HIGHEST [23:38:39] [server thread/ERROR] [FML]: 1: ASM: net.minecraftforge.common.ForgeInternalHandler@2f5a23c1 onEntityJoinWorld(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V [23:38:39] [server thread/ERROR] [FML]: 2: NORMAL [23:38:39] [server thread/ERROR] [FML]: 3: ASM: net.hungerstruck.arrowphysics.ArrowPhysicsMod@1bae8e5e entityJoinWorldEvent(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V [23:38:39] [server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.entity.EntityJoinWorldEvent@b8047f5: java.lang.NullPointerException at net.hungerstruck.arrowphysics.ArrowPhysicsMod.entityJoinWorldEvent(ArrowPhysicsMod.java:53) ~[ArrowPhysicsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_ArrowPhysicsMod_entityJoinWorldEvent_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?] at net.minecraft.world.World.spawnEntityInWorld(World.java:1230) ~[World.class:?] at net.hungerstruck.arrowphysics.ArrowPhysicsMod.entityJoinWorldEvent(ArrowPhysicsMod.java:54) ~[ArrowPhysicsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_ArrowPhysicsMod_entityJoinWorldEvent_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) [EventBus.class:?] at net.minecraft.world.World.spawnEntityInWorld(World.java:1230) [World.class:?] at net.minecraft.item.ItemBow.onPlayerStoppedUsing(ItemBow.java:95) [itemBow.class:?] at net.minecraft.item.ItemStack.onPlayerStoppedUsing(ItemStack.java:530) [itemStack.class:?] at net.minecraft.entity.player.EntityPlayer.stopUsingItem(EntityPlayer.java:232) [EntityPlayer.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:525) [NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:53) [C07PacketPlayerDigging.class:?] at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:76) [C07PacketPlayerDigging.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) [PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_65] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65] [23:38:39] [server thread/ERROR] [FML]: Index: 3 Listeners: [23:38:39] [server thread/ERROR] [FML]: 0: HIGHEST [23:38:39] [server thread/ERROR] [FML]: 1: ASM: net.minecraftforge.common.ForgeInternalHandler@2f5a23c1 onEntityJoinWorld(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V [23:38:39] [server thread/ERROR] [FML]: 2: NORMAL [23:38:39] [server thread/ERROR] [FML]: 3: ASM: net.hungerstruck.arrowphysics.ArrowPhysicsMod@1bae8e5e entityJoinWorldEvent(Lnet/minecraftforge/event/entity/EntityJoinWorldEvent;)V [23:38:39] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_65] at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_65] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_65] Caused by: java.lang.NullPointerException at net.hungerstruck.arrowphysics.ArrowPhysicsMod.entityJoinWorldEvent(ArrowPhysicsMod.java:53) ~[ArrowPhysicsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_ArrowPhysicsMod_entityJoinWorldEvent_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?] at net.minecraft.world.World.spawnEntityInWorld(World.java:1230) ~[World.class:?] at net.hungerstruck.arrowphysics.ArrowPhysicsMod.entityJoinWorldEvent(ArrowPhysicsMod.java:54) ~[ArrowPhysicsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_ArrowPhysicsMod_entityJoinWorldEvent_EntityJoinWorldEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:55) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:140) ~[EventBus.class:?] at net.minecraft.world.World.spawnEntityInWorld(World.java:1230) ~[World.class:?] at net.minecraft.item.ItemBow.onPlayerStoppedUsing(ItemBow.java:95) ~[itemBow.class:?] at net.minecraft.item.ItemStack.onPlayerStoppedUsing(ItemStack.java:530) ~[itemStack.class:?] at net.minecraft.entity.player.EntityPlayer.stopUsingItem(EntityPlayer.java:232) ~[EntityPlayer.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerDigging(NetHandlerPlayServer.java:525) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:53) ~[C07PacketPlayerDigging.class:?] at net.minecraft.network.play.client.C07PacketPlayerDigging.processPacket(C07PacketPlayerDigging.java:76) ~[C07PacketPlayerDigging.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_65] at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_65] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] ... 5 more Line references have changed: 53 is pointing to the line replacement.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
  3. Thanks for all the info! Okay, so I've created my event handler and I think the logic is fine. How should I register my customized entity? I tried EntityRegistry.registerGlobalEntityID(UnderwaterEntityArrow.class, "Arrow", 262); But this causes some unclear error (stacktrace doesn't yield helpful information, but I'm going to assume ID clash, I tried to use the ID of an arrow... what param should I use instead? some arbitrary large number?), any ideas? I can't seem to find examples of replacing entities, and so I'm not sure what ID I should use (or even if I'm using the right registry class). Edit: I got it to register like this (I think... at least it didn't error): EntityRegistry.registerModEntity(UnderwaterEntityArrow.class, "Arrow", 262, this, 100, 100, true); Here's my code for the event: @SubscribeEvent public void entityJoinWorldEvent(EntityJoinWorldEvent event) { if(event.entity instanceof EntityArrow) { UnderwaterEntityArrow replacement = new UnderwaterEntityArrow(event.world); Entity shooter = ((EntityArrow) event.entity).shootingEntity; replacement.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); event.world.spawnEntityInWorld(replacement); event.entity.setDead(); } } Unfortunately I get an NPE at line 43. Shooter is the only possible null thing (as replacement is instantiated just above it), what should I do? My guess would be that custom arrow isn't having its data set... Not really sure what to do. Also, is shootingEntity of EntityArrow referring to the Bow or the source (Player, Skeleton, dispenser, etc)? Im not sure what constructor you should be using look at ItemBow for which constructor it uses you will also need to set it's Motion and heading before you spawn it. *Edit Isnt shootingEntity a private field. shootingEntity is public, though it looks like it's always null (not sure why?). How should I feed it heading information if I can't really get info from the shooter? Any way to cleanly copy all data from old arrow over to the new one?
  4. Ah, I should have specified! Sorry! It's just Bukkit without Forge, I think it would be best to modify client to fit Bukkit because this mod will be optional on our server (if the visual aspect of the arrow not matching is bothersome, players will be allowed to use our mod to correct their client). If you suggest something else, however, I'll definitely consider it. This just seems like the most straightforward choice. Thanks for your reply! I haven't had any progress since the last person to reply however. Currently I tried just spawning in my extended class on EntityJoinWorldEvent, and removing the original entity. It just freezes the game and dies. Any idea on the proper way to do this?
  5. Thanks for all the info! Okay, so I've created my event handler and I think the logic is fine. How should I register my customized entity? I tried EntityRegistry.registerGlobalEntityID(UnderwaterEntityArrow.class, "Arrow", 262); But this causes some unclear error (stacktrace doesn't yield helpful information, but I'm going to assume ID clash, I tried to use the ID of an arrow... what param should I use instead? some arbitrary large number?), any ideas? I can't seem to find examples of replacing entities, and so I'm not sure what ID I should use (or even if I'm using the right registry class). Edit: I got it to register like this (I think... at least it didn't error): EntityRegistry.registerModEntity(UnderwaterEntityArrow.class, "Arrow", 262, this, 100, 100, true); Here's my code for the event: @SubscribeEvent public void entityJoinWorldEvent(EntityJoinWorldEvent event) { if(event.entity instanceof EntityArrow) { UnderwaterEntityArrow replacement = new UnderwaterEntityArrow(event.world); Entity shooter = ((EntityArrow) event.entity).shootingEntity; replacement.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight(), shooter.posZ, shooter.rotationYaw, shooter.rotationPitch); event.world.spawnEntityInWorld(replacement); event.entity.setDead(); } } Unfortunately I get an NPE at line 43. Shooter is the only possible null thing (as replacement is instantiated just above it), what should I do? My guess would be that custom arrow isn't having its data set... Not really sure what to do. Also, is shootingEntity of EntityArrow referring to the Bow or the source (Player, Skeleton, dispenser, etc)?
  6. Thanks for the reply! Our Bukkit changes directly alter NMS code motion, so the issue is not the sending of update packets. The issue is that, to prevent lag, Minecraft simulates physics of Arrows on the client and simply checks that they match the server's authoritative packets. I took a look at EntityJoinWorldEvent, the issue is that I need to override a method entirely (to change 1 local variable in the method EntityArrow#onUpdate() Is there a clean way to do that using EntityJoinWorldEvent? If not, then how exactly do I replace the entity cleanly? Do I need to find a way to instantiate the class with all the information from the player, or ..? Also does the fact that the players will get the entity through a chest affect how EntityJoinWorldEvent in Forge are registered, or is it based off of received packets? Thanks again for your time!
  7. Hello! I am the owner of a server network, and we have been patching our version of Bukkit to add support for cool features. Our latest feature requires replicating arrow shooting physics underwater to match above ground. The change is as simple as commenting out 1 line in Bukkit (changing the value multiplied across each axis of motion), however: The client appears to run its own arrow simulation. This causes something we're trying to fix using an (optional) game mod: When a player shoots, the arrow droops down underwater and then teleports to where the server believes it should be. None of us are completely familiar with Forge. I have set up the Intellij workspace as detailed in the main tutorial, and have located the NMS code I need to change. My question: What steps should I take towards overriding the default entity? I've been doing a lot of searching on how to do this, but it appears that overriding entities is highly discouraged and usually involves ASM (which I'd like to avoid due to the complexity...). Could someone please point me towards the resources I should look into? Should I extend the class, register a new entity, and try to spawn it in everywhere (not sure if the event system here allows that). Sorry if this question is basic and very obvious. Again, we all come from the server side of things, and aren't completely familiar with modding in general. Thanks in advance for your time! Edit: The server supports version 1.8.7-1.8.9 I believe, and I set up my workspace using the 1.8-11.14.4.1563 setup
×
×
  • Create New...

Important Information

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