I have seen that whenever a new block is created, people create a whole new class.
That seems like a lot of useless classes and code must be copy-pasted every time.
So I created only two classes, one for creating blocks, and one for creating items, and I just pass arguments to a constructor, and inside it runs methods: setMaxStackSize(), setUnlocalizedName() and a few more. That saves me from creating a new class every time I need to create a new block. So, since I haven't seen that aproach used anywhere, I just wonder is there something wrong with it? Does it create lag, or conflicts with some rules or conventions?
package packageName;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
public class className extends Item{
public className(int itemID, int stackSize, String name, CreativeTabs tab, String texture) {
super(itemID);
setMaxStackSize(stackSize);
setUnlocalizedName(name);
setCreativeTab(tab);
setTextureName("intercraft:"+texture);
}
public className(int itemID, int stackSize, String name, CreativeTabs tab) {
super(itemID);
setMaxStackSize(stackSize);
setUnlocalizedName(name);
setCreativeTab(tab);
}
}