From 143b010ac201a4e28f02613cc7bf85a1610e429a Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Tue, 9 Aug 2022 17:06:51 -0700 Subject: [PATCH] More innerSeams, less confusion - Add `innerSeams` support to all applicable methods (`horizontal`, `vertical`, `h+v`, `v+h`, `top`) - Rewrite connection map calculation for some processors to be more efficient and compact - Change BlockState retrieval across all processors to be more efficient and make more sense - Change seeding method for `random` - Move check for one sprite from RandomSpriteProvider to Factory - Remove StandardOverlayQuadProcessor.BlockStateAndBoolean - Do not normalize normal vector if its length is zero in CompactCTMQuadProcessor - Move OptionalListCreator into CTMPropertiesLoader - Standardize locations of Override and Nullable annotations - Require Fabric API >=0.58.0 --- gradle.properties | 6 +- gradle/wrapper/gradle-wrapper.jar | Bin 59536 -> 60756 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 16 ++-- gradlew.bat | 14 ++-- .../continuity/client/ContinuityClient.java | 11 ++- .../LifecycledResourceManagerImplMixin.java | 3 +- .../mixin/SpriteAtlasTextureDataMixin.java | 3 +- .../continuity/client/mixin/SpriteMixin.java | 3 +- .../client/model/EmissiveUnbakedModel.java | 2 +- .../client/model/WrappingUnbakedModel.java | 6 +- .../processor/CompactCTMQuadProcessor.java | 21 ++--- .../processor/ConnectingQuadProcessor.java | 4 +- .../client/processor/ConnectionPredicate.java | 18 +++- .../processor/HorizontalQuadProcessor.java | 20 ++--- .../HorizontalVerticalQuadProcessor.java | 47 ++++------- .../client/processor/ProcessingDataKeys.java | 1 - .../client/processor/TopQuadProcessor.java | 22 ++--- .../VerticalHorizontalQuadProcessor.java | 47 +++++------ .../processor/VerticalQuadProcessor.java | 20 ++--- .../overlay/StandardOverlayQuadProcessor.java | 78 +++++++----------- .../processor/simple/CTMSpriteProvider.java | 32 ++----- .../processor/simple/FixedSpriteProvider.java | 3 + .../simple/RandomSpriteProvider.java | 49 +++++------ .../simple/RepeatSpriteProvider.java | 3 + .../processor/simple/SpriteProvider.java | 3 + .../properties/ConnectingCTMProperties.java | 18 ++-- .../properties/PropertiesParsingHelper.java | 2 +- .../client/resource/CTMPropertiesLoader.java | 20 ++++- .../client/resource/ModelWrappingHandler.java | 9 +- .../continuity/client/util/MathUtil.java | 22 +++++ .../client/util/OptionalListCreator.java | 28 ------- .../continuity/client/util/QuadUtil.java | 4 +- .../client/util/RandomIndexProvider.java | 6 +- src/main/resources/fabric.mod.json | 2 +- 35 files changed, 263 insertions(+), 282 deletions(-) delete mode 100644 src/main/java/me/pepperbell/continuity/client/util/OptionalListCreator.java diff --git a/gradle.properties b/gradle.properties index 09de108..e0c6ef3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,8 +4,8 @@ org.gradle.jvmargs = -Xmx1G # Fabric Properties loom_version = 0.12-SNAPSHOT minecraft_version = 1.18.2 - yarn_mappings = 1.18.2+build.3 - loader_version = 0.14.6 + yarn_mappings = 1.18.2+build.4 + loader_version = 0.14.9 # Mod Properties mod_version = 2.0.1 @@ -14,4 +14,4 @@ org.gradle.jvmargs = -Xmx1G archives_base_name = continuity # Dependencies - fabric_version = 0.55.1+1.18.2 + fabric_version = 0.58.0+1.18.2 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2ae8848c63b8b4dea2cb829da983f2fa..249e5832f090a2944b7473328c07c9755baa3196 100644 GIT binary patch delta 10158 zcmaKSbyOWsmn~e}-QC?axCPf>!2<-jxI0|j{UX8L-QC?axDz};a7}ppGBe+Nv*x{5 zy?WI?=j^WT(_Md5*V*xNP>X9&wM>xUvNiMuKDK=Xg!N%oM>Yru2rh7#yD-sW0Ov#$ zCKBSOD3>TM%&1T5t&#FK@|@1f)Ze+EE6(7`}J(Ek4})CD@I+W;L{ zO>K;wokKMA)EC6C|D@nz%D2L3U=Nm(qc>e4GM3WsHGu-T?l^PV6m-T-(igun?PZ8U z{qbiLDMcGSF1`FiKhlsV@qPMRm~h9@z3DZmWp;Suh%5BdP6jq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xZU3af8F p+x$Nxf1895@0bJirXkdpJh+N7@Nb7x007(DEB&^Lm}dWn{T~m64-^0Z diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e589..ae04661 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index c53aefa..a69d9cb 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ # Busybox and similar reduced shells will NOT work, because this script # requires all of these POSIX shell features: # * functions; -# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», -# «${var#prefix}», «${var%suffix}», and «$( cmd )»; -# * compound commands having a testable exit status, especially «case»; -# * various built-in commands including «command», «set», and «ulimit». +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». # # Important for patching: # @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd3..f127cfd 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/src/main/java/me/pepperbell/continuity/client/ContinuityClient.java b/src/main/java/me/pepperbell/continuity/client/ContinuityClient.java index 90232e9..b0103ec 100644 --- a/src/main/java/me/pepperbell/continuity/client/ContinuityClient.java +++ b/src/main/java/me/pepperbell/continuity/client/ContinuityClient.java @@ -22,7 +22,6 @@ import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; import me.pepperbell.continuity.client.properties.BaseCTMProperties; import me.pepperbell.continuity.client.properties.CompactConnectingCTMProperties; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; import me.pepperbell.continuity.client.properties.RandomCTMProperties; import me.pepperbell.continuity.client.properties.RepeatCTMProperties; import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; @@ -94,34 +93,34 @@ public void onInitializeClient() { registry.registerLoader("ctm_compact", loader); loader = CTMLoader.of( - wrapFactory(ConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(4)), + wrapFactory(StandardConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(4)), new HorizontalQuadProcessor.Factory() ); registry.registerLoader("horizontal", loader); registry.registerLoader("bookshelf", loader); loader = CTMLoader.of( - wrapFactory(ConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(4)), + wrapFactory(StandardConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(4)), new VerticalQuadProcessor.Factory() ); registry.registerLoader("vertical", loader); loader = CTMLoader.of( - wrapFactory(ConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(7)), + wrapFactory(StandardConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(7)), new HorizontalVerticalQuadProcessor.Factory() ); registry.registerLoader("horizontal+vertical", loader); registry.registerLoader("h+v", loader); loader = CTMLoader.of( - wrapFactory(ConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(7)), + wrapFactory(StandardConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(7)), new VerticalHorizontalQuadProcessor.Factory() ); registry.registerLoader("vertical+horizontal", loader); registry.registerLoader("v+h", loader); loader = CTMLoader.of( - wrapFactory(ConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(1)), + wrapFactory(StandardConnectingCTMProperties::new, new TileAmountValidator.Exactly<>(1)), new TopQuadProcessor.Factory() ); registry.registerLoader("top", loader); diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java index 8c43951..1a02e44 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java @@ -54,7 +54,8 @@ private Identifier redirectGetAllResourcesId(Identifier id) { } @Override - public @Nullable ResourceRedirectHandler getRedirectHandler() { + @Nullable + public ResourceRedirectHandler getRedirectHandler() { return redirectHandler; } } diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureDataMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureDataMixin.java index 81f82a6..7fcd9b7 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureDataMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureDataMixin.java @@ -16,7 +16,8 @@ public class SpriteAtlasTextureDataMixin implements SpriteAtlasTextureDataExtens private Map emissiveIdMap; @Override - public @Nullable Map getEmissiveIdMap() { + @Nullable + public Map getEmissiveIdMap() { return emissiveIdMap; } diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteMixin.java index 6dc7558..d7c35bd 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteMixin.java @@ -13,7 +13,8 @@ public class SpriteMixin implements SpriteExtension { private Sprite emissiveSprite; @Override - public @Nullable Sprite getEmissiveSprite() { + @Nullable + public Sprite getEmissiveSprite() { return emissiveSprite; } diff --git a/src/main/java/me/pepperbell/continuity/client/model/EmissiveUnbakedModel.java b/src/main/java/me/pepperbell/continuity/client/model/EmissiveUnbakedModel.java index fe21399..f119f65 100644 --- a/src/main/java/me/pepperbell/continuity/client/model/EmissiveUnbakedModel.java +++ b/src/main/java/me/pepperbell/continuity/client/model/EmissiveUnbakedModel.java @@ -17,8 +17,8 @@ public EmissiveUnbakedModel(UnbakedModel wrapped) { super(wrapped); } - @Nullable @Override + @Nullable public BakedModel wrapBaked(@Nullable BakedModel bakedWrapped, ModelLoader loader, Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { if (bakedWrapped == null || bakedWrapped.isBuiltin()) { return bakedWrapped; diff --git a/src/main/java/me/pepperbell/continuity/client/model/WrappingUnbakedModel.java b/src/main/java/me/pepperbell/continuity/client/model/WrappingUnbakedModel.java index 90ce6bd..cc2bf19 100644 --- a/src/main/java/me/pepperbell/continuity/client/model/WrappingUnbakedModel.java +++ b/src/main/java/me/pepperbell/continuity/client/model/WrappingUnbakedModel.java @@ -36,8 +36,8 @@ public Collection getTextureDependencies(Function textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) { if (isBaking) { return null; @@ -45,9 +45,9 @@ public BakedModel bake(ModelLoader loader, Function te isBaking = true; Map unbakedModels = ((ModelLoaderAccessor) loader).getUnbakedModels(); - UnbakedModel previous = unbakedModels.put(modelId, wrapped); + UnbakedModel previous = unbakedModels.replace(modelId, wrapped); BakedModel bakedWrapped = loader.bake(modelId, rotationContainer); - unbakedModels.put(modelId, previous); + unbakedModels.replace(modelId, previous); BakedModel baked = wrapBaked(bakedWrapped, loader, textureGetter, rotationContainer, modelId); isBaking = false; diff --git a/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java index 786d89f..8a36716 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java @@ -54,12 +54,10 @@ public class CompactCTMQuadProcessor extends ConnectingQuadProcessor { ArrayUtils.shift(map[7], 1); } - protected boolean innerSeams; protected Sprite[] replacementSprites; public CompactCTMQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams, Sprite[] replacementSprites) { - super(sprites, processingPredicate, connectionPredicate); - this.innerSeams = innerSeams; + super(sprites, processingPredicate, connectionPredicate, innerSeams); this.replacementSprites = replacementSprites; } @@ -115,17 +113,17 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl boolean vSplit30 = shouldSplitUV(vSignum3, vSignum0); // Cannot split across U and V at the same time - if (uSplit01 & vSplit01 || uSplit12 & vSplit12 || uSplit23 & vSplit23 || uSplit30 & vSplit30) { + if (uSplit01 & vSplit01 | uSplit12 & vSplit12 | uSplit23 & vSplit23 | uSplit30 & vSplit30) { return ProcessingResult.CONTINUE; } // Cannot split across U twice in a row - if (uSplit01 & uSplit12 || uSplit12 & uSplit23 || uSplit23 & uSplit30 || uSplit30 & uSplit01) { + if (uSplit01 & uSplit12 | uSplit12 & uSplit23 | uSplit23 & uSplit30 | uSplit30 & uSplit01) { return ProcessingResult.CONTINUE; } // Cannot split across V twice in a row - if (vSplit01 & vSplit12 || vSplit12 & vSplit23 || vSplit23 & vSplit30 || vSplit30 & vSplit01) { + if (vSplit01 & vSplit12 | vSplit12 & vSplit23 | vSplit23 & vSplit30 | vSplit30 & vSplit01) { return ProcessingResult.CONTINUE; } @@ -551,10 +549,13 @@ public void setLerped(float delta, Vertex vertexA, Vertex vertexB) { normalX = MathHelper.lerp(delta, vertexA.normalX, vertexB.normalX); normalY = MathHelper.lerp(delta, vertexA.normalY, vertexB.normalY); normalZ = MathHelper.lerp(delta, vertexA.normalZ, vertexB.normalZ); - float scale = 1 / (float) Math.sqrt(normalX * normalX + normalY * normalY + normalZ * normalZ); - normalX *= scale; - normalY *= scale; - normalZ *= scale; + float sqLength = normalX * normalX + normalY * normalY + normalZ * normalZ; + if (sqLength != 0) { + float scale = 1 / (float) Math.sqrt(sqLength); + normalX *= scale; + normalY *= scale; + normalZ *= scale; + } } } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ConnectingQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/ConnectingQuadProcessor.java index 76136f2..8573887 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ConnectingQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ConnectingQuadProcessor.java @@ -4,9 +4,11 @@ public abstract class ConnectingQuadProcessor extends AbstractQuadProcessor { protected ConnectionPredicate connectionPredicate; + protected boolean innerSeams; - public ConnectingQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { + public ConnectingQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { super(sprites, processingPredicate); this.connectionPredicate = connectionPredicate; + this.innerSeams = innerSeams; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java index 25ece2a..acf0cd5 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ConnectionPredicate.java @@ -7,9 +7,21 @@ import net.minecraft.world.BlockRenderView; public interface ConnectionPredicate { - boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockState to, Direction face, BlockRenderView blockView); + boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite); - default boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockPos toPos, Direction face, BlockRenderView blockView) { - return shouldConnect(state, quadSprite, pos, blockView.getBlockState(toPos), face, blockView); + default boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockPos toPos, Direction face, Sprite quadSprite) { + return shouldConnect(blockView, state, pos, blockView.getBlockState(toPos), face, quadSprite); + } + + default boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockPos.Mutable toPos, Direction face, Sprite quadSprite, boolean innerSeams) { + if (shouldConnect(blockView, state, pos, toPos, face, quadSprite)) { + if (innerSeams) { + toPos.move(face); + return !shouldConnect(blockView, state, pos, toPos, face, quadSprite); + } else { + return true; + } + } + return false; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java index f09bcbb..6bba4b1 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java @@ -5,7 +5,7 @@ import me.pepperbell.continuity.api.client.QuadProcessor; import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; +import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; @@ -20,8 +20,8 @@ public class HorizontalQuadProcessor extends ConnectingQuadProcessor { 3, 2, 0, 1, }; - public HorizontalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { - super(sprites, processingPredicate, connectionPredicate); + public HorizontalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { + super(sprites, processingPredicate, connectionPredicate, innerSeams); } @Override @@ -34,26 +34,24 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl } protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - mutablePos.set(pos); int connections = 0; for (int i = 0; i < 2; i++) { - mutablePos.move(directions[i * 2]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { + mutablePos.set(pos, directions[i * 2]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << i; } - mutablePos.set(pos); } return connections; } - public static class Factory extends AbstractQuadProcessorFactory { + public static class Factory extends AbstractQuadProcessorFactory { @Override - public QuadProcessor createProcessor(ConnectingCTMProperties properties, Sprite[] sprites) { - return new HorizontalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate()); + public QuadProcessor createProcessor(StandardConnectingCTMProperties properties, Sprite[] sprites) { + return new HorizontalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate(), properties.getInnerSeams()); } @Override - public int getTextureAmount(ConnectingCTMProperties properties) { + public int getTextureAmount(StandardConnectingCTMProperties properties) { return 4; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java index 7f83510..ab2300f 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java @@ -5,7 +5,7 @@ import me.pepperbell.continuity.api.client.QuadProcessor; import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; +import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; @@ -18,15 +18,15 @@ public class HorizontalVerticalQuadProcessor extends HorizontalQuadProcessor { // 32 16 8 // * // 1 2 4 - protected static final int[] SPRITE_INDEX_MAP_1 = new int[] { + protected static final int[] SECONDARY_SPRITE_INDEX_MAP = new int[] { 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 4, 4, 5, 4, 4, 4, 4, 4, 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 6, 3, 3, 3, 3, 3, }; - public HorizontalVerticalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { - super(sprites, processingPredicate, connectionPredicate); + public HorizontalVerticalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { + super(sprites, processingPredicate, connectionPredicate, innerSeams); } @Override @@ -38,49 +38,38 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl if (connections != 0) { newSprite = sprites[SPRITE_INDEX_MAP[connections]]; } else { - connections = getConnections1(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); - newSprite = sprites[SPRITE_INDEX_MAP_1[connections]]; + int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + newSprite = sprites[SECONDARY_SPRITE_INDEX_MAP[secondaryConnections]]; } return SimpleQuadProcessor.process(quad, sprite, newSprite); } - protected int getConnections1(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - mutablePos.set(pos); + protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { - mutablePos.move(directions[i * 2 + 1]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { + Direction direction = directions[i * 2 + 1]; + mutablePos.set(pos, direction); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << (i * 3 + 1); - } - mutablePos.set(pos); - } - for (int i = 0; i < 4; i++) { - int shift = (i / 2) * 3 + 1; - int index1 = i; - int index2 = (i + 1) % 4; - if (((connections >> shift) & 1) == 1) { - mutablePos.move(directions[index1]).move(directions[index2]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - int shift1 = i % 2; - if (shift1 <= 0) { - shift1--; + for (int j = 0; j < 2; j++) { + mutablePos.set(pos, direction).move(directions[((i + j) % 2) * 2]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + connections |= 1 << (i * 3 + j * 2); } - connections |= 1 << (shift + shift1); } - mutablePos.set(pos); } } return connections; } - public static class Factory extends AbstractQuadProcessorFactory { + public static class Factory extends AbstractQuadProcessorFactory { @Override - public QuadProcessor createProcessor(ConnectingCTMProperties properties, Sprite[] sprites) { - return new HorizontalVerticalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate()); + public QuadProcessor createProcessor(StandardConnectingCTMProperties properties, Sprite[] sprites) { + return new HorizontalVerticalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate(), properties.getInnerSeams()); } @Override - public int getTextureAmount(ConnectingCTMProperties properties) { + public int getTextureAmount(StandardConnectingCTMProperties properties) { return 7; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java index 05ec713..262fc50 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/ProcessingDataKeys.java @@ -15,7 +15,6 @@ public final class ProcessingDataKeys { public static final ProcessingDataKey BIOME_CACHE_KEY = create("biome_cache", BaseProcessingPredicate.BiomeCache::new, BaseProcessingPredicate.BiomeCache::reset); public static final ProcessingDataKey BLOCK_ENTITY_NAME_CACHE_KEY = create("block_entity_name_cache", BaseProcessingPredicate.BlockEntityNameCache::new, BaseProcessingPredicate.BlockEntityNameCache::reset); public static final ProcessingDataKey VERTEX_CONTAINER_KEY = create("vertex_container", CompactCTMQuadProcessor.VertexContainer::new); - public static final ProcessingDataKey BLOCK_STATE_AND_BOOLEAN_KEY = create("block_state_and_boolean", StandardOverlayQuadProcessor.BlockStateAndBoolean::new); public static final ProcessingDataKey STANDARD_OVERLAY_RENDERER_POOL_KEY = create("standard_overlay_renderer_pool", StandardOverlayQuadProcessor.OverlayRendererPool::new, StandardOverlayQuadProcessor.OverlayRendererPool::reset); public static final ProcessingDataKey SIMPLE_OVERLAY_RENDERER_POOL_KEY = create("simple_overlay_renderer_pool", SimpleOverlayQuadProcessor.OverlayRendererPool::new, SimpleOverlayQuadProcessor.OverlayRendererPool::reset); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java index cc49726..ba96a8d 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java @@ -5,7 +5,7 @@ import me.pepperbell.continuity.api.client.QuadProcessor; import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; +import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; @@ -15,35 +15,37 @@ import net.minecraft.world.BlockRenderView; public class TopQuadProcessor extends ConnectingQuadProcessor { - public TopQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { - super(sprites, processingPredicate, connectionPredicate); + public TopQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { + super(sprites, processingPredicate, connectionPredicate, innerSeams); } @Override public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, int pass, int processorIndex, ProcessingContext context) { Direction lightFace = quad.lightFace(); - Direction.Axis axis = Direction.Axis.Y; + Direction.Axis axis; if (state.contains(Properties.AXIS)) { axis = state.get(Properties.AXIS); + } else { + axis = Direction.Axis.Y; } if (lightFace.getAxis() != axis) { Direction up = Direction.from(axis, Direction.AxisDirection.POSITIVE); - BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos); - if (connectionPredicate.shouldConnect(state, sprite, pos, mutablePos.move(up), lightFace, blockView)) { + BlockPos.Mutable mutablePos = context.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos, up); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, lightFace, sprite, innerSeams)) { return SimpleQuadProcessor.process(quad, sprite, sprites[0]); } } return ProcessingResult.CONTINUE; } - public static class Factory extends AbstractQuadProcessorFactory { + public static class Factory extends AbstractQuadProcessorFactory { @Override - public QuadProcessor createProcessor(ConnectingCTMProperties properties, Sprite[] sprites) { - return new TopQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate()); + public QuadProcessor createProcessor(StandardConnectingCTMProperties properties, Sprite[] sprites) { + return new TopQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate(), properties.getInnerSeams()); } @Override - public int getTextureAmount(ConnectingCTMProperties properties) { + public int getTextureAmount(StandardConnectingCTMProperties properties) { return 1; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java index 9b37227..142556a 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java @@ -5,7 +5,7 @@ import me.pepperbell.continuity.api.client.QuadProcessor; import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; +import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; @@ -18,15 +18,15 @@ public class VerticalHorizontalQuadProcessor extends VerticalQuadProcessor { // 32 16 // 1 * 8 // 2 4 - protected static final int[] SPRITE_INDEX_MAP_1 = new int[] { + protected static final int[] SECONDARY_SPRITE_INDEX_MAP = new int[] { 3, 6, 3, 3, 3, 6, 3, 3, 4, 5, 4, 4, 3, 6, 3, 3, 3, 6, 3, 3, 3, 6, 3, 3, 3, 6, 3, 3, 3, 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, }; - public VerticalHorizontalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { - super(sprites, processingPredicate, connectionPredicate); + public VerticalHorizontalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { + super(sprites, processingPredicate, connectionPredicate, innerSeams); } @Override @@ -38,45 +38,38 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl if (connections != 0) { newSprite = sprites[SPRITE_INDEX_MAP[connections]]; } else { - connections = getConnections1(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); - newSprite = sprites[SPRITE_INDEX_MAP_1[connections]]; + int secondaryConnections = getSecondaryConnections(directions, mutablePos, blockView, state, pos, quad.lightFace(), sprite); + newSprite = sprites[SECONDARY_SPRITE_INDEX_MAP[secondaryConnections]]; } return SimpleQuadProcessor.process(quad, sprite, newSprite); } - protected int getConnections1(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - mutablePos.set(pos); + protected int getSecondaryConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { int connections = 0; for (int i = 0; i < 2; i++) { - mutablePos.move(directions[i * 2]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - connections |= 1 << i * 3; - } - mutablePos.set(pos); - } - for (int i = 0; i < 4; i++) { - int shift = (i / 2) * 3; - int index1 = i; - int index2 = (i + 1) % 4; - if (((connections >> shift) & 1) == 1) { - mutablePos.move(directions[index1]).move(directions[index2]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - connections |= 1 << (shift + i % 2 + 1); + Direction direction = directions[i * 2]; + mutablePos.set(pos, direction); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + connections |= 1 << (i * 3); + for (int j = 0; j < 2; j++) { + mutablePos.set(pos, direction).move(directions[((i + j) % 2) * 2 + 1]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + connections |= 1 << ((i * 3 + j * 2 + 5) % 6); + } } - mutablePos.set(pos); } } return connections; } - public static class Factory extends AbstractQuadProcessorFactory { + public static class Factory extends AbstractQuadProcessorFactory { @Override - public QuadProcessor createProcessor(ConnectingCTMProperties properties, Sprite[] sprites) { - return new VerticalHorizontalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate()); + public QuadProcessor createProcessor(StandardConnectingCTMProperties properties, Sprite[] sprites) { + return new VerticalHorizontalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate(), properties.getInnerSeams()); } @Override - public int getTextureAmount(ConnectingCTMProperties properties) { + public int getTextureAmount(StandardConnectingCTMProperties properties) { return 7; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java index 35b5001..705d8ed 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java @@ -5,7 +5,7 @@ import me.pepperbell.continuity.api.client.QuadProcessor; import me.pepperbell.continuity.client.processor.simple.SimpleQuadProcessor; -import me.pepperbell.continuity.client.properties.ConnectingCTMProperties; +import me.pepperbell.continuity.client.properties.StandardConnectingCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView; import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; @@ -22,8 +22,8 @@ public class VerticalQuadProcessor extends ConnectingQuadProcessor { 3, 2, 0, 1, }; - public VerticalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate) { - super(sprites, processingPredicate, connectionPredicate); + public VerticalQuadProcessor(Sprite[] sprites, ProcessingPredicate processingPredicate, ConnectionPredicate connectionPredicate, boolean innerSeams) { + super(sprites, processingPredicate, connectionPredicate, innerSeams); } @Override @@ -36,26 +36,24 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl } protected int getConnections(Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - mutablePos.set(pos); int connections = 0; for (int i = 0; i < 2; i++) { - mutablePos.move(directions[i * 2 + 1]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { + mutablePos.set(pos, directions[i * 2 + 1]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { connections |= 1 << i; } - mutablePos.set(pos); } return connections; } - public static class Factory extends AbstractQuadProcessorFactory { + public static class Factory extends AbstractQuadProcessorFactory { @Override - public QuadProcessor createProcessor(ConnectingCTMProperties properties, Sprite[] sprites) { - return new VerticalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate()); + public QuadProcessor createProcessor(StandardConnectingCTMProperties properties, Sprite[] sprites) { + return new VerticalQuadProcessor(sprites, BaseProcessingPredicate.fromProperties(properties), properties.getConnectionPredicate(), properties.getInnerSeams()); } @Override - public int getTextureAmount(ConnectingCTMProperties properties) { + public int getTextureAmount(StandardConnectingCTMProperties properties) { return 4; } } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java index 33d49f7..d368e39 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/overlay/StandardOverlayQuadProcessor.java @@ -68,7 +68,7 @@ public ProcessingResult processQuadInner(MutableQuadView quad, Sprite sprite, Bl return ProcessingResult.CONTINUE; } - protected boolean appliesOverlay(BlockState other, BlockState state, Direction face, Sprite quadSprite, BlockPos pos, BlockRenderView blockView) { + protected boolean appliesOverlay(BlockState other, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { if (other.getBlock().hasDynamicBounds()) { return false; } @@ -85,10 +85,10 @@ protected boolean appliesOverlay(BlockState other, BlockState state, Direction f return false; } } - return !connectionPredicate.shouldConnect(state, quadSprite, pos, other, face, blockView); + return !connectionPredicate.shouldConnect(blockView, state, pos, other, face, quadSprite); } - protected boolean hasSameOverlay(BlockState other, BlockState state, Direction face, Sprite quadSprite, BlockPos pos, BlockRenderView blockView) { + protected boolean hasSameOverlay(BlockState other, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { if (matchBlocksPredicate != null) { if (!matchBlocksPredicate.test(other)) { return false; @@ -102,50 +102,38 @@ protected boolean hasSameOverlay(BlockState other, BlockState state, Direction f return true; } - protected void appliesOverlayUnobscured(Direction direction0, BlockStateAndBoolean blockStateAndBoolean, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - mutablePos.move(direction0); - BlockState state0 = blockView.getBlockState(mutablePos); - boolean bool = appliesOverlay(state0, state, lightFace, quadSprite, pos, blockView); - if (bool) { - mutablePos.move(lightFace); - if (blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { - bool = false; - } + protected boolean appliesOverlayUnobscured(BlockState state0, Direction direction0, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { + boolean a0 = appliesOverlay(state0, blockView, state, pos, lightFace, quadSprite); + if (a0) { + mutablePos.set(pos, direction0).move(lightFace); + a0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); } - mutablePos.set(pos); - blockStateAndBoolean.state = state0; - blockStateAndBoolean.bool = bool; + return a0; } protected boolean hasSameOverlayUnobscured(BlockState state0, Direction direction0, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - boolean s0 = hasSameOverlay(state0, state, lightFace, quadSprite, pos, blockView); + boolean s0 = hasSameOverlay(state0, blockView, state, pos, lightFace, quadSprite); if (s0) { - mutablePos.move(direction0).move(lightFace); - if (blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { - s0 = false; - } - mutablePos.set(pos); + mutablePos.set(pos, direction0).move(lightFace); + s0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); } return s0; } protected boolean appliesOverlayCorner(Direction direction0, Direction direction1, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { - mutablePos.move(direction0).move(direction1); - boolean corner0 = appliesOverlay(blockView.getBlockState(mutablePos), state, lightFace, quadSprite, pos, blockView); + mutablePos.set(pos, direction0).move(direction1); + boolean corner0 = appliesOverlay(blockView.getBlockState(mutablePos), blockView, state, pos, lightFace, quadSprite); if (corner0) { mutablePos.move(lightFace); - if (blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { - corner0 = false; - } + corner0 = !blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos); } - mutablePos.set(pos); return corner0; } protected OverlayRenderer fromCorner(Direction direction0, Direction direction1, int sprite0, int sprite1, OverlayRenderer renderer, BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, BlockPos.Mutable mutablePos) { Sprite[] rendererSprites = prepareRenderer(renderer, lightFace, blockView, pos); - mutablePos.move(direction0).move(direction1); - if (appliesOverlay(blockView.getBlockState(mutablePos), state, lightFace, quadSprite, pos, blockView)) { + mutablePos.set(pos, direction0).move(direction1); + if (appliesOverlay(blockView.getBlockState(mutablePos), blockView, state, pos, lightFace, quadSprite)) { mutablePos.move(lightFace); if (!blockView.getBlockState(mutablePos).isOpaqueFullCube(blockView, mutablePos)) { rendererSprites[1] = sprites[sprite1]; @@ -216,23 +204,22 @@ protected OverlayRenderer prepareRenderer(OverlayRenderer renderer, Direction fa 16: L U (CORNER) */ protected OverlayRenderer getRenderer(BlockRenderView blockView, BlockPos pos, BlockState state, Direction lightFace, Sprite quadSprite, Direction[] directions, ProcessingDataProvider dataProvider) { - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos); - BlockStateAndBoolean blockStateAndBoolean = dataProvider.getData(ProcessingDataKeys.BLOCK_STATE_AND_BOOLEAN_KEY); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); // - appliesOverlayUnobscured(directions[0], blockStateAndBoolean, blockView, pos, state, lightFace, quadSprite, mutablePos); - BlockState state0 = blockStateAndBoolean.state; - boolean left = blockStateAndBoolean.bool; - appliesOverlayUnobscured(directions[1], blockStateAndBoolean, blockView, pos, state, lightFace, quadSprite, mutablePos); - BlockState state1 = blockStateAndBoolean.state; - boolean down = blockStateAndBoolean.bool; - appliesOverlayUnobscured(directions[2], blockStateAndBoolean, blockView, pos, state, lightFace, quadSprite, mutablePos); - BlockState state2 = blockStateAndBoolean.state; - boolean right = blockStateAndBoolean.bool; - appliesOverlayUnobscured(directions[3], blockStateAndBoolean, blockView, pos, state, lightFace, quadSprite, mutablePos); - BlockState state3 = blockStateAndBoolean.state; - boolean up = blockStateAndBoolean.bool; + mutablePos.set(pos, directions[0]); + BlockState state0 = blockView.getBlockState(mutablePos); + boolean left = appliesOverlayUnobscured(state0, directions[0], blockView, pos, state, lightFace, quadSprite, mutablePos); + mutablePos.set(pos, directions[1]); + BlockState state1 = blockView.getBlockState(mutablePos); + boolean down = appliesOverlayUnobscured(state1, directions[1], blockView, pos, state, lightFace, quadSprite, mutablePos); + mutablePos.set(pos, directions[2]); + BlockState state2 = blockView.getBlockState(mutablePos); + boolean right = appliesOverlayUnobscured(state2, directions[2], blockView, pos, state, lightFace, quadSprite, mutablePos); + mutablePos.set(pos, directions[3]); + BlockState state3 = blockView.getBlockState(mutablePos); + boolean up = appliesOverlayUnobscured(state3, directions[3], blockView, pos, state, lightFace, quadSprite, mutablePos); // @@ -334,11 +321,6 @@ protected OverlayRenderer getRenderer(BlockRenderView blockView, BlockPos pos, B return null; } - public static class BlockStateAndBoolean { - public BlockState state; - public boolean bool; - } - public static class OverlayRenderer implements Consumer { protected static final Sprite[] EMPTY_SPRITES = new Sprite[4]; diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/CTMSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/CTMSpriteProvider.java index 8a8ebae..799d541 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/CTMSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/CTMSpriteProvider.java @@ -3,6 +3,8 @@ import java.util.Random; import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + import me.pepperbell.continuity.api.client.ProcessingDataProvider; import me.pepperbell.continuity.client.processor.ConnectionPredicate; import me.pepperbell.continuity.client.processor.DirectionMaps; @@ -52,6 +54,7 @@ public CTMSpriteProvider(Sprite[] sprites, ConnectionPredicate connectionPredica } @Override + @Nullable public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { Direction[] directions = useTextureOrientation ? DirectionMaps.getDirections(quad) : DirectionMaps.getMap(quad.lightFace())[0]; BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY); @@ -60,38 +63,21 @@ public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, } public static int getConnections(ConnectionPredicate connectionPredicate, boolean innerSeams, Direction[] directions, BlockPos.Mutable mutablePos, BlockRenderView blockView, BlockState state, BlockPos pos, Direction face, Sprite quadSprite) { - mutablePos.set(pos); int connections = 0; for (int i = 0; i < 4; i++) { - mutablePos.move(directions[i]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - if (innerSeams) { - mutablePos.move(face); - if (!connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - connections |= 1 << (i * 2); - } - } else { - connections |= 1 << (i * 2); - } + mutablePos.set(pos, directions[i]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + connections |= 1 << (i * 2); } - mutablePos.set(pos); } for (int i = 0; i < 4; i++) { int index1 = i; int index2 = (i + 1) % 4; if (((connections >> index1 * 2) & 1) == 1 && ((connections >> index2 * 2) & 1) == 1) { - mutablePos.move(directions[index1]).move(directions[index2]); - if (connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - if (innerSeams) { - mutablePos.move(face); - if (!connectionPredicate.shouldConnect(state, quadSprite, pos, mutablePos, face, blockView)) { - connections |= 1 << (i * 2 + 1); - } - } else { - connections |= 1 << (i * 2 + 1); - } + mutablePos.set(pos, directions[index1]).move(directions[index2]); + if (connectionPredicate.shouldConnect(blockView, state, pos, mutablePos, face, quadSprite, innerSeams)) { + connections |= 1 << (i * 2 + 1); } - mutablePos.set(pos); } } return connections; diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java index a04a2c3..2f9c41e 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/FixedSpriteProvider.java @@ -3,6 +3,8 @@ import java.util.Random; import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + import me.pepperbell.continuity.api.client.ProcessingDataProvider; import me.pepperbell.continuity.client.properties.BaseCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView; @@ -19,6 +21,7 @@ public FixedSpriteProvider(Sprite sprite) { } @Override + @Nullable public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { return this.sprite; } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java index c5c3db0..015ac3e 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/RandomSpriteProvider.java @@ -3,11 +3,13 @@ import java.util.Random; import java.util.function.Supplier; -import it.unimi.dsi.fastutil.HashCommon; +import org.jetbrains.annotations.Nullable; + import me.pepperbell.continuity.api.client.ProcessingDataProvider; import me.pepperbell.continuity.client.processor.ProcessingDataKeys; import me.pepperbell.continuity.client.processor.Symmetry; import me.pepperbell.continuity.client.properties.RandomCTMProperties; +import me.pepperbell.continuity.client.util.MathUtil; import me.pepperbell.continuity.client.util.RandomIndexProvider; import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView; import net.minecraft.block.Block; @@ -15,7 +17,6 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; -import net.minecraft.util.math.MathHelper; import net.minecraft.world.BlockRenderView; public class RandomSpriteProvider implements SpriteProvider { @@ -34,43 +35,33 @@ public RandomSpriteProvider(Sprite[] sprites, RandomIndexProvider indexProvider, } @Override + @Nullable public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { - Sprite newSprite; - if (sprites.length == 1) { - newSprite = sprites[0]; - } else { - Direction face = symmetry.getActualFace(quad.lightFace()); + Direction face = symmetry.getActualFace(quad.lightFace()); - int x = pos.getX(); - int y = pos.getY(); - int z = pos.getZ(); - if (linked) { - Block block = state.getBlock(); - BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos); - do { - mutablePos.move(Direction.DOWN); - } while (block == blockView.getBlockState(mutablePos).getBlock()); - y = mutablePos.getY() + 1; - } + int x = pos.getX(); + int y = pos.getY(); + int z = pos.getZ(); - int hash = hash(x, y, z, face.ordinal(), randomLoops); - newSprite = sprites[indexProvider.getRandomIndex(hash)]; + if (linked) { + Block block = state.getBlock(); + BlockPos.Mutable mutablePos = dataProvider.getData(ProcessingDataKeys.MUTABLE_POS_KEY).set(pos); + do { + mutablePos.setY(mutablePos.getY() - 1); + } while (block == blockView.getBlockState(mutablePos).getBlock()); + y = mutablePos.getY() + 1; } - return newSprite; - } - public static int hash(int x, int y, int z, int face, int loops) { - int hash = Integer.rotateLeft(Long.hashCode(MathHelper.hashCode(x, y, z)), face * 5); - hash = HashCommon.mix(hash); - for (int i = 0; i < loops; i++) { - hash = HashCommon.mix(hash); - } - return hash; + int seed = MathUtil.mix(x, y, z, face.ordinal(), randomLoops); + return sprites[indexProvider.getRandomIndex(seed)]; } public static class Factory implements SpriteProvider.Factory { @Override public SpriteProvider createSpriteProvider(Sprite[] sprites, RandomCTMProperties properties) { + if (sprites.length == 1) { + return new FixedSpriteProvider(sprites[0]); + } return new RandomSpriteProvider(sprites, properties.getIndexProviderFactory().createIndexProvider(sprites.length), properties.getRandomLoops(), properties.getSymmetry(), properties.getLinked()); } diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java index be2f199..7ca2598 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/RepeatSpriteProvider.java @@ -3,6 +3,8 @@ import java.util.Random; import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + import me.pepperbell.continuity.api.client.ProcessingDataProvider; import me.pepperbell.continuity.client.processor.Symmetry; import me.pepperbell.continuity.client.properties.RepeatCTMProperties; @@ -27,6 +29,7 @@ public RepeatSpriteProvider(Sprite[] sprites, int width, int height, Symmetry sy } @Override + @Nullable public Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider) { Direction face = symmetry.getActualFace(quad.lightFace()); diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java index 3ec26da..992abbb 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/SpriteProvider.java @@ -3,6 +3,8 @@ import java.util.Random; import java.util.function.Supplier; +import org.jetbrains.annotations.Nullable; + import me.pepperbell.continuity.api.client.ProcessingDataProvider; import me.pepperbell.continuity.client.properties.BaseCTMProperties; import net.fabricmc.fabric.api.renderer.v1.mesh.QuadView; @@ -12,6 +14,7 @@ import net.minecraft.world.BlockRenderView; public interface SpriteProvider { + @Nullable Sprite getSprite(QuadView quad, Sprite sprite, BlockRenderView blockView, BlockState state, BlockPos pos, Supplier randomSupplier, ProcessingDataProvider dataProvider); interface Factory { diff --git a/src/main/java/me/pepperbell/continuity/client/properties/ConnectingCTMProperties.java b/src/main/java/me/pepperbell/continuity/client/properties/ConnectingCTMProperties.java index 0f1f731..cd5a6e4 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/ConnectingCTMProperties.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/ConnectingCTMProperties.java @@ -63,29 +63,29 @@ public ConnectionPredicate getConnectionPredicate() { public enum ConnectionType implements ConnectionPredicate { BLOCK { @Override - public boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockState to, Direction face, BlockRenderView blockView) { - return state.getBlock() == to.getBlock(); + public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { + return state.getBlock() == toState.getBlock(); } }, TILE { @Override - public boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockState to, Direction face, BlockRenderView blockView) { - if (state == to) { + public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { + if (state == toState) { return true; } - return quadSprite == SpriteCalculator.getSprite(to, face); + return quadSprite == SpriteCalculator.getSprite(toState, face); } }, MATERIAL { @Override - public boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockState to, Direction face, BlockRenderView blockView) { - return state.getMaterial() == to.getMaterial(); + public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { + return state.getMaterial() == toState.getMaterial(); } }, STATE { @Override - public boolean shouldConnect(BlockState state, Sprite quadSprite, BlockPos pos, BlockState to, Direction face, BlockRenderView blockView) { - return state == to; + public boolean shouldConnect(BlockRenderView blockView, BlockState state, BlockPos pos, BlockState toState, Direction face, Sprite quadSprite) { + return state == toState; } }; } diff --git a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java index ad4e21a..0b58eef 100644 --- a/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java +++ b/src/main/java/me/pepperbell/continuity/client/properties/PropertiesParsingHelper.java @@ -196,8 +196,8 @@ public static Predicate parseBlockStates(Properties properties, Stri ImmutableList> predicateList = predicateListBuilder.build(); if (!predicateList.isEmpty()) { - int amount = predicateList.size(); return state -> { + int amount = predicateList.size(); for (int i = 0; i < amount; i++) { if (predicateList.get(i).test(state)) { return true; diff --git a/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java b/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java index fc37058..37d4dca 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java @@ -21,7 +21,6 @@ import me.pepperbell.continuity.api.client.CTMProperties; import me.pepperbell.continuity.client.ContinuityClient; import me.pepperbell.continuity.client.util.BooleanState; -import me.pepperbell.continuity.client.util.OptionalListCreator; import net.minecraft.block.BlockState; import net.minecraft.client.util.SpriteIdentifier; import net.minecraft.resource.ResourceManager; @@ -211,4 +210,23 @@ public static void clearAll() { IGNORES_BLOCK.clear(); VALID_FOR_MULTIPASS.clear(); } + + private static class OptionalListCreator implements Consumer { + private ObjectArrayList list = null; + + @Override + public void accept(T t) { + if (list == null) { + list = new ObjectArrayList<>(); + } + list.add(t); + } + + @Nullable + public ObjectArrayList get() { + ObjectArrayList list = this.list; + this.list = null; + return list; + } + } } diff --git a/src/main/java/me/pepperbell/continuity/client/resource/ModelWrappingHandler.java b/src/main/java/me/pepperbell/continuity/client/resource/ModelWrappingHandler.java index 02be078..39c404d 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/ModelWrappingHandler.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/ModelWrappingHandler.java @@ -12,7 +12,6 @@ import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.ObjectArrayList; -import it.unimi.dsi.fastutil.objects.ObjectArraySet; import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet; import me.pepperbell.continuity.client.mixinterface.SpriteAtlasTextureDataExtension; import me.pepperbell.continuity.client.model.CTMUnbakedModel; @@ -77,7 +76,7 @@ public static void wrapCTMModels(Map unbakedModels, Ma Set> dependents = container.getRecursiveMultipassDependents(); if (dependents != null) { if (multipassContainerSet == null) { - multipassContainerSet = new ObjectArraySet<>(); + multipassContainerSet = new ObjectOpenHashSet<>(); } multipassContainerSet.addAll(dependents); } @@ -158,10 +157,8 @@ private static Function createUnbakedModelGetter(Map wrappedModels, Map unbakedModels, Map modelsToBake) { wrappedModels.forEach((id, wrapped) -> { - unbakedModels.put(id, wrapped); - if (modelsToBake.containsKey(id)) { - modelsToBake.put(id, wrapped); - } + unbakedModels.replace(id, wrapped); + modelsToBake.replace(id, wrapped); }); } diff --git a/src/main/java/me/pepperbell/continuity/client/util/MathUtil.java b/src/main/java/me/pepperbell/continuity/client/util/MathUtil.java index 443f0f5..65ec026 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/MathUtil.java +++ b/src/main/java/me/pepperbell/continuity/client/util/MathUtil.java @@ -1,6 +1,11 @@ package me.pepperbell.continuity.client.util; +import net.minecraft.util.math.MathHelper; + public final class MathUtil { + // Borrowed from SplittableRandom + public static final long GOLDEN_GAMMA = 0x9e3779b97f4a7c15L; + public static int signum(int value) { if (value > 0) { return 1; @@ -26,4 +31,21 @@ public static int lerpLight(float delta, int lightA, int lightB) { return (lerp(delta, lightA >> 20 & 0xF, lightB >> 20 & 0xF) << 20) | (lerp(delta, lightA >> 4 & 0xF, lightB >> 4 & 0xF) << 4); } + + // Borrowed from SplittableRandom + public static long mix64(long z) { + z = (z ^ (z >>> 30)) * 0xbf58476d1ce4e5b9L; + z = (z ^ (z >>> 27)) * 0x94d049bb133111ebL; + return z ^ (z >>> 31); + } + + // Borrowed from SplittableRandom + public static int mix32(long z) { + z = (z ^ (z >>> 33)) * 0x62a9d9ed799705f5L; + return (int) (((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32); + } + + public static int mix(int x, int y, int z, int face, int loops) { + return mix32((MathHelper.hashCode(x, y, z) ^ mix64(GOLDEN_GAMMA * (1 + face))) + GOLDEN_GAMMA * (1 + loops)); + } } diff --git a/src/main/java/me/pepperbell/continuity/client/util/OptionalListCreator.java b/src/main/java/me/pepperbell/continuity/client/util/OptionalListCreator.java deleted file mode 100644 index b808847..0000000 --- a/src/main/java/me/pepperbell/continuity/client/util/OptionalListCreator.java +++ /dev/null @@ -1,28 +0,0 @@ -package me.pepperbell.continuity.client.util; - -import java.util.function.Consumer; -import java.util.function.Supplier; - -import org.jetbrains.annotations.Nullable; - -import it.unimi.dsi.fastutil.objects.ObjectArrayList; - -public class OptionalListCreator implements Consumer, Supplier> { - private ObjectArrayList list = null; - - @Override - public void accept(T t) { - if (list == null) { - list = new ObjectArrayList<>(); - } - list.add(t); - } - - @Override - @Nullable - public ObjectArrayList get() { - ObjectArrayList list = this.list; - this.list = null; - return list; - } -} diff --git a/src/main/java/me/pepperbell/continuity/client/util/QuadUtil.java b/src/main/java/me/pepperbell/continuity/client/util/QuadUtil.java index 50c011c..82845f4 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/QuadUtil.java +++ b/src/main/java/me/pepperbell/continuity/client/util/QuadUtil.java @@ -26,8 +26,8 @@ public static void interpolate(MutableQuadView quad, Sprite oldSprite, Sprite ne public static void assignLerpedUVs(MutableQuadView quad, Sprite sprite) { float delta = sprite.getAnimationFrameDelta(); - float centerU = (sprite.getMinU() + sprite.getMaxU()) / 2.0f; - float centerV = (sprite.getMinV() + sprite.getMaxV()) / 2.0f; + float centerU = (sprite.getMinU() + sprite.getMaxU()) * 0.5f; + float centerV = (sprite.getMinV() + sprite.getMaxV()) * 0.5f; float lerpedMinU = MathHelper.lerp(delta, sprite.getMinU(), centerU); float lerpedMaxU = MathHelper.lerp(delta, sprite.getMaxU(), centerU); float lerpedMinV = MathHelper.lerp(delta, sprite.getMinV(), centerV); diff --git a/src/main/java/me/pepperbell/continuity/client/util/RandomIndexProvider.java b/src/main/java/me/pepperbell/continuity/client/util/RandomIndexProvider.java index a49dcab..addb2b7 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/RandomIndexProvider.java +++ b/src/main/java/me/pepperbell/continuity/client/util/RandomIndexProvider.java @@ -34,10 +34,10 @@ class Weighted implements RandomIndexProvider { protected int weightSum; protected int maxIndex; - public Weighted(int[] weights, int weightSum, int maxIndex) { + public Weighted(int[] weights, int weightSum) { this.weights = weights; this.weightSum = weightSum; - this.maxIndex = maxIndex; + this.maxIndex = weights.length - 1; } @Override @@ -77,7 +77,7 @@ public RandomIndexProvider createIndexProvider(int size) { } } - return new Weighted(newWeights, weightSum, size - 1); + return new Weighted(newWeights, weightSum); } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 54d94b4..44f6a24 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -32,7 +32,7 @@ "depends": { "fabricloader": ">=0.11.7", - "fabric": ">=0.51.0", + "fabric": ">=0.58.0", "minecraft": "1.18.x", "java": ">=17" },