aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSHsuperCM <shsupercm@gmail.com>2021-08-27 18:00:19 +0300
committerSHsuperCM <shsupercm@gmail.com>2021-08-27 18:00:19 +0300
commit9b6a8d4d8fa19a32474bbb8c78875ea4002595d1 (patch)
tree8a885ae037d93473a36bb177260c87adca2e33eb /src
parentb3af35489238421ce65dba8026ed233ee0b92f14 (diff)
downloadCITResewn-9b6a8d4d8fa19a32474bbb8c78875ea4002595d1.tar.gz
CITResewn-9b6a8d4d8fa19a32474bbb8c78875ea4002595d1.tar.bz2
CITResewn-9b6a8d4d8fa19a32474bbb8c78875ea4002595d1.zip
CIT ordering
Diffstat (limited to 'src')
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java4
-rw-r--r--src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java b/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java
index 0ecd632..76473a0 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/ActiveCITs.java
@@ -10,6 +10,7 @@ import net.minecraft.world.World;
import shcm.shsupercm.fabric.citresewn.pack.cits.*;
import java.util.*;
+import java.util.stream.Collectors;
public class ActiveCITs {
public final Collection<CIT> cits;
@@ -21,7 +22,8 @@ public class ActiveCITs {
public ActiveCITs(Collection<CIT> cits) {
this.cits = cits;
- for (CIT cit : cits) {
+
+ for (CIT cit : cits.stream().sorted(Comparator.<CIT>comparingInt(cit -> cit.weight).reversed().thenComparing(cit -> cit.propertiesIdentifier.getPath())).collect(Collectors.toList())) {
if (cit instanceof CITItem item)
for (Item type : item.items)
citItems.computeIfAbsent(type, t -> new ArrayList<>()).add(item);
diff --git a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
index 2bd2b76..f50f6e9 100644
--- a/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
+++ b/src/main/java/shcm/shsupercm/fabric/citresewn/pack/cits/CIT.java
@@ -39,7 +39,7 @@ public abstract class CIT {
public final Predicate<NbtCompound> nbt;
- private final int weight;
+ public final int weight;
public CIT(CITPack pack, Identifier identifier, Properties properties) throws CITParseException {
this.pack = pack;