Trying to make a new mob drop a custom item. cant reference the item from the Items class, so how do I do it?
Screenshot of my problem attached.
In the dropFewItems method is where I wish to make my mob drop the custom item. On the right, you can see my items each have a seperate class. Is this a problem???
You should have instances of each of your Item classes stored as fields of either your main class or a class like ModItems that specifically stores your Items. Reference these fields instead of the fields of the Items class (e.g. this.dropItem(ModItems.zerglingClaw, 2))
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
It will be similar to the Items class, yes. Basically, have a static field for each Item then instantiate and register each Item in a method called during preInit. Assign the Item instances to the fields and reference those fields when needed.
Sometimes people also handle adding recipes in the ModItems class (done during init).
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
For the type of the field, either use the base Item or the actual class used for the item (e.g. MineralShard).
For example:
public static Item mineralShard; // Using Item
public static ProtossVespene protossVespene; // Using actual class
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Fairly simple problem.
Trying to make a new mob drop a custom item. cant reference the item from the Items class, so how do I do it?
Screenshot of my problem attached.
In the dropFewItems method is where I wish to make my mob drop the custom item. On the right, you can see my items each have a seperate class. Is this a problem???
NULL
You should have instances of each of your Item classes stored as fields of either your main class or a class like ModItems that specifically stores your Items. Reference these fields instead of the fields of the Items class (e.g. this.dropItem(ModItems.zerglingClaw, 2))
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
So how would I begin constructing such a class? Just construct it based off of the built in Items class for Minecraft?
NULL
It will be similar to the Items class, yes. Basically, have a static field for each Item then instantiate and register each Item in a method called during preInit. Assign the Item instances to the fields and reference those fields when needed.
Sometimes people also handle adding recipes in the ModItems class (done during init).
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
But how would the field be created?
Say I have an object of the class Item called myItem.
Something like "public static" to start off, but then what comes after?
I've already registered the items and created a class to handle mod items. All I need now is to create the fields for my items.
Forgive me. I'm new to modding.
NULL
For example:
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Ok. I understand now. Thank you!
NULL