mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-20 15:29:35 +00:00
78 lines
5.4 KiB
Diff
78 lines
5.4 KiB
Diff
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 0b7639ef2540f8af2e5b5fc47df24d2e5ffd0846..4b1a08fa9a9d34c40b4fee601495528ea1c5095d 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -510,7 +510,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
|
|
this.bb = Entity.INITIAL_AABB;
|
|
this.stuckSpeedMultiplier = Vec3.ZERO;
|
|
this.nextStep = 1.0F;
|
|
- this.random = SHARED_RANDOM; // Paper
|
|
+ this.random = top.leavesmc.leaves.LeavesConfig.useVanillaRandom ? RandomSource.create() : SHARED_RANDOM; // Paper // 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 9a7956befc346e1b58f064213800fd099a052fc6..d508448c7627c4cef90a30b471252841b7e20fa1 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.random.nextInt(10); // CraftBukkit - SPIGOT-7495: Give Bees another chance and let them use their own random, avoid concurrency issues
|
|
+ this.travellingTicks = top.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 f60c4cd0543fd5d50fa7e2c1a9e8381227adb540..8c9c694744951dc11b9f8828f27e4d4a2210a3bc 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/animal/Squid.java
|
|
@@ -44,7 +44,7 @@ public class Squid extends WaterAnimal {
|
|
|
|
public Squid(EntityType<? extends Squid> type, Level world) {
|
|
super(type, world);
|
|
- //this.random.setSeed((long)this.getId()); // Paper - we set the random to shared, do not clobber the seed
|
|
+ if (top.leavesmc.leaves.LeavesConfig.useVanillaRandom) this.random.setSeed(this.getId()); // Paper - we set the random to shared, do not clobber the seed // 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 e2f3044ce964f0da9df83b8a302316d2438384e7..5eb9d599e2f6e61adb34c991fe9008859633fdfc 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);
|