Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.malkuthe.apotheosis.api;
- import com.malkuthe.apotheosis.items.reference.SAAItem;
- import com.malkuthe.apotheosis.potion.PotionHandler;
- import com.malkuthe.apotheosis.registry.empower.ItemRegistry;
- import net.minecraft.entity.item.EntityItem;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.World;
- /**
- * Created by Malkuthe on 6/23/2014.
- */
- public class SAAItemEmpowered extends SAAItem {
- public SAAItemEmpowered(String name) {
- super(name);
- }
- /**
- * ITEM API FOR EMPOWER CRAFTING
- * LOOK HERE FOR EMPOWERED ITEMS
- *
- * setEmpoweredItemProperties
- * @param isempowered - boolean that determines whether an item is empowered or not
- * @param empowertier - integer that determines the minimum tier catalyst required for empowering this item
- * @param itemmundane - item class that determines the mundane form of an item
- * @param duration - the integer duration (in seconds) of the empowerment effect applied
- * @param empowerprice - the base amount of damage that will be inflicted on the catalyst upon empowerment
- *
- * getIsEmpowered - returns true if item is empowered.
- * getEmpowerTier - returns int equal to tier of empowered item.
- * getItemMundane - returns the item class of the Mundane item that the empowered item will revert to after empowerment.
- * getEmpowerDuration - returns the duration of the Empowerment effect.
- * getEmpowerPrice - returns int value price of the amount of damage that will be inflicted on the catalyst upon empowerment.
- *
- * */
- private boolean isEmpowered;
- private int itemMundaneDamage, tierEmpower, durationEmpower, priceEmpower;
- private int tickDurationEmpower = this.durationEmpower * 20;
- private Item itemMundane;
- public SAAItemEmpowered setEmpoweredItemProperties( boolean isempowered, int empowertier, Item itemmundane, int itemmundanedamage, int duration, int empowerprice){
- this.isEmpowered = isempowered;
- this.tierEmpower = empowertier;
- this.durationEmpower = duration;
- this.priceEmpower = empowerprice;
- this.itemMundane = itemmundane;
- if (itemmundanedamage != 0){
- this.itemMundaneDamage = itemmundanedamage;
- } else {
- this.itemMundaneDamage = 0;
- }
- ItemRegistry.registerEmpoweredItem(this, itemmundane, empowertier);
- return this;
- }
- public boolean getIsEmpowered(){
- return this.isEmpowered;
- }
- public int getTierEmpower(){
- return this.tierEmpower;
- }
- public Item getItemMundane() { return this.itemMundane; }
- public int getDurationEmpower(){
- return this.durationEmpower;
- }
- public int getPriceEmpower(){
- return this.priceEmpower;
- }
- public int getItemMundaneDamage(){ return this.itemMundaneDamage; }
- @Override
- public void onUpdate(ItemStack itemstack, World world, EntityPlayer player, int par1, boolean par2) {
- super.onUpdate(itemstack, world, player, par1, par2);
- System.out.println("onUpdate is now working");
- // if(!world.isRemote){
- // if (!player.isPotionActive(PotionHandler.empowerPotion)){
- // itemstack.stackSize--;
- // ItemStack mundaneStack = new ItemStack(this.getItemMundane(), 1, this.getItemMundaneDamage());
- // InventoryPlayer invPlayer = player.inventory;
- // int occupiedSlots = 0;
- // for (int i = 0; i < invPlayer.getSizeInventory(); ++i){
- // if(invPlayer.getStackInSlot(i) == null){
- // invPlayer.setInventorySlotContents(i, mundaneStack);
- // break;
- // } else {
- // occupiedSlots++;
- // }
- // }
- // if (occupiedSlots == invPlayer.getSizeInventory()){
- // world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, mundaneStack));
- // }
- // }
- // }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment