Jump to content

wesserboy

Members
  • Posts

    71
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

wesserboy's Achievements

Stone Miner

Stone Miner (3/8)

7

Reputation

  1. I have figured it out, it was indeed a scaling issue. After looking at the event class I noticed it supplies you with a resolution. I solved it by getting the scaled height form the event: event.getResolution().getScaledHeight_double()
  2. I am working on a mod that adds some overlays to the game, and for one of them I wanted to render an entity on the hud, but I'm having some problems positioning it where I want it. I am using the RenderGameOverlayEvent.Post event to render it to the hud. When I don't apply any translations it appears in the top left of the screen, which makes sense. Since I want it to show up in the bottom left, I would assume I have to translate it by the height of the screen (I assumed was Minecraft.getMinecraft().displayHeight). However this doesn't work, I have to divide it by 2 to get it to show up at the bottom. I am very confused by this behavior. Then if I make the game fullscreen, the model disappears. I assume there is some kind of scaling going on here, but I have no idea how to reliably calculate the amount I want to translate the model down by. The translation I am currently using is: GlStateManager.translate(25F, mc.displayHeight / 2F - 10, 50F); which somehow works on the default window size. The entire class can be found here: https://github.com/wesserboy/Overlays-MC-/blob/master/src/main/java/com/wesserboy/overlays/renderers/BowAimHelp.java Anyone know how I can render the model in the bottom left of the hud, independent of the window size?
  3. Yes, you still need to call world.spawnEntityInWorld(cow); to actually spawn the entity in the world As a side note: Make sure you only spawn the entity on the server (!world.isRemote)
  4. UPDATE: Problem #1 is magically solved . I suspect that the problem was indeed the "particle" element missing and i probably just forgot to save the file somewhere along the line....... oops Problem #2 is also solved. I solved it by overriding isFullCube to return false (seems obvious now ). I also found the isFullBlock method, should i override this as well? Because it feels to me that these two methods are basically the same thing. (Correct me if i'm wrong)
  5. Hello everyone, For my mod I am making some kind of pedestal that can hold an item, it looks like this: https://s31.postimg.org/6c0glhp3f/2016_07_12_17_05_22.png[/img] I am using a json model file to render the base, and a TileEntitySpecialRenderer for the pillars and the item. The model is rendering correctly, however there are still some minor details that are not working correctly: #1: Probably the easiest one (I think). The block-break particles show up as missing texture. After reading numerous forum posts my friend Google kindly provided me it seemed like the problem always was the missing "particle" element in the json model. Adding this element did however not fix the problem for me. I suspect the problem might be because i am also using a TileEntitySpecialRenderer, but i couldn't find a solution. this is my json model: https://gist.github.com/wesserboy/26c88e64bafa39c7204bb36421e7b8c5 SOLVED, see 2nd post for the answer #2: The bounding box for my model is behaving very strange. Since my model is not occupying the full block space i wanted to set up a custom bounding box. I used the following code to do this: protected static final AxisAlignedBB AABB = new AxisAlignedBB(0.125D, 0.0D, 0.125D, 0.875D, 0.5D, 0.875D); @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { return AABB; } As you can see in the first picture the wireframe shows up the way i expected, and from the top the bounding box acts the same as the one form the slab (The box has the same height), because the player auto-walks on top of it. However when i stand one level below the block (face the same level as the block) and i walk into the block i get the following screen: https://s31.postimg.org/yq5w5dcnf/2016_07_12_17_06_02.png[/img] If i am in survival mode the player also takes damage (suffocation). This leads me to believe that the problem lies in the collision box, however i have no idea how to solve this. SOLVED, see 2nd post for the answer #3 (Bonus issue) I am currently rendering the pillars by rendering obsidian using the RenderItem and scaling this to look like pillars. This is obviously not the correct way of doing things, but i wasn't able to find a way to animate certain parts of a json model using the TileEntitySpecialRenderer. If anyone knows how to properly do this, be sure to let me know. Any help would be much appreciated! If more code is needed, just ask and i will provide it.
  6. The achievement class has a field 'parentAchievement'. Use the same method as before to check if the player has the parentAchievement as well.
  7. Just out of curiosity, why bother translating coordinate symbols? I am pretty sure they are the same in all languages anyway? also, to convert an int to a String you can use: String.valueOf(i); Integer.toString(i); instead of "" + i; which looks a bit cleaner in my opinion
  8. Thank you! I implemented it, and it works like a charm. It is probably also way more reliable than my tick-handler magic
  9. I figured out the problem and it works now. I do however feel like there must be a better way to solve this. I will explain what was causing the crash, and what i did to fix it. I would like to hear any recommendations/ideas on how to improve it, if you have any. The cause: The crash was a ConcurrentModificationException. There were two threads modifying the same List simultaneously: * The thread handling my packet was adding the fake player to the list. * The server thread was checking the chunks around the players in this list in order to tick them, send updates to clients etc... When these two operations happend at the same time --> ConcurrentModificationException. The fix: When the message is received (On the server), I subscribe it to the TickEvent.ServerTickEvent. I use the different phases of this event to monitor the tick progress, and i schedule the insertion of the fake player in between two ticks. (After Phase.END and before the next Phase.START) Fields of improvement: 1. I feel like there should be a better way of loading distant chunks altogether. Inserting fake players and rerouting vanilla packets feel really hacky, and i can't imagine this being the first situation where distant chunks are needed on the client. 2. I think there must be a better way to schedule tasks in between ticks. Vanilla minecraft also has to insert the player into this list when it spawns a new player. This (obviously) doesn't cause a crash, so a mechanism to handle this must already be in place. (at least, I would think) EDIT: Has been improved, now uses a mechanic that is already present in vanilla 3. Possibly other things I haven't thought of yet As mentioned before, any feedback is greatly appreciated, since I am not yet fully convinced of the effectiveness of my current approach. thank you for your interest
  10. I wasn't able to solve the problems of the previous approach, so I am currently working on a new approach: (still to problem #1) I am now creating a fake EntityPlayerMP, and put that one on the location the player should be looking. The packets sent to this fake version, i forward to the client of the original player. The game crashes when i add my fake version to the PlayerChunkMap. It complains about a ConcurrentModificationException. This must be thread related (i think), I can't however seem to figure out which thread is (constantly?) reading the array of PlayerChunkMapEntries. This is the crash log: If additional code is required i will provide it. Any information regarding the crash, or this problem in general would be nice, since I am really stuck on this one
  11. While looking through the minecraft code i found there is one place where such an exception is thrown: net.minecraft.server.MinecraftServer: line 776 It gets thrown when the WorldServer.tick() method fails. This confirms my suspicion that I am indeed overloading the server (which causes a tick to fail). I am confused however why balancing out the requests doesn't work. I think load balancing should fix problems regarding too heavy loads... Anyone that can explain why balancing doesn't work, or point me in the right direction as to how i could fix this?
  12. You have a valid point here However, i couldn't find my answer in the LookingGlass source. I did find a (currently) half working solution: I created a custom packet that the client can use to request a chunk from the server. I reply to this packet by sending a vanilla chunk packet back to the client. Here is the code i use for this packet: @Override public void handleServerSide(MessageChunkRequest message, EntityPlayer player) { if(player instanceof EntityPlayerMP){ EntityPlayerMP playerMP = (EntityPlayerMP) player; if(playerMP.worldObj instanceof WorldServer){ WorldServer world = (WorldServer) playerMP.worldObj; Chunk chunk = world.getChunkProvider().provideChunk(message.chunkX, message.chunkZ); Packet<?> packet = new SPacketChunkData(chunk, 65535); playerMP.connection.sendPacket(packet); } } } On flat worlds this works, however on non-flat worlds this causes a crash: I have never encountered such a crash, but my guess is that the server is overloaded because of all the chunks i request. (most of which have not been generated yet). But if someone could confirm that this is indeed the case that would be nice. I tried only requesting the next chunk when the previously requested one has arrived, but this doesn't help, which makes me think there might be another problem causing the crash... Any help/tips are greatly appreciated.
  13. Turns out I was wrong, he updates them when the client receives the chunk data. I looked which method he used to force a render update: markBlockRangeForRenderUpdate ( How did i miss that method... My brain must have been dead last night). For people that are curious, i found it here: https://github.com/XCompWiz/LookingGlass/blob/946429fc5e7c82393b23e43f1820104b75febbf9/src/main/java/com/xcompwiz/lookingglass/network/packet/PacketChunkInfo.java Problem #2 is fixed now, the chunks re-render when the player steps off the block and it look fine. The only problem that remains is problem #1: How do i force the client to load (and render) a chunk far away from the player?
  14. I had stumbled upon looking glass before, but it seems this is only intended for locations in different dimensions. My block is limited to only the dimension the block is located in. He wrote a custom way to retrieve chunk data from the server (since vanilla doesn't support this for multiple dimensions), but i was kinda hoping to be able to use the vanilla way (Since i stick to the world the client is in already anyway). I don't think he does any marking for re-rendering, since he doesn't move the vision of the actual client side player. I could be wrong though. I will browse through the code once more, to see if it might still be able to give me some clues
×
×
  • Create New...

Important Information

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