aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch
diff options
context:
space:
mode:
authorMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
committerMiniDigger | Martin <[email protected]>2024-01-14 11:04:49 +0100
commitbee74680e607c2e29b038329f62181238911cd83 (patch)
tree708fd1a4a0227d9071243adf2a42d5e9e96cde4a /patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch
parent0a44692ef6ff6e255d48eb3ba1bb114166eafda9 (diff)
downloadPaper-softspoon.tar.gz
Paper-softspoon.zip
add remapped patches as a testsoftspoon
Diffstat (limited to 'patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch72
1 files changed, 72 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch b/patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch
new file mode 100644
index 0000000000..e7a11c6556
--- /dev/null
+++ b/patch-remap/mache-vineflower/net/minecraft/world/item/SnowballItem.java.patch
@@ -0,0 +1,72 @@
+--- a/net/minecraft/world/item/SnowballItem.java
++++ b/net/minecraft/world/item/SnowballItem.java
+@@ -3,42 +3,49 @@
+ 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.Snowball;
+ import net.minecraft.world.level.Level;
+
+ public class SnowballItem extends Item {
++
+ public SnowballItem(Item.Properties properties) {
+ super(properties);
+ }
+
+ @Override
+- public InteractionResultHolder<ItemStack> use(Level level, Player player, InteractionHand hand) {
+- ItemStack itemInHand = player.getItemInHand(hand);
+- level.playSound(
+- null,
+- player.getX(),
+- player.getY(),
+- player.getZ(),
+- SoundEvents.SNOWBALL_THROW,
+- SoundSource.NEUTRAL,
+- 0.5F,
+- 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)
+- );
++ public InteractionResultHolder<ItemStack> use(Level level, Player player, EnumHand hand) {
++ ItemStack itemstack = player.getItemInHand(hand);
++
++ // CraftBukkit - moved down
++ // world.playSound((EntityHuman) null, entityhuman.getX(), entityhuman.getY(), entityhuman.getZ(), SoundEffects.SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (world.getRandom().nextFloat() * 0.4F + 0.8F));
+ if (!level.isClientSide) {
+- Snowball snowball = new Snowball(level, player);
+- snowball.setItem(itemInHand);
+- snowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
+- level.addFreshEntity(snowball);
++ Snowball entitysnowball = new Snowball(level, player);
++
++ entitysnowball.setItem(itemstack);
++ entitysnowball.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 1.5F, 1.0F);
++ if (level.addFreshEntity(entitysnowball)) {
++ if (!player.getAbilities().instabuild) {
++ itemstack.shrink(1);
++ }
++
++ level.playSound((Player) null, player.getX(), player.getY(), player.getZ(), SoundEvents.SNOWBALL_THROW, SoundSource.NEUTRAL, 0.5F, 0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F));
++ } else if (player instanceof net.minecraft.server.level.ServerPlayer) {
++ ((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity().updateInventory();
++ }
+ }
++ // CraftBukkit end
+
+ player.awardStat(Stats.ITEM_USED.get(this));
+- if (!player.getAbilities().instabuild) {
+- itemInHand.shrink(1);
++ // CraftBukkit start - moved up
++ /*
++ if (!entityhuman.getAbilities().instabuild) {
++ itemstack.shrink(1);
+ }
++ */
+
+- return InteractionResultHolder.sidedSuccess(itemInHand, level.isClientSide());
++ return InteractionResultHolder.sidedSuccess(itemstack, level.isClientSide());
+ }
+ }