
SecondAmendment
Members-
Posts
81 -
Joined
-
Last visited
Everything posted by SecondAmendment
-
Anyone have a good MCPBot / SRG name tutorial? Like what pre-requisits do I need to use SRG names?
-
Draw a line from the player's cursor to a mob.
SecondAmendment replied to SecondAmendment's topic in Modder Support
Oh, that makes sense. So what render event should i use for my particular need? -
Draw a line from the player's cursor to a mob.
SecondAmendment replied to SecondAmendment's topic in Modder Support
well I found this that i tried private void drawLineWithGL(Vec3d blockA, Vec3d blockB) { GL11.glColor4f(1F, 0F, 1F, 0F); GL11.glBegin(GL11.GL_LINE_STRIP); GL11.glVertex3d(blockA.xCoord, blockA.yCoord, blockA.zCoord); GL11.glVertex3d(blockB.xCoord, blockB.yCoord, blockB.zCoord); GL11.glEnd(); } -
How can I draw a line from the player's cursor to a mob on screen? Ive looked around and messed with GL11 but I just cant figure it out. Someone please help.
-
Check if Chunk has generated a structure?
SecondAmendment replied to TheMasterGabriel's topic in Modder Support
I know how to in spiggot, not sure about forge though. -
Ok what about the changing team way? How can i change the mobs team
-
Does anyone know how to change the color of entity.setGlowing(true). Preferably a way that doesn't involve changing the entity's team.
-
Checking the drop chance of a mob
SecondAmendment replied to SecondAmendment's topic in Modder Support
What would the method be called? I cant seem to find it on the spreadsheet -
Checking the drop chance of a mob
SecondAmendment replied to SecondAmendment's topic in Modder Support
How do I do it with MC Bot in order to get the SRG name? -
Checking the drop chance of a mob
SecondAmendment replied to SecondAmendment's topic in Modder Support
Hmmmm... Im having trouble getting the field. the crash report says it cannot find it. What am I doing wrong? public void playerTick(PlayerTickEvent event) throws IllegalArgumentException, IllegalAccessException, NoSuchFieldException, SecurityException { List<Entity> entities = event.player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getEntityBoundingBox().expand(5.0D, 5.0D, 5.0D)); for(Entity entity : entities){ if((entity instanceof EntityMob && ((EntityLivingBase) entity).getHeldItemMainhand() != null && !previousmobs.contains(entity))){ Field dropchance = null; dropchance = ((EntityLiving)entity).getClass().getDeclaredField("inventoryHandsDropChances"); dropchance.setAccessible(true); Object floatchance = dropchance.get(entity); event.player.addChatMessage(((EntityLivingBase) entity).getHeldItemMainhand().getTextComponent().appendSibling((new TextComponentString(" Drop Chance: ").appendText(Array.get(floatchance , 0).toString())))); Crash Report: [11:04:45] [Server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking player at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:210) ~[NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: inventoryHandsDropChances at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-17.0.jar:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:191) ~[EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) ~[NetHandlerPlayServer.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) ~[NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) ~[NetworkSystem.class:?] ... 5 more Caused by: java.lang.NoSuchFieldException: inventoryHandsDropChances -
Checking the drop chance of a mob
SecondAmendment replied to SecondAmendment's topic in Modder Support
Damn it, I hate using Reflection -
Is there a way to check the drop chance of an item a mob is holding?
-
ConcurrentModificationException
SecondAmendment replied to SecondAmendment's topic in Modder Support
Got it: Solved I dont know how I forgot such a basic rule of java. Whenever iterating through a List always use an Iterator. -
ConcurrentModificationException
SecondAmendment replied to SecondAmendment's topic in Modder Support
Oh yeah. I forgot about the iterator method -
public void playerTick(PlayerTickEvent event) { List<Entity> entities = event.player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getEntityBoundingBox().expand(1.0D, 1.0D, 1.0D)); for(Entity entity : entities){ if((entity instanceof EntityMob && ((EntityLivingBase) entity).getHeldItemMainhand() != null && !previousmobs.contains(entity))){ event.player.addChatMessage(((EntityLivingBase) entity).getHeldItemMainhand().getTextComponent()); previousmobs.add((EntityMob) entity); } } if(!previousmobs.isEmpty()){ for(Entity e : previousmobs){ if(e.isDead){ previousmobs.remove(e); } } } ConcurrentModificationException: (I am assuming that means that at the same time it is removing it from the list it is also checking if its on the list causing it to crash) The game crashes right after I kill a mob and the body drops. Stacktrace: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_65] at java.util.ArrayList$Itr.next(Unknown Source) ~[?:1.8.0_65] at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:74) ~[DungeonRealmsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) [FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) [EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) [NetHandlerPlayServer.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) [NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] [13:01:22] [Server thread/ERROR] [FML]: Index: 1 Listeners: [13:01:22] [Server thread/ERROR] [FML]: 0: NORMAL [13:01:22] [Server thread/ERROR] [FML]: 1: ASM: com.vivabenfica4ps3.gmail.DungeonRealmsMod@158774d3 playerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$PlayerTickEvent;)V [13:01:22] [Server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking player at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:210) ~[NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] Caused by: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) ~[?:1.8.0_65] at java.util.ArrayList$Itr.next(Unknown Source) ~[?:1.8.0_65] at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:74) ~[DungeonRealmsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) ~[EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) ~[NetHandlerPlayServer.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) ~[NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) ~[NetworkSystem.class:?] ... 5 more [13:01:22] [Server thread/ERROR]: This crash report has been saved to: D:\DRMod\run\.\crash-reports\crash-2017-02-18_13.01.22-server.txt [13:01:22] [Server thread/INFO]: Stopping server [13:01:22] [Server thread/INFO]: Saving players [13:01:22] [Server thread/INFO]: Saving worlds [13:01:22] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld [13:01:22] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ---- // You're mean. Time: 2/18/17 1:01 PM Description: Ticking player java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(Unknown Source) at java.util.ArrayList$Itr.next(Unknown Source) at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:74) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) at java.lang.Thread.run(Unknown Source) Does anyone know how to fix this?
-
Where do I end this discussion? SOLVED
-
Silly me, how did I make such a mistake. Thank you very much sir.
-
I know, I still have to add a check for a null getItemMainHand but I already tried commenting that out and the problem still occured on the line where it states: player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getCollisionBoundingBox().expand(5.0D, 5.0D, 5.0D)); as for the entities field not being a local variable I changed it: @SideOnly(Side.CLIENT) @SubscribeEvent public void playerTick(PlayerTickEvent event) { List<Entity> entities = event.player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getCollisionBoundingBox().expand(5.0D, 5.0D, 5.0D)); for(Entity entity : entities){ event.player.addChatMessage(((EntityLivingBase) entity).getHeldItemMainhand().getTextComponent()); } if(event.player.getLastAttacker() != null && !event.player.getLastAttacker().equals(previousentity) && (event.player.getLastAttacker().getHeldItemMainhand() != null)){ event.player.addChatMessage(event.player.getLastAttacker().getHeldItemMainhand().getTextComponent()); previousentity = (Entity) event.player.getLastAttacker(); } } Problem still occurs. Same line I just didn't have the variable locally because I might want to use it for later in some other method.
-
[11:31:16] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.fml.common.gameevent.TickEvent$PlayerTickEvent@1618ea3f: java.lang.NullPointerException at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:63) ~[DungeonRealmsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) [EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) [FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) [EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) [EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) [NetHandlerPlayServer.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) [NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) [NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) [NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) [IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] [11:31:16] [Server thread/ERROR] [FML]: Index: 1 Listeners: [11:31:16] [Server thread/ERROR] [FML]: 0: NORMAL [11:31:16] [Server thread/ERROR] [FML]: 1: ASM: com.vivabenfica4ps3.gmail.DungeonRealmsMod@158774d3 playerTick(Lnet/minecraftforge/fml/common/gameevent/TickEvent$PlayerTickEvent;)V [11:31:16] [Server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking player at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:210) ~[NetworkSystem.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) ~[IntegratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.8.0_65] Caused by: java.lang.NullPointerException at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:63) ~[DungeonRealmsMod.class:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) ~[?:?] at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) ~[ASMEventHandler.class:?] at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) ~[EventBus.class:?] at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) ~[FMLCommonHandler.class:?] at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) ~[EntityPlayer.class:?] at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) ~[EntityPlayerMP.class:?] at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) ~[NetHandlerPlayServer.class:?] at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) ~[NetworkDispatcher$1.class:?] at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) ~[NetworkManager.class:?] at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) ~[NetworkSystem.class:?] ... 5 more [11:31:16] [Server thread/ERROR]: This crash report has been saved to: D:\DRMod\run\.\crash-reports\crash-2017-02-18_11.31.16-server.txt [11:31:16] [Server thread/INFO]: Stopping server [11:31:16] [Server thread/INFO]: Saving players [11:31:16] [Client thread/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:649]: ---- Minecraft Crash Report ---- // Surprise! Haha. Well, this is awkward. Time: 2/18/17 11:31 AM Description: Ticking player java.lang.NullPointerException: Ticking player at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:63) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) at java.lang.Thread.run(Unknown Source) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace: at com.vivabenfica4ps3.gmail.DungeonRealmsMod.playerTick(DungeonRealmsMod.java:63) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler_6_DungeonRealmsMod_playerTick_PlayerTickEvent.invoke(.dynamic) at net.minecraftforge.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:90) at net.minecraftforge.fml.common.eventhandler.EventBus.post(EventBus.java:185) at net.minecraftforge.fml.common.FMLCommonHandler.onPlayerPreTick(FMLCommonHandler.java:360) at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:215) -- Player being ticked -- Details: Entity Type: null (net.minecraft.entity.player.EntityPlayerMP) Entity ID: 135 Entity Name: Player287 Entity's Exact location: 54.27, 83.00, 77.70 Entity's Block location: World: (54,83,77), Chunk: (at 6,5,13 in 3,4; contains blocks 48,0,64 to 63,255,79), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Entity's Momentum: 0.00, -0.08, 0.00 Entity's Passengers: [] Entity's Vehicle: ~~ERROR~~ NullPointerException: null Stacktrace: at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:341) at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:174) at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:216) at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:308) -- Ticking connection -- Details: Connection: net.minecraft.network.NetworkManager@bf0b82a Stacktrace: at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:195) at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:806) at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:687) at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:156) at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:536) at java.lang.Thread.run(Unknown Source) This is the crash report/stacktrace The crash occurs right after I join a world. Here is the whole area where it occurs: @SideOnly(Side.CLIENT) @SubscribeEvent public void playerTick(PlayerTickEvent event) { entities = event.player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getCollisionBoundingBox().expand(5.0D, 5.0D, 5.0D)); for(Entity entity : entities){ event.player.addChatMessage(((EntityLivingBase) entity).getHeldItemMainhand().getTextComponent()); } } The variable entities is defined earlier as follows: List<Entity> entities;
-
Could it be due to the fact that act that current point in time there are no mobs around me causing it to crash? Ill try adding a check to see if there are any mobs first.
-
It tells me there is a null pointer but I dont know where a value would be null.
-
Ok so I am trying to get the mobs around the player. However I cant do that because the entity is Ticking. I have solved many of these problems in the past, however I dont know how to solve this one. public void playerTick(PlayerTickEvent event) { entities = event.player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(event.player, event.player.getCollisionBoundingBox().expand(5.0D, 5.0D, 5.0D)); for(Entity entity : entities){
-
Ok so I changed them to a float to allow for a shorter range of numbers, and also added tollerance. But it will not stop, it will still go on forever. new Timer().schedule( new java.util.TimerTask() { @Override public void run() { float x = (float) Minecraft.getMinecraft().thePlayer.posX; System.out.println(x); boolean atPosition = true; Minecraft.getMinecraft().thePlayer.rotationYaw = Minecraft.getMinecraft().thePlayer.rotationYaw+rotation; Minecraft.getMinecraft().gameSettings.keyBindForward.setKeyBindState(Keyboard.KEY_W, true); while(atPosition){ if(((float)Minecraft.getMinecraft().thePlayer.posX) >= x+1){ Minecraft.getMinecraft().gameSettings.keyBindForward.setKeyBindState(Keyboard.KEY_W, false); Minecraft.getMinecraft().thePlayer.rotationYaw = Minecraft.getMinecraft().thePlayer.rotationYaw+rotation; atPosition = false; } } atPosition = true; } }, 0 );