aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch100
1 files changed, 100 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch
new file mode 100644
index 0000000000..e2792900ad
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/item/TridentItem.java.patch
@@ -0,0 +1,100 @@
+--- a/net/minecraft/world/item/TridentItem.java
++++ b/net/minecraft/world/item/TridentItem.java
+@@ -62,39 +68,70 @@
+ int riptide = EnchantmentHelper.getRiptide(stack);
+ if (riptide <= 0 || player.isInWaterOrRain()) {
+ if (!level.isClientSide) {
+- stack.hurtAndBreak(1, player, contextEntity -> contextEntity.broadcastBreakEvent(entityLiving.getUsedItemHand()));
+- if (riptide == 0) {
+- ThrownTrident thrownTrident = new ThrownTrident(level, player, stack);
+- thrownTrident.shootFromRotation(player, player.getXRot(), player.getYRot(), 0.0F, 2.5F + (float)riptide * 0.5F, 1.0F);
+- if (player.getAbilities().instabuild) {
+- thrownTrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
++ // CraftBukkit - moved down
++ /*
++ itemstack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(entityliving.getUsedItemHand());
++ });
++ */
++ if (k == 0) {
++ ThrownTrident entitythrowntrident = new ThrownTrident(level, entityhuman, stack);
++
++ entitythrowntrident.shootFromRotation(entityhuman, entityhuman.getXRot(), entityhuman.getYRot(), 0.0F, 2.5F + (float) k * 0.5F, 1.0F);
++ if (entityhuman.getAbilities().instabuild) {
++ entitythrowntrident.pickup = AbstractArrow.Pickup.CREATIVE_ONLY;
+ }
+
+- level.addFreshEntity(thrownTrident);
+- level.playSound(null, thrownTrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F);
+- if (!player.getAbilities().instabuild) {
+- player.getInventory().removeItem(stack);
++ // CraftBukkit start
++ if (!level.addFreshEntity(entitythrowntrident)) {
++ if (entityhuman instanceof net.minecraft.server.level.ServerPlayer) {
++ ((net.minecraft.server.level.ServerPlayer) entityhuman).getBukkitEntity().updateInventory();
++ }
++ return;
+ }
++
++ stack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(entityLiving.getUsedItemHand());
++ });
++ entitythrowntrident.pickupItemStack = stack.copy(); // SPIGOT-4511 update since damage call moved
++ // CraftBukkit end
++
++ level.playSound((Player) null, (Entity) entitythrowntrident, SoundEvents.TRIDENT_THROW, SoundSource.PLAYERS, 1.0F, 1.0F);
++ if (!entityhuman.getAbilities().instabuild) {
++ entityhuman.getInventory().removeItem(stack);
++ }
++ // CraftBukkit start - SPIGOT-5458 also need in this branch :(
++ } else {
++ stack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
++ entityhuman1.broadcastBreakEvent(entityLiving.getUsedItemHand());
++ });
++ // CraftBukkkit end
+ }
+ }
+
+- player.awardStat(Stats.ITEM_USED.get(this));
+- if (riptide > 0) {
+- float yRot = player.getYRot();
+- float xRot = player.getXRot();
+- float f = -Mth.sin(yRot * (float) (Math.PI / 180.0)) * Mth.cos(xRot * (float) (Math.PI / 180.0));
+- float f1 = -Mth.sin(xRot * (float) (Math.PI / 180.0));
+- float f2 = Mth.cos(yRot * (float) (Math.PI / 180.0)) * Mth.cos(xRot * (float) (Math.PI / 180.0));
+- float squareRoot = Mth.sqrt(f * f + f1 * f1 + f2 * f2);
+- float f3 = 3.0F * ((1.0F + (float)riptide) / 4.0F);
+- f *= f3 / squareRoot;
+- f1 *= f3 / squareRoot;
+- f2 *= f3 / squareRoot;
+- player.push((double)f, (double)f1, (double)f2);
+- player.startAutoSpinAttack(20);
+- if (player.onGround()) {
+- float f4 = 1.1999999F;
+- player.move(MoverType.SELF, new Vec3(0.0, 1.1999999F, 0.0));
++ entityhuman.awardStat(Stats.ITEM_USED.get(this));
++ if (k > 0) {
++ // CraftBukkit start
++ org.bukkit.event.player.PlayerRiptideEvent event = new org.bukkit.event.player.PlayerRiptideEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(stack));
++ event.getPlayer().getServer().getPluginManager().callEvent(event);
++ // CraftBukkit end
++ float f = entityhuman.getYRot();
++ float f1 = entityhuman.getXRot();
++ float f2 = -Mth.sin(f * 0.017453292F) * Mth.cos(f1 * 0.017453292F);
++ float f3 = -Mth.sin(f1 * 0.017453292F);
++ float f4 = Mth.cos(f * 0.017453292F) * Mth.cos(f1 * 0.017453292F);
++ float f5 = Mth.sqrt(f2 * f2 + f3 * f3 + f4 * f4);
++ float f6 = 3.0F * ((1.0F + (float) k) / 4.0F);
++
++ f2 *= f6 / f5;
++ f3 *= f6 / f5;
++ f4 *= f6 / f5;
++ entityhuman.push((double) f2, (double) f3, (double) f4);
++ entityhuman.startAutoSpinAttack(20);
++ if (entityhuman.onGround()) {
++ float f7 = 1.1999999F;
++
++ entityhuman.move(EnumMoveType.SELF, new Vec3(0.0D, 1.1999999284744263D, 0.0D));
+ }
+
+ SoundEvent soundEvent;