Skip to content

Commit

Permalink
Update and fix void trade
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jun 23, 2024
1 parent adf56d0 commit befffe0
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ version=1.21-R0.1-SNAPSHOT

mcVersion=1.21
org.gradle.jvmargs=-Xmx2G
paperRef=0a1b133c28bfa9b71cd23a10b42b521ad50aacb5
paperRef=76c2f16f577d2e5515482a8dcd3d97aeeec20e1e
preVersion=true
updatingMinecraft=true
8 changes: 4 additions & 4 deletions patches/server/0004-Leaves-Server-Utils.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index 46954db7ecd35ac4018fdf476df7c8020d7ce6c8..044c51ebb058fc36074fd178929e3279
public PlayerAreaMap() {
super();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 437956b18d5bffd93c46e0be34cf413e9c704e5a..ba365cd594276b4876856799f793ed0b55cc9d2c 100644
index 1a40128b06e70e39a82f170fc16dcae1e22c745c..c050b6f432c875cb417ee67727560843f6ff3871 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -429,6 +429,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand All @@ -42,15 +42,15 @@ index 437956b18d5bffd93c46e0be34cf413e9c704e5a..ba365cd594276b4876856799f793ed0b

public void setOrigin(@javax.annotation.Nonnull Location location) {
this.origin = location.toVector();
@@ -2453,6 +2454,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2452,6 +2453,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
+ nbttagcompound.put("Leaves.Data", leavesData); // Leaves - leaves ex data
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2600,6 +2602,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2599,6 +2601,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
Expand All @@ -62,7 +62,7 @@ index 437956b18d5bffd93c46e0be34cf413e9c704e5a..ba365cd594276b4876856799f793ed0b

} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -4820,4 +4827,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4819,4 +4826,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return ((net.minecraft.server.level.ServerChunkCache) level.getChunkSource()).isPositionTicking(this);
}
// Paper end - Expose entity id counter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Reduce entity fluid lookups if no fluids
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 48d5f7b950f9c2e6c8e64193ebbfc15404f7b0cb..29e5b5fd8460b4f385aacdafeca0954d3bfbc52c 100644
index e383b9e97396a2b469a963ef3c246ae31462a537..a753c4817cb50aa4026b7961da93f440c7d11d72 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4291,16 +4291,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4290,16 +4290,18 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
Expand All @@ -35,7 +35,7 @@ index 48d5f7b950f9c2e6c8e64193ebbfc15404f7b0cb..29e5b5fd8460b4f385aacdafeca0954d
double d1 = 0.0D;
boolean flag = this.isPushedByFluid();
boolean flag1 = false;
@@ -4308,38 +4310,123 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4307,38 +4309,123 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
int k1 = 0;
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Skip entity move if movement is zero
This patch is Powered by Gale(https://github.com/GaleMC/Gale)

diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 42555b711a2d54ce2bada37a6e5cc970f095fbe4..1d87a789c717435ab45e0b00429bd766f03beba6 100644
index 89303a5c20b48993290665669518e67dbd8eef8f..22fab19ae305f0eb67fb588db68f4ed4839888f8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -323,6 +323,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Expand All @@ -31,7 +31,7 @@ index 42555b711a2d54ce2bada37a6e5cc970f095fbe4..1d87a789c717435ab45e0b00429bd766
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
@@ -4001,6 +4009,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4000,6 +4008,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}

public final void setBoundingBox(AABB boundingBox) {
Expand Down
21 changes: 21 additions & 0 deletions patches/server/0107-Force-Void-Trade.patch
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,24 @@ index 0efc8d997b34302c3e0a5d7ec73a11a940dbeefe..d246c9932f3f98972124089306d6ed74
}

public void setToOutOfStock() {
diff --git a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
index 11486419dd98a013c7387d3d73f322a95a18c574..811e7d619900e86acb6f1bce33046a9d69e96e8a 100644
--- a/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/EndGatewayBlock.java
@@ -114,6 +114,16 @@ public class EndGatewayBlock extends BaseEntityBlock implements Portal {
if (tileentity instanceof TheEndGatewayBlockEntity tileentityendgateway) {
Vec3 vec3d = tileentityendgateway.getPortalPosition(world, pos);

+ // Leaves start - force void trade
+ if (org.leavesmc.leaves.LeavesConfig.forceVoidTrade && vec3d != null && entity instanceof net.minecraft.server.level.ServerPlayer player) {
+ if (player.containerMenu instanceof net.minecraft.world.inventory.MerchantMenu merchantMenu) {
+ if (merchantMenu.trader instanceof net.minecraft.world.entity.npc.AbstractVillager villager) {
+ villager.setVoidTrade();
+ }
+ }
+ }
+ // Leaves end - force void trade
+
return vec3d != null ? new DimensionTransition(world, vec3d, EndGatewayBlock.calculateExitMovement(entity), entity.getYRot(), entity.getXRot(), DimensionTransition.PLACE_PORTAL_TICKET, PlayerTeleportEvent.TeleportCause.END_GATEWAY) : null; // CraftBukkit
} else {
return null;
4 changes: 2 additions & 2 deletions patches/server/0127-Fix-falling-block-s-block-location.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Fix falling block's block location


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dfa10ae5d19840febb15b46293dc29d309b6d6d9..832ccbdd0a761e59270835d4810edaf08313f48c 100644
index e4767aaf0001ed7892a2d1132a051ec8c19a383d..d033a45e1ebe173d13011f5db6c89b4733bc1abe 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4670,6 +4670,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4669,6 +4669,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
int j = Mth.floor(y);
int k = Mth.floor(z);

Expand Down

0 comments on commit befffe0

Please sign in to comment.