Guest User

Untitled

a guest
Jun 24th, 2014
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.26 KB | None | 0 0
  1. package com.malkuthe.apotheosis.api;
  2.  
  3. import com.malkuthe.apotheosis.items.reference.SAAItem;
  4. import com.malkuthe.apotheosis.potion.PotionHandler;
  5. import com.malkuthe.apotheosis.registry.empower.ItemRegistry;
  6. import net.minecraft.entity.item.EntityItem;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.entity.player.InventoryPlayer;
  9. import net.minecraft.item.Item;
  10. import net.minecraft.item.ItemStack;
  11. import net.minecraft.potion.PotionEffect;
  12. import net.minecraft.world.World;
  13.  
  14. /**
  15.  * Created by Malkuthe on 6/23/2014.
  16.  */
  17. public class SAAItemEmpowered extends SAAItem {
  18.     public SAAItemEmpowered(String name) {
  19.         super(name);
  20.     }
  21.  
  22.     /**
  23.      * ITEM API FOR EMPOWER CRAFTING
  24.      * LOOK HERE FOR EMPOWERED ITEMS
  25.      *
  26.      * setEmpoweredItemProperties
  27.      * @param isempowered - boolean that determines whether an item is empowered or not
  28.      * @param empowertier - integer that determines the minimum tier catalyst required for empowering this item
  29.      * @param itemmundane - item class that determines the mundane form of an item
  30.      * @param duration - the integer duration (in seconds) of the empowerment effect applied
  31.      * @param empowerprice - the base amount of damage that will be inflicted on the catalyst upon empowerment
  32.      *
  33.      * getIsEmpowered - returns true if item is empowered.
  34.      * getEmpowerTier - returns int equal to tier of empowered item.
  35.      * getItemMundane - returns the item class of the Mundane item that the empowered item will revert to after empowerment.
  36.      * getEmpowerDuration - returns the duration of the Empowerment effect.
  37.      * getEmpowerPrice - returns int value price of the amount of damage that will be inflicted on the catalyst upon empowerment.
  38.      *
  39.      * */
  40.  
  41.     private boolean isEmpowered;
  42.     private int itemMundaneDamage, tierEmpower, durationEmpower, priceEmpower;
  43.     private int tickDurationEmpower = this.durationEmpower * 20;
  44.     private Item itemMundane;
  45.  
  46.     public SAAItemEmpowered setEmpoweredItemProperties( boolean isempowered, int empowertier, Item itemmundane, int itemmundanedamage, int duration, int empowerprice){
  47.  
  48.         this.isEmpowered = isempowered;
  49.         this.tierEmpower = empowertier;
  50.         this.durationEmpower = duration;
  51.         this.priceEmpower = empowerprice;
  52.         this.itemMundane = itemmundane;
  53.         if (itemmundanedamage != 0){
  54.             this.itemMundaneDamage = itemmundanedamage;
  55.         } else {
  56.             this.itemMundaneDamage = 0;
  57.         }
  58.         ItemRegistry.registerEmpoweredItem(this, itemmundane, empowertier);
  59.  
  60.         return this;
  61.     }
  62.  
  63.     public boolean getIsEmpowered(){
  64.         return this.isEmpowered;
  65.     }
  66.  
  67.     public int getTierEmpower(){
  68.         return this.tierEmpower;
  69.     }
  70.  
  71.     public Item getItemMundane() { return this.itemMundane; }
  72.  
  73.     public int getDurationEmpower(){
  74.         return this.durationEmpower;
  75.     }
  76.  
  77.     public int getPriceEmpower(){
  78.         return this.priceEmpower;
  79.     }
  80.  
  81.     public int getItemMundaneDamage(){ return this.itemMundaneDamage; }
  82.  
  83.     @Override
  84.     public void onUpdate(ItemStack itemstack, World world, EntityPlayer player, int par1, boolean par2) {
  85.         super.onUpdate(itemstack, world, player, par1, par2);
  86.         System.out.println("onUpdate is now working");
  87. //        if(!world.isRemote){
  88. //            if (!player.isPotionActive(PotionHandler.empowerPotion)){
  89. //                itemstack.stackSize--;
  90. //                ItemStack mundaneStack = new ItemStack(this.getItemMundane(), 1, this.getItemMundaneDamage());
  91. //                InventoryPlayer invPlayer = player.inventory;
  92. //                int occupiedSlots = 0;
  93. //                for (int i = 0; i < invPlayer.getSizeInventory(); ++i){
  94. //                    if(invPlayer.getStackInSlot(i) == null){
  95. //                        invPlayer.setInventorySlotContents(i, mundaneStack);
  96. //                        break;
  97. //                    } else {
  98. //                        occupiedSlots++;
  99. //                    }
  100. //                }
  101. //                if (occupiedSlots == invPlayer.getSizeInventory()){
  102. //                    world.spawnEntityInWorld(new EntityItem(world, player.posX, player.posY, player.posZ, mundaneStack));
  103. //                }
  104. //            }
  105. //        }
  106.     }
  107. }
Advertisement
Add Comment
Please, Sign In to add comment