mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-04 15:41:40 +00:00
Apply all
This commit is contained in:
@@ -7,10 +7,10 @@ Original license: MIT
|
||||
Original project: https://github.com/thebrightspark/AsyncLocator
|
||||
|
||||
diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java
|
||||
index 2723d5377567241921fef61952e474c1c0ee9bbf..0918b528e0310b12378e185b29a478ed188a2d58 100644
|
||||
index a734b2597c3491db35d9660e169f8e8b6320900b..8a79a339757d6ac49713bf6db0fb675d9893fd1b 100644
|
||||
--- a/net/minecraft/server/commands/LocateCommand.java
|
||||
+++ b/net/minecraft/server/commands/LocateCommand.java
|
||||
@@ -109,6 +109,38 @@ public class LocateCommand {
|
||||
@@ -106,6 +106,38 @@ public class LocateCommand {
|
||||
BlockPos blockPos = BlockPos.containing(source.getPosition());
|
||||
ServerLevel level = source.getLevel();
|
||||
Stopwatch stopwatch = Stopwatch.createStarted(Util.TICKER);
|
||||
@@ -50,10 +50,10 @@ index 2723d5377567241921fef61952e474c1c0ee9bbf..0918b528e0310b12378e185b29a478ed
|
||||
stopwatch.stop();
|
||||
if (pair == null) {
|
||||
diff --git a/net/minecraft/world/entity/animal/Dolphin.java b/net/minecraft/world/entity/animal/Dolphin.java
|
||||
index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446dbd22cf2 100644
|
||||
index 23696a5e2871ea07f34d4b4f6a20e2896ac3f5bd..c4fda92e078c9ba745b2548ecaaffffff97fb0fd 100644
|
||||
--- a/net/minecraft/world/entity/animal/Dolphin.java
|
||||
+++ b/net/minecraft/world/entity/animal/Dolphin.java
|
||||
@@ -486,6 +486,10 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
@@ -487,6 +487,10 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
static class DolphinSwimToTreasureGoal extends Goal {
|
||||
private final Dolphin dolphin;
|
||||
private boolean stuck;
|
||||
@@ -64,7 +64,7 @@ index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446
|
||||
|
||||
DolphinSwimToTreasureGoal(Dolphin dolphin) {
|
||||
this.dolphin = dolphin;
|
||||
@@ -505,6 +509,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
@@ -506,6 +510,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public boolean canContinueToUse() {
|
||||
@@ -76,7 +76,7 @@ index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446
|
||||
BlockPos blockPos = this.dolphin.treasurePos;
|
||||
return blockPos != null
|
||||
&& !BlockPos.containing(blockPos.getX(), this.dolphin.getY(), blockPos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0)
|
||||
@@ -519,6 +528,22 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
@@ -520,6 +529,22 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
this.stuck = false;
|
||||
this.dolphin.getNavigation().stop();
|
||||
BlockPos blockPos = this.dolphin.blockPosition();
|
||||
@@ -99,7 +99,7 @@ index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446
|
||||
BlockPos blockPos1 = serverLevel.findNearestMapStructure(StructureTags.DOLPHIN_LOCATED, blockPos, 50, false);
|
||||
if (blockPos1 != null) {
|
||||
this.dolphin.treasurePos = blockPos1;
|
||||
@@ -531,6 +556,12 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
@@ -532,6 +557,12 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
@@ -112,7 +112,7 @@ index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446
|
||||
BlockPos blockPos = this.dolphin.treasurePos;
|
||||
if (blockPos == null
|
||||
|| BlockPos.containing(blockPos.getX(), this.dolphin.getY(), blockPos.getZ()).closerToCenterThan(this.dolphin.position(), 4.0)
|
||||
@@ -541,6 +572,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
@@ -542,6 +573,11 @@ public class Dolphin extends AgeableWaterCreature {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
@@ -125,18 +125,18 @@ index 87ba416479df56bad5d13c01e96e92e45b7802a3..2508645b62e7f935dee00fe87b3a6446
|
||||
Level level = this.dolphin.level();
|
||||
if (this.dolphin.closeToNextPos() || this.dolphin.getNavigation().isDone()) {
|
||||
diff --git a/net/minecraft/world/entity/projectile/EyeOfEnder.java b/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
index 59941c605085d93357211939114ecf1b88aef05d..74ffcc5417dd20635a52a3e799436eaf18076a0e 100644
|
||||
index 2bb3c5018be0c669da4c28a34ce2f2e124547691..2c34e956e8a3263bb05ae2810a8578696f739263 100644
|
||||
--- a/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
+++ b/net/minecraft/world/entity/projectile/EyeOfEnder.java
|
||||
@@ -29,6 +29,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
public double tz;
|
||||
@@ -28,6 +28,7 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
public Vec3 target;
|
||||
public int life;
|
||||
public boolean surviveAfterDeath;
|
||||
+ public boolean asyncLocator$locateTaskOngoing = false; // Leaf - Asynchronous locator
|
||||
|
||||
public EyeOfEnder(EntityType<? extends EyeOfEnder> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
@@ -116,6 +117,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@@ -95,6 +96,11 @@ public class EyeOfEnder extends Entity implements ItemSupplier {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@@ -145,14 +145,14 @@ index 59941c605085d93357211939114ecf1b88aef05d..74ffcc5417dd20635a52a3e799436eaf
|
||||
+ return;
|
||||
+ }
|
||||
+ // Leaf end - Asynchronous locator
|
||||
Vec3 deltaMovement = this.getDeltaMovement();
|
||||
double d = this.getX() + deltaMovement.x;
|
||||
double d1 = this.getY() + deltaMovement.y;
|
||||
Vec3 vec3 = this.position().add(this.getDeltaMovement());
|
||||
if (!this.level().isClientSide() && this.target != null) {
|
||||
this.setDeltaMovement(updateDeltaMovement(this.getDeltaMovement(), vec3, this.target));
|
||||
diff --git a/net/minecraft/world/item/EnderEyeItem.java b/net/minecraft/world/item/EnderEyeItem.java
|
||||
index 68f33de233b716055f791fd87fe3be981580375c..bd60cc8f7e37cba981792412a8ce7f71ea8b33f5 100644
|
||||
index 51e0985bde9cf6ac2f4264d21edec3d1623a2d0d..ca2b493e4032208311c857db799632ac3d3ab077 100644
|
||||
--- a/net/minecraft/world/item/EnderEyeItem.java
|
||||
+++ b/net/minecraft/world/item/EnderEyeItem.java
|
||||
@@ -105,14 +105,47 @@ public class EnderEyeItem extends Item {
|
||||
@@ -106,14 +106,46 @@ public class EnderEyeItem extends Item {
|
||||
} else {
|
||||
player.startUsingItem(hand);
|
||||
if (level instanceof ServerLevel serverLevel) {
|
||||
@@ -185,7 +185,7 @@ index 68f33de233b716055f791fd87fe3be981580375c..bd60cc8f7e37cba981792412a8ce7f71
|
||||
+ ).thenOnServerThread(pos -> {
|
||||
+ eyeOfEnder.asyncLocator$locateTaskOngoing = false;
|
||||
+ if (pos != null) {
|
||||
+ eyeOfEnder.signalTo(pos);
|
||||
+ eyeOfEnder.signalTo(Vec3.atLowerCornerOf(pos));
|
||||
+ CriteriaTriggers.USED_ENDER_EYE.trigger((ServerPlayer) player, pos);
|
||||
+ player.awardStat(Stats.ITEM_USED.get(this));
|
||||
+ } else {
|
||||
@@ -195,14 +195,13 @@ index 68f33de233b716055f791fd87fe3be981580375c..bd60cc8f7e37cba981792412a8ce7f71
|
||||
+ });
|
||||
+ }
|
||||
+ // Leaf end - Asynchronous locator
|
||||
+
|
||||
eyeOfEnder.setItem(itemInHand);
|
||||
- eyeOfEnder.signalTo(blockPos);
|
||||
+ if (!isAsyncLocatorEnabled) eyeOfEnder.signalTo(blockPos); // Leaf - Asynchronous locator
|
||||
- eyeOfEnder.signalTo(Vec3.atLowerCornerOf(blockPos));
|
||||
+ if (!isAsyncLocatorEnabled) eyeOfEnder.signalTo(Vec3.atLowerCornerOf(blockPos)); // Leaf - Asynchronous locator
|
||||
level.gameEvent(GameEvent.PROJECTILE_SHOOT, eyeOfEnder.position(), GameEvent.Context.of(player));
|
||||
// CraftBukkit start
|
||||
if (!level.addFreshEntity(eyeOfEnder)) {
|
||||
@@ -126,7 +159,7 @@ public class EnderEyeItem extends Item {
|
||||
@@ -127,7 +159,7 @@ public class EnderEyeItem extends Item {
|
||||
float f = Mth.lerp(level.random.nextFloat(), 0.33F, 0.5F);
|
||||
level.playSound(null, player.getX(), player.getY(), player.getZ(), SoundEvents.ENDER_EYE_LAUNCH, SoundSource.NEUTRAL, 1.0F, f);
|
||||
itemInHand.consume(1, player);
|
||||
|
||||
Reference in New Issue
Block a user