base mod created
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package net.minecraft.item;
|
||||
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.stats.StatList;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemEmptyMap extends ItemMapBase
|
||||
{
|
||||
protected ItemEmptyMap()
|
||||
{
|
||||
this.setCreativeTab(CreativeTabs.MISC);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the equipped item is right clicked.
|
||||
*/
|
||||
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
|
||||
{
|
||||
ItemStack itemstack = ItemMap.setupNewMap(worldIn, playerIn.posX, playerIn.posZ, (byte)0, true, false);
|
||||
ItemStack itemstack1 = playerIn.getHeldItem(handIn);
|
||||
itemstack1.shrink(1);
|
||||
|
||||
if (itemstack1.isEmpty())
|
||||
{
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!playerIn.inventory.addItemStackToInventory(itemstack.copy()))
|
||||
{
|
||||
playerIn.dropItem(itemstack, false);
|
||||
}
|
||||
|
||||
playerIn.addStat(StatList.getObjectUseStats(this));
|
||||
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack1);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user