{"action":"opened","issue":{"url":"https://api.github.com/repos/RootsTeam/Embers/issues/237","repository_url":"https://api.github.com/repos/RootsTeam/Embers","labels_url":"https://api.github.com/repos/RootsTeam/Embers/issues/237/labels{/name}","comments_url":"https://api.github.com/repos/RootsTeam/Embers/issues/237/comments","events_url":"https://api.github.com/repos/RootsTeam/Embers/issues/237/events","html_url":"https://github.com/RootsTeam/Embers/issues/237","id":243535203,"number":237,"title":"[1.12] CreativeCore compatibility issue","user":{"login":"CreativeMD","id":1353495,"avatar_url":"https://avatars3.githubusercontent.com/u/1353495?v=4","gravatar_id":"","url":"https://api.github.com/users/CreativeMD","html_url":"https://github.com/CreativeMD","followers_url":"https://api.github.com/users/CreativeMD/followers","following_url":"https://api.github.com/users/CreativeMD/following{/other_user}","gists_url":"https://api.github.com/users/CreativeMD/gists{/gist_id}","starred_url":"https://api.github.com/users/CreativeMD/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CreativeMD/subscriptions","organizations_url":"https://api.github.com/users/CreativeMD/orgs","repos_url":"https://api.github.com/users/CreativeMD/repos","events_url":"https://api.github.com/users/CreativeMD/events{/privacy}","received_events_url":"https://api.github.com/users/CreativeMD/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-17T21:35:52Z","updated_at":"2017-07-17T21:35:52Z","closed_at":null,"body":"Hey there,\r\n\r\nI'm the author of CreativeCore and somebody reported this issue: https://github.com/CreativeMD/CreativeCore/issues/18. I'm modifying the `loadedTileEntityList` of the world, to fix some horrible lag spikes (https://www.youtube.com/watch?v=vTCJbp45pWM).\r\n\r\nSo `loadedTileEntityList` is not really an `ArrayList` anymore, but instead a `HashMap<ChunkPos, List<TileEntity>>`. Actually you don't have to care about all this ...\r\n\r\nCurrently you are using the `size()` and `get(int index)` methods, which will not work with my changes:\r\n\r\nhttps://github.com/RootsTeam/Embers/blob/28695d9b808e3470e0e6947df71d641285f9677d/src/main/java/teamroots/embers/EventManager.java#L586\r\n```java\r\nList<TileEntity> list = Minecraft.getMinecraft().world.loadedTileEntityList;\r\nGlStateManager.pushMatrix();\r\nfor (int i = 0; i < list.size(); i ++){\r\n\tTileEntitySpecialRenderer render = TileEntityRendererDispatcher.instance.getSpecialRenderer(list.get(i));\r\n\tif (render instanceof ITileEntitySpecialRendererLater){\r\n\t\tdouble x = Minecraft.getMinecraft().player.lastTickPosX + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posX-Minecraft.getMinecraft().player.lastTickPosX);\r\n\t\tdouble y = Minecraft.getMinecraft().player.lastTickPosY + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posY-Minecraft.getMinecraft().player.lastTickPosY);\r\n\t\tdouble z = Minecraft.getMinecraft().player.lastTickPosZ + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posZ-Minecraft.getMinecraft().player.lastTickPosZ);\r\n\t\t((ITileEntitySpecialRendererLater)render).renderLater(list.get(i), list.get(i).getPos().getX()-x, list.get(i).getPos().getY()-y, list.get(i).getPos().getZ()-z, Minecraft.getMinecraft().getRenderPartialTicks());\r\n\t}\r\n}\r\n```\r\nInstead you should use the iterator ...\r\n\r\n```java\r\nfor(Iterator<TileEntity> iterator = Minecraft.getMinecraft().world.loadedTileEntityList.iterator(); iterator.hasNext()){\r\n\tTileEntity te = iterator.next();\r\n\tTileEntitySpecialRenderer render = TileEntityRendererDispatcher.instance.getSpecialRenderer(te);\r\n\tif (render instanceof ITileEntitySpecialRendererLater){\r\n\t\tdouble x = Minecraft.getMinecraft().player.lastTickPosX + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posX-Minecraft.getMinecraft().player.lastTickPosX);\r\n\t\tdouble y = Minecraft.getMinecraft().player.lastTickPosY + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posY-Minecraft.getMinecraft().player.lastTickPosY);\r\n\t\tdouble z = Minecraft.getMinecraft().player.lastTickPosZ + Minecraft.getMinecraft().getRenderPartialTicks()*(Minecraft.getMinecraft().player.posZ-Minecraft.getMinecraft().player.lastTickPosZ);\r\n\t\t((ITileEntitySpecialRendererLater)render).renderLater(te, te.getPos().getX()-x, te.getPos().getY()-y, te.getPos().getZ()-z, Minecraft.getMinecraft().getRenderPartialTicks());\r\n\t}\r\n}\r\n```\r\n\r\nTheoretically i could fix this issue from my end, but `get(int index)` is incredible bad for performance, basically it would cause horrible lag, so i rather cause a crash.\r\n\r\nIt would be very cool if you could implement this change.\r\n\r\nIn Regards\r\nCreativeMD"}}
{"actor":{"display_login":"CreativeMD"}}