Simpler way of obtaining items via API
This commit is contained in:
parent
61b2b293ba
commit
cce3d6b79a
|
@ -6,9 +6,13 @@ import lombok.Setter;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
public class BloodMagicAPI {
|
||||
|
||||
public static final String ORB = "ItemBloodOrb";
|
||||
public static final String SCRIBE = "ItemInscriptionTool";
|
||||
|
||||
@Getter @Setter
|
||||
private static boolean loggingEnabled;
|
||||
|
||||
|
@ -18,11 +22,16 @@ public class BloodMagicAPI {
|
|||
@Getter
|
||||
private static DamageSource damageSource = new DamageSourceBloodMagic();
|
||||
|
||||
@Getter @Setter
|
||||
private static Item orbItem;
|
||||
@Getter @Setter
|
||||
private static Item scribeItem;
|
||||
|
||||
/**
|
||||
* Used to obtain Items from BloodMagic. Use the constants above for common items in case internal names
|
||||
* change.
|
||||
*
|
||||
* @param name - The registered name of the item. Usually the same as the class name.
|
||||
* @return - The requested Item
|
||||
*/
|
||||
public static Item getItem(String name) {
|
||||
return GameRegistry.findItem(Constants.Mod.MODID, name);
|
||||
}
|
||||
|
||||
@Getter @Setter
|
||||
private static Fluid lifeEssence;
|
||||
|
|
|
@ -24,7 +24,7 @@ public enum EnumRuneType implements IStringSerializable {
|
|||
}
|
||||
|
||||
public ItemStack getScribeStack() {
|
||||
return new ItemStack(BloodMagicAPI.getScribeItem(), 1, ordinal());
|
||||
return new ItemStack(BloodMagicAPI.getItem(BloodMagicAPI.SCRIBE), 1, ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,6 @@ public class ModItems {
|
|||
|
||||
public static void init() {
|
||||
bloodOrb = registerItem(new ItemBloodOrb());
|
||||
BloodMagicAPI.setOrbItem(bloodOrb);
|
||||
orbWeak = new BloodOrb("weak", 1, 5000);
|
||||
OrbRegistry.registerOrb(orbWeak);
|
||||
orbApprentice = new BloodOrb("apprentice", 2, 25000);
|
||||
|
@ -69,7 +68,6 @@ public class ModItems {
|
|||
activationCrystal = registerItem(new ItemActivationCrystal());
|
||||
slate = registerItem(new ItemSlate());
|
||||
inscriptionTool = registerItem(new ItemInscriptionTool());
|
||||
BloodMagicAPI.setScribeItem(inscriptionTool);
|
||||
|
||||
sacrificialDagger = registerItem(new ItemSacrificialDagger());
|
||||
packSacrifice = registerItem(new ItemPackSacrifice());
|
||||
|
|
Loading…
Reference in a new issue