mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 07:20:24 +01:00
Make Tadpole apply
This commit is contained in:
parent
b97663fdf9
commit
e20952c643
2 changed files with 22 additions and 15 deletions
|
@ -18,17 +18,17 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -122,12 +_,14 @@
|
@@ -122,12 +_,14 @@
|
||||||
public void addAdditionalSaveData(CompoundTag tag) {
|
public void addAdditionalSaveData(CompoundTag compound) {
|
||||||
super.addAdditionalSaveData(tag);
|
super.addAdditionalSaveData(compound);
|
||||||
tag.putInt("Age", this.age);
|
compound.putInt("Age", this.age);
|
||||||
+ tag.putBoolean("AgeLocked", this.ageLocked); // Paper
|
+ compound.putBoolean("AgeLocked", this.ageLocked); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readAdditionalSaveData(CompoundTag tag) {
|
public void readAdditionalSaveData(CompoundTag compound) {
|
||||||
super.readAdditionalSaveData(tag);
|
super.readAdditionalSaveData(compound);
|
||||||
this.setAge(tag.getInt("Age"));
|
this.setAge(compound.getInt("Age"));
|
||||||
+ this.ageLocked = tag.getBoolean("AgeLocked"); // Paper
|
+ this.ageLocked = compound.getBoolean("AgeLocked"); // Paper
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
--- a/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
|
--- a/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
|
||||||
+++ b/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
|
+++ b/net/minecraft/world/level/storage/loot/entries/LootPoolSingletonContainer.java
|
||||||
@@ -126,9 +126,35 @@
|
@@ -32,6 +_,10 @@
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
+ // Paper start - Configurable LootPool luck formula
|
||||||
|
+ private Float lastLuck;
|
||||||
|
+ private int lastWeight;
|
||||||
|
+ // Paper end - Configurable LootPool luck formula
|
||||||
|
|
||||||
|
protected LootPoolSingletonContainer(int weight, int quality, List<LootItemCondition> conditions, List<LootItemFunction> functions) {
|
||||||
|
super(conditions);
|
||||||
|
@@ -126,7 +_,31 @@
|
||||||
protected abstract class EntryBase implements LootPoolEntry {
|
protected abstract class EntryBase implements LootPoolEntry {
|
||||||
@Override
|
@Override
|
||||||
public int getWeight(float luck) {
|
public int getWeight(float luck) {
|
||||||
- return Math.max(Mth.floor((float)LootPoolSingletonContainer.this.weight + (float)LootPoolSingletonContainer.this.quality * luck), 0);
|
- return Math.max(Mth.floor(LootPoolSingletonContainer.this.weight + LootPoolSingletonContainer.this.quality * luck), 0);
|
||||||
+ // Paper start - Configurable LootPool luck formula
|
+ // Paper start - Configurable LootPool luck formula
|
||||||
+ // SEE: https://luckformula.emc.gs for details and data
|
+ // SEE: https://luckformula.emc.gs for details and data
|
||||||
+ if (LootPoolSingletonContainer.this.lastLuck != null && LootPoolSingletonContainer.this.lastLuck == luck) {
|
+ if (LootPoolSingletonContainer.this.lastLuck != null && LootPoolSingletonContainer.this.lastLuck == luck) {
|
||||||
|
@ -29,11 +40,7 @@
|
||||||
+ LootPoolSingletonContainer.this.lastLuck = luck;
|
+ LootPoolSingletonContainer.this.lastLuck = luck;
|
||||||
+ LootPoolSingletonContainer.this.lastWeight = (int) Math.max(Math.floor(baseWeight), 0);
|
+ LootPoolSingletonContainer.this.lastWeight = (int) Math.max(Math.floor(baseWeight), 0);
|
||||||
+ return lastWeight;
|
+ return lastWeight;
|
||||||
|
+ // Paper end - Configurable LootPool luck formula
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+ private Float lastLuck = null;
|
|
||||||
+ private int lastWeight = 0;
|
|
||||||
+ // Paper end - Configurable LootPool luck formula
|
|
||||||
|
|
||||||
@FunctionalInterface
|
|
||||||
protected interface EntryConstructor {
|
|
Loading…
Reference in a new issue