mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-30 12:29:18 +00:00
1.20.6 (#216)
--------- Co-authored-by: MC_XiaoHei <xiaohei.xor7studio@foxmail.com> Co-authored-by: Bluemangoo <chenfy2006@qq.com>
This commit is contained in:
77
patches/server/0053-Use-vanilla-random-config.patch
Normal file
77
patches/server/0053-Use-vanilla-random-config.patch
Normal file
@@ -0,0 +1,77 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: violetc <58360096+s-yh-china@users.noreply.github.com>
|
||||
Date: Thu, 16 Feb 2023 17:25:01 +0800
|
||||
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 bf8e3d510631e418eb6d2e641b51a1220bee2d7d..d6b5514dfe94b48a81ddd62b57a5d72b0510a61f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -580,7 +580,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.bb = Entity.INITIAL_AABB;
|
||||
this.stuckSpeedMultiplier = Vec3.ZERO;
|
||||
this.nextStep = 1.0F;
|
||||
- this.random = SHARED_RANDOM; // Paper - Share random for entities to make them more random
|
||||
+ this.random = org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? RandomSource.create() : SHARED_RANDOM; // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
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 0dfb8109fd8c022b079da00f6a0e3fc85b57bf7a..3c9560b63e77059ea32ccf7844817d2d22881162 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java
|
||||
@@ -1018,7 +1018,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal {
|
||||
|
||||
BeeGoToHiveGoal() {
|
||||
super();
|
||||
- this.travellingTicks = Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
|
||||
+ this.travellingTicks = org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? Bee.this.level().random.nextInt(10) : Bee.this.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues // 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 43b4ea96c5c4a6234e5b83d41db9b85c1fe27b8f..7e5294d856a757e55fe873d92d1de00a6a7b570e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
||||
@@ -42,7 +42,7 @@ public class Squid extends WaterAnimal {
|
||||
|
||||
public Squid(EntityType<? extends Squid> type, Level world) {
|
||||
super(type, world);
|
||||
- //this.random.setSeed((long)this.getId()); // Paper - Share random for entities to make them more random
|
||||
+ if (org.leavesmc.leaves.LeavesConfig.useVanillaRandom) this.random.setSeed(this.getId()); // Paper - Share random for entities to make them more random // Leaves - vanilla plz
|
||||
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 d3fa592892fc72c8fc8f23e8e477eb88902bba16..1bb762349c868e6a68b46366710dbbee60466eaf 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -78,7 +78,13 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
// Paper start - Don't use level random in entity constructors (to make them thread-safe)
|
||||
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 (org.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 - Don't use level random in entity constructors
|
||||
// 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 eb9529b4bf20f828fd7e8abf6895baf0c7900dcc..248a94f366d9fb30112c65d151b19879c684b803 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -42,7 +42,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 level random in entity constructors
|
||||
+ double d3 = (org.leavesmc.leaves.LeavesConfig.useVanillaRandom ? world.random.nextDouble() : this.random.nextDouble()) * 6.2831854820251465D; // Paper - Don't use level random in entity constructors // Leaves - why?
|
||||
|
||||
this.setDeltaMovement(-Math.sin(d3) * 0.02D, 0.20000000298023224D, -Math.cos(d3) * 0.02D);
|
||||
this.setFuse(80);
|
||||
Reference in New Issue
Block a user