aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch
new file mode 100644
index 0000000000..8a0e2affae
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/ChorusFruitItem.java.patch
@@ -0,0 +1,86 @@
+--- a/net/minecraft/world/item/ChorusFruitItem.java
++++ b/net/minecraft/world/item/ChorusFruitItem.java
+@@ -15,50 +15,58 @@
+
+ public class ChorusFruitItem extends Item {
+
+- public ChorusFruitItem(Item.Properties item_properties) {
+- super(item_properties);
++ public ChorusFruitItem(Item.Properties properties) {
++ super(properties);
+ }
+
+ @Override
+- @Override
+- public ItemStack finishUsingItem(ItemStack itemstack, Level level, LivingEntity livingentity) {
+- ItemStack itemstack1 = super.finishUsingItem(itemstack, level, livingentity);
++ public ItemStack finishUsingItem(ItemStack stack, Level level, LivingEntity entityLiving) {
++ ItemStack itemstack1 = super.finishUsingItem(stack, level, entityLiving);
+
+ if (!level.isClientSide) {
+ for (int i = 0; i < 16; ++i) {
+- double d0 = livingentity.getX() + (livingentity.getRandom().nextDouble() - 0.5D) * 16.0D;
+- double d1 = Mth.clamp(livingentity.getY() + (double) (livingentity.getRandom().nextInt(16) - 8), (double) level.getMinBuildHeight(), (double) (level.getMinBuildHeight() + ((ServerLevel) level).getLogicalHeight() - 1));
+- double d2 = livingentity.getZ() + (livingentity.getRandom().nextDouble() - 0.5D) * 16.0D;
++ double d0 = entityLiving.getX() + (entityLiving.getRandom().nextDouble() - 0.5D) * 16.0D;
++ double d1 = Mth.clamp(entityLiving.getY() + (double) (entityLiving.getRandom().nextInt(16) - 8), (double) level.getMinBuildHeight(), (double) (level.getMinBuildHeight() + ((ServerLevel) level).getLogicalHeight() - 1));
++ double d2 = entityLiving.getZ() + (entityLiving.getRandom().nextDouble() - 0.5D) * 16.0D;
+
+- if (livingentity.isPassenger()) {
+- livingentity.stopRiding();
++ if (entityLiving.isPassenger()) {
++ entityLiving.stopRiding();
+ }
+
+- Vec3 vec3 = livingentity.position();
++ Vec3 vec3d = entityLiving.position();
+
+- if (livingentity.randomTeleport(d0, d1, d2, true)) {
+- level.gameEvent(GameEvent.TELEPORT, vec3, GameEvent.Context.of((Entity) livingentity));
+- SoundEvent soundevent;
+- SoundSource soundsource;
++ // CraftBukkit start - handle canceled status of teleport event
++ java.util.Optional<Boolean> status = entityLiving.randomTeleport(d0, d1, d2, true, org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.CHORUS_FRUIT);
+
+- if (livingentity instanceof Fox) {
+- soundevent = SoundEvents.FOX_TELEPORT;
+- soundsource = SoundSource.NEUTRAL;
++ if (!status.isPresent()) {
++ // teleport event was canceled, no more tries
++ break;
++ }
++
++ if (status.get()) {
++ // CraftBukkit end
++ level.gameEvent(GameEvent.TELEPORT, vec3d, GameEvent.Context.of((Entity) entityLiving));
++ SoundEvent soundeffect;
++ SoundSource soundcategory;
++
++ if (entityLiving instanceof Fox) {
++ soundeffect = SoundEvents.FOX_TELEPORT;
++ soundcategory = SoundSource.NEUTRAL;
+ } else {
+- soundevent = SoundEvents.CHORUS_FRUIT_TELEPORT;
+- soundsource = SoundSource.PLAYERS;
++ soundeffect = SoundEvents.CHORUS_FRUIT_TELEPORT;
++ soundcategory = SoundSource.PLAYERS;
+ }
+
+- level.playSound((Player) null, livingentity.getX(), livingentity.getY(), livingentity.getZ(), soundevent, soundsource);
+- livingentity.resetFallDistance();
++ level.playSound((Player) null, entityLiving.getX(), entityLiving.getY(), entityLiving.getZ(), soundeffect, soundcategory);
++ entityLiving.resetFallDistance();
+ break;
+ }
+ }
+
+- if (livingentity instanceof Player) {
+- Player player = (Player) livingentity;
++ if (entityLiving instanceof Player) {
++ Player entityhuman = (Player) entityLiving;
+
+- player.getCooldowns().addCooldown(this, 20);
++ entityhuman.getCooldowns().addCooldown(this, 20);
+ }
+ }
+