initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
77
java/src/game/item/ItemBucketMilk.java
Executable file
77
java/src/game/item/ItemBucketMilk.java
Executable file
|
@ -0,0 +1,77 @@
|
|||
package game.item;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import game.collect.Sets;
|
||||
import game.entity.attributes.Attribute;
|
||||
import game.entity.attributes.AttributeModifier;
|
||||
import game.entity.attributes.Attributes;
|
||||
import game.entity.npc.EntityNPC;
|
||||
import game.init.Items;
|
||||
import game.world.World;
|
||||
|
||||
public class ItemBucketMilk extends Item
|
||||
{
|
||||
public ItemBucketMilk()
|
||||
{
|
||||
this.setMaxStackSize(1);
|
||||
this.setTab(CheatTab.tabTools);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player finishes using this Item (E.g. finishes eating.). Not called when the player stops using
|
||||
* the Item before the action is complete.
|
||||
*/
|
||||
public ItemStack onItemUseFinish(ItemStack stack, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
// if (!playerIn.creative)
|
||||
// {
|
||||
--stack.stackSize;
|
||||
// }
|
||||
|
||||
if (!worldIn.client)
|
||||
{
|
||||
playerIn.clearEffects(false);
|
||||
}
|
||||
|
||||
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||||
return stack.stackSize <= 0 ? new ItemStack(Items.bucket) : stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
public int getMaxItemUseDuration(ItemStack stack)
|
||||
{
|
||||
return 32;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the action that specifies what animation to play when the items is being used
|
||||
*/
|
||||
public ItemAction getItemUseAction(ItemStack stack)
|
||||
{
|
||||
return ItemAction.DRINK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
|
||||
{
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
public Map<Attribute, Set<AttributeModifier>> getItemInventoryModifiers()
|
||||
{
|
||||
Map<Attribute, Set<AttributeModifier>> multimap = super.getItemInventoryModifiers();
|
||||
multimap.put(Attributes.RADIATION, Sets.newHashSet(new AttributeModifier(Attributes.ITEM_VAL_ID, "Milk modifier", -5.0, false, true, true)));
|
||||
return multimap;
|
||||
}
|
||||
|
||||
public boolean isMagnetic() {
|
||||
return true;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue