Jump to content

herbix

Forge Modder
  • Posts

    116
  • Joined

  • Last visited

Everything posted by herbix

  1. Thanks TGG, but How can I find all "sword" models and replace them with my own?
  2. Hi, My question is simple: Can I or how to render an item with some coverage based on NBT tag of the item? For example, I have a diamond sword and now it's rendered as it is. When I changed some of its NBT tags, I need it rendered differently. Say, a diamond sword with blood. Modifying one item may not difficult, but what should I do if I want all sword items have this feature (maybe include swords of other mods)?
  3. As I searched ChunkProviderGenerate#provideChunk, ChunkProviderEvent.ReplaceBiomeBlocks event could get the ChunkPrimer during terrain generation.
  4. Hi Samueru, If you are to generate terrain once the chunk created, you could generate it in ChunkProvider#provideChunk. Usually a ChunkPrimer is created in it in order to set all blockstates in the chunk. Set a blockstate in ChunkPrimer is much more efficient than World#setBlockState, and vanilla cave generation is implemented in this way.
  5. Sure. These code works on client side. When rendering other players, they are looked from your eyes. That means they are always in third view. If not check unique ID, other players' item are rendered as first view when you are in first view.
  6. I don't understand why you read property ICE and then write it back. Also, you didn't implement getMetaFromState and getStateFromMeta well. Since you don't have a getStateFromMeta, the state will always be the default state. And... using getActualState means some states are calculated not stored in meta. For example, the direction of redstone wire. If your block states cannot be calculated, I suppose tile entity is a better choice.
  7. I did it in my item class, override getModel method: @Override @SideOnly(Side.CLIENT) public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { Minecraft mc = Minecraft.getMinecraft(); boolean isFirstPersonView = mc.thePlayer.getUniqueID().equals(player.getUniqueID()) && mc.gameSettings.thirdPersonView == 0; if(isFirstPersonView) { return /* some resource */ } else { return /* some other resource */ } }
  8. Thanks. I found out that since it's a weak map, its values can be released by gc mechanism.
  9. I read codes of DimensionManager and find a field weakWorldMap . It's a weak map and when setWorld a world object is put in and they are never removed. I doubt whether this would cause memory leak after several loading and unloading operations, since weak maps determine equality by == not .equals . And want to know what the field used for. That's my question. Any reply would help. Thank you.
  10. I suddenly found out that I uses net.minecraftforge.fml.client.config.GuiSlider not the vanilla one.
  11. Override canUseCommand or something similar. PS: Whether a player can use a command depends on "cheat enabled" not "creative mode".
  12. You can get the player by event.player , and the world event.player.worldObj . There're methods and fields related to player list in worldObj . And there're methods in Entity class to calculate distance. Players are also entities. PS: There're lots of changes from MCP to Forge. Reading Forge source codes helps more.
  13. Try events. There's a cancelable event ServerChatEvent .
  14. Server resource packs would help.
  15. Also, minecraft 1.8 uses World#addWeatherEffect not World#spawnEntityInWorld to spawn a lightning bolt. CommandSummon gives an example of how to summon lightnings.
  16. I suppose some mathematic calculations should be applyed to get pitch and yaw. double x = player.posX - blockPos.getX() - 0.5; double y = player.posY - blockPos.getY() - 0.5; double z = player.posZ - blockPos.getZ() - 0.5; double pitch = Math.atan2(-y, Math.sqrt(x*x+z*z)); double yaw = Math.atan2(z, -x); I forget the sign before x and y . You may try twice and get the correct ones.
  17. There's a little difference between x >> 4 and x / 16 if x < 0 , since (-1 >> 4) == -1 while (-1 / 16) == 0 . The same thing occurs on & and % . (-1 & 15) == 15 while (-1 % 16) == -1 . To get correct chunk coords efficiently, >> and & are necessary.
  18. Simply divide x, y, z coords by 16 you will get chunk coords int x = 1000, y = 64, z = 1000; int chunkx = x >> 4; int chunky = y >> 4; int chunkz = z >> 4;
  19. Thank you, Lex. This may be what I'm looking for. Seems I should look at Forge repositories before I asked here. And thanks to all who replied me.
  20. You didn't get my point. It's not me who defines func_aaa_b.
  21. Yes. It's easy to replace func_aaa_b to something, since aaa is an unique number. And I can simply use text replacement to achieve this. However, if func_aaa_b is mapped to A in old mappings and B in new mappings. I have to look up A in old mappings to get func_aaa_b, and then look up it in new mappings to get B. It cost more time and I can't simply replace text because it's not unique. I have to do it manually in case change other methods with the same name. That's why I am looking for a tool.
  22. It's just an example. I mean, if the deobfuscated name of a vanilla method changed in some mappings, the codes that follow old mappings and use the method couldn't be compiled when using new mappings. The same method, is named A in old mappings while named B in new mappings. My codes call A(). If I change to new mapping, A() doesn't exist and my codes can't be compiled until I change A() to B(). I'm seeking a way to do it automatically.
  23. For example, now I have these codes in my mod: @Override public void func_180434_a(WorldRenderer worldRenderer, Entity entity, float time, float f4, float f5, float f6, float f7, float f8) { ... } Maybe in another obfuscation mapping, func_180434_a is replaced by renderParticle. If I changed the mapping, a compile error occurs. So is there any tool that input two mappings and my codes, output rewrited codes that replaced all obfuscated methods and fields? So that I could focus on issues such as BlockPos replacing x,y,z instead of renaming func_180434_a to renderParticle. Any clue could help.
  24. Add a adapter to your class: @Override @SideOnly(Side.CLIENT) public EnumWorldBlockLayer getBlockLayer() { return Blocks.leaves.getBlockLayer(); }
  25. It's impossible to look back. ISimpleBlockRenderingHandler won't back. But ExtendedBlockState and ISmartBlockModel would help. See this tutorial and may it help: http://www.minecraftforge.net/forum/index.php/topic,28714.0.html
×
×
  • Create New...

Important Information

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