Skip to content

Commit

Permalink
[ci skip] Fix vanilla random
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jul 30, 2023
1 parent 769b2d8 commit 3a40ec4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
47 changes: 46 additions & 1 deletion patches/server/0058-Use-vanilla-random-config.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Use vanilla random config


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index afecf33c1df964decad84636c4e588369ad5ea8a..5094a84eab7109b138b5b44562c1ee9bc57ca8ad 100644
index 0d674998a3d17eb63e32e350b3a235d7df3d186a..a65f2d6262af6b34e1e3fbd2f195a788b6c10993 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -568,7 +568,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
Expand All @@ -17,6 +17,19 @@ index afecf33c1df964decad84636c4e588369ad5ea8a..5094a84eab7109b138b5b44562c1ee9b
this.remainingFireTicks = -this.getFireImmuneTicks();
this.fluidHeight = new Object2DoubleArrayMap(2);
this.fluidOnEyes = new HashSet();
diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java
index 55026e1731e41b4e3e4c6a8fef5d96a32051a556..81a15ba8cc959311363bdfd9340833a9c0f84f77 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
@@ -1029,7 +1029,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {

BeeGoToHiveGoal() {
super();
- this.travellingTicks = Bee.this./* level(). */random.nextInt(10); // Paper - use entity random
+ this.travellingTicks = top.leavesmc.leaves.LeavesConfig.useVanillaRandom ? Bee.this.level().random.nextInt(10) : Bee.this.random.nextInt(10); // Paper - use entity random // Leaves - why no vanilla
this.blacklistedTargets = Lists.newArrayList();
this.setFlags(EnumSet.of(Goal.Flag.MOVE));
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Squid.java b/src/main/java/net/minecraft/world/entity/animal/Squid.java
index f60c4cd0543fd5d50fa7e2c1a9e8381227adb540..8c9c694744951dc11b9f8828f27e4d4a2210a3bc 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
Expand All @@ -30,3 +43,35 @@ index f60c4cd0543fd5d50fa7e2c1a9e8381227adb540..8c9c694744951dc11b9f8828f27e4d4a
this.tentacleSpeed = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}

diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 46d51b33cf68eaf759b437862778006e95861942..1234310bf4b981039135c865296e6d94052d81e2 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -71,7 +71,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
// Paper start - don't use world random in entity constructor
this(EntityType.ITEM, world);
this.setPos(x, y, z);
- this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D);
+ // Leaves start - vanilla yes, paper no
+ if (top.leavesmc.leaves.LeavesConfig.useVanillaRandom) {
+ this.setDeltaMovement(world.random.nextDouble() * 0.2D - 0.1D, 0.2D, world.random.nextDouble() * 0.2D - 0.1D);
+ } else {
+ this.setDeltaMovement(this.random.nextDouble() * 0.2D - 0.1D, 0.2D, this.random.nextDouble() * 0.2D - 0.1D);
+ }
+ // Leaves end - vanilla yes, paper no
this.setItem(stack);
// Paper end
// Leaves start - stackable shulker boxes
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 25a01ca42b8f2f0590965edbeca9c1f95cd66420..e66b138370ceae2ea16c48a17d0a3d8209fe9b55 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -36,7 +36,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
this(EntityType.TNT, world);
this.setPos(x, y, z);
- double d3 = this.random.nextDouble() * 6.2831854820251465D; // Paper - don't use world random in entity constructor
+ double d3 = (top.leavesmc.leaves.LeavesConfig.useVanillaRandom ? world.random.nextDouble() : this.random.nextDouble()) * 6.2831854820251465D; // Paper - don't use world random in entity constructor // Leaves - why?

this.setDeltaMovement(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D);
this.setFuse(80);
4 changes: 2 additions & 2 deletions patches/server/0086-Use-fast-item-merge-raytracing.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Use fast item merge raytracing
This patch is Powered by Gale(https://github.com/GaleMC/Gale)

diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
index 46d51b33cf68eaf759b437862778006e95861942..064f9ea24bb9d2fce45a94a5b6f9ea2469f2b80a 100644
index 1234310bf4b981039135c865296e6d94052d81e2..c72e73ee5878651f48a0513e03dc7903386d6eb5 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -280,10 +280,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -286,10 +286,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
if (entityitem.isMergable()) {
// Paper Start - Fix items merging through walls
if (this.level().paperConfig().fixes.fixItemsMergingThroughWalls) {
Expand Down

0 comments on commit 3a40ec4

Please sign in to comment.