From d9c05615509db804bb818e30a77a207dd5f2b86a Mon Sep 17 00:00:00 2001 From: PepperCode1 <44146161+PepperCode1@users.noreply.github.com> Date: Tue, 7 Jun 2022 22:21:42 -0700 Subject: [PATCH] Update to 1.19 --- build.gradle | 4 ++-- gradle.properties | 8 +++---- .../continuity/api/client/QuadProcessor.java | 2 +- .../client/config/ContinuityConfigScreen.java | 9 ++++---- .../FallingBlockEntityRendererMixin.java | 4 ++-- .../LifecycledResourceManagerImplMixin.java | 10 +-------- .../client/mixin/SpriteAtlasTextureMixin.java | 2 +- .../client/model/CTMBakedModel.java | 2 +- .../client/model/EmissiveBakedModel.java | 2 +- .../processor/AbstractQuadProcessor.java | 2 +- .../processor/BaseProcessingPredicate.java | 2 +- .../processor/CompactCTMQuadProcessor.java | 2 +- .../processor/HorizontalQuadProcessor.java | 2 +- .../HorizontalVerticalQuadProcessor.java | 2 +- .../client/processor/TopQuadProcessor.java | 2 +- .../VerticalHorizontalQuadProcessor.java | 2 +- .../processor/VerticalQuadProcessor.java | 2 +- .../overlay/SimpleOverlayQuadProcessor.java | 2 +- .../overlay/StandardOverlayQuadProcessor.java | 2 +- .../processor/simple/CTMSpriteProvider.java | 2 +- .../processor/simple/FixedSpriteProvider.java | 2 +- .../simple/RandomSpriteProvider.java | 2 +- .../simple/RepeatSpriteProvider.java | 2 +- .../processor/simple/SimpleQuadProcessor.java | 2 +- .../processor/simple/SpriteProvider.java | 2 +- .../client/resource/CTMPropertiesLoader.java | 2 +- .../client/resource/CustomBlockLayers.java | 22 +++++++++++-------- .../client/resource/EmissiveSuffixLoader.java | 22 +++++++++++-------- .../client/util/SpriteCalculator.java | 4 ++-- src/main/resources/fabric.mod.json | 2 +- .../resourcepacks/default/pack.mcmeta | 2 +- .../glass_pane_culling_fix/pack.mcmeta | 2 +- 32 files changed, 65 insertions(+), 66 deletions(-) diff --git a/build.gradle b/build.gradle index 9992faf..dbe9a16 100644 --- a/build.gradle +++ b/build.gradle @@ -37,11 +37,11 @@ dependencies { // Fabric API modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - modImplementation('com.terraformersmc:modmenu:3.2.2') { + modImplementation('com.terraformersmc:modmenu:4.0.0') { exclude group: 'net.fabricmc.fabric-api' } - modCompileOnly 'maven.modrinth:sodium:mc1.18.2-0.4.1' + modCompileOnly 'maven.modrinth:sodium:mc1.19-0.4.2' modCompileOnly 'io.vram:canvas-fabric-mc118:1.0.2308' modCompileOnly 'maven.modrinth:indium:1.0.3+mc1.18.2' } diff --git a/gradle.properties b/gradle.properties index 5868cc4..f603d31 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,15 +3,15 @@ org.gradle.jvmargs = -Xmx1G # Fabric Properties loom_version = 0.12-SNAPSHOT - minecraft_version = 1.18.2 - yarn_mappings = 1.18.2+build.3 + minecraft_version = 1.19 + yarn_mappings = 1.19+build.1 loader_version = 0.14.6 # Mod Properties mod_version = 2.0.0 - mod_minecraft_version = 1.18.2 + mod_minecraft_version = 1.19 maven_group = me.pepperbell archives_base_name = continuity # Dependencies - fabric_version = 0.55.1+1.18.2 + fabric_version = 0.55.1+1.19 diff --git a/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java b/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java index 0255c47..bf22cc0 100644 --- a/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/api/client/QuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.api.client; -import java.util.Random; import java.util.function.Consumer; import java.util.function.Supplier; @@ -10,6 +9,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public interface QuadProcessor { diff --git a/src/main/java/me/pepperbell/continuity/client/config/ContinuityConfigScreen.java b/src/main/java/me/pepperbell/continuity/client/config/ContinuityConfigScreen.java index a6c76da..213691c 100644 --- a/src/main/java/me/pepperbell/continuity/client/config/ContinuityConfigScreen.java +++ b/src/main/java/me/pepperbell/continuity/client/config/ContinuityConfigScreen.java @@ -1,19 +1,18 @@ package me.pepperbell.continuity.client.config; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ScreenTexts; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.screen.ScreenTexts; import net.minecraft.text.StringVisitable; import net.minecraft.text.Text; -import net.minecraft.text.TranslatableText; public class ContinuityConfigScreen extends Screen { private final Screen parent; private final ContinuityConfig config; public ContinuityConfigScreen(Screen parent, ContinuityConfig config) { - super(new TranslatableText(getTranslationKey("title"))); + super(Text.translatable(getTranslationKey("title"))); this.parent = parent; this.config = config; } @@ -61,8 +60,8 @@ private ButtonWidget.TooltipSupplier createDefaultTooltipSupplier(StringVisitabl private ButtonWidget createBooleanOptionButton(int x, int y, int width, int height, Option option) { String translationKey = getTranslationKey(option.getKey()); - Text text = new TranslatableText(translationKey); - Text tooltipText = new TranslatableText(getTooltipKey(translationKey)); + Text text = Text.translatable(translationKey); + Text tooltipText = Text.translatable(getTooltipKey(translationKey)); return new ButtonWidget(x, y, width, height, ScreenTexts.composeToggleText(text, option.get()), button -> { boolean newValue = !option.get(); diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/FallingBlockEntityRendererMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/FallingBlockEntityRendererMixin.java index 199a50f..b226f7e 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/FallingBlockEntityRendererMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/FallingBlockEntityRendererMixin.java @@ -13,14 +13,14 @@ @Mixin(FallingBlockEntityRenderer.class) public class FallingBlockEntityRendererMixin { - @Inject(method = "render(Lnet/minecraft/entity/FallingBlockEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockModelRenderer;render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z")) + @Inject(method = "render(Lnet/minecraft/entity/FallingBlockEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockModelRenderer;render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V")) private void beforeRenderModel(FallingBlockEntity fallingBlockEntity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { ContinuityFeatureStates states = ContinuityFeatureStates.get(); states.getConnectedTexturesState().disable(); states.getEmissiveTexturesState().disable(); } - @Inject(method = "render(Lnet/minecraft/entity/FallingBlockEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockModelRenderer;render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z", shift = At.Shift.AFTER)) + @Inject(method = "render(Lnet/minecraft/entity/FallingBlockEntity;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/block/BlockModelRenderer;render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", shift = At.Shift.AFTER)) private void afterRenderModel(FallingBlockEntity fallingBlockEntity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { ContinuityFeatureStates states = ContinuityFeatureStates.get(); states.getConnectedTexturesState().enable(); 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..d7680b9 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/LifecycledResourceManagerImplMixin.java @@ -29,7 +29,7 @@ private void onTailInit(ResourceType type, List packs, CallbackInf } } - @ModifyVariable(method = "getResource(Lnet/minecraft/util/Identifier;)Lnet/minecraft/resource/Resource;", at = @At("HEAD")) + @ModifyVariable(method = "getResource(Lnet/minecraft/util/Identifier;)Ljava/util/Optional;", at = @At("HEAD")) private Identifier redirectGetResourceId(Identifier id) { if (redirectHandler != null) { return redirectHandler.redirect(id); @@ -37,14 +37,6 @@ private Identifier redirectGetResourceId(Identifier id) { return id; } - @ModifyVariable(method = "containsResource(Lnet/minecraft/util/Identifier;)Z", at = @At("HEAD")) - private Identifier redirectContainsResourceId(Identifier id) { - if (redirectHandler != null) { - return redirectHandler.redirect(id); - } - return id; - } - @ModifyVariable(method = "getAllResources(Lnet/minecraft/util/Identifier;)Ljava/util/List;", at = @At("HEAD")) private Identifier redirectGetAllResourcesId(Identifier id) { if (redirectHandler != null) { diff --git a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureMixin.java b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureMixin.java index a2f82f1..700a679 100644 --- a/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureMixin.java +++ b/src/main/java/me/pepperbell/continuity/client/mixin/SpriteAtlasTextureMixin.java @@ -60,7 +60,7 @@ private void onTailLoadSprites(ResourceManager resourceManager, Set if (!id.getPath().endsWith(emissiveSuffix)) { Identifier emissiveId = new Identifier(id.getNamespace(), id.getPath() + emissiveSuffix); Identifier emissiveLocation = getTexturePath(emissiveId); - if (resourceManager.containsResource(emissiveLocation)) { + if (resourceManager.getResource(emissiveLocation).isPresent()) { emissiveIds.add(emissiveId); emissiveIdMap.put(id, emissiveId); } diff --git a/src/main/java/me/pepperbell/continuity/client/model/CTMBakedModel.java b/src/main/java/me/pepperbell/continuity/client/model/CTMBakedModel.java index 4b23219..2307339 100644 --- a/src/main/java/me/pepperbell/continuity/client/model/CTMBakedModel.java +++ b/src/main/java/me/pepperbell/continuity/client/model/CTMBakedModel.java @@ -1,7 +1,6 @@ package me.pepperbell.continuity.client.model; import java.util.List; -import java.util.Random; import java.util.function.Supplier; import org.jetbrains.annotations.Nullable; @@ -17,6 +16,7 @@ import net.minecraft.client.render.model.BakedModel; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class CTMBakedModel extends ForwardingBakedModel { diff --git a/src/main/java/me/pepperbell/continuity/client/model/EmissiveBakedModel.java b/src/main/java/me/pepperbell/continuity/client/model/EmissiveBakedModel.java index b8b788d..1fbcbeb 100644 --- a/src/main/java/me/pepperbell/continuity/client/model/EmissiveBakedModel.java +++ b/src/main/java/me/pepperbell/continuity/client/model/EmissiveBakedModel.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.model; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.EmissiveSpriteApi; @@ -21,6 +20,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class EmissiveBakedModel extends ForwardingBakedModel { diff --git a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java index 96a88e5..dced780 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/AbstractQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -8,6 +7,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public abstract class AbstractQuadProcessor implements QuadProcessor { diff --git a/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java b/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java index 0e23681..5bafd49 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/BaseProcessingPredicate.java @@ -110,7 +110,7 @@ public String get(BlockRenderView blockView, BlockPos pos) { BlockEntity blockEntity = blockView.getBlockEntity(pos); if (blockEntity instanceof Nameable nameable) { if (nameable.hasCustomName()) { - blockEntityName = nameable.getCustomName().asString(); + blockEntityName = nameable.getCustomName().getString(); } else { blockEntityName = null; } 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..e6e66c5 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/CompactCTMQuadProcessor.java @@ -1,7 +1,6 @@ package me.pepperbell.continuity.client.processor; import java.util.List; -import java.util.Random; import java.util.function.Function; import java.util.function.Supplier; @@ -29,6 +28,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class CompactCTMQuadProcessor extends ConnectingQuadProcessor { 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..ccd54f3 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -11,6 +10,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class HorizontalQuadProcessor extends ConnectingQuadProcessor { 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..43b23a9 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/HorizontalVerticalQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -11,6 +10,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class HorizontalVerticalQuadProcessor extends HorizontalQuadProcessor { 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..c0f98f9 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/TopQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -12,6 +11,7 @@ import net.minecraft.state.property.Properties; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class TopQuadProcessor extends ConnectingQuadProcessor { 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..a7ca8fa 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/VerticalHorizontalQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -11,6 +10,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class VerticalHorizontalQuadProcessor extends VerticalQuadProcessor { 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..c44a7b1 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/VerticalQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -11,6 +10,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class VerticalQuadProcessor extends ConnectingQuadProcessor { diff --git a/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java index 42bb336..76f8e3d 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/overlay/SimpleOverlayQuadProcessor.java @@ -1,7 +1,6 @@ package me.pepperbell.continuity.client.processor.overlay; import java.util.List; -import java.util.Random; import java.util.function.Consumer; import java.util.function.Supplier; @@ -24,6 +23,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class SimpleOverlayQuadProcessor extends SimpleQuadProcessor { 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..0061899 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 @@ -1,7 +1,6 @@ package me.pepperbell.continuity.client.processor.overlay; import java.util.List; -import java.util.Random; import java.util.Set; import java.util.function.Consumer; import java.util.function.Predicate; @@ -31,6 +30,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; import net.minecraft.world.EmptyBlockView; 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..e1195b7 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 @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.ProcessingDataProvider; @@ -13,6 +12,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class CTMSpriteProvider implements SpriteProvider { 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..f628839 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 @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.ProcessingDataProvider; @@ -9,6 +8,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class FixedSpriteProvider implements SpriteProvider { 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..7894cb4 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 @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import it.unimi.dsi.fastutil.HashCommon; @@ -16,6 +15,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class RandomSpriteProvider implements SpriteProvider { 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..a57a178 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 @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.ProcessingDataProvider; @@ -11,6 +10,7 @@ import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class RepeatSpriteProvider implements SpriteProvider { diff --git a/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java b/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java index b661b3d..5b99c23 100644 --- a/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java +++ b/src/main/java/me/pepperbell/continuity/client/processor/simple/SimpleQuadProcessor.java @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.QuadProcessor; @@ -14,6 +13,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public class SimpleQuadProcessor implements QuadProcessor { 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..e908df4 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 @@ -1,6 +1,5 @@ package me.pepperbell.continuity.client.processor.simple; -import java.util.Random; import java.util.function.Supplier; import me.pepperbell.continuity.api.client.ProcessingDataProvider; @@ -9,6 +8,7 @@ import net.minecraft.block.BlockState; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.BlockRenderView; public interface SpriteProvider { 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 6763666..268dabe 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CTMPropertiesLoader.java @@ -56,7 +56,7 @@ public static void loadAll(ResourceManager resourceManager) { private static void loadAll(ResourcePack pack, int packPriority) { String packName = pack.getName(); for (String namespace : pack.getNamespaces(ResourceType.CLIENT_RESOURCES)) { - Collection ids = pack.findResources(ResourceType.CLIENT_RESOURCES, namespace, "optifine/ctm", Integer.MAX_VALUE, path -> path.endsWith(".properties")); + Collection ids = pack.findResources(ResourceType.CLIENT_RESOURCES, namespace, "optifine/ctm", id -> id.getPath().endsWith(".properties")); for (Identifier id : ids) { try (InputStream stream = pack.open(ResourceType.CLIENT_RESOURCES, id)) { Properties properties = new Properties(); diff --git a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java index ccf2f6a..b3a754b 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/CustomBlockLayers.java @@ -1,7 +1,9 @@ package me.pepperbell.continuity.client.resource; -import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.util.Locale; +import java.util.Optional; import java.util.Properties; import java.util.function.Predicate; @@ -44,14 +46,16 @@ public static RenderLayer getLayer(BlockState state) { private static void reload(ResourceManager manager) { System.arraycopy(EMPTY_LAYER_PREDICATES, 0, LAYER_PREDICATES, 0, EMPTY_LAYER_PREDICATES.length); - try (Resource resource = manager.getResource(LOCATION)) { - Properties properties = new Properties(); - properties.load(resource.getInputStream()); - reload(properties, resource.getId(), resource.getResourcePackName()); - } catch (FileNotFoundException e) { - // - } catch (Exception e) { - ContinuityClient.LOGGER.error("Failed to load custom block layers from file '" + LOCATION + "'", e); + Optional optionalResource = manager.getResource(LOCATION); + if (optionalResource.isPresent()) { + Resource resource = optionalResource.get(); + try (InputStream inputStream = resource.getInputStream()) { + Properties properties = new Properties(); + properties.load(inputStream); + reload(properties, LOCATION, resource.getResourcePackName()); + } catch (IOException e) { + ContinuityClient.LOGGER.error("Failed to load custom block layers from file '" + LOCATION + "'", e); + } } } diff --git a/src/main/java/me/pepperbell/continuity/client/resource/EmissiveSuffixLoader.java b/src/main/java/me/pepperbell/continuity/client/resource/EmissiveSuffixLoader.java index d82f03f..5591daa 100644 --- a/src/main/java/me/pepperbell/continuity/client/resource/EmissiveSuffixLoader.java +++ b/src/main/java/me/pepperbell/continuity/client/resource/EmissiveSuffixLoader.java @@ -1,6 +1,8 @@ package me.pepperbell.continuity.client.resource; -import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.Optional; import java.util.Properties; import org.jetbrains.annotations.ApiStatus; @@ -25,14 +27,16 @@ public static String getEmissiveSuffix() { public static void load(ResourceManager manager) { emissiveSuffix = null; - try (Resource resource = manager.getResource(LOCATION)) { - Properties properties = new Properties(); - properties.load(resource.getInputStream()); - emissiveSuffix = properties.getProperty("suffix.emissive"); - } catch (FileNotFoundException e) { - // - } catch (Exception e) { - ContinuityClient.LOGGER.error("Failed to load emissive suffix from file '" + LOCATION + "'", e); + Optional optionalResource = manager.getResource(LOCATION); + if (optionalResource.isPresent()) { + Resource resource = optionalResource.get(); + try (InputStream inputStream = resource.getInputStream()) { + Properties properties = new Properties(); + properties.load(inputStream); + emissiveSuffix = properties.getProperty("suffix.emissive"); + } catch (IOException e) { + ContinuityClient.LOGGER.error("Failed to load emissive suffix from file '" + LOCATION + "'", e); + } } } } diff --git a/src/main/java/me/pepperbell/continuity/client/util/SpriteCalculator.java b/src/main/java/me/pepperbell/continuity/client/util/SpriteCalculator.java index 4224a31..bdbcc31 100644 --- a/src/main/java/me/pepperbell/continuity/client/util/SpriteCalculator.java +++ b/src/main/java/me/pepperbell/continuity/client/util/SpriteCalculator.java @@ -3,7 +3,6 @@ import java.util.EnumMap; import java.util.List; import java.util.Map; -import java.util.Random; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.Supplier; @@ -17,11 +16,12 @@ import net.minecraft.client.render.model.BakedQuad; import net.minecraft.client.texture.Sprite; import net.minecraft.util.math.Direction; +import net.minecraft.util.math.random.Random; public final class SpriteCalculator { private static final BlockModels MODELS = MinecraftClient.getInstance().getBakedModelManager().getBlockModels(); private static final Supplier RANDOM_SUPPLIER = new Supplier<>() { - private final Random random = new Random(); + private final Random random = Random.create(); @Override public Random get() { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 54d94b4..0985bcd 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ "depends": { "fabricloader": ">=0.11.7", "fabric": ">=0.51.0", - "minecraft": "1.18.x", + "minecraft": "1.19.x", "java": ">=17" }, diff --git a/src/main/resources/resourcepacks/default/pack.mcmeta b/src/main/resources/resourcepacks/default/pack.mcmeta index 85522de..161b11f 100644 --- a/src/main/resources/resourcepacks/default/pack.mcmeta +++ b/src/main/resources/resourcepacks/default/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 8, + "pack_format": 9, "description": "Default connected textures for Continuity" } } diff --git a/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta b/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta index cc57261..435bfa1 100644 --- a/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta +++ b/src/main/resources/resourcepacks/glass_pane_culling_fix/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 8, + "pack_format": 9, "description": "Glass pane culling fix" } }