Reapply more patches

This commit is contained in:
AlphaKR93
2025-02-23 22:54:00 +09:00
parent 14403ebab9
commit 7fac157785
10 changed files with 97 additions and 209 deletions

View File

@@ -0,0 +1,25 @@
--- a/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
+++ b/net/minecraft/advancements/critereon/InventoryChangeTrigger.java
@@ -22,7 +_,22 @@
return InventoryChangeTrigger.TriggerInstance.CODEC;
}
+ // Plazma start - Optimize advancement criterion triggering (Based on https://github.com/bigenergy/achievement-optimizer/tree/1f956f1)
+ public static int idleTick;
+ private int ticksSkipped;
+
+ @org.jetbrains.annotations.Contract(mutates = "this")
+ private boolean shouldTick() {
+ if (++this.ticksSkipped <= idleTick) return false;
+
+ this.ticksSkipped = 0;
+ return true;
+ }
+ // Plazma end - Optimize advancement criterion triggering
+
public void trigger(ServerPlayer player, Inventory inventory, ItemStack stack) {
+ if (idleTick > 0 && !this.shouldTick()) return; // Plazma - Optimize advancement criterion triggering
+
int i = 0;
int i1 = 0;
int i2 = 0;

View File

@@ -1,5 +1,31 @@
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1309,13 +_,14 @@
}
private void refreshDirtyAttributes() {
- Set<AttributeInstance> attributesToUpdate = this.getAttributes().getAttributesToUpdate();
+ final Set<AttributeInstance> attributeInstances = this.getAttributes().getAttributesToUpdate(); // Plazma - Suppress errors from drity attributes
+ final Set<AttributeInstance> attributesToUpdate = this.level().plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? java.util.Collections.synchronizedSet(attributeInstances) : attributeInstances; // Plazma - Suppress errors from drity attributes
for (AttributeInstance attributeInstance : attributesToUpdate) {
this.onAttributeUpdated(attributeInstance.getAttribute());
}
- attributesToUpdate.clear();
+ attributeInstances.clear(); // Plazma - Suppress errors from drity attributes
}
protected void onAttributeUpdated(Holder<Attribute> attribute) {
@@ -2666,6 +_,8 @@
}
protected void updateSwingTime() {
+ if (!this.swinging && this.swingTime == 0) return; // Plazma - Improve swing time ticking
+
int currentSwingDuration = this.getCurrentSwingDuration();
if (this.swinging) {
this.swingTime++;
@@ -4421,7 +_,7 @@
BlockState blockState = this.level().getBlockState(pos);