Colorful Hearts

Colorful Hearts

12M Downloads

MC 1.21.1 is not starting when having the mod

Razuuu opened this issue ยท 3 comments

commented

OS: Arch EndeavourOS with KDE Plasma
This only happens to me, on 2 Windows machines it is starting successfully.

I do have the latest mod version and Thermoo installed
Error:

java.util.concurrent.CompletionException: java.lang.IllegalStateException: Duplicate key 2011070 (attempted merging values terrails.colorfulhearts.render.ImageUtils$$Lambda/0x0000705195691158@23b4402a and terrails.colorfulhearts.render.ImageUtils$$Lambda/0x0000705195691158@6d165287)
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1770) ~[?:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) ~[?:?]
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) ~[?:?]
Caused by: java.lang.IllegalStateException: Duplicate key 2011070 (attempted merging values terrails.colorfulhearts.render.ImageUtils$$Lambda/0x0000705195691158@23b4402a and terrails.colorfulhearts.render.ImageUtils$$Lambda/0x0000705195691158@6d165287)
	at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:135) ~[?:?]
	at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:182) ~[?:?]
	at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:?]
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) ~[?:?]
	at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) ~[?:?]
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) ~[?:?]
	at terrails.colorfulhearts.render.atlas.sources.ColoredHearts.processColors(ColoredHearts.java:77) ~[colorfulhearts-fabric-1.21.1-10.3.7.jar:?]
	at terrails.colorfulhearts.render.atlas.sources.ColoredHearts.method_47673(ColoredHearts.java:64) ~[colorfulhearts-fabric-1.21.1-10.3.7.jar:?]
	at net.minecraft.class_7947.method_47669(class_7947.java:61) ~[client-intermediary.jar:?]
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) ~[?:?]
	at net.minecraft.class_7947.method_47667(class_7947.java:61) ~[client-intermediary.jar:?]
	at net.minecraft.class_7766.method_47660(class_7766.java:117) ~[client-intermediary.jar:?]
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
	... 6 more
commented

Hm, do you perhaps have 2 values that have the same color in the config? I might have an idea what the issue is then:

Map<Integer, IntUnaryOperator> map = colors.get().stream().map(rgb -> Map.entry(rgb, ImageUtils.getColorOverlayOperator(rgb))).collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

(By 2 values I mean a duplicate in the same list.)

commented

this is my colorfulhearts.toml:

[absorption]
	#Render vanilla hearts
	#Default: true
	vanillaHearts = true
	#Two alternating colors while withered
	#Default: ["#787061", "#73625C"]
	witheredColors = ["#787061", "#73625C"]
	#Two alternating colors while freezing
	#Default: ["#90D136", "#36D183"]
	frozenColors = ["#90D136", "#36D183"]
	#Two alternating colors while poisoned
	#Default: ["#BFF230", "#7AA15A"]
	poisonedColors = ["#BFF230", "#7AA15A"]
	#Colors for every 10 hearts (not counting the default red)
	#All values are written as hexadecimal RGB color in '#RRGGBB' format
	#Default: ["#E1FA9B", "#A0FFAF", "#AAFFFA", "#AACDFF", "#D7B4FF", "#FAA5FF", "#FFB4B4", "#FFAA7D", "#D7F0FF", "#EBFFFA"]
	colors = ["#E1FA9B", "#A0FFAF", "#AAFFFA", "#AACDFF", "#D7B4FF", "#FAA5FF", "#FFB4B4", "#FFAA7D", "#D7F0FF", "#EBFFFA"]

[health]
	#Render vanilla hearts
	#Default: true
	vanillaHearts = false
	#Two alternating colors while withered
	#There can be one color in case vanilla withered heart is wanted
	#Default: ["#0F0F0F"]
	witheredColors = ["#0F0F0F"]
	#Two alternating colors while freezing
	#There can be one color in case vanilla frozen heart is wanted
	#Default: ["#3E70E6"]
	frozenColors = ["#3E70E6"]
	#Two alternating colors while poisoned
	#There can be one color in case vanilla poisoned heart is wanted
	#Default: ["#739B00"]
	poisonedColors = ["#739B00"]
	#Colors for every 10 hearts (not counting the default red)
	#All values are written as hexadecimal RGB color in '#RRGGBB' format
	#Default: ["#F06E14", "#F5DC23", "#2DB928", "#1EAFBE", "#7346E1", "#FA7DEB", "#EB375A", "#FF8278", "#AAFFFA", "#EBEBFF"]
	colors = ["#1EAFBE", "#F5DC23", "#2DB928", "#1EAFBE", "#7346E1", "#FA7DEB", "#EB375A", "#FF8278", "#AAFFFA", "#EBEBFF"]```

	colors = ["#1EAFBE", "#F5DC23", "#2DB928", "#1EAFBE", "#7346E1", "#FA7DEB", "#EB375A", "#FF8278", "#AAFFFA", "#EBEBFF"]

#1EAFBE is a duplicate in the list. By increasing the E to an F, it can finally start. Thank you!

commented

I'll make sure to prevent it from crashing when this happens. Having duplicates should be allowed, its just that I do not handle it on my side.