Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player)
- {
- if(itemStack.stackTagCompound == null)
- {
- createNBT(itemStack);
- }
- if(player.isSneaking())
- {
- int mode = itemStack.stackTagCompound.getInteger("mode");
- switch(mode)
- {
- case(0):{itemStack.stackTagCompound.setInteger("mode", 1);InfoUtil.chat(player, "Switched mode to withdraw.");break;}
- case(1):{itemStack.stackTagCompound.setInteger("mode", 0);InfoUtil.chat(player, "Switched mode to deposit.");break;}
- }
- Random r = new Random();
- player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
- }
- if(!player.isSneaking())
- {
- int mode = itemStack.stackTagCompound.getInteger("mode");
- switch(mode)
- {
- case(0):
- {
- float x = itemStack.stackTagCompound.getFloat("stored");
- if(player.experienceLevel >= 1 && x != 30)
- {
- player.experienceLevel--;
- itemStack.stackTagCompound.setFloat("stored", x + 1);
- Random r = new Random();
- player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
- player.attackEntityFrom(DamageSource.magic, 2.0F);
- }
- break;
- }
- case(1):
- {
- float y = itemStack.stackTagCompound.getFloat("stored");
- if(y >= 1)
- {
- player.experienceLevel++;
- float z = itemStack.stackTagCompound.getFloat("stored");
- itemStack.stackTagCompound.setFloat("stored", z - 1);
- Random r = new Random();
- player.playSound("random.orb", 0.1F, 0.5F * ((r.nextFloat() - r.nextFloat()) * 0.7F + 1.8F));
- player.attackEntityFrom(DamageSource.magic, 2.0F);
- }
- break;
- }
- }
- }
- return itemStack;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement