Files
2019-02-24 22:29:41 +08:00

42 lines
1.8 KiB
Diff

--- ../src-base/minecraft/net/minecraft/item/ItemSnowball.java
+++ ../src-work/minecraft/net/minecraft/item/ItemSnowball.java
@@ -2,6 +2,7 @@
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntitySnowball;
import net.minecraft.init.SoundEvents;
import net.minecraft.stats.StatList;
@@ -23,18 +24,28 @@
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
+ // CraftBukkit start - moved down
+ /*
if (!playerIn.capabilities.isCreativeMode)
{
itemstack.shrink(1);
}
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
-
+ */
if (!worldIn.isRemote)
{
EntitySnowball entitysnowball = new EntitySnowball(worldIn, playerIn);
entitysnowball.shoot(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
- worldIn.spawnEntity(entitysnowball);
+ if (worldIn.spawnEntity(entitysnowball)) {
+ if (!playerIn.capabilities.isCreativeMode) {
+ itemstack.shrink(1);
+ }
+
+ worldIn.playSound(null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.itemRand.nextFloat() * 0.4F + 0.8F));
+ } else if (playerIn instanceof EntityPlayerMP) {
+ ((EntityPlayerMP) playerIn).getBukkitEntity().updateInventory();
+ }
}
playerIn.addStat(StatList.getObjectUseStats(this));