Jump to content

Choonster

Moderators
  • Posts

    5161
  • Joined

  • Last visited

  • Days Won

    76

Everything posted by Choonster

  1. As I said, you need to call it with reflection. This is because it's package-private rather than public. I use the Class#member notation to refer to the non-static field or method member in Class. I use Class.member to refer to static fields and methods. You can use ReflectionHelper.findMethod to get a Method object referring to a method and then use Method#invoke to call the method. The first argument is the object to call it on (use null for static methods) and the vararg is the arguments to pass to the method. If you were calling this method more than once, you'd want to store the Method object in a private static final field so you only do the expensive lookup once. The same applies to reflecting fields and Field objects. You need to do this in your client proxy (or another client-only class called from it), not just mark the preInit method in your @Mod class as @SideOnly. If your mod is client-only, it's probably safe to do this in your @Mod class. You could suggest this in the Suggestions section or on GitHub. Side note: The @Mod.Instance annotation is meant to be applied to the field that will store the instance of your @Mod class, not the field storing your mod ID. Why are you using fully-qualified names for the @Mod annotation?
  2. Post the FML log, the models/blockstates files and your model registration code. Are you getting the missing model (a black and pink checkered cube with the model location overlayed on it that appears in the middle of the screen when held) or the actual model with the missing texture (a black and pink checkered pattern).
  3. ForgeRegistry#getEntries returns an immutable copy of the registry's entries, so you can't use it to modify the registry. As I said earlier in the thread, use IForgeRegistryModifiable#remove.
  4. That looks mostly correct, but I highly recommend moving the synchronisation to MoralityScale itself (like I described in this post) so the code that uses it gets the synchronisation automatically. This avoids repeating the synchronisation code in every place you change the morality value and prevents inconsistencies between places that change the value, e.g. forgetting to send the packet or sending the wrong packet. Your addVirtue/addSin methods attempt to clamp the morality value between the maximum virtue and sin values but you only do this when the morality is already at the maximum, which means that any argument greater than or equal to 2 could push it over the maximum ((max - 1) + 2 = max + 1 ). I recommend using MathHelper.clamp(int, int, int) to clamp morality +/- points between the maximum virtue and sin values. Don't create a new Random each time you need a random number, create one instance and store it. You're still using hardcoded chat messages rather than specifying them in the lang files. You should only send chat messages on one side (usually the server) to avoid sending the message twice. I'm glad you've learned from this.
  5. If you extend RenderBiped, it automatically adds LayerHeldItem (which renders the entity's held items) for you. If you extend RenderLiving, you need to add it yourself.
  6. I'm not a moderator. Reality Controller is a title based on the number of posts I've made and Forge Modder was an opt-in group for mod developers before the site revamp (I'm not sure if it's still possible to opt-in).
  7. Don't include the .png extension in your model texture paths, Minecraft adds it automatically. If you've already fixed that in your models but Minecraft is still using an older version of them, rebuild your project to make sure everything is up-to-date.
  8. I explained in detail how to upload the FML log to Gist here, you should be able to adapt these instructions to your situation. If you're using Gist, you can upload multiple files in a single gist.
  9. I'm not good at diagnosing problems without information. Uploading files to Gist/Pastebin is a very simple process, you shouldn't need to be good at it.
  10. Yes, every model that uses non-vanilla textures specifies the testmod3 resource domain for them.
  11. You could use an Access Transformer, but I'm not sure how much documentation there is on them.
  12. Don't create a new Random every time, create one and store it. Item#itemRand already contains a Random instance that you can use. You need to generate the random number in your override of Item#getContainerItem(ItemStack).
  13. Wherever you specify the textures, in the model or the blockstates file.
  14. When FML sends an IMessage over the network, it includes the discriminator byte you specified for the class in SimpleNetworkWrapper#registerMessage so it knows which class to instantiate on the receiving side. If you don't register an IMessage class, it defaults to 0 and instantiates whatever class you registered for discriminator 0. Since the class instantiated on the receiving side is different to the one that was sent, the byte buffer won't contain the data it was expecting and an exception will be thrown (if it tries to read more data than was written) or it will silently corrupt the data as it reads it from the byte buffer (if it tries to read less than or equal to the amount that was written).
  15. Minecraft is trying to load your textures from the minecraft resource domain, where they don't exist. You need to specify your mod's resource domain, i.e. use "<modid>:<texture_path>" rather than just "<texture_path>".
  16. The only one of these constructors added by Forge is ItemAxe(ToolMaterial, float, float), which uses the same access level as the vanilla ItemAxe(ToolMaterial) constructor. All of the others are vanilla constructors whose access levels aren't changed by Forge.
  17. No, ConfigManager creates and stores the Configuration instance for each @Config class. You get the Property from the Configuration (via the ConfigCategory) and call Property#setConfigEntryClass with NumberSliderEntry.class.
  18. In the moralityScale class, yes. Don't add the player as an argument to any of the functions, the moralityScale already knows which player it's attached to (the one stored in the field). Again, you don't need these arguments because the moralityScale already knows its current morality value and which player it's attached to. Data persistence and networking are completely separate. Only the server persists the game state (i.e. writes your capability to NBT and writes the NBT to the disk), the client doesn't need to persist anything. This is correct, just have the packet set the morality value directly; it doesn't need to do anything NBT-related. Side note: I recommend following Java naming conventions by using PascalCase for class, enum and interface names and camelCase for field, parameter, local variable and method names.
  19. Post your code, any relevant JSON files and the FML log (logs/fml-client-latest.log in the game directory) using Gist or Pastebin.
  20. It looks like you'll need to use reflection to call ConfigManager.getConfiguration with the mod ID and name you specified in your @Config annotation, this will return your mod's Configuration instance. You can then use Configuration#getCategory to get the ConfigCategory (you can specify a full path by separating each category name with periods . ) and ConfigCategory#get(String) to get the Property. You'll want to do this on the physical client (e.g. in your client proxy) in preInit.
  21. PopulateChunkEvent.Populate is fired for specific features and I guess nobody ever requested the addition of The End's 1.9 features. If you create an issue or PR on GitHub, the missing features may be added to the event.
  22. It looks like Forge only fires PopulateChunkEvent.Populate in ChunkGeneratorOverworld and ChunkGeneratorHell, but it fires PopulateChunkEvent.Pre/Post in these classes as well as in ChunkGeneratorEnd and ChunkGeneratorFlat.
  23. You can get a Cycle Value String control by using an enum field. To get a Slider control, you'll need to get the Property from the Configuration instance Forge created for your @Config class and call Property#setConfigEntryClass with NumberSliderEntry.class.
  24. moralityScale should have an EntityPlayer field holding the player it's attached to. Create a method in IMorality called something like synchronise and implement it in moralityScale to check that it's being called on the server (i.e. World#isRemote is false for the player's World) before sending a packet to the player with the current morality value. In moralityScale#addSin, moralityScale#addVirtue and moralityScale#set (i.e. the methods that change the morality value), call the synchronise method after changing the morality value to sync the change to the client. Byte buffers are for sending data between the client and server using packets. NBT is for storing data that will be saved to the disk. You very rarely send NBT between the client and server and should never need to use byte buffers for saving data to the disk.
×
×
  • Create New...

Important Information

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