Skip to content

Commit

Permalink
Updated SparklyPaper port to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
AlphaKR93 committed Oct 25, 2024
1 parent 3224396 commit 98cf5b2
Show file tree
Hide file tree
Showing 8 changed files with 8,096 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Fri, 25 Oct 2024 19:11:40 +0900
Subject: [PATCH] Reset dirty flag when loading maps from the disk

Based on SparklyPaper, Copyright (C) 2024 SparklyPower
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea

diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index 769d283cd98cba829262e45020ce3936c484938a..726c3e81d04731fe6ac92f0b612ce33e53803132 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -209,6 +209,7 @@ public class MapItemSavedData extends SavedData {
}
}

+ if (org.plazmamc.plazma.configurations.GlobalConfiguration.get().misc.resetDirtyWhenLoadingMapsFromDisk) worldmap.setDirty(false); // Plazma - Reset dirty flag when loading maps from the disk
return worldmap;
}

diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
index d781a7ba785789c9657c94fb0d164e532daccc96..fd1c84a86b16265400c9cd4e504b23632c5d0aa8 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
@@ -115,6 +115,7 @@ public class GlobalConfiguration extends ConfigurationPart {

public boolean reduceRandom = OPTIMIZE;
public boolean ignoreThreadSafeRandom = false;
+ public boolean resetDirtyWhenLoadingMapsFromDisk = false;

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Fri, 25 Oct 2024 19:13:21 +0900
Subject: [PATCH] Allow throttling hopper checks if the target container is
full

Based on SparklyPaper, Copyright (C) 2024 SparklyPower.
commit: c023b928439b9c71277f27cc9b5bd36ca32624ea

diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index cab403efd471bb61835224eea4e99570d34dcaaa..4b4d31cb3c379a59c43c7356522a5b67c5a87de5 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -441,6 +441,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen
Direction enumdirection = blockEntity.facing.getOpposite();

if (HopperBlockEntity.isFullContainer(iinventory, enumdirection)) {
+ if (world.plazmaConfig().block.hopper.fullCooldown != 0) blockEntity.setCooldown(world.plazmaConfig().block.hopper.fullCooldown); // Plazma - Allow throttling hopper checks if the target container is full
return false;
} else {
// Paper start - Perf: Optimize Hoppers
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index 5978970f80b1b4672298426dcd8026e453025a52..c74209e70a6fab1fd2a17605abf95f54e2156004 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -107,6 +107,13 @@ public class WorldConfigurations extends ConfigurationPart {

}

+ public Hopper hopper;
+ public class Hopper extends ConfigurationPart {
+
+ public int fullCooldown = 0;
+
+ }
+
}

}
41 changes: 41 additions & 0 deletions patches/server/0038-Suppress-errors-from-dirty-attributes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: AlphaKR93 <[email protected]>
Date: Fri, 25 Oct 2024 19:26:15 +0900
Subject: [PATCH] Suppress errors from dirty attributes


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 0d48209efc607dd7f81deffa96af2ff05ccd37b7..9ab19aa8d05384bc03c8250f8ea628a9b0a00fa2 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1348,7 +1348,8 @@ public abstract class LivingEntity extends Entity implements Attackable {
}

private void refreshDirtyAttributes() {
- Set<AttributeInstance> set = this.getAttributes().getAttributesToUpdate();
+ Set<AttributeInstance> attr = this.getAttributes().getAttributesToUpdate(); // Plazma - Suppress errors from dirty attributes
+ final Set<AttributeInstance> set = level().plazmaConfig().entity.suppressErrorsFromDirtyAttributes ? java.util.Collections.synchronizedSet(attr) : attr; // Plazma - Suppress errors from dirty attributes
Iterator iterator = set.iterator();

while (iterator.hasNext()) {
@@ -1357,7 +1358,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.onAttributeUpdated(attributemodifiable.getAttribute());
}

- set.clear();
+ attr.clear(); // Plazma - Suppress errors from dirty attributes
}

private void onAttributeUpdated(Holder<Attribute> attribute) {
diff --git a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
index c74209e70a6fab1fd2a17605abf95f54e2156004..0be2dc76d868265a4a51ff077b971938b13d72c7 100644
--- a/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
+++ b/src/main/java/org/plazmamc/plazma/configurations/WorldConfigurations.java
@@ -30,6 +30,7 @@ public class WorldConfigurations extends ConfigurationPart {
public class Entity extends ConfigurationPart {

public int sensorTick = 1;
+ public boolean suppressErrorsFromDirtyAttributes = OPTIMIZE;

public Phantom phantom;
public class Phantom extends ConfigurationPart {

This file was deleted.

Loading

0 comments on commit 98cf5b2

Please sign in to comment.