Jump to content

rich1051414

Forge Modder
  • Posts

    160
  • Joined

  • Last visited

Everything posted by rich1051414

  1. Yes, on a client side render tick end(this is important), do this: if(Minecraft.getMinecraft().currentScreen == null){ ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft().gameSettings, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight); FontRenderer fontrenderer = Minecraft.getMinecraft().fontRenderer; int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); Minecraft.getMinecraft().entityRenderer.setupOverlayRendering(); //Do your rendering... } That should set you up for everything you need to add anything you want to the gui. If you wanted to replace the gui entirely however, the location of the built in hud is located at Minecraft.getMinecraft().ingameGUI. I assume one could simply assign that to your gui replacement if you wanted to change the hud entirely, although I have never tried it.
  2. ALL mods should have configs that let you manually change the block ID's, or you could delete trouble configs one by one until they all get reassigned(if it was coded right). If the mod does not have configurable block id's... it is not worth using. Sorry, that's my opinion. It takes no effort and makes me lose my entire confidence in the mod.
  3. Yes, Today I added 3d rendering and animation to one of my mods that had a projectile. It tumbles in flight, and I quickly noticed choppy animation that wasn't present in earlier mods doing similar things. I corrected many of the issues by using a datawatcher, it seems to update at a much smoother rate than it's NBT data. I am unsure why. Motion itself isn't too bad, unless your lagging, but the rotation was a problem, almost rubber-banding effect.
  4. Depends on the method, some methods execute client side only, i dont play sounds at all in these, but in one situation, I did need to play a sound via a packet. In onItemUseFirst overrides, if you return false to prevent a menu from opening, it will not run server side. I made a packet to handle this request, but as it also consumed items, I felt it was a low risk of abuse. And yes, all my sounds are played in a "if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {}" block, and they all work great, and as an added bonus, it is inherently multiplayer compatible, other players will hear it too. When I had problems playing sounds, it was when I did not put world.playSoundAtEntity calls within a server check block. This is probably your issue.
  5. Hud layers depend on what gets drawn first. Try rendering on a render Tick Start instead of end.
  6. Hmm, have you tried something like this? I did something like this ages ago and I never experienced those problems with this method. @Override public void tickEnd(EnumSet<TickType> type, Object... tickData) { ScaledResolution scaledresolution = new ScaledResolution( mc.gameSettings, mc.displayWidth, mc.displayHeight); int width = scaledresolution.getScaledWidth(); int height = scaledresolution.getScaledHeight(); FontRenderer fontrenderer = mc.fontRenderer; mc.entityRenderer.setupOverlayRendering(); // render }
  7. I never read this, but this is EXACTLY how i do my non-consumed recipe ingredients. Seems it is probably the easiest way.
  8. Extend Tile Entity of course for your tile entity(mostly server side). Extend Container for your server+Client inventory handling 'proxy'. This is where all your slots and ItemStack handling will go. Extend GuiContainer for your ClientSide only UI for visualizing the Container.
  9. Use EntityPlayer references, not EntityPlayerMP(server only) or EntityClientPlayerMP(ClientSide), they BOTH inherit Entity Player, so that declaration is safe. If you make sure it is serverside when you play sound at entity, the built in event bus will send the necessary packets to the clients to play sounds. A client cannot tell the server to play a sound without a custom packet handler, and unless the server knows to play the sound too, you may not hear it at all, and definitely other players will not. Most of the time, your methods can be accessed both by server and client, and you need to make sure which side you are on to prevent undesired packet duplication.(Servers CAN send packets to themselves.) But as I said, all this is unnecessary 99% of the time, as most of your code can be accessed by the server and client. You need to be careful setting up a packet handler to play sounds, because a clever coder could abuse it, spamming everyone with sounds. It is ideal to do the sound playing within the method, and avoid a packet handler when possible. As I said, if the server side gets told to play a sound, it will automatically register the event and will deliver it with the built in packet handler.
  10. You need to do all item handling in a GuiContainer, not a client side visual gui. It will be in three layers: [Tile_Entity_Storage] -----------|------------- ----------\/------------ [CommonSidedGuiContainer] -----------|------------- ----------\/------------ [ClientSidedVisualGui] The container will access the tile entity, and the client side visual gui only adds the textures and stuff.
  11. Well after reading back over this, I should point at that a HashSet has a much faster .contains lookup due to how the hash key lookup functions. ArrayLists are superior if an ordered system is required, as well as sporting faster full list iterations, however the HashSet uses a hash lookup, which means it has much faster random access. If you only need to check if your list contains the ID, then just address the entityID from the evt, use a HashSet.
  12. Override slotClicked and return null(maybe just return? can't remember) if that item shouldn't be placed in the slot number passed in, otherwise, call the super. You can get the itemstack that is currently stuck to the players mouse by doing a player.inventory.getItemStack() Edit: Return the ItemStack, not null. Returning Null will delete the item in their hand.
  13. Why not just return a different texture location from getTextureBySide by checking what the current graphics settings is then?
  14. No it wouldn't be costly as long as you do it right. I assume you want to listen to multiple players? If so, and you are worried about performance, just add the player entityID's to an ArrayList. Register onto the event bus with PlayerEvent(the most specific event for your use available), and do a if(playerList.contains(evt.entityLiving.entityID) ) first, and the performance loss should be negligible.
  15. That's a bit nuts... although client to server packets get you kicked without your own packet handler, it usually is not necessary. If the method runs client and server side, just do this: if(!world.isRemote()){ world.playerSoundAtEntity(player, ...etc); } If you need to play a sound but you are in a client side environment, just send the dimension and the entity ID that the sound originates and do a: WorldServer world = FMLCommonHandler.getInstance().getServerInstance().getWorldServerByDimensionID(dimSentToSever); Entity entity = world.getEntityByID(idSentToServer); world.playSoundAtEntity(entity, ...); I just typed that out by memory, so don't copy and paste it, it is just to give you an idea of how its normally done.
  16. Hmm, i dont really know, the thing is, minecraft is a huge modding community, most things that can be done, have been done. I suppose you could look at explosives, that seems to be what has the biggest impact on peoples computers. Maximizing performance while minimizing loss of quality would make some happy I am sure, but I don't know if it is anything that hasn't been done before.
  17. Item's are not unique, they are static duplicates. you can not have an item unique variable. These items ARE contained within item stacks however, which are unique to one another tho.
  18. Of course it is possible... create a new item stack and add in the tags, then give it to the player... what kind of hook are you looking for, nothing is needed to do this.
  19. just check the instance of the entity. if(evt.entity instanceof EntityPlayer){ ... }
  20. magicItems.common.EntityFlameshot cannot be cast to net.minecraft.src.EntityLiving Are you kidding me? Am I a bad person for pointing and laughing? Please learn how to use java first please.
  21. You could just keep a server side HashMap. You wouldn't really need to save it either if you do it right, do a redundancy system, where info is stored to the player and the map, and if either is null, restore with what the other has. This would allow you to get away with not actually saving the mapped data entirely.
  22. Uh you do realize you have to pass the id's of the blocks you want to hide to your proxies via Mod.proxy.doNEICheck(blockOrItemIDToHide) right? My example won't work unless the world is already loaded, you can put the call in a tick, and toggle a boolean to disable the call if it succeeds. I don't know what would happen if you try to remove an ID that doesn't exist, probably nothing, but there is no point and is a waste of resources.
  23. It looks like your command block is setting null to your spawn point, let's see your code.
  24. Uh, have you ever used google? There are thousands of tutorials on this subject. You need a ISimpleBlockRenderingHandler, you need to generate a unique render id(client side) with RenderingRegistry.getNextAvailableRenderId, and you need to register it with RenderingRegistry.registerBlockHandler. Return the generated ID as your rendertype. That covers all of the problems I know of people have with this.
×
×
  • Create New...

Important Information

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