diff options
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/EggItem.java.patch')
-rw-r--r-- | patch-remap/mache-spigotflower/net/minecraft/world/item/EggItem.java.patch | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/EggItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/EggItem.java.patch new file mode 100644 index 0000000000..6678bf5c4e --- /dev/null +++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/EggItem.java.patch @@ -0,0 +1,52 @@ +--- a/net/minecraft/world/item/EggItem.java ++++ b/net/minecraft/world/item/EggItem.java +@@ -3,7 +3,7 @@ + import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.stats.Stats; +-import net.minecraft.world.InteractionHand; ++import net.minecraft.world.EnumHand; + import net.minecraft.world.InteractionResultHolder; + import net.minecraft.world.entity.player.Player; + import net.minecraft.world.entity.projectile.ThrownEgg; +@@ -11,23 +11,30 @@ + + public class EggItem extends Item { + +- public EggItem(Item.Properties item_properties) { +- super(item_properties); ++ public EggItem(Item.Properties properties) { ++ super(properties); + } + + @Override +- @Override +- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand interactionhand) { +- ItemStack itemstack = player.getItemInHand(interactionhand); ++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) { ++ ItemStack itemstack = player.getItemInHand(hand); + +- level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.EGG_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); ++ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down + if (!level.isClientSide) { +- ThrownEgg thrownegg = new ThrownEgg(level, player); ++ ThrownEgg entityegg = new ThrownEgg(level, player); + +- thrownegg.setItem(itemstack); +- thrownegg.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); +- level.addFreshEntity(thrownegg); ++ entityegg.setItem(itemstack); ++ entityegg.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F); ++ // CraftBukkit start ++ if (!level.addFreshEntity(entityegg)) { ++ if (player instanceof net.minecraft.server.level.ServerPlayer) { ++ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory(); ++ } ++ return InteractionResultHolder.fail(itemstack); ++ } ++ // CraftBukkit end + } ++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.EGG_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)); + + player.awardStat(Stats.ITEM_USED.get(this)); + if (!player.getAbilities().instabuild) { |