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

@ -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);