forked from LeavesMC/Leaves
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RNG Fishing, but it not work fun (LeavesMC#120)
- Loading branch information
1 parent
d087f76
commit 549e454
Showing
2 changed files
with
100 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: violetc <[email protected]> | ||
Date: Mon, 4 Sep 2023 22:09:10 +0800 | ||
Subject: [PATCH] Loot world random | ||
Subject: [PATCH] RNG Fishing | ||
|
||
|
||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java | ||
index 35672105a000d87c7fe82eb65456d891b3bd983d..12279c640b66815fba2e42624fe5195890692d9c 100644 | ||
index 750802a734515758d00696eb207851958b4ab269..a695de87e8dcca151ba92ad961ffd1a9eed969e4 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java | ||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java | ||
@@ -504,7 +504,7 @@ public class FishingHook extends Projectile { | ||
} else if (this.nibble > 0) { | ||
LootParams lootparams = (new LootParams.Builder((ServerLevel) this.level())).withParameter(LootContextParams.ORIGIN, this.position()).withParameter(LootContextParams.TOOL, usedItem).withParameter(LootContextParams.THIS_ENTITY, this).withLuck((float) this.luck + entityhuman.getLuck()).create(LootContextParamSets.FISHING); | ||
LootTable loottable = this.level().getServer().getLootData().getLootTable(BuiltInLootTables.FISHING); | ||
- List<ItemStack> list = loottable.getRandomItems(lootparams); | ||
+ List<ItemStack> list = top.leavesmc.leaves.LeavesConfig.lootWorldRandom ? loottable.getRandomItems(lootparams, this.random) : loottable.getRandomItems(lootparams); // Leaves - world random | ||
+ List<ItemStack> list = top.leavesmc.leaves.LeavesConfig.rngFishing ? loottable.getRandomItems(lootparams, this.random) : loottable.getRandomItems(lootparams); // Leaves - world random | ||
|
||
CriteriaTriggers.FISHING_ROD_HOOKED.trigger((ServerPlayer) entityhuman, usedItem, this, list); | ||
Iterator iterator = list.iterator(); | ||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java | ||
index d042b04108c3fe244caa6b9fc293c83ac7200a57..dd63d7893d12c9378192f5415231d7ec832c0a78 100644 | ||
index d042b04108c3fe244caa6b9fc293c83ac7200a57..58d27f27dc3b60ba7d4e14f86431890481275cdd 100644 | ||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java | ||
+++ b/src/main/java/net/minecraft/world/level/storage/loot/LootContext.java | ||
@@ -95,6 +95,13 @@ public class LootContext { | ||
|
@@ -35,18 +35,6 @@ index d042b04108c3fe244caa6b9fc293c83ac7200a57..dd63d7893d12c9378192f5415231d7ec | |
public LootContext.Builder withOptionalRandomSeed(long seed) { | ||
if (seed != 0L) { | ||
this.random = RandomSource.create(seed); | ||
@@ -110,6 +117,11 @@ public class LootContext { | ||
public LootContext create(Optional<ResourceLocation> randomId) { | ||
ServerLevel serverLevel = this.getLevel(); | ||
MinecraftServer minecraftServer = serverLevel.getServer(); | ||
+ // Leaves start - world random | ||
+ if (top.leavesmc.leaves.LeavesConfig.lootWorldRandom) { | ||
+ return new LootContext(this.params, serverLevel.getRandom(), minecraftServer.getLootData()); | ||
+ } | ||
+ // Leaves end - world random | ||
RandomSource randomSource = Optional.ofNullable(this.random).or(() -> { | ||
return randomId.map(serverLevel::getRandomSequence); | ||
}).orElseGet(serverLevel::getRandom); | ||
diff --git a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java b/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java | ||
index 05af6fa0585406c4922d2eb174f7e53f4269acd6..3fcbb53f1244adc46e1bdf681f72598b10fb6fb1 100644 | ||
--- a/src/main/java/net/minecraft/world/level/storage/loot/LootTable.java | ||
|