-
-
Save TehNut/a1cf69c53c27b169bb65 to your computer and use it in GitHub Desktop.
Proposed changes to Blood Orbs for 1.8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package WayofTime.alchemicalWizardry.api.soulNetwork; | |
/** | |
* Base object for all Blood Orbs. Makes Orb creation quite a bit easier. | |
* | |
* Just create a new BloodOrb instance then add to a list of orbs (currently in {@link WayofTime.alchemicalWizardry.common.items.ItemBloodOrb}) | |
* This will allow the use of just one item ID for all orbs. If an addon dev needs more control over the intricacies | |
* of their orb (custom right clicking, renderers, etc), they can just create their own item as normal. | |
* | |
*/ | |
public class BloodOrb { | |
private String name; | |
private int tier; | |
private int capacity; | |
/** | |
* A base object for BloodOrbs. A bit cleaner than the | |
* old way through EnergyItems. | |
* | |
* @param name - A name for the Orb. Gets put into an unlocalized name. | |
* @param tier - The tier of the Orb. | |
* @param capacity - The max amount of LP the Orb can store. | |
*/ | |
public BloodOrb(String name, int tier, int capacity) { | |
this.name = name; | |
this.tier = tier; | |
this.capacity = capacity; | |
} | |
public String getName() { | |
return name; | |
} | |
public int getTier() { | |
return tier; | |
} | |
public int getCapacity() { | |
return capacity; | |
} | |
@Override | |
public String toString() { | |
return "BloodOrb{" + | |
"name='" + name + '\'' + | |
", tier=" + tier + | |
", capacity=" + capacity + | |
'}'; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package WayofTime.alchemicalWizardry.api.items.interfaces; | |
/** | |
* Methods now allow you to get the level and essence from a meta. | |
*/ | |
public interface IBloodOrb { | |
int getMaxEssence(int meta); | |
int getOrbLevel(int meta); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package WayofTime.alchemicalWizardry.common.items; | |
import WayofTime.alchemicalWizardry.AlchemicalWizardry; | |
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable; | |
import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; | |
import WayofTime.alchemicalWizardry.api.registry.OrbRegistry; | |
import WayofTime.alchemicalWizardry.api.soulNetwork.BloodOrb; | |
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 java.util.List; | |
public class ItemBloodOrb extends Item implements IBloodOrb, IBindable { | |
public ItemBloodOrb() { | |
super(); | |
setCreativeTab(AlchemicalWizardry.tabBloodMagic); | |
setUnlocalizedName(AlchemicalWizardry.MODID + ".orb."); | |
setMaxStackSize(1); | |
setHasSubtypes(true); | |
// Can be moved elsewhere | |
BloodOrb orbWeak = new BloodOrb("weak", 1, 5000); | |
OrbRegistry.registerOrb(orbWeak); | |
OrbRegistry.registerOrbTexture(orbWeak, "alchemicalwizardry:ItemBloodOrbWeak"); | |
BloodOrb orbApprentice = new BloodOrb("apprentice", 2, 25000); | |
OrbRegistry.registerOrb(orbApprentice); | |
OrbRegistry.registerOrbTexture(orbApprentice, "alchemicalwizardry:ItemBloodOrbApprentice"); | |
BloodOrb orbMagician = new BloodOrb("magician", 3, 150000); | |
OrbRegistry.registerOrb(orbMagician); | |
OrbRegistry.registerOrbTexture(orbMagician, "alchemicalwizardry:ItemBloodOrbMagician"); | |
BloodOrb orbMaster = new BloodOrb("master", 4, 1000000); | |
OrbRegistry.registerOrb(orbMaster); | |
OrbRegistry.registerOrbTexture(orbMaster, "alchemicalwizardry:ItemBloodOrbMaster"); | |
BloodOrb orbArchmage = new BloodOrb("archmage", 5, 10000000); | |
OrbRegistry.registerOrb(orbArchmage); | |
OrbRegistry.registerOrbTexture(orbArchmage, "alchemicalwizardry:ItemBloodOrbArchmage"); | |
BloodOrb orbTrancendant = new BloodOrb("transcendent", 6, 30000000); | |
OrbRegistry.registerOrb(orbTrancendant); | |
OrbRegistry.registerOrbTexture(orbTrancendant, "alchemicalwizardry:ItemBloodOrbTrancendant"); | |
BloodOrb orbCreative =new BloodOrb("creative", 666, Integer.MAX_VALUE); | |
OrbRegistry.registerOrb(orbCreative); | |
OrbRegistry.registerOrbTexture(orbCreative, "alchemicalwizardry:ItemBloodOrbCreative"); | |
} | |
@Override | |
public String getUnlocalizedName(ItemStack stack) { | |
return getUnlocalizedName() + OrbRegistry.getOrb(stack.getItemDamage() % OrbRegistry.getSize()).getName().toLowerCase(); | |
} | |
@Override | |
@SuppressWarnings("unchecked") | |
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { | |
list.add(StatCollector.translateToLocal("tooltip.energybattery.desc")); | |
if (!(stack.getTagCompound() == null)) | |
list.add(StatCollector.translateToLocalFormatted("tooltip.owner.currentowner", stack.getTagCompound().getString("ownerName"))); | |
} | |
@Override | |
@SuppressWarnings("unchecked") | |
public void getSubItems(Item item, CreativeTabs tab, List sub) { | |
for (int i = 0; i < OrbRegistry.getSize(); i++) | |
sub.add(new ItemStack(this, 1, i)); | |
} | |
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { | |
// Do the clicky stuff | |
return stack; | |
} | |
@Override | |
public ItemStack getContainerItem(ItemStack stack) { | |
return stack; | |
} | |
@Override | |
public boolean hasContainerItem(ItemStack stack) { | |
return true; | |
} | |
// IBloodOrb | |
@Override | |
public int getMaxEssence(int meta) { | |
return OrbRegistry.getOrb(meta).getCapacity(); | |
} | |
@Override | |
public int getOrbLevel(int meta) { | |
return OrbRegistry.getOrb(meta).getTier(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package WayofTime.alchemicalWizardry.api.registry; | |
import WayofTime.alchemicalWizardry.AlchemicalWizardry; | |
import WayofTime.alchemicalWizardry.api.soulNetwork.BloodOrb; | |
import net.minecraft.client.Minecraft; | |
import net.minecraft.client.renderer.entity.RenderItem; | |
import net.minecraft.client.resources.model.ModelBakery; | |
import net.minecraft.client.resources.model.ModelResourceLocation; | |
import net.minecraft.item.Item; | |
import net.minecraft.item.ItemStack; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class OrbRegistry { | |
private static List<BloodOrb> orbs = new ArrayList<BloodOrb>(); | |
public static Item orbItem; | |
public static void registerOrb(BloodOrb orb) { | |
if (!orbs.contains(orb)) | |
orbs.add(orb); | |
else | |
AlchemicalWizardry.logger.error("Error adding orb: " + orb.toString()); | |
} | |
public static void registerOrbTexture(BloodOrb orb, String resourceLocation) { | |
int meta = getIndexOf(orb); | |
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); | |
ModelBakery.addVariantName(orbItem, resourceLocation); | |
renderItem.getItemModelMesher().register(orbItem, meta, new ModelResourceLocation(resourceLocation, "inventory")); | |
} | |
public static BloodOrb getOrb(int index) { | |
return orbs.get(index); | |
} | |
public static int getIndexOf(BloodOrb orb) { | |
return orbs.indexOf(orb); | |
} | |
public static boolean isEmpty() { | |
return orbs.isEmpty(); | |
} | |
public static int getSize() { | |
return orbs.size(); | |
} | |
public static List<BloodOrb> getOrbList() { | |
return new ArrayList<BloodOrb>(orbs); | |
} | |
public static ItemStack getOrbStack(BloodOrb orb) { | |
return new ItemStack(orbItem, 1, getIndexOf(orb)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment