Everything posted by Choonster
-
How to use the ItemCraftedEvent event
I'm not going to write your code for you. I've told you exactly which methods to override and call and in what order, you just need to translate that into code. If there's a specific part of my post that you didn't understand, I can try to explain it further.
-
How to use the ItemCraftedEvent event
You'll need to be more specific. Which part didn't you understand?
-
Forge config gui
That should work, yes. You can also use ConfigCategory#getValues to get an immutable copy of the category's property names and properties (and use Map#getValues to get a collection of the Map's values) or ConfigCategory#getOrderedValues to get an ordered immutable copy of the category's properties.
-
How to use the ItemCraftedEvent event
Use the container item system for this, not ItemCraftedEvent. If the sandpaper is returned to the player without change, call Item#setContainerItem with this as the argument in the sandpaper Item's constructor to set it as its own container item. If the sandpaper is changed (e.g. damaged) by the crafting, override Item#getContainerItem(ItemStack) to copy its argument (ItemStack#copy), damage the copy (ItemStack#attemptDamageItem) and return the copy.
-
Forge config gui
You'll need to call Property#setConfigEntryClass on each of those Property objects, yes.
-
Forge config gui
Call Property#setConfigEntryClass with NumberSliderEntry.class as the argument.
-
Forge config gui
That looks correct, yes.
-
Forge config gui
Yes. Forge uses your category names in a regular expression (for String#replaceFirst), so they can't contain any characters that have a special meaning in regular expressions (e.g parentheses).
-
[1.12] Custom Crafting with OreDictionary?
The actual ore dictionary matching has moved to OreIngredient (forge:ore_dict in JSON), which you can use as an Ingredient in any Vanilla or Forge recipe class. You can create and register recipes in code if you want, but moving to the JSON system is recommended.
-
1.10.2 how is crafting recipes handled for shears
Because there's no class with that name. Use World Capabilities or World Saved Data. If you want more help with this, create a new thread. The Item.ToolMaterial and ItemArmor.ArmorMaterial enums control the stats of tools and armour, respectively.
-
1.10.2 how is crafting recipes handled for shears
To open a class by name, use Navigate > Class (Ctrl-N) in IDEA or Navigate > Go To > Type... in Eclipse. This will avoid manually searching or asking for the fully qualified name.
-
Codding Dices
There's no method in Item called useItemRightClick, so your method doesn't override anything and is never called. You shouldn't be storing an ItemStack in your Item class, the ItemStack will be provided to most Item methods you override. Always annotate override methods with @Override so you get a compilation error if they don't actually override a super methods. You should use your IDE to auto-generate override methods with the correct signature and annotation. In this case, you'll want to override Item#onItemRightClick and use ICommandManager#executeCommand to execute the command. Use MinecraftServer#getCommandManager to get the server's ICommandManager instance and use World#getMinecraftServer to get the MinecraftServer instance. You should only do all of this on the logical server (when World#isRemote is false).
-
Forge config gui
The full path of the category, not the full path of the field that was used to create it. The default top-level category is general and the frame category is in that, so use "general.frame".
-
Minecraft Mojang Screen Bug. FML Help
The FML log is the logs/fml-client-latest.log file in the Minecraft game directory.
-
Forge config gui
The Configuration object contains the properties and categories created by Forge from your @Config class. You need it to get the Property so you can set NumberSliderEntry as its config GUI entry type (i.e. use a slider for that property in the config GUI). You get the Property by calling these methods:
-
Forge config gui
That looks correct. There's no need to have the variable declaration and assignment on separate lines, though.
-
Forge config gui
It will return a value of type Configuration, but the compiler doesn't know that. You need to cast the return value to Configuration yourself.
-
[1.12] build failed for task compileJava
There is no net.minecraft.player package (or rather there's no classes in it to import), only net.minecraft.player.inventory.
-
Forge config gui
That will work because the method checks if name is either null or empty, though Forge never calls it with null as the name argument (like I said in my previous post, the default value is the empty string). Method#invoke returns whatever the method returned. In this case it's the Configuration object, so store it in a local variable.
-
Forge config gui
It's a local variable rather than a field, so it can't be private or static. It can be final to prevent its value from being changed, but this isn't required. If you were calling an instance method of ConfigManager (and ConfigManager actually had any instance methods), you'd pass an instance of ConfigManager as the obj argument. Since the method you're calling is static, just pass null. The two parameters of ConfigManager.getConfiguration are modid and name, which should match the values you specified in the @Config annotation. Use an empty string for name if you didn't specify it in the annotation, since that's the annotation property's default value.
-
Forge config gui
If you want to call a method multiple times, you should look up the Method object once and store it in a private static final field; yes. You then call Method#invoke on it when you want to call the method (which is usually at a different time to when the field is initialised, i.e. in a method rather than a field initialiser). I've just realised that ConfigManager.getConfiguration only needs to be called once, so there's no need to store the Method object in a field. I forgot about this in my earlier posts. When I say "call Class#method", I mean "call the method named method on an instance of Class". In this case, call the invoke method on the Method object.
-
Forge config gui
NumberSliderEntry isn't involved here. You want to access the getConfiguration method in the ConfigManager class, so use ConfigManager.class as the clazz argument and "getConfiguration" as the methodName argument. The method doesn't have an obfuscated name (since it's not added by vanilla), so use null as the methodObfName argument. The method takes has two String parameters, so use String.class, String.class as the parameterTypes argument.
-
Forge config gui
I just added two more enum properties to my mod, both of which are in a subcategory/nested class rather than the top-level category/class. One uses an enum defined in the top-level class, the other uses an enum defined in the nested class. Both save without issue.
-
Forge config gui
I then explained how to call it with reflection in more detail here: When you use reflection to call a method, you don't call it directly like you would normally. You need to get the Method object for the method and then use that to call it.
-
Forge config gui
I've told you which methods you need to call, was there a particular part of my instructions that you didn't understand? Class.forName requires the fully qualified name of the class, e.g. "java.lang.Thread" rather than just "Thread". You only need to call Class.forName to get a Class object for a class that isn't known at compile-time. If you do know the class at compile-time, use a class literal instead.
IPS spam blocked by CleanTalk.