Change how blocks/items are registered (desc)

tterrag is a meany face and yelled at me for using class.getSimpleName(). So here's an API-friendly re-work of the registration system. This allows all our Items/Blocks to be obtained via the API. Just add a new enum.
This commit is contained in:
Nick 2016-01-18 22:34:12 -08:00
parent 2a028414b1
commit fdfcb5c5b7
69 changed files with 260 additions and 15 deletions

View file

@ -35,8 +35,9 @@ public class BloodMagicAPI
private static Fluid lifeEssence;
/**
* Used to obtain Items from BloodMagic. Use the constants above for common
* items in case internal names change.
* Used to obtain Items from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to get
* the registered name.
*
* @param name
* - The registered name of the item. Usually the same as the class
@ -48,6 +49,43 @@ public class BloodMagicAPI
return GameRegistry.findItem(Constants.Mod.MODID, name);
}
/**
* @see #getItem(String)
*
* @param bloodMagicItem
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to get.
* @return - The requested Item
*/
public static Item getItem(Constants.BloodMagicItem bloodMagicItem) {
return getItem(bloodMagicItem.getRegName());
}
/**
* Used to obtain Blocks from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock} to get
* the registered name.
*
* @param name
* - The registered name of the block. Usually the same as the class
* name.
* @return - The requested Block
*/
public static Block getBlock(String name)
{
return GameRegistry.findBlock(Constants.Mod.MODID, name);
}
/**
* @see #getBlock(String)
*
* @param bloodMagicBlock
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock} to get.
* @return - The requested Block
*/
public static Block getBlock(Constants.BloodMagicBlock bloodMagicBlock) {
return getBlock(bloodMagicBlock.getRegName());
}
/**
* Used to add a {@link BlockStack} to the Teleposer blacklist that cannot
* be changed via Configuration files.

View file

@ -1,5 +1,8 @@
package WayofTime.bloodmagic.api;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.potion.Potion;
import java.util.Locale;
@ -131,4 +134,105 @@ public class Constants
{
public static final int POTION_ARRAY_SIZE = Potion.potionTypes.length;
}
public enum BloodMagicItem
{
ACTIVATION_CRYSTAL("ItemActivationCrystal"),
ALTAR_MAKER("ItemAltarMaker"),
ARCANE_ASHES("ItemArcaneAshes"),
BLOOD_ORB("ItemBloodOrb"),
BOUND_AXE("ItemBoundAxe"),
BLOOD_SHARD("ItemBloodShard"),
BOUND_PICKAXE("ItemBoundPickaxe"),
BOUND_SHOVEL("ItemBoundShovel"),
BOUND_SWORD("ItemBoundSword"),
BUCKET_ESSENCE("ItemBucketEssence"),
COMPONENT("ItemComponent"),
DAGGER_OF_SACRIFICE("ItemDaggerOfSacrifice"),
INSCRIPTION_TOOL("ItemInscriptionTool"),
LAVA_CRYSTAL("ItemLavaCrystal"),
LIVING_ARMOR_HELMET("ItemLivingArmourHelmet"),
LIVING_ARMOR_CHEST("ItemLivingArmourChest"),
LIVING_ARMOR_LEGS("ItemLivingArmourLegs"),
LIVING_ARMOR_BOOTS("ItemLivingArmourBoots"),
MONSTER_SOUL("ItemMonsterSoul"),
NODE_ROUTER("ItemNodeRouter"),
RITUAL_DIVINER("ItemRitualDiviner"),
ROUTER_FILTER("ItemRouterFilter"),
SACRIFICIAL_DAGGER("ItemSacrificialDagger"),
SACRIFICE_PACK("ItemPackSacrifice"),
SELF_SACRIFICE_PACK("ItemPackSelfSacrifice"),
SENTIENT_ARMOR_HELMET("ItemSentientArmourHelmet"),
SENTIENT_ARMOR_CHEST("ItemSentientArmourChest"),
SENTIENT_ARMOR_LEGS("ItemSentientArmourLegs"),
SENTIENT_ARMOR_BOOTS("ItemSentientArmourBoots"),
SENTIENT_ARMOR_GEM("ItemSentientArmourGem"),
SENTIENT_BOW("ItemSentientBow"),
SENTIENT_SWORD("ItemSentientSword"),
SOUL_GEM("ItemSoulGem"),
SOUL_SNARE("ItemSoulSnare"),
SIGIL_AIR("ItemSigilAir"),
SIGIL_BLOOD_LIGHT("ItemSigilBloodLight"),
SIGIL_COMPRESSION("ItemSigilCompression"),
SIGIL_DIVINATION("ItemSigilDivination"),
SIGIL_ELEMENTAL_AFFINITY("ItemSigilElementalAffinity"),
SIGIL_ENDER_SEVERANCE("ItemSigilEnderSeverance"),
SIGIL_FAST_MINER("ItemSigilFastMiner"),
SIGIL_GREEN_GROVE("ItemSigilGreenGrove"),
SIGIL_HASTE("ItemSigilHaste"),
SIGIL_LAVA("ItemSigilLava"),
SIGIL_MAGNETISM("ItemSigilMagnetism"),
SIGIL_PHANTOM_BRIDGE("ItemSigilPhantomBridge"),
SIGIL_SEER("ItemSigilSeer"),
SIGIL_SUPPRESION("ItemSigilSuppression"),
SIGIL_VOID("ItemSigilVoid"),
SIGIL_WATER("ItemSigilWater"),
SIGIL_WHIRLWIND("ItemSigilWhirlwind"),
SLATE("ItemSlate"),
TELEPOSITION_FOCUS("ItemTelepositionFocus"),
UPGRADE_TOME("ItemUpgradeTome");
@Getter
private final String regName;
BloodMagicItem(String regName) {
this.regName = regName;
}
public Item getItem() {
return BloodMagicAPI.getItem(getRegName());
}
}
public enum BloodMagicBlock {
ALCHEMY_ARRAY("BlockAlchemyArray"),
ALTAR("BlockAltar"),
BLOOD_LIGHT("BlockBloodLight"),
BLOOD_RUNE("BlockBloodRune"),
BLOOD_STONE("BlockBloodStoneBrick"),
CRYSTAL("BlockCrystal"),
INPUT_ROUTING_NODE("BlockInputRoutingNode"),
ITEM_ROUTING_NODE("BlockItemRoutingNode"),
LIFE_ESSENCE("BlockLifeEssence"),
MASTER_ROUTING_NODE("BlockMasterRoutingNode"),
OUTPUT_ROUTING_NODE("BlockOutputRoutingNode"),
PEDESTAL("BlockPedestal"),
PHANTOM("BlockPhantom"),
RITUAL_CONTROLLER("BlockRitualController"),
RITUAL_STONE("BlockRitualStone"),
SOUL_FORGE("BlockSoulForge"),
SPECTRAL("BlockSpectral"),
TELEPOSER("BlockTeleposer");
@Getter
private final String regName;
BloodMagicBlock(String regName) {
this.regName = regName;
}
public Block getBlock() {
return BloodMagicAPI.getBlock(getRegName());
}
}
}

View file

@ -27,6 +27,7 @@ public class BlockAlchemyArray extends BlockContainer
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".alchemyArray");
setRegistryName(Constants.BloodMagicBlock.ALCHEMY_ARRAY.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
this.setHardness(0.1f);
this.setBlockBounds(0, 0, 0, 1, 0.1f, 1);

View file

@ -23,6 +23,7 @@ public class BlockAltar extends BlockContainer
super(Material.rock);
setUnlocalizedName(Constants.Mod.MODID + ".altar");
setRegistryName(Constants.BloodMagicBlock.ALTAR.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);

View file

@ -23,6 +23,7 @@ public class BlockBloodLight extends Block
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".bloodLight");
setRegistryName(Constants.BloodMagicBlock.BLOOD_LIGHT.getRegName());
}
@Override

View file

@ -14,6 +14,7 @@ public class BlockBloodRune extends BlockString
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".rune.");
setRegistryName(Constants.BloodMagicBlock.BLOOD_RUNE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setStepSound(soundTypeStone);
setHardness(2.0F);

View file

@ -14,6 +14,7 @@ public class BlockBloodStoneBrick extends BlockString
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".bloodstonebrick.");
setRegistryName(Constants.BloodMagicBlock.BLOOD_STONE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);

View file

@ -14,6 +14,7 @@ public class BlockCrystal extends BlockString
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".crystal.");
setRegistryName(Constants.BloodMagicBlock.CRYSTAL.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setStepSound(soundTypeStone);
setHardness(2.0F);

View file

@ -17,6 +17,7 @@ public class BlockInputRoutingNode extends BlockRoutingNode
super();
setUnlocalizedName(Constants.Mod.MODID + ".inputRouting");
setRegistryName(Constants.BloodMagicBlock.INPUT_ROUTING_NODE.getRegName());
}
@Override

View file

@ -15,6 +15,7 @@ public class BlockItemRoutingNode extends BlockRoutingNode
super();
setUnlocalizedName(Constants.Mod.MODID + ".itemRouting");
setRegistryName(Constants.BloodMagicBlock.ITEM_ROUTING_NODE.getRegName());
}
@Override

View file

@ -26,7 +26,7 @@ public class BlockLifeEssence extends BlockFluidClassic
super(lifeEssence, Material.water);
setUnlocalizedName(Constants.Mod.MODID + ".fluid.lifeEssence");
setRegistryName(Constants.BloodMagicBlock.LIFE_ESSENCE.getRegName());
lifeEssence.setBlock(this);
BloodMagicAPI.setLifeEssence(lifeEssence);
}

View file

@ -19,6 +19,7 @@ public class BlockMasterRoutingNode extends BlockContainer
super(Material.rock);
setUnlocalizedName(Constants.Mod.MODID + ".masterRouting");
setRegistryName(Constants.BloodMagicBlock.MASTER_ROUTING_NODE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);

View file

@ -17,6 +17,7 @@ public class BlockOutputRoutingNode extends BlockRoutingNode
super();
setUnlocalizedName(Constants.Mod.MODID + ".outputRouting");
setRegistryName(Constants.BloodMagicBlock.OUTPUT_ROUTING_NODE.getRegName());
}
@Override

View file

@ -23,6 +23,7 @@ public class BlockPedestal extends BlockStringContainer
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".");
setRegistryName(Constants.BloodMagicBlock.PEDESTAL.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHardness(2.0F);
setResistance(5.0F);

View file

@ -25,6 +25,7 @@ public class BlockPhantom extends BlockContainer
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".phantom");
setRegistryName(Constants.BloodMagicBlock.PHANTOM.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -30,6 +30,7 @@ public class BlockRitualController extends BlockStringContainer
super(Material.rock, names);
setUnlocalizedName(Constants.Mod.MODID + ".stone.ritual.");
setRegistryName(Constants.BloodMagicBlock.RITUAL_CONTROLLER.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setStepSound(soundTypeStone);
setHardness(2.0F);

View file

@ -18,6 +18,7 @@ public class BlockRitualStone extends BlockString implements IRitualStone
super(Material.iron, names);
setUnlocalizedName(Constants.Mod.MODID + ".ritualStone.");
setRegistryName(Constants.BloodMagicBlock.RITUAL_STONE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setStepSound(soundTypeStone);
setHardness(2.0F);

View file

@ -22,6 +22,7 @@ public class BlockSoulForge extends BlockContainer
super(Material.iron);
setUnlocalizedName(Constants.Mod.MODID + ".soulForge");
setRegistryName(Constants.BloodMagicBlock.SOUL_FORGE.getRegName());
setHardness(2.0F);
setResistance(5.0F);
setStepSound(soundTypeMetal);

View file

@ -25,6 +25,7 @@ public class BlockSpectral extends BlockContainer
super(Material.cloth);
setUnlocalizedName(Constants.Mod.MODID + ".spectral");
setRegistryName(Constants.BloodMagicBlock.SPECTRAL.getRegName());
setBlockBounds(0, 0, 0, 0, 0, 0);
}

View file

@ -24,6 +24,7 @@ public class BlockTeleposer extends BlockContainer
setCreativeTab(BloodMagic.tabBloodMagic);
setUnlocalizedName(Constants.Mod.MODID + ".teleposer");
setRegistryName(Constants.BloodMagicBlock.TELEPOSER.getRegName());
setHardness(2.0F);
setResistance(5.0F);
}

View file

@ -24,6 +24,7 @@ public class BlockTestSpellBlock extends Block
setResistance(5.0F);
setUnlocalizedName(Constants.Mod.MODID + ".testSpellBlock");
setRegistryName("BlockTestSpellBlock");
setCreativeTab(BloodMagic.tabBloodMagic);
this.setDefaultState(this.blockState.getBaseState().withProperty(INPUT, EnumFacing.DOWN).withProperty(OUTPUT, EnumFacing.UP));
}

View file

@ -20,6 +20,7 @@ public class ItemActivationCrystal extends ItemBindable
super();
setUnlocalizedName(Constants.Mod.MODID + ".activationCrystal.");
setRegistryName(Constants.BloodMagicItem.ACTIVATION_CRYSTAL.getRegName());
setHasSubtypes(true);
setLPUsed(100);
}

View file

@ -32,6 +32,7 @@ public class ItemAltarMaker extends Item implements IAltarManipulator
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".altarMaker");
setRegistryName(Constants.BloodMagicItem.ALTAR_MAKER.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setMaxStackSize(1);
setFull3D();

View file

@ -20,6 +20,7 @@ public class ItemArcaneAshes extends Item
public ItemArcaneAshes()
{
setUnlocalizedName(Constants.Mod.MODID + ".arcaneAshes");
setRegistryName(Constants.BloodMagicItem.ARCANE_ASHES.getRegName());
setMaxStackSize(1);
setMaxDamage(19); //Allows for 20 uses
setCreativeTab(BloodMagic.tabBloodMagic);

View file

@ -13,7 +13,6 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -25,6 +24,7 @@ public class ItemBloodOrb extends ItemBindable implements IBloodOrb, IBindable
public ItemBloodOrb()
{
setUnlocalizedName(Constants.Mod.MODID + ".orb.");
setRegistryName(Constants.BloodMagicItem.BLOOD_ORB.getRegName());
setHasSubtypes(true);
}

View file

@ -20,6 +20,7 @@ public class ItemBloodShard extends Item
setCreativeTab(BloodMagic.tabBloodMagic);
setUnlocalizedName(Constants.Mod.MODID + ".bloodShard.");
setRegistryName(Constants.BloodMagicItem.BLOOD_SHARD.getRegName());
setHasSubtypes(true);
}

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Multimap;
@ -27,6 +28,7 @@ public class ItemBoundAxe extends ItemBoundTool
public ItemBoundAxe()
{
super("axe", 5, EFFECTIVE_ON);
setRegistryName(Constants.BloodMagicItem.BOUND_AXE.getRegName());
}
@Override

View file

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Set;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.enchantment.EnchantmentHelper;
@ -27,6 +28,7 @@ public class ItemBoundPickaxe extends ItemBoundTool
public ItemBoundPickaxe()
{
super("pickaxe", 5, EFFECTIVE_ON);
setRegistryName(Constants.BloodMagicItem.BOUND_PICKAXE.getRegName());
}
@Override

View file

@ -1,6 +1,7 @@
package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import com.google.common.collect.HashMultiset;
@ -27,6 +28,7 @@ public class ItemBoundShovel extends ItemBoundTool
public ItemBoundShovel()
{
super("shovel", 5, EFFECTIVE_ON);
setRegistryName(Constants.BloodMagicItem.BOUND_SHOVEL.getRegName());
}
@Override

View file

@ -37,6 +37,7 @@ public class ItemBoundSword extends ItemSword
super(ModItems.boundToolMaterial);
setUnlocalizedName(Constants.Mod.MODID + ".bound.sword");
setRegistryName(Constants.BloodMagicItem.BOUND_SWORD.getRegName());
setHasSubtypes(true);
setNoRepair();
setCreativeTab(BloodMagic.tabBloodMagic);

View file

@ -13,6 +13,7 @@ public class ItemBucketEssence extends ItemBucket
super(ModBlocks.lifeEssence);
setUnlocalizedName(Constants.Mod.MODID + ".bucket.lifeEssence");
setRegistryName(Constants.BloodMagicItem.BUCKET_ESSENCE.getRegName());
setContainerItem(Items.bucket);
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -34,6 +34,7 @@ public class ItemComponent extends Item
super();
setUnlocalizedName(Constants.Mod.MODID + ".baseComponent.");
setRegistryName(Constants.BloodMagicItem.COMPONENT.getRegName());
setHasSubtypes(true);
setCreativeTab(BloodMagic.tabBloodMagic);

View file

@ -24,6 +24,7 @@ public class ItemDaggerOfSacrifice extends Item
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".daggerOfSacrifice");
setRegistryName(Constants.BloodMagicItem.DAGGER_OF_SACRIFICE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setMaxStackSize(1);
setFull3D();

View file

@ -25,9 +25,10 @@ public class ItemInscriptionTool extends ItemBindable
{
super();
setLPUsed(100);
setUnlocalizedName(Constants.Mod.MODID + ".scribe.");
setRegistryName(Constants.BloodMagicItem.INSCRIPTION_TOOL.getRegName());
setHasSubtypes(true);
setLPUsed(100);
}
@Override

View file

@ -19,6 +19,7 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".lavaCrystal");
setRegistryName(Constants.BloodMagicItem.LAVA_CRYSTAL.getRegName());
setLPUsed(25);
}

View file

@ -43,6 +43,7 @@ public class ItemRitualDiviner extends Item
public ItemRitualDiviner()
{
setUnlocalizedName(Constants.Mod.MODID + ".ritualDiviner");
setRegistryName(Constants.BloodMagicItem.RITUAL_DIVINER.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHasSubtypes(true);
setMaxStackSize(1);

View file

@ -35,6 +35,7 @@ public class ItemSacrificialDagger extends Item
super();
setUnlocalizedName(Constants.Mod.MODID + ".sacrificialDagger.");
setRegistryName(Constants.BloodMagicItem.SACRIFICIAL_DAGGER.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHasSubtypes(true);
setMaxStackSize(1);

View file

@ -23,6 +23,7 @@ public class ItemSlate extends Item
setCreativeTab(BloodMagic.tabBloodMagic);
setUnlocalizedName(Constants.Mod.MODID + ".slate.");
setRegistryName(Constants.BloodMagicItem.SLATE.getRegName());
setHasSubtypes(true);
}

View file

@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.fml.relauncher.Side;
@ -30,6 +29,7 @@ public class ItemTelepositionFocus extends ItemBindable
super();
setUnlocalizedName(Constants.Mod.MODID + ".focus.");
setRegistryName(Constants.BloodMagicItem.TELEPOSITION_FOCUS.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setMaxStackSize(1);
setHasSubtypes(true);

View file

@ -28,6 +28,7 @@ public class ItemUpgradeTome extends Item
setCreativeTab(BloodMagic.tabUpgradeTome);
setUnlocalizedName(Constants.Mod.MODID + ".upgradeTome");
setRegistryName(Constants.BloodMagicItem.UPGRADE_TOME.getRegName());
setHasSubtypes(true);
setMaxStackSize(1);
}

View file

@ -26,6 +26,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator
super(ArmorMaterial.CHAIN, 0, 1);
setUnlocalizedName(Constants.Mod.MODID + ".pack.sacrifice");
setRegistryName(Constants.BloodMagicItem.SACRIFICE_PACK.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -33,6 +33,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
super(ArmorMaterial.CHAIN, 0, 1);
setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice");
setRegistryName(Constants.BloodMagicItem.SELF_SACRIFICE_PACK.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -26,6 +26,7 @@ public class ItemNodeRouter extends Item
public ItemNodeRouter()
{
setUnlocalizedName(Constants.Mod.MODID + ".nodeRouter");
setRegistryName(Constants.BloodMagicItem.NODE_ROUTER.getRegName());
setMaxStackSize(1);
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -28,6 +28,7 @@ public class ItemRouterFilter extends Item implements IItemFilterProvider
super();
setUnlocalizedName(Constants.Mod.MODID + ".itemFilter.");
setRegistryName(Constants.BloodMagicItem.ROUTER_FILTER.getRegName());
setHasSubtypes(true);
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Vec3;
@ -10,6 +11,7 @@ public class ItemSigilAir extends ItemSigilBase
public ItemSigilAir()
{
super("air", 50);
setRegistryName(Constants.BloodMagicItem.SIGIL_AIR.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.item.ItemBindable;
@ -15,6 +16,7 @@ public class ItemSigilBloodLight extends ItemSigilBase
public ItemSigilBloodLight()
{
super("bloodLight", 10);
setRegistryName(Constants.BloodMagicItem.SIGIL_BLOOD_LIGHT.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.compress.CompressionRegistry;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
@ -11,6 +12,7 @@ public class ItemSigilCompression extends ItemSigilToggleable
public ItemSigilCompression()
{
super("compression", 200);
setRegistryName(Constants.BloodMagicItem.SIGIL_COMPRESSION.getRegName());
}
// TODO REWRITE all compression stuff if someone has time

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@ -10,7 +11,6 @@ import WayofTime.bloodmagic.api.altar.IBloodAltar;
import WayofTime.bloodmagic.api.iface.IAltarReader;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -19,6 +19,7 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
public ItemSigilDivination()
{
super("divination");
setRegistryName(Constants.BloodMagicItem.SIGIL_DIVINATION.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
@ -11,6 +12,7 @@ public class ItemSigilElementalAffinity extends ItemSigilToggleable
public ItemSigilElementalAffinity()
{
super("elementalAffinity", 200);
setRegistryName(Constants.BloodMagicItem.SIGIL_ELEMENTAL_AFFINITY.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModPotions;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityEnderman;
@ -16,6 +17,7 @@ public class ItemSigilEnderSeverance extends ItemSigilToggleable
public ItemSigilEnderSeverance()
{
super("enderSeverance", 200);
setRegistryName(Constants.BloodMagicItem.SIGIL_ENDER_SEVERANCE.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
@ -11,6 +12,7 @@ public class ItemSigilFastMiner extends ItemSigilToggleable
public ItemSigilFastMiner()
{
super("fastMiner", 100);
setRegistryName(Constants.BloodMagicItem.SIGIL_FAST_MINER.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
@ -15,6 +16,7 @@ public class ItemSigilGreenGrove extends ItemSigilToggleable
public ItemSigilGreenGrove()
{
super("greenGrove", 150);
setRegistryName(Constants.BloodMagicItem.SIGIL_GREEN_GROVE.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModPotions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -11,6 +12,7 @@ public class ItemSigilHaste extends ItemSigilToggleable
public ItemSigilHaste()
{
super("haste", 250);
setRegistryName(Constants.BloodMagicItem.SIGIL_HASTE.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -20,6 +21,7 @@ public class ItemSigilLava extends ItemSigilBase
public ItemSigilLava()
{
super("lava", 1000);
setRegistryName(Constants.BloodMagicItem.SIGIL_LAVA.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
@ -14,6 +15,7 @@ public class ItemSigilMagnetism extends ItemSigilToggleable
public ItemSigilMagnetism()
{
super("magnetism", 50);
setRegistryName(Constants.BloodMagicItem.SIGIL_MAGNETISM.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -11,6 +12,7 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleable
public ItemSigilPhantomBridge()
{
super("phantomBridge", 100);
setRegistryName(Constants.BloodMagicItem.SIGIL_PHANTOM_BRIDGE.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -11,7 +12,6 @@ import WayofTime.bloodmagic.api.altar.IBloodAltar;
import WayofTime.bloodmagic.api.iface.IAltarReader;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -20,6 +20,7 @@ public class ItemSigilSeer extends ItemSigilBase implements IAltarReader
public ItemSigilSeer()
{
super("seer");
setRegistryName(Constants.BloodMagicItem.SIGIL_SEER.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.TileSpectralBlock;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.Block;
@ -14,6 +15,7 @@ public class ItemSigilSuppression extends ItemSigilToggleable
public ItemSigilSuppression()
{
super("suppression", 400);
setRegistryName(Constants.BloodMagicItem.SIGIL_SUPPRESION.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -17,6 +18,7 @@ public class ItemSigilVoid extends ItemSigilBase
public ItemSigilVoid()
{
super("void", 50);
setRegistryName(Constants.BloodMagicItem.SIGIL_VOID.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
@ -20,6 +21,7 @@ public class ItemSigilWater extends ItemSigilBase
public ItemSigilWater()
{
super("water", 100);
setRegistryName(Constants.BloodMagicItem.SIGIL_WATER.getRegName());
}
@Override

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModPotions;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@ -11,6 +12,7 @@ public class ItemSigilWhirlwind extends ItemSigilToggleable
public ItemSigilWhirlwind()
{
super("whirlwind", 250);
setRegistryName(Constants.BloodMagicItem.SIGIL_WHIRLWIND.getRegName());
}
@Override

View file

@ -24,6 +24,7 @@ public class ItemMonsterSoul extends Item implements IDemonWill
super();
setUnlocalizedName(Constants.Mod.MODID + ".monsterSoul.");
setRegistryName(Constants.BloodMagicItem.MONSTER_SOUL.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHasSubtypes(true);
setMaxStackSize(1);

View file

@ -22,9 +22,10 @@ public class ItemSentientArmourGem extends Item
{
super();
this.setCreativeTab(BloodMagic.tabBloodMagic);
setCreativeTab(BloodMagic.tabBloodMagic);
setUnlocalizedName(Constants.Mod.MODID + ".sentientArmourGem");
this.setMaxStackSize(1);
setRegistryName(Constants.BloodMagicItem.SENTIENT_ARMOR_GEM.getRegName());
setMaxStackSize(1);
}
@Override

View file

@ -23,7 +23,8 @@ public class ItemSentientBow extends ItemBow
{
super();
setUnlocalizedName(Constants.Mod.MODID + ".sentientBow");
this.setCreativeTab(BloodMagic.tabBloodMagic);
setRegistryName(Constants.BloodMagicItem.SENTIENT_BOW.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
}
@Override

View file

@ -40,7 +40,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
super(ModItems.soulToolMaterial);
setUnlocalizedName(Constants.Mod.MODID + ".sentientSword");
setRegistryName(Constants.BloodMagicItem.SENTIENT_SWORD.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
}

View file

@ -25,6 +25,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem
super();
setUnlocalizedName(Constants.Mod.MODID + ".soulGem.");
setRegistryName(Constants.BloodMagicItem.SOUL_GEM.getRegName());
setHasSubtypes(true);
setMaxStackSize(1);
setCreativeTab(BloodMagic.tabBloodMagic);

View file

@ -24,6 +24,7 @@ public class ItemSoulSnare extends Item
super();
setUnlocalizedName(Constants.Mod.MODID + ".soulSnare.");
setRegistryName(Constants.BloodMagicItem.SOUL_SNARE.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setHasSubtypes(true);
setMaxStackSize(16);

View file

@ -163,7 +163,15 @@ public class ModBlocks
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock)
{
return registerBlock(block, itemBlock, block.getClass().getSimpleName());
if (block.getRegistryName() == null) {
BloodMagic.instance.getLogger().error("Attempted to register Block {} without setting a registry name. Block will not be registered. Please report this.", block.getClass().getCanonicalName());
return block;
}
if (!ConfigHandler.blockBlacklist.contains(block.getRegistryName().split(":")[1]))
GameRegistry.registerBlock(block, itemBlock);
return block;
}
private static Block registerBlock(Block block, String name)
@ -176,6 +184,14 @@ public class ModBlocks
private static Block registerBlock(Block block)
{
return registerBlock(block, block.getClass().getSimpleName());
if (block.getRegistryName() == null) {
BloodMagic.instance.getLogger().error("Attempted to register Block {} without setting a registry name. Block will not be registered. Please report this.", block.getClass().getCanonicalName());
return null;
}
if (!ConfigHandler.blockBlacklist.contains(block.getRegistryName().split(":")[1]))
GameRegistry.registerBlock(block);
return block;
}
}

View file

@ -360,6 +360,14 @@ public class ModItems
private static Item registerItem(Item item)
{
return registerItem(item, item.getClass().getSimpleName());
if (item.getRegistryName() == null) {
BloodMagic.instance.getLogger().error("Attempted to register Item {} without setting a registry name. Item will not be registered. Please report this.", item.getClass().getCanonicalName());
return item;
}
if (!ConfigHandler.itemBlacklist.contains(item.getRegistryName().split(":")[1]))
GameRegistry.registerItem(item);
return item;
}
}