From 76e10eb252598eb0caa4fa319ce65664cce991a3 Mon Sep 17 00:00:00 2001 From: Treetrain1 Date: Sun, 9 Jun 2024 07:28:20 -0500 Subject: [PATCH 01/15] Port to 1.21-pre4 --- build.gradle.kts | 2 +- gradle.properties | 10 +-- .../net/frozenblock/lib/FrozenClient.java | 2 +- .../java/net/frozenblock/lib/FrozenMain.java | 12 ---- .../lib/FrozenSharedConstants.java | 2 +- .../entity/BillboardBlockEntityRenderer.java | 2 +- .../config/impl/network/ConfigSyncPacket.java | 4 +- .../entrypoint/api/FrozenModInitializer.java | 2 +- .../gravity/impl/GravityRenderingImpl.java | 51 ++++++++------- .../ingamedevtools/item/LootTableWhacker.java | 2 +- .../lib/integration/api/ModIntegration.java | 2 +- .../lib/integration/api/ModIntegrations.java | 4 +- .../impl/network/CooldownChangePacket.java | 4 +- .../impl/network/CooldownTickCountPacket.java | 4 +- .../impl/network/ForcedCooldownPacket.java | 4 +- .../lib/item/mixin/ServerPlayerMixin.java | 5 +- .../liquid/render/api/LiquidRenderUtils.java | 62 +++++++++---------- .../lib/menu/mixin/ScreenMixin.java | 2 +- .../lib/recipe/api/FrozenRecipeProvider.java | 2 +- .../impl/network/EntityScreenShakePacket.java | 4 +- .../RemoveEntityScreenShakePacket.java | 4 +- .../impl/network/RemoveScreenShakePacket.java | 4 +- .../impl/network/ScreenShakePacket.java | 4 +- .../screenshake/mixin/ServerPlayerMixin.java | 5 +- .../mixin/client/GameRendererMixin.java | 6 +- .../FadingDistanceSwitchingSoundPacket.java | 4 +- .../api/networking/FlyBySoundPacket.java | 4 +- .../networking/LocalPlayerSoundPacket.java | 4 +- .../api/networking/LocalSoundPacket.java | 4 +- ...stanceSwitchingRestrictionSoundPacket.java | 4 +- .../MovingRestrictionSoundPacket.java | 4 +- ...rtingMovingRestrictionSoundLoopPacket.java | 2 +- .../BlockSoundGroupManager.java | 8 +-- .../api/ClientSpottingIconMethods.java | 2 +- .../impl/SpottingIconPacket.java | 4 +- .../impl/SpottingIconRemovePacket.java | 4 +- .../mixin/client/EntityRendererMixin.java | 13 ++-- .../mixin/client/LevelRendererMixin.java | 5 +- .../lib/stencil/api/StencilRenderer.java | 6 +- .../networking/WindDisturbancePacket.java | 4 +- .../wind/impl/networking/WindSyncPacket.java | 4 +- .../lib/worldgen/biome/api/FrozenBiome.java | 2 +- .../api/FrozenConfiguredFeatureUtils.java | 4 +- .../feature/api/FrozenPlacementUtils.java | 2 +- .../mixin/SinglePoolElementMixin.java | 7 ++- .../registry/impl/event/DelayedRegistry.java | 6 ++ .../registry/impl/sync/ClientPackets.java | 6 +- .../registry/impl/sync/ServerPackets.java | 13 ++-- .../api/QuiltDataFixerBuilder.java | 11 +++- .../datafixerupper/api/QuiltDataFixes.java | 3 +- .../frozenblock/lib/core/api/StringUtil.kt | 4 +- src/main/resources/frozenlib.accesswidener | 3 +- .../lib/testmod/FrozenTestClient.java | 6 +- .../lib/testmod/FrozenTestMain.java | 2 +- .../lib/testmod/config/TestConfig.kt | 6 +- .../lib/testmod/config/gui/TestConfigGui.java | 2 +- .../testmod/datagen/FrozenLibTestDatagen.java | 2 +- .../lib/testmod/mixin/CreeperMixin.java | 3 +- .../lib/testmod/mixin/PhantomMixin.java | 3 +- .../lib/testmod/mixin/PlayerMixin.java | 3 +- .../lib/testmod/mixin/WardenMixin.java | 3 +- .../testmod/worldgen/TestSurfaceRules.java | 4 +- src/testmod/resources/fabric.mod.json | 2 +- 63 files changed, 194 insertions(+), 184 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 903b9b47b..c3b2941f9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -281,7 +281,7 @@ tasks { processResources { val properties = HashMap() properties["version"] = project.version - properties["minecraft_version"] = minecraft_version + properties["minecraft_version"] = "~1.21-"//minecraft_version properties["fabric_loader_version"] = ">=$min_loader_version" properties["fabric_api_version"] = ">=$fabric_api_version" diff --git a/gradle.properties b/gradle.properties index 508bd4b5a..976556387 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,11 +12,11 @@ # Fabric Properties # Get new versions at https://fabricmc.net/develop and https://lambdaurora.dev/tools/import_quilt.html - minecraft_version=1.20.6 - quilt_mappings=1.20.5+build.1 + minecraft_version=1.21-pre4 + quilt_mappings=1.21-pre4+build.1 parchment_mappings=1.20.6:2024.06.02 loader_version=0.15.11 - min_loader_version=0.15.10 + min_loader_version=0.15.11 # Mod Properties mod_version = 1.7.2 @@ -25,7 +25,7 @@ archives_base_name = FrozenLib # Dependencies - fabric_api_version=0.100.0+1.20.6 + fabric_api_version=0.100.0+1.21 fabric_kotlin_version=1.11.0+kotlin.2.0.0 toml4j_version=0.7.2 jankson_version=1.2.3 @@ -34,6 +34,6 @@ fresult_version=3.1 # External Mods - modmenu_version=10.0.0-beta.1 + modmenu_version=11.0.0-beta.1 cloth_config_version=14.0.126 terrablender_version=1.20.2-3.2.0.14 diff --git a/src/main/java/net/frozenblock/lib/FrozenClient.java b/src/main/java/net/frozenblock/lib/FrozenClient.java index e91bc3b5a..558be3161 100644 --- a/src/main/java/net/frozenblock/lib/FrozenClient.java +++ b/src/main/java/net/frozenblock/lib/FrozenClient.java @@ -59,7 +59,7 @@ public void onInitializeClient() { particleRegistry.register(FrozenParticleTypes.DEBUG_POS, DebugPosParticle.Provider::new); - Panoramas.addPanorama(new ResourceLocation("textures/gui/title/background/panorama")); + Panoramas.addPanorama(ResourceLocation.withDefaultNamespace("textures/gui/title/background/panorama")); var resourceLoader = ResourceManagerHelper.get(PackType.CLIENT_RESOURCES); resourceLoader.registerReloadListener(BlockSoundGroupManager.INSTANCE); diff --git a/src/main/java/net/frozenblock/lib/FrozenMain.java b/src/main/java/net/frozenblock/lib/FrozenMain.java index c0a0d26fb..29e11f4c8 100644 --- a/src/main/java/net/frozenblock/lib/FrozenMain.java +++ b/src/main/java/net/frozenblock/lib/FrozenMain.java @@ -145,16 +145,4 @@ public void onInitialize(String modId, ModContainer container) { ModIntegrations.initialize(); }); } - - @Contract("_ -> new") - @Deprecated(forRemoval = true) - public static @NotNull ResourceLocation resourceLocation(String path) { - return new ResourceLocation(FrozenSharedConstants.MOD_ID, path); - } - - @Deprecated(forRemoval = true) - public static @NotNull String string(String path) { - return resourceLocation(path).toString(); - } - } diff --git a/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java b/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java index fe3e64467..1b5a19483 100644 --- a/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java +++ b/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java @@ -43,7 +43,7 @@ public final class FrozenSharedConstants { @Contract("_ -> new") @NotNull public static ResourceLocation id(String path) { - return new ResourceLocation(FrozenSharedConstants.MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, path); } @NotNull diff --git a/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java b/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java index f3269e324..bcd414c83 100644 --- a/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java +++ b/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java @@ -63,7 +63,7 @@ public void render(@NotNull T entity, float tickDelta, @NotNull PoseStack poseSt poseStack.translate(0.5, 0, 0.5); poseStack.pushPose(); poseStack.mulPose(this.rotation); - this.base.render(poseStack, vertexConsumers.getBuffer(RenderType.entityCutout(this.getTexture(entity))), light, overlay, 1.0F, 1.0F, 1.0F, 1.0F); + this.base.render(poseStack, vertexConsumers.getBuffer(RenderType.entityCutout(this.getTexture(entity))), light, overlay); poseStack.popPose(); } diff --git a/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java b/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java index e07f434ad..2e30b6a36 100644 --- a/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java +++ b/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java @@ -55,8 +55,8 @@ public record ConfigSyncPacket( public static final int PERMISSION_LEVEL = 2; - public static final Type> PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("config_sync_packet") + public static final Type> PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("config_sync_packet") ); public static final StreamCodec> CODEC = StreamCodec.ofMember(ConfigSyncPacket::write, ConfigSyncPacket::create); diff --git a/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java b/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java index 5c0580fa4..9760d61d2 100644 --- a/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java +++ b/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java @@ -49,7 +49,7 @@ public ModContainer container() { } public ResourceLocation id(String path) { - return new ResourceLocation(this.modId, path); + return ResourceLocation.fromNamespaceAndPath(this.modId, path); } public T register(Registry registry, String path, T value) { diff --git a/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java b/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java index 8d48000ff..ca783ec7d 100644 --- a/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java +++ b/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java @@ -39,13 +39,12 @@ public final class GravityRenderingImpl { private GravityRenderingImpl() {} - private static final ResourceLocation FORCEFIELD_LOCATION = new ResourceLocation("textures/misc/forcefield.png"); + private static final ResourceLocation FORCEFIELD_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/forcefield.png"); public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStack poseStack) { // not working properly if (true) return; RenderSystem.defaultBlendFunc(); - BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder(); double y = camera.getPosition().y(); for (GravityBelt gravityBelt : GravityAPI.getAllBelts(level)) { poseStack.pushPose(); @@ -63,19 +62,19 @@ public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStac float k = 130; RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 1.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 1.0f).endVertex(); - BufferUploader.drawWithShader(bufferBuilder.end()); + var firstBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + firstBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 0.0f); + firstBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 0.0f); + firstBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 1.0f); + firstBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 1.0f); + BufferUploader.drawWithShader(firstBuffer.build()); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 1.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 1.0f).endVertex(); - BufferUploader.drawWithShader(bufferBuilder.end()); + var secondBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + secondBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 0.0f); + secondBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 0.0f); + secondBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 1.0f); + secondBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 1.0f); + BufferUploader.drawWithShader(secondBuffer.build()); poseStack.popPose(); } } @@ -93,19 +92,19 @@ public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStac float k = 130; RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 1.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 1.0f).endVertex(); - BufferUploader.drawWithShader(bufferBuilder.end()); + var firstBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + firstBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 0.0f); + firstBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 0.0f); + firstBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 1.0f); + firstBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 1.0f); + BufferUploader.drawWithShader(firstBuffer.build()); - bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 0.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 1.0f).endVertex(); - bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 1.0f).endVertex(); - BufferUploader.drawWithShader(bufferBuilder.end()); + var secondBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + secondBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 0.0f); + secondBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 0.0f); + secondBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 1.0f); + secondBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 1.0f); + BufferUploader.drawWithShader(secondBuffer.build()); poseStack.popPose(); } } diff --git a/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java b/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java index a2fe4eaa0..d97dbc382 100644 --- a/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java +++ b/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java @@ -55,7 +55,7 @@ public InteractionResult useOn(@NotNull UseOnContext context) { } if (stack.has(DataComponents.CUSTOM_NAME)) { String id = stack.getHoverName().getString(); - ResourceLocation location = new ResourceLocation(id); + ResourceLocation location = ResourceLocation.parse(id); ResourceKey key = ResourceKey.create(Registries.LOOT_TABLE, location); if (!level.isClientSide) { if (level.getBlockEntity(blockPos) instanceof RandomizableContainerBlockEntity loot) { diff --git a/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java b/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java index 3978b4ecc..03fdecb70 100644 --- a/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java +++ b/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java @@ -53,7 +53,7 @@ public String getID() { } public ResourceLocation id(String path) { - return new ResourceLocation(this.modRegistryID, path); + return ResourceLocation.fromNamespaceAndPath(this.modRegistryID, path); } public Block getBlock(String path) { diff --git a/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java b/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java index d6becb5dc..a4d431ecf 100644 --- a/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java +++ b/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java @@ -40,7 +40,7 @@ private ModIntegrations() { * @return A {@link ModIntegrationSupplier}. */ public static ModIntegrationSupplier register(Supplier integration, String srcModID, String modID) { - return Registry.register(FrozenRegistry.MOD_INTEGRATION, new ResourceLocation(srcModID, modID), new ModIntegrationSupplier<>(integration, modID)); + return Registry.register(FrozenRegistry.MOD_INTEGRATION, ResourceLocation.fromNamespaceAndPath(srcModID, modID), new ModIntegrationSupplier<>(integration, modID)); } /** @@ -53,7 +53,7 @@ public static ModIntegrationSupplier register(Supplier * @return A {@link ModIntegrationSupplier}. */ public static ModIntegrationSupplier register(Supplier integration, Supplier unloadedIntegration, String srcModID, String modID) { - return Registry.register(FrozenRegistry.MOD_INTEGRATION, new ResourceLocation(srcModID, modID), new ModIntegrationSupplier<>(integration, unloadedIntegration, modID)); + return Registry.register(FrozenRegistry.MOD_INTEGRATION, ResourceLocation.fromNamespaceAndPath(srcModID, modID), new ModIntegrationSupplier<>(integration, unloadedIntegration, modID)); } public static List> getIntegrationSuppliers() { diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java index 046c32d5f..790a80f7a 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java @@ -31,8 +31,8 @@ public record CooldownChangePacket( int additional ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("cooldown_change_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("cooldown_change_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(CooldownChangePacket::write, CooldownChangePacket::new); diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java index 44b214853..924d03652 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java @@ -26,8 +26,8 @@ public record CooldownTickCountPacket(int count) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("cooldown_tick_count_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("cooldown_tick_count_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(CooldownTickCountPacket::new, CooldownTickCountPacket::count).cast(); diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java index 3809d22dc..7cb0b0186 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java @@ -32,8 +32,8 @@ public record ForcedCooldownPacket( int endTime ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("forced_cooldown_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("forced_cooldown_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(ForcedCooldownPacket::write, ForcedCooldownPacket::new); diff --git a/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java b/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java index 98d4dfd58..d75c2716b 100644 --- a/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java +++ b/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java @@ -25,6 +25,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.portal.DimensionTransition; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -66,14 +67,14 @@ public void tick(CallbackInfo info) { } @Inject(method = "changeDimension", at = @At(value = "HEAD")) - public void frozenLib$changeDimensionSaveCooldowns(ServerLevel destination, CallbackInfoReturnable info) { + public void frozenLib$changeDimensionSaveCooldowns(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { CompoundTag tempTag = new CompoundTag(); SaveableItemCooldowns.saveCooldowns(tempTag, ServerPlayer.class.cast(this)); this.frozenLib$savedCooldownTag = tempTag; } @Inject(method = "changeDimension", at = @At(value = "RETURN")) - public void frozenLib$changeDimensionLoadCooldowns(ServerLevel destination, CallbackInfoReturnable info) { + public void frozenLib$changeDimensionLoadCooldowns(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { if (this.frozenLib$savedCooldownTag != null) { this.frozenLib$savedItemCooldowns = Optional.of(SaveableItemCooldowns.readCooldowns(this.frozenLib$savedCooldownTag)); } diff --git a/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java b/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java index 36f3e4940..d1f7112d2 100644 --- a/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java +++ b/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java @@ -93,9 +93,9 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos southEastHeight = calculateAverageHeight(level, fluid, n, t, u, pos.relative(Direction.SOUTH).relative(Direction.EAST)); southWestHeight = calculateAverageHeight(level, fluid, n, t, v, pos.relative(Direction.SOUTH).relative(Direction.WEST)); } - double d = pos.getX() & 0xF; - double e = pos.getY() & 0xF; - double w = pos.getZ() & 0xF; + float d = pos.getX() & 0xF; + float e = pos.getY() & 0xF; + float w = pos.getZ() & 0xF; y = shouldRenderDown ? 0.001f : 0.0f; if (shouldRenderUp && !isFaceOccludedByNeighbor(level, pos, Direction.UP, Math.min(Math.min(northWestHeight, southWestHeight), Math.min(southEastHeight, northEastHeight)), upBlockState, blockState)) { float ak; @@ -132,15 +132,15 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos float an = k * f; ao = k * g; ap = k * h; - vertex(vertexConsumer, d + 0.0, e + northWestHeight, w + 0.0, an, ao, ap, z, aa, am); - vertex(vertexConsumer, d + 0.0, e + southWestHeight, w + 1.0, an, ao, ap, ab, ac, am); - vertex(vertexConsumer, d + 1.0, e + southEastHeight, w + 1.0, an, ao, ap, ad, ae, am); - vertex(vertexConsumer, d + 1.0, e + northEastHeight, w + 0.0, an, ao, ap, af, ag, am); + vertex(vertexConsumer, d + 0.0f, e + northWestHeight, w + 0.0f, an, ao, ap, z, aa, am); + vertex(vertexConsumer, d + 0.0f, e + southWestHeight, w + 1.0f, an, ao, ap, ab, ac, am); + vertex(vertexConsumer, d + 1.0f, e + southEastHeight, w + 1.0f, an, ao, ap, ad, ae, am); + vertex(vertexConsumer, d + 1.0f, e + northEastHeight, w + 0.0f, an, ao, ap, af, ag, am); if (fluidState.shouldRenderBackwardUpFace(level, pos.above()) || !blockState.equals(downBlockState)) { - vertex(vertexConsumer, d + 0.0, e + northWestHeight, w + 0.0, an, ao, ap, z, aa, am); - vertex(vertexConsumer, d + 1.0, e + northEastHeight, w + 0.0, an, ao, ap, af, ag, am); - vertex(vertexConsumer, d + 1.0, e + southEastHeight, w + 1.0, an, ao, ap, ad, ae, am); - vertex(vertexConsumer, d + 0.0, e + southWestHeight, w + 1.0, an, ao, ap, ab, ac, am); + vertex(vertexConsumer, d + 0.0f, e + northWestHeight, w + 0.0f, an, ao, ap, z, aa, am); + vertex(vertexConsumer, d + 1.0f, e + northEastHeight, w + 0.0f, an, ao, ap, af, ag, am); + vertex(vertexConsumer, d + 1.0f, e + southEastHeight, w + 1.0f, an, ao, ap, ad, ae, am); + vertex(vertexConsumer, d + 0.0f, e + southWestHeight, w + 1.0f, an, ao, ap, ab, ac, am); } } if (shouldRenderDown) { @@ -152,30 +152,30 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos ac = j * f; ae = j * g; ag = j * h; - vertex(vertexConsumer, d, e + y, w + 1.0, ac, ae, ag, z, af, aq); + vertex(vertexConsumer, d, e + y, w + 1.0f, ac, ae, ag, z, af, aq); vertex(vertexConsumer, d, e + y, w, ac, ae, ag, z, ad, aq); - vertex(vertexConsumer, d + 1.0, e + y, w, ac, ae, ag, ab, ad, aq); - vertex(vertexConsumer, d + 1.0, e + y, w + 1.0, ac, ae, ag, ab, af, aq); + vertex(vertexConsumer, d + 1.0f, e + y, w, ac, ae, ag, ab, ad, aq); + vertex(vertexConsumer, d + 1.0f, e + y, w + 1.0f, ac, ae, ag, ab, af, aq); if (!downFluidState.equals(fluidState) && downBlockState.getBlock() != blockState.getBlock() && !downBlockState.canOcclude()) { - vertex(vertexConsumer, d, e + y, w + 1.0, ac, ae, ag, z, af, aq); - vertex(vertexConsumer, d + 1.0, e + y, w + 1.0, ac, ae, ag, z, ad, aq); - vertex(vertexConsumer, d + 1.0, e + y, w, ac, ae, ag, ab, ad, aq); + vertex(vertexConsumer, d, e + y, w + 1.0f, ac, ae, ag, z, af, aq); + vertex(vertexConsumer, d + 1.0f, e + y, w + 1.0f, ac, ae, ag, z, ad, aq); + vertex(vertexConsumer, d + 1.0f, e + y, w, ac, ae, ag, ab, ad, aq); vertex(vertexConsumer, d, e + y, w, ac, ae, ag, ab, af, aq); } } int ar = getLightColor(level, pos); for (Direction direction : Direction.Plane.HORIZONTAL) { - double av; - double au; - double at; - double as; + float av; + float au; + float at; + float as; float aa; if (!(switch (direction) { case NORTH -> { af = northWestHeight; aa = northEastHeight; as = d; - at = d + 1.0; + at = d + 1.0f; au = w + 0.001f; av = w + 0.001f; yield shouldRenderNorth; @@ -183,10 +183,10 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos case SOUTH -> { af = southEastHeight; aa = southWestHeight; - as = d + 1.0; + as = d + 1.0f; at = d; - au = w + 1.0 - 0.001f; - av = w + 1.0 - 0.001f; + au = w + 1.0f - 0.001f; + av = w + 1.0f - 0.001f; yield bl5; } case WEST -> { @@ -194,17 +194,17 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos aa = northWestHeight; as = d + 0.001f; at = d + 0.001f; - au = w + 1.0; + au = w + 1.0f; av = w; yield bl6; } default -> { af = northEastHeight; aa = southEastHeight; - as = d + 1.0 - 0.001f; - at = d + 1.0 - 0.001f; + as = d + 1.0f - 0.001f; + at = d + 1.0f - 0.001f; au = w; - av = w + 1.0; + av = w + 1.0f; yield bl7; } }) || isFaceOccludedByNeighbor(level, pos, direction, Math.max(af, aa), level.getBlockState(pos.relative(direction)), level.getBlockState(pos.relative(direction)))) continue; @@ -276,8 +276,8 @@ public static float getHeight(BlockAndTintGetter world, Fluid fluid, BlockPos po } //vertex - public static void vertex(VertexConsumer consumer, double x, double y, double z, float red, float green, float blue, float u, float v, int packedLight) { - consumer.vertex(x, y, z).color(red, green, blue, 1.0f).uv(u, v).uv2(packedLight).normal(0.0f, 1.0f, 0.0f).endVertex(); + public static void vertex(VertexConsumer consumer, float x, float y, float z, float red, float green, float blue, float u, float v, int packedLight) { + consumer.addVertex(x, y, z).setColor(red, green, blue, 1.0f).setUv(u, v).setLight(packedLight).setNormal(0.0f, 1.0f, 0.0f); } public static int getLightColor(BlockAndTintGetter level, BlockPos pos) { diff --git a/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java b/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java index 14b23c772..8ec1457c1 100644 --- a/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java +++ b/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java @@ -43,7 +43,7 @@ private static CubeMap multiplePanoramas(ResourceLocation baseImageLocation, Ope String path = panLocation.getPath(); for(int i = 0; i < 6; ++i) { //Panorama isn't valid if one of the six images isn't found; move on to the next ResourceLocation in the list. - if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation(namespace, path + "_" + i + ".png")).isEmpty()) { + if (Minecraft.getInstance().getResourceManager().getResource(ResourceLocation.fromNamespaceAndPath(namespace, path + "_" + i + ".png")).isEmpty()) { FrozenLogUtils.logWarning("Unable to use panorama at " + namespace + ":" + path + ", proper resource pack may not be loaded!", FrozenSharedConstants.UNSTABLE_LOGGING); break; } diff --git a/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java b/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java index 4e8b8056a..1b2c1cff4 100644 --- a/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java +++ b/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java @@ -96,7 +96,7 @@ public static void colorWithDyes(RecipeOutput recipeOutput, @NotNull List .requires(Ingredient.of(dyeableItems.stream().filter(item2x -> !item2x.equals(item2)).map(ItemStack::new))) .group(group) .unlockedBy("has_needed_dye", RecipeProvider.has(item)) - .save(recipeOutput, new ResourceLocation(modID, "dye_" + RecipeProvider.getItemName(item2))); + .save(recipeOutput, ResourceLocation.fromNamespaceAndPath(modID, "dye_" + RecipeProvider.getItemName(item2))); } } } diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java index 88fa8fdde..01074035b 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java @@ -32,8 +32,8 @@ public record EntityScreenShakePacket( int ticks ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("screen_shake_entity_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("screen_shake_entity_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(EntityScreenShakePacket::write, EntityScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java index 40bf10ff7..c159cce9e 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java @@ -28,8 +28,8 @@ public record RemoveEntityScreenShakePacket( int entityId ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("remove_entity_screen_shakes_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("remove_entity_screen_shakes_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(RemoveEntityScreenShakePacket::new, RemoveEntityScreenShakePacket::entityId).cast(); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java index f1900631f..52bc6a37d 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java @@ -25,8 +25,8 @@ public record RemoveScreenShakePacket() implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("remove_screen_shakes_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("remove_screen_shakes_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(RemoveScreenShakePacket::write, RemoveScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java index 698513d36..f6e0c678a 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java @@ -33,8 +33,8 @@ public record ScreenShakePacket( int ticks ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("screen_shake_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("screen_shake_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(ScreenShakePacket::write, ScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java b/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java index 0bf6999bd..29f2b70fd 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java +++ b/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java @@ -24,6 +24,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.portal.DimensionTransition; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -56,7 +57,7 @@ public class ServerPlayerMixin { } @Inject(method = "changeDimension", at = @At(value = "HEAD")) - public void frozenLib$changeDimensionSaveScreenShakes(ServerLevel destination, CallbackInfoReturnable info) { + public void frozenLib$changeDimensionSaveScreenShakes(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { CompoundTag tempTag = new CompoundTag(); EntityScreenShakeManager entityScreenShakeManager = ((EntityScreenShakeInterface)ServerPlayer.class.cast(this)).getScreenShakeManager(); entityScreenShakeManager.save(tempTag); @@ -64,7 +65,7 @@ public class ServerPlayerMixin { } @Inject(method = "changeDimension", at = @At(value = "RETURN")) - public void frozenLib$changeDimensionLoadScreenShakes(ServerLevel destination, CallbackInfoReturnable info) { + public void frozenLib$changeDimensionLoadScreenShakes(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { if (this.frozenLib$savedScreenShakesTag != null) { EntityScreenShakeManager entityScreenShakeManager = ((EntityScreenShakeInterface)ServerPlayer.class.cast(this)).getScreenShakeManager(); entityScreenShakeManager.load(this.frozenLib$savedScreenShakesTag); diff --git a/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java b/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java index ec5a3201b..50ff29872 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java @@ -18,8 +18,10 @@ package net.frozenblock.lib.screenshake.mixin.client; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; +import com.llamalad7.mixinextras.sugar.Local; import com.mojang.blaze3d.vertex.PoseStack; import net.frozenblock.lib.screenshake.api.client.ScreenShaker; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.renderer.GameRenderer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -28,8 +30,8 @@ public class GameRendererMixin { @ModifyExpressionValue(method = "renderLevel", at = @At(value = "NEW", target = "()Lcom/mojang/blaze3d/vertex/PoseStack;")) - public PoseStack frozenLib$shakeLeve(PoseStack matrixStack, float partialTicks, long finishTimeNano) { - ScreenShaker.shake(matrixStack, partialTicks); + public PoseStack frozenLib$shakeLevel(PoseStack matrixStack, DeltaTracker tracker, @Local(ordinal = 0) float deltaTime) { + ScreenShaker.shake(matrixStack, deltaTime); return matrixStack; } diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java index 8c1060cc7..fc3bf94a5 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java @@ -40,8 +40,8 @@ public record FadingDistanceSwitchingSoundPacket( float maxDist ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("fading_distance_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("fading_distance_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(FadingDistanceSwitchingSoundPacket::write, FadingDistanceSwitchingSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java index f270a168e..c02586a5d 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java @@ -41,8 +41,8 @@ public record FlyBySoundPacket( float volume, float pitch ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("flyby_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("flyby_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(FlyBySoundPacket::write, FlyBySoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java index b1a9e1a1d..8004fd19b 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java @@ -28,8 +28,8 @@ import org.jetbrains.annotations.NotNull; public record LocalPlayerSoundPacket(Holder sound, float volume, float pitch) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("local_player_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("local_player_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(LocalPlayerSoundPacket::write, LocalPlayerSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java index 2045a3e89..791a0ac03 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java @@ -37,8 +37,8 @@ public record LocalSoundPacket( float pitch, boolean distanceDelay ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("local_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("local_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(LocalSoundPacket::write, LocalSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java index 52e51dd3f..16b3959c9 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java @@ -43,8 +43,8 @@ public record MovingFadingDistanceSwitchingRestrictionSoundPacket( boolean looping ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("moving_fading_restriction_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("moving_fading_restriction_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(MovingFadingDistanceSwitchingRestrictionSoundPacket::write, MovingFadingDistanceSwitchingRestrictionSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java index 3dcd07f03..e30111ebe 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java @@ -40,8 +40,8 @@ public record MovingRestrictionSoundPacket( boolean looping ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("moving_restriction_sound_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("moving_restriction_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(MovingRestrictionSoundPacket::write, MovingRestrictionSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java index edbf5dfd9..ea1e38d20 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java @@ -39,7 +39,7 @@ public record StartingMovingRestrictionSoundLoopPacket( ResourceLocation predicateId, boolean stopOnDeath ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("starting_moving_restriction_looping_sound_packet")); + public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("starting_moving_restriction_looping_sound_packet")); public static final StreamCodec CODEC = StreamCodec.ofMember(StartingMovingRestrictionSoundLoopPacket::write, StartingMovingRestrictionSoundLoopPacket::new); public StartingMovingRestrictionSoundLoopPacket(@NotNull RegistryFriendlyByteBuf buf) { diff --git a/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java b/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java index 23b49bbd3..35747a156 100644 --- a/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java +++ b/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java @@ -89,7 +89,7 @@ public void addBlock(ResourceLocation key, SoundType sounds, BooleanSupplier con * This will only work with vanilla blocks. */ public void addBlock(String id, SoundType sounds, BooleanSupplier condition) { - var key = new ResourceLocation(id); + var key = ResourceLocation.parse(id); addBlock(key, sounds, condition); } @@ -97,7 +97,7 @@ public void addBlock(String id, SoundType sounds, BooleanSupplier condition) { * Adds a block with the specified namespace and id. */ public void addBlock(String namespace, String id, SoundType sounds, BooleanSupplier condition) { - var key = new ResourceLocation(namespace, id); + var key = ResourceLocation.fromNamespaceAndPath(namespace, id); addBlock(key, sounds, condition); } @@ -127,7 +127,7 @@ public void addBlockTag(TagKey tag, SoundType sounds, BooleanSupplier con } public static ResourceLocation getPath(ResourceLocation blockId) { - return new ResourceLocation(blockId.getNamespace(), DIRECTORY + "/" + blockId.getPath() + ".json"); + return ResourceLocation.fromNamespaceAndPath(blockId.getNamespace(), DIRECTORY + "/" + blockId.getPath() + ".json"); } @Override @@ -187,7 +187,7 @@ private void addOverwrite(ResourceLocation id, Resource resource) { return; } - ResourceLocation overwriteId = new ResourceLocation(id.getNamespace(), id.getPath().substring((DIRECTORY + "/").length())); + ResourceLocation overwriteId = ResourceLocation.fromNamespaceAndPath(id.getNamespace(), id.getPath().substring((DIRECTORY + "/").length())); overwrites.put(overwriteId, result.result().orElseThrow().getFirst()); } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java b/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java index dec62952e..69d770866 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java @@ -26,7 +26,7 @@ public class ClientSpottingIconMethods { public static boolean hasTexture(ResourceLocation resourceLocation) { - return Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation(resourceLocation.getNamespace(), resourceLocation.getPath())).isPresent(); + return Minecraft.getInstance().getResourceManager().getResource(ResourceLocation.fromNamespaceAndPath(resourceLocation.getNamespace(), resourceLocation.getPath())).isPresent(); } } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java index be17de4bd..18fe26464 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java @@ -32,8 +32,8 @@ public record SpottingIconPacket( ResourceLocation restrictionID ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("spotting_icon_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("spotting_icon_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(SpottingIconPacket::write, SpottingIconPacket::new); diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java index 877e36ad3..5b625b1ae 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java @@ -28,8 +28,8 @@ public record SpottingIconRemovePacket( int entityId ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("spotting_icon_remove_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("spotting_icon_remove_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT .map(SpottingIconRemovePacket::new, SpottingIconRemovePacket::entityId) diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java index 292e71846..778b72b8f 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java @@ -71,12 +71,11 @@ public abstract class EntityRendererMixin implements EntityRen @Unique private static void frozenLib$vertex(@NotNull VertexConsumer vertexConsumer, PoseStack.Pose pose, int i, float f, int j, int u, int v, int alpha) { - vertexConsumer.vertex(pose, f - 0.5F, (float)j - 0.5F, 0.0F) - .color(255, 255, 255, alpha) - .uv((float)u, (float)v) - .overlayCoords(OverlayTexture.NO_OVERLAY) - .uv2(i) - .normal(pose, 0.0F, 1.0F, 0.0F) - .endVertex(); + vertexConsumer.addVertex(pose, f - 0.5F, (float)j - 0.5F, 0.0F) + .setColor(255, 255, 255, alpha) + .setUv((float)u, (float)v) + .setOverlay(OverlayTexture.NO_OVERLAY) + .setLight(i) + .setNormal(pose, 0.0F, 1.0F, 0.0F); } } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java index 69435d19b..8c3cd3fa2 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java @@ -21,6 +21,7 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.frozenblock.lib.spotting_icons.impl.EntityRenderDispatcherWithIcon; import net.minecraft.client.Camera; +import net.minecraft.client.DeltaTracker; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; @@ -55,7 +56,7 @@ public class LevelRendererMixin { private ClientLevel level; @Inject(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/renderer/RenderBuffers;bufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;", shift = At.Shift.AFTER)) - public void renderLevel(float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, Matrix4f matrix2, CallbackInfo info, @Local PoseStack poseStack) { + public void renderLevel(DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f projectionMatrix, Matrix4f matrix4f, CallbackInfo ci, @Local(ordinal = 0) float deltaTime, @Local PoseStack poseStack) { if (this.level != null) { MultiBufferSource.BufferSource bufferSource = this.renderBuffers.bufferSource(); for (Entity entity : this.level.entitiesForRendering()) { @@ -68,7 +69,7 @@ public void renderLevel(float partialTick, long finishNanoTime, boolean renderBl entity.yOld = entity.getY(); entity.zOld = entity.getZ(); } - this.renderEntityIcon(entity, d, e, f, partialTick, poseStack, bufferSource); + this.renderEntityIcon(entity, d, e, f, deltaTime, poseStack, bufferSource); } } } diff --git a/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java b/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java index 9b1141c47..8788a167d 100644 --- a/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java +++ b/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java @@ -48,9 +48,9 @@ public static void render(Triangle[] triangles, Matrix4f matrix4f, MultiBufferSo for (RenderType renderType : DYNAMIC_LIGHT) { VertexConsumer vertexConsumer = multiBufferSource.getBuffer(renderType); for (Triangle triangle : triangles) { - vertexConsumer.vertex(matrix4f, triangle.p0.x, triangle.p0.y, triangle.p0.z).color(j, k, l, m).endVertex(); - vertexConsumer.vertex(matrix4f, triangle.p2.x, triangle.p2.y, triangle.p2.z).color(j, k, l, m).endVertex(); - vertexConsumer.vertex(matrix4f, triangle.p1.x, triangle.p1.y, triangle.p1.z).color(j, k, l, m).endVertex(); + vertexConsumer.addVertex(matrix4f, triangle.p0.x, triangle.p0.y, triangle.p0.z).setColor(j, k, l, m); + vertexConsumer.addVertex(matrix4f, triangle.p2.x, triangle.p2.y, triangle.p2.z).setColor(j, k, l, m); + vertexConsumer.addVertex(matrix4f, triangle.p1.x, triangle.p1.y, triangle.p1.z).setColor(j, k, l, m); } } } diff --git a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java index 4103657fa..1c5310eca 100644 --- a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java +++ b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java @@ -35,8 +35,8 @@ public record WindDisturbancePacket( long posOrID ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("wind_disturbance_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("wind_disturbance_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(WindDisturbancePacket::write, WindDisturbancePacket::new); diff --git a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java index 405405d0a..523436c57 100644 --- a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java +++ b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java @@ -31,8 +31,8 @@ public record WindSyncPacket( Vec3 commandWind ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType( - FrozenSharedConstants.string("wind_sync_packet") + public static final Type PACKET_TYPE = new Type<>( + FrozenSharedConstants.id("wind_sync_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(WindSyncPacket::write, WindSyncPacket::create); diff --git a/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java b/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java index 02dc78e0b..cbfc02003 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java +++ b/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java @@ -42,7 +42,7 @@ public abstract class FrozenBiome { private static final List BIOMES = new ArrayList<>(); - private final ResourceKey key = ResourceKey.create(Registries.BIOME, new ResourceLocation(this.modID(), this.biomeID())); + private final ResourceKey key = ResourceKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(this.modID(), this.biomeID())); protected FrozenBiome() { BIOMES.add(this); diff --git a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java index d05f4e7bb..0546a58ef 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java +++ b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java @@ -39,7 +39,7 @@ private FrozenConfiguredFeatureUtils() { } public static ResourceKey> createKey(String namespace, String path) { - return ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(namespace, path)); + return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation.fromNamespaceAndPath(namespace, path)); } public static Holder> register(DynamicRegistryManagerSetupContext context, DynamicRegistryManagerSetupContext.RegistryMap registries, String namespace, String id, Feature feature) { @@ -49,7 +49,7 @@ private FrozenConfiguredFeatureUtils() { public static , C extends ConfiguredFeature> Holder.Reference register(DynamicRegistryManagerSetupContext context, DynamicRegistryManagerSetupContext.RegistryMap registries, @NotNull String namespace, @NotNull String id, F feature, @NotNull FC config) { var configuredRegistry = registries.get(Registries.CONFIGURED_FEATURE); final ConfiguredFeature configuredFeature = new ConfiguredFeature<>(feature, config); - Registry.register(configuredRegistry, new ResourceLocation(namespace, id), configuredFeature); + Registry.register(configuredRegistry, ResourceLocation.fromNamespaceAndPath(namespace, id), configuredFeature); var featureEntry = getExact(registries, configuredFeature); return (Holder.Reference) featureEntry; } diff --git a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java index 4f028fbf5..ba85253b6 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java +++ b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java @@ -36,7 +36,7 @@ private FrozenPlacementUtils() { } public static ResourceKey createKey(String namespace, String path) { - return ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation(namespace, path)); + return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.fromNamespaceAndPath(namespace, path)); } public static Holder register( diff --git a/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java b/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java index aaa6ed09b..ff8b2a4e6 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java +++ b/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java @@ -23,6 +23,7 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; +import net.minecraft.world.level.levelgen.structure.templatesystem.LiquidSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import org.spongepowered.asm.mixin.Final; @@ -32,6 +33,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import java.util.Optional; @Mixin(SinglePoolElement.class) public class SinglePoolElementMixin { @@ -41,8 +43,9 @@ public class SinglePoolElementMixin { @Mutable protected Either template; - @Inject(method = "(Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;)V", at = @At("TAIL")) - public void replaceStructure(Either template, Holder processors, StructureTemplatePool.Projection projection, CallbackInfo info) { + @SuppressWarnings("OptionalUsedAsFieldOrParameterType") + @Inject(method = "", at = @At("TAIL")) + public void replaceStructure(Either template, Holder processors, StructureTemplatePool.Projection projection, Optional overrideLiquidSettings, CallbackInfo info) { if (template.left().isPresent()) { ResourceLocation id = template.left().get(); if (StructurePoolElementIdReplacements.RESOURCE_LOCATION_REPLACEMENTS.containsKey(id)) { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java index c1b9f4a9b..dbd8a8ae8 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java @@ -95,6 +95,12 @@ public Lifecycle registryLifecycle() { return this.wrapped.registryLifecycle(); } + @Override + @NotNull + public Optional> getAny() { + return this.wrapped.getAny(); + } + @Override @NotNull public Set keySet() { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java index 96da51a9b..30891afa2 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java @@ -42,7 +42,7 @@ public final class ClientPackets { * */ public record Handshake(int version) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/handshake_client")); + public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/handshake_client")); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(Handshake::new, Handshake::version).cast(); @Override @@ -67,7 +67,7 @@ public Type type() { * */ public record ModProtocol(Object2IntOpenHashMap protocols) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/mod_protocol")); + public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/mod_protocol")); public static final StreamCodec CODEC = StreamCodec.ofMember(ModProtocol::write, ModProtocol::new); public ModProtocol(FriendlyByteBuf buf) { @@ -105,7 +105,7 @@ public Type type() { * Ends registry sync. No data */ public record End() implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/end")); + public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/end")); public static final StreamCodec CODEC = StreamCodec.ofMember(End::write, End::new); public End(FriendlyByteBuf buf) { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java index 6a359ed85..7f873b48d 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java @@ -26,6 +26,7 @@ import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; +import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.quiltmc.qsl.frozenblock.core.registry.api.sync.ModProtocolDef; @@ -45,7 +46,7 @@ public final class ServerPackets { * */ public record Handshake(IntList supportedVersions) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/handshake")); + public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/handshake")); public static final StreamCodec CODEC = StreamCodec.ofMember(Handshake::write, Handshake::new); public Handshake(@NotNull FriendlyByteBuf buf) { @@ -66,7 +67,7 @@ public Type type() { * Ends registry sync. No data */ public record End() implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/end")); + public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/end")); public static final StreamCodec CODEC = StreamCodec.ofMember(End::write, End::new); public End(FriendlyByteBuf buf) { @@ -97,7 +98,7 @@ public Type type() { * */ public record ErrorStyle(Component errorHeader, Component errorFooter, boolean showError) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/error_style")); + public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/error_style")); public static final StreamCodec CODEC = StreamCodec.ofMember(ErrorStyle::write, ErrorStyle::new); public ErrorStyle(@NotNull FriendlyByteBuf buf) { @@ -134,7 +135,7 @@ public Type type() { * */ public record ModProtocol(String prioritizedId, Collection protocols) implements CustomPacketPayload { - public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/mod_protocol")); + public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/mod_protocol")); public static final StreamCodec CODEC = StreamCodec.ofMember(ModProtocol::write, ModProtocol::new); public ModProtocol(@NotNull FriendlyByteBuf buf) { @@ -153,7 +154,7 @@ public Type type() { } } - private static String id(String path) { - return FrozenSharedConstants.string(path); + private static ResourceLocation id(String path) { + return FrozenSharedConstants.id(path); } } diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java index b4f4fdda1..57af09b40 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java @@ -24,6 +24,7 @@ import java.util.Set; import java.util.concurrent.Executor; import java.util.function.Supplier; +import net.minecraft.Util; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -57,14 +58,18 @@ public int getDataVersion() { /** * Builds the final {@code DataFixer}. *

- * This will build either an {@linkplain #buildUnoptimized() unoptimized fixer} or an - * {@linkplain #buildOptimized(Set, Executor) optimized fixer}, depending on the vanilla game's settings. + * This will build either an {@linkplain #build() unoptimized fixer} or an + * {@linkplain #build(Set, Supplier) optimized fixer}, depending on the vanilla game's settings. * * @param executorGetter the executor supplier, only invoked if the game is using optimized data fixers * @return the newly built data fixer */ @Contract(value = "_, _ -> new") public @NotNull DataFixer build(Set types, @NotNull Supplier executorGetter) { - return types.isEmpty() ? this.buildUnoptimized() : this.buildOptimized(types, executorGetter.get()); + return types.isEmpty() ? this.build().fixer() : Util.make(() -> { + var result = this.build(); + result.optimize(types, executorGetter.get()); + return result.fixer(); + }); } } diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java index ab5c061aa..8e88a4e30 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java @@ -32,6 +32,7 @@ import net.fabricmc.loader.api.ModContainer; import net.minecraft.SharedConstants; import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.datafix.DataFixTypes; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -187,7 +188,7 @@ public static DataFixer buildFixer(@NotNull QuiltDataFixerBuilder dataFixerBuild new ThreadFactoryBuilder().setNameFormat("FrozenLib Quilt Datafixer Bootstrap").setDaemon(true).setPriority(1).build() ); - return dataFixerBuilder.build(SharedConstants.DATA_FIX_TYPES_TO_OPTIMIZE, executor); + return dataFixerBuilder.build(DataFixTypes.TYPES_FOR_LEVEL_LIST, executor); } /** diff --git a/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt b/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt index eca7a1635..f6c64c432 100644 --- a/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt +++ b/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt @@ -22,9 +22,9 @@ import java.net.URI fun String.uri(): URI = URI.create(this) -fun vanillaId(path: String): ResourceLocation = ResourceLocation(path) +fun vanillaId(path: String): ResourceLocation = ResourceLocation.withDefaultNamespace(path) val String.asResourceLocation: ResourceLocation get() { - return ResourceLocation(this) + return ResourceLocation.parse(this) } diff --git a/src/main/resources/frozenlib.accesswidener b/src/main/resources/frozenlib.accesswidener index ed549df33..db319430f 100644 --- a/src/main/resources/frozenlib.accesswidener +++ b/src/main/resources/frozenlib.accesswidener @@ -67,7 +67,7 @@ transitive-accessible method net/minecraft/client/renderer/item/ItemProper # Structures transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece getWorldPos (III)Lnet/minecraft/core/BlockPos$MutableBlockPos; -transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement (Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;)V +transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/LegacySinglePoolElement (Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;Ljava/util/Optional;)V transitive-accessible method net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece updateAverageGroundHeight (Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/world/level/levelgen/structure/BoundingBox;I)Z transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece generateBox (Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/levelgen/structure/BoundingBox;IIIIIILnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Z)V transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece placeBlock (Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/block/state/BlockState;IIILnet/minecraft/world/level/levelgen/structure/BoundingBox;)V @@ -144,7 +144,6 @@ transitive-accessible method net/minecraft/client/renderer/RenderType c transitive-accessible field net/minecraft/client/renderer/RenderStateShard POSITION_COLOR_SHADER Lnet/minecraft/client/renderer/RenderStateShard$ShaderStateShard; # Biomes -transitive-accessible class net/minecraft/world/level/chunk/status/ChunkStatus$GenerationTask transitive-accessible method net/minecraft/data/worldgen/biome/OverworldBiomes calculateSkyColor (F)I transitive-accessible method net/minecraft/world/level/levelgen/feature/stateproviders/SimpleStateProvider (Lnet/minecraft/world/level/block/state/BlockState;)V transitive-accessible method net/minecraft/world/level/biome/OverworldBiomeBuilder addBiomes (Ljava/util/function/Consumer;)V diff --git a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java index 3fe39754e..de3c46838 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java @@ -35,8 +35,8 @@ public final class FrozenTestClient implements ClientModInitializer { @Override public void onInitializeClient() { FlyBySoundHub.AUTO_ENTITIES_AND_SOUNDS.put(EntityType.ARROW, new FlyBySoundHub.FlyBySound(1.0F, 1.0F, SoundSource.NEUTRAL, SoundEvents.AXE_SCRAPE)); - SplashTextAPI.addSplashLocation(new ResourceLocation(FrozenSharedConstants.MOD_ID, "texts/splashes.txt")); - Panoramas.addPanorama(new ResourceLocation(FrozenSharedConstants.MOD_ID, "textures/gui/title/background/panorama")); - Panoramas.addPanorama(new ResourceLocation("this_will_throw_an_error", "textures/gui/title/background/panorama")); + SplashTextAPI.addSplashLocation(ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, "texts/splashes.txt")); + Panoramas.addPanorama(ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, "textures/gui/title/background/panorama")); + Panoramas.addPanorama(ResourceLocation.fromNamespaceAndPath("this_will_throw_an_error", "textures/gui/title/background/panorama")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java index 1a6d2037e..402df459f 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java @@ -117,6 +117,6 @@ private static void applyDataFixes(ModContainer mod) { } public static ResourceLocation id(String path) { - return new ResourceLocation(MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt b/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt index badddc8db..0f8d2ecaa 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt +++ b/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt @@ -73,14 +73,14 @@ data class TestConfig( @JvmField @Comment("This is a sound event typed entry.") - var randomSound: TypedEntry> = TypedEntry( + var randomSound: TypedEntry> = TypedEntry.create( SOUND_HOLDER_TYPE, SoundEvents.BREEZE_WIND_CHARGE_BURST ), @JvmField @Comment("This is a Vec3 list typed entry.") - var typedVecList: TypedEntry> = TypedEntry( + var typedVecList: TypedEntry> = TypedEntry.create( VEC_LIST_TYPE, listOf( Vec3(0.0, 0.0, 0.0), @@ -114,7 +114,7 @@ data class TestConfig( XjsConfig( FrozenTestMain.MOD_ID, TestConfig::class.java, - XjsFormat.XJS_FORMATTED + XjsFormat.DJS_FORMATTED ) ) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java b/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java index c2e211184..55ee0f660 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java @@ -40,7 +40,7 @@ public static void setupEntries(ConfigCategory category, ConfigEntryBuilder entr var config = TestConfig.get(true); var defaultConfig = TestConfig.INSTANCE.defaultInstance(); var subMenu = config.subMenu; - category.setBackground(new ResourceLocation("textures/block/packed_mud.png")); + category.setBackground(ResourceLocation.withDefaultNamespace("textures/block/packed_mud.png")); var test = category.addEntry(entryBuilder.startBooleanToggle(text("test_toggle"), config.testToggle) .setDefaultValue(defaultConfig.testToggle) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java b/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java index 9028e60a3..9f941d787 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java @@ -125,7 +125,7 @@ public TestAdvancementLootTableProvider(FabricDataOutput output, CompletableFutu } @Override - public void generate(@NotNull HolderLookup.Provider provider, BiConsumer, LootTable.Builder> output) { + public void generate(BiConsumer, LootTable.Builder> output) { output.accept( ResourceKey.create(Registries.LOOT_TABLE, FrozenTestMain.id("test_loottable")), LootTable.lootTable() diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java index 99cb61edf..57764510f 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java @@ -18,6 +18,7 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; +import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.world.entity.EntityType; @@ -34,7 +35,7 @@ public class CreeperMixin { @Inject(method = "", at = @At(value = "TAIL")) public void initWithIcon(EntityType entityType, Level level, CallbackInfo info) { Creeper creeper = Creeper.class.cast(this); - ((EntitySpottingIconInterface) creeper).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/creeper.png"), 16, 20, FrozenMain.resourceLocation("default")); + ((EntitySpottingIconInterface) creeper).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/creeper.png"), 16, 20, FrozenSharedConstants.id("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java index ccdef8be9..34d0063b9 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java @@ -18,6 +18,7 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; +import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.world.entity.EntityType; @@ -34,6 +35,6 @@ public class PhantomMixin { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(EntityType entityType, Level level, CallbackInfo ci) { Phantom phantom = Phantom.class.cast(this); - ((EntitySpottingIconInterface) phantom).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/phantom.png"), 16, 20, FrozenMain.resourceLocation("default")); + ((EntitySpottingIconInterface) phantom).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/phantom.png"), 16, 20, FrozenSharedConstants.id("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java index 4124818d8..0aab7a691 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java @@ -19,6 +19,7 @@ import com.mojang.authlib.GameProfile; import net.frozenblock.lib.FrozenMain; +import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.core.BlockPos; @@ -36,6 +37,6 @@ public class PlayerMixin { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(Level level, BlockPos pos, float yRot, GameProfile gameProfile, CallbackInfo ci) { Player player = Player.class.cast(this); - ((EntitySpottingIconInterface) player).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/player.png"), 0, 1, FrozenMain.resourceLocation("default")); + ((EntitySpottingIconInterface) player).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/player.png"), 0, 1, FrozenSharedConstants.id("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java index 4dbbe4a9c..23e615106 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java @@ -18,6 +18,7 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; +import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.screenshake.api.ScreenShakeManager; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; @@ -42,7 +43,7 @@ private WardenMixin(EntityType entityType, Level level) { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(EntityType entityType, Level level, CallbackInfo ci) { Warden warden = Warden.class.cast(this); - ((EntitySpottingIconInterface) warden).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/warden.png"), 8, 12, FrozenMain.resourceLocation("default")); + ((EntitySpottingIconInterface) warden).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/warden.png"), 8, 12, FrozenSharedConstants.id("default")); } @Inject(method = "doHurtTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/warden/Warden;playSound(Lnet/minecraft/sounds/SoundEvent;FF)V")) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java b/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java index 7bcac17c8..75db82d99 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java @@ -83,7 +83,7 @@ public void addEndSurfaceRules(List context) { @Override public void addGenericSurfaceRules(List context) { context.add(new FrozenDimensionBoundRuleSource( - new ResourceLocation("overworld"), + ResourceLocation.withDefaultNamespace("overworld"), SurfaceRules.sequence( SurfaceRules.ifTrue( SurfaceRules.isBiome(Biomes.BIRCH_FOREST), @@ -92,7 +92,7 @@ public void addGenericSurfaceRules(List context) ) )); context.add(new FrozenDimensionBoundRuleSource( - new ResourceLocation("the_nether"), + ResourceLocation.withDefaultNamespace("the_nether"), SurfaceRules.sequence( SurfaceRules.ifTrue( SurfaceRules.isBiome(Biomes.WARPED_FOREST), diff --git a/src/testmod/resources/fabric.mod.json b/src/testmod/resources/fabric.mod.json index 3aeed3838..d13793bd6 100644 --- a/src/testmod/resources/fabric.mod.json +++ b/src/testmod/resources/fabric.mod.json @@ -31,7 +31,7 @@ "depends": { "fabricloader": ">=0.14.22", "fabric-api": ">=0.90.0", - "minecraft": "~1.20.2-", + "minecraft": "~1.21-", "java": ">=21" }, "breaks": { From 2e6d9da175a6fcfa98de6ba930571317543ac86f Mon Sep 17 00:00:00 2001 From: Treetrain1 Date: Sun, 9 Jun 2024 09:45:10 -0500 Subject: [PATCH 02/15] Fix access widener --- src/main/resources/frozenlib.accesswidener | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/frozenlib.accesswidener b/src/main/resources/frozenlib.accesswidener index db319430f..df65e7281 100644 --- a/src/main/resources/frozenlib.accesswidener +++ b/src/main/resources/frozenlib.accesswidener @@ -67,7 +67,7 @@ transitive-accessible method net/minecraft/client/renderer/item/ItemProper # Structures transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece getWorldPos (III)Lnet/minecraft/core/BlockPos$MutableBlockPos; -transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/LegacySinglePoolElement (Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;Ljava/util/Optional;)V +transitive-accessible method net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement (Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;Ljava/util/Optional;)V transitive-accessible method net/minecraft/world/level/levelgen/structure/ScatteredFeaturePiece updateAverageGroundHeight (Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/world/level/levelgen/structure/BoundingBox;I)Z transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece generateBox (Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/levelgen/structure/BoundingBox;IIIIIILnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/block/state/BlockState;Z)V transitive-accessible method net/minecraft/world/level/levelgen/structure/StructurePiece placeBlock (Lnet/minecraft/world/level/WorldGenLevel;Lnet/minecraft/world/level/block/state/BlockState;IIILnet/minecraft/world/level/levelgen/structure/BoundingBox;)V From da95f2388557afe0d58e802a52f6dbe614a3260c Mon Sep 17 00:00:00 2001 From: Treetrain1 Date: Mon, 10 Jun 2024 17:50:09 -0500 Subject: [PATCH 03/15] Single handedly port the entire mod to 1.21 RC1 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 976556387..b14083232 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ # Fabric Properties # Get new versions at https://fabricmc.net/develop and https://lambdaurora.dev/tools/import_quilt.html - minecraft_version=1.21-pre4 + minecraft_version=1.21-rc1 quilt_mappings=1.21-pre4+build.1 parchment_mappings=1.20.6:2024.06.02 loader_version=0.15.11 From 8efc053a287e4b46d08ef03aaee85f25b62e306a Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 10 Jun 2024 21:49:22 -0400 Subject: [PATCH 04/15] Update build.gradle.kts --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index c3b2941f9..a0cfb9db4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -253,7 +253,7 @@ dependencies { modApi("com.terraformersmc:modmenu:${modmenu_version}") // Cloth Config - modApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") { + modCompileOnlyApi("me.shedaniel.cloth:cloth-config-fabric:${cloth_config_version}") { exclude(group = "net.fabricmc.fabric-api") exclude(group = "com.terraformersmc") } From 9c863aa9361533ace34c1a194b2e5b1fd23c8991 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Thu, 13 Jun 2024 12:54:06 -0400 Subject: [PATCH 05/15] Update gradle.properties --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 4589b8c8c..a00edf871 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,7 +12,7 @@ # Fabric Properties # Get new versions at https://fabricmc.net/develop and https://lambdaurora.dev/tools/import_quilt.html - minecraft_version=1.21-rc1 + minecraft_version=1.21 quilt_mappings=1.21-pre4+build.1 parchment_mappings=1.20.6:2024.06.02 loader_version=0.15.11 From 86a9e9b985d3c998cbadb6effd3b389d627efc7e Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:10:11 -0400 Subject: [PATCH 06/15] optimized getting --- CHANGELOG.md | 2 +- build.gradle.kts | 2 +- gradle.properties | 2 +- .../config/frozenlib_config/FrozenLibConfig.java | 16 +++++++++++++++- .../lib/wind/api/ClientWindManager.java | 4 ++-- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ea39c0546..94bf70e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,4 +5,4 @@ Make sure to clear this after each release Put changelog here: ----------------- -- Configs now save after the game loads to ensure they're loaded properly. +- Optimized getting of `useWindOnNonFrozenServers` diff --git a/build.gradle.kts b/build.gradle.kts index a0cfb9db4..487e166b2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ buildscript { } plugins { - id("fabric-loom") version("1.6.+") + id("fabric-loom") version("+") id("org.ajoberstar.grgit") version("+") id("org.quiltmc.gradle.licenser") version("+") id("com.modrinth.minotaur") version("+") diff --git a/gradle.properties b/gradle.properties index a00edf871..b25a79a9c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ min_loader_version=0.15.11 # Mod Properties - mod_version = 1.7.3 + mod_version = 1.7.4 mod_loader = Fabric maven_group = net.frozenblock archives_base_name = FrozenLib diff --git a/src/main/java/net/frozenblock/lib/config/frozenlib_config/FrozenLibConfig.java b/src/main/java/net/frozenblock/lib/config/frozenlib_config/FrozenLibConfig.java index 6cab5a82c..da4bc3adb 100644 --- a/src/main/java/net/frozenblock/lib/config/frozenlib_config/FrozenLibConfig.java +++ b/src/main/java/net/frozenblock/lib/config/frozenlib_config/FrozenLibConfig.java @@ -40,9 +40,23 @@ public class FrozenLibConfig { true, QuiltDataFixes.buildFixer(new QuiltDataFixerBuilder(0)), 0 - ) + ) { + @Override + public void onSave() throws Exception { + super.onSave(); + this.onSync(null); + } + + @Override + public void onSync(FrozenLibConfig syncInstance) { + var config = this.config(); + USE_WIND_ON_NON_FROZEN_SERVERS = config.useWindOnNonFrozenServers; + } + } ); + public static volatile boolean USE_WIND_ON_NON_FROZEN_SERVERS = true; + @Comment("Mods may override any of these options, but the config file will not change.") @EntrySyncData(value = "useWindOnNonFrozenServers", behavior = SyncBehavior.UNSYNCABLE) diff --git a/src/main/java/net/frozenblock/lib/wind/api/ClientWindManager.java b/src/main/java/net/frozenblock/lib/wind/api/ClientWindManager.java index 13d9e538a..825982c57 100644 --- a/src/main/java/net/frozenblock/lib/wind/api/ClientWindManager.java +++ b/src/main/java/net/frozenblock/lib/wind/api/ClientWindManager.java @@ -128,7 +128,7 @@ public static double getWindZ(float partialTick) { } public static boolean shouldUseWind() { - return hasInitialized || FrozenLibConfig.get().useWindOnNonFrozenServers; + return hasInitialized || FrozenLibConfig.USE_WIND_ON_NON_FROZEN_SERVERS; } public static void tick(@NotNull ClientLevel level) { @@ -163,7 +163,7 @@ public static void tick(@NotNull ClientLevel level) { extension.clientTick(); } - if (!hasInitialized && time > 80D && FrozenLibConfig.get().useWindOnNonFrozenServers) { + if (!hasInitialized && time > 80D && FrozenLibConfig.USE_WIND_ON_NON_FROZEN_SERVERS) { RandomSource randomSource = AdvancedMath.random(); setSeed(randomSource.nextLong()); time = randomSource.nextLong(); From 889890573ddcd6a68b08454e33457979ea4a81ce Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Wed, 19 Jun 2024 12:14:02 -0400 Subject: [PATCH 07/15] Update build.gradle.kts --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 487e166b2..a0cfb9db4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,7 +21,7 @@ buildscript { } plugins { - id("fabric-loom") version("+") + id("fabric-loom") version("1.6.+") id("org.ajoberstar.grgit") version("+") id("org.quiltmc.gradle.licenser") version("+") id("com.modrinth.minotaur") version("+") From 7e83aa513c3eca0245123de008036ddc89c04bd9 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Thu, 20 Jun 2024 14:02:19 -0400 Subject: [PATCH 08/15] Shadow Is Missing --- build.gradle.kts | 12 +++++++----- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a0cfb9db4..8d85239b9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,11 +21,11 @@ buildscript { } plugins { - id("fabric-loom") version("1.6.+") + id("fabric-loom") version("+") id("org.ajoberstar.grgit") version("+") id("org.quiltmc.gradle.licenser") version("+") id("com.modrinth.minotaur") version("+") - id("com.github.johnrengelman.shadow") version("+") + //id("com.github.johnrengelman.shadow") version("+") `maven-publish` eclipse idea @@ -235,7 +235,7 @@ dependencies { mappings(loom.layered { // please annoy treetrain if this doesn't work mappings("org.quiltmc:quilt-mappings:$quilt_mappings:intermediary-v2") - parchment("org.parchmentmc.data:parchment-$parchment_mappings@zip") + //parchment("org.parchmentmc.data:parchment-$parchment_mappings@zip") officialMojangMappings { nameSyntheticMembers = false } @@ -308,6 +308,7 @@ tasks { useJUnitPlatform() } + /* shadowJar { configurations = listOf(relocModApi) isEnableRelocation = true @@ -320,6 +321,7 @@ tasks { //relocate("blue.endless.jankson", "net.frozenblock.lib.config.api.jankson") } + */ register("javadocJar", Jar::class) { dependsOn(javadoc) @@ -334,8 +336,8 @@ tasks { } remapJar { - dependsOn(shadowJar) - input = shadowJar.get().archiveFile + //dependsOn(shadowJar) + //input = shadowJar.get().archiveFile } withType(JavaCompile::class) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b82aa23a4..a4413138c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From b5ec3bbc7dd814f6be0e86a99324a9e133e169e3 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:46:43 -0400 Subject: [PATCH 09/15] BlockEntity item rendering registry --- CHANGELOG.md | 1 + ...ockEntityWithoutLevelRendererRegistry.java | 39 ++++++++++ .../BlockEntityWithoutLevelRendererMixin.java | 78 +++++++++++++++++++ .../mixin/frozenlib.block.mixins.json | 5 +- 4 files changed, 122 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java create mode 100644 src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java diff --git a/CHANGELOG.md b/CHANGELOG.md index 94bf70e57..f7a58316a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,3 +6,4 @@ Put changelog here: ----------------- - Optimized getting of `useWindOnNonFrozenServers` +- Added the `BlockEntityWithoutLevelRendererRegistry` to make rendering of items using Block Entities easier. diff --git a/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java b/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java new file mode 100644 index 000000000..4a3669aec --- /dev/null +++ b/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2024 FrozenBlock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.frozenblock.lib.block.api.entity; + +import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; +import org.jetbrains.annotations.NotNull; +import java.util.Optional; + +public class BlockEntityWithoutLevelRendererRegistry { + private static final Object2ObjectLinkedOpenHashMap BLOCK_TO_BLOCK_ENTITY_MAP = new Object2ObjectLinkedOpenHashMap<>(); + + public static void register(Block block, @NotNull BlockEntityType blockEntityType) { + BLOCK_TO_BLOCK_ENTITY_MAP.put(block, blockEntityType.create(BlockPos.ZERO, block.defaultBlockState())); + } + + public static Optional getBlockEntity(Block block) { + return Optional.ofNullable(BLOCK_TO_BLOCK_ENTITY_MAP.get(block)); + } + +} diff --git a/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java new file mode 100644 index 000000000..4889e72ea --- /dev/null +++ b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2024 FrozenBlock + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.frozenblock.lib.block.mixin.entity.client; + +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; +import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Share; +import com.llamalad7.mixinextras.sugar.ref.LocalRef; +import com.mojang.blaze3d.vertex.PoseStack; +import net.frozenblock.lib.block.api.entity.BlockEntityWithoutLevelRendererRegistry; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Slice; +import java.util.Optional; + +@Mixin(BlockEntityWithoutLevelRenderer.class) +public class BlockEntityWithoutLevelRendererMixin { + + @WrapOperation( + method = "renderByItem", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/world/level/block/state/BlockState;is(Lnet/minecraft/world/level/block/Block;)Z", + ordinal = 0 + ), + slice = @Slice( + from = @At( + value = "FIELD", + target = "Lnet/minecraft/world/level/block/Blocks;CONDUIT:Lnet/minecraft/world/level/block/Block;" + ) + ) + ) + public boolean trailierTales$selectCoffin( + BlockState instance, Block block, Operation original, + @Share("frozenLib$blockEntity") LocalRef> customBlockEntity + ) { + customBlockEntity.set(BlockEntityWithoutLevelRendererRegistry.getBlockEntity(block)); + return original.call(instance, block) || customBlockEntity.get().isPresent(); + } + + @WrapOperation( + method = "renderByItem", + at = @At( + value = "INVOKE", + target = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;renderItem(Lnet/minecraft/world/level/block/entity/BlockEntity;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;II)Z", + ordinal = 0 + ) + ) + public boolean trailierTales$replaceWithCoffin( + BlockEntityRenderDispatcher instance, BlockEntity blockEntity, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay, Operation original, + @Share("frozenLib$blockEntity") LocalRef> customBlockEntity + ) { + blockEntity = customBlockEntity.get().orElse(blockEntity); + return original.call(instance, blockEntity, poseStack, bufferSource, packedLight, packedOverlay); + } + +} diff --git a/src/main/resources/mixin/frozenlib.block.mixins.json b/src/main/resources/mixin/frozenlib.block.mixins.json index 06114e16c..9bb73db87 100644 --- a/src/main/resources/mixin/frozenlib.block.mixins.json +++ b/src/main/resources/mixin/frozenlib.block.mixins.json @@ -4,10 +4,13 @@ "package": "net.frozenblock.lib.block.mixin", "compatibilityLevel": "JAVA_21", "injectors": { - "defaultRequire": 1 + "defaultRequire": 1 }, "mixins": [ "dripstone.PointedDripstoneBlockMixin", "tick.BlockBehaviourMixin" + ], + "client": [ + "entity.client.BlockEntityWithoutLevelRendererMixin" ] } From 49fd42afe8405ae0cdb1b941eac794b1e6354622 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Thu, 20 Jun 2024 21:50:21 -0400 Subject: [PATCH 10/15] Update BlockEntityWithoutLevelRendererMixin.java --- .../entity/client/BlockEntityWithoutLevelRendererMixin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java index 4889e72ea..693cfbaa1 100644 --- a/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java @@ -55,7 +55,7 @@ public class BlockEntityWithoutLevelRendererMixin { BlockState instance, Block block, Operation original, @Share("frozenLib$blockEntity") LocalRef> customBlockEntity ) { - customBlockEntity.set(BlockEntityWithoutLevelRendererRegistry.getBlockEntity(block)); + customBlockEntity.set(BlockEntityWithoutLevelRendererRegistry.getBlockEntity(instance.getBlock())); return original.call(instance, block) || customBlockEntity.get().isPresent(); } From bce5230fed00d76d558f97e5e35c2c0c83490d9b Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 24 Jun 2024 13:16:14 -0400 Subject: [PATCH 11/15] Revert "Shadow Is Missing" This reverts commit 7e83aa513c3eca0245123de008036ddc89c04bd9. --- build.gradle.kts | 12 +++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8d85239b9..a0cfb9db4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,11 +21,11 @@ buildscript { } plugins { - id("fabric-loom") version("+") + id("fabric-loom") version("1.6.+") id("org.ajoberstar.grgit") version("+") id("org.quiltmc.gradle.licenser") version("+") id("com.modrinth.minotaur") version("+") - //id("com.github.johnrengelman.shadow") version("+") + id("com.github.johnrengelman.shadow") version("+") `maven-publish` eclipse idea @@ -235,7 +235,7 @@ dependencies { mappings(loom.layered { // please annoy treetrain if this doesn't work mappings("org.quiltmc:quilt-mappings:$quilt_mappings:intermediary-v2") - //parchment("org.parchmentmc.data:parchment-$parchment_mappings@zip") + parchment("org.parchmentmc.data:parchment-$parchment_mappings@zip") officialMojangMappings { nameSyntheticMembers = false } @@ -308,7 +308,6 @@ tasks { useJUnitPlatform() } - /* shadowJar { configurations = listOf(relocModApi) isEnableRelocation = true @@ -321,7 +320,6 @@ tasks { //relocate("blue.endless.jankson", "net.frozenblock.lib.config.api.jankson") } - */ register("javadocJar", Jar::class) { dependsOn(javadoc) @@ -336,8 +334,8 @@ tasks { } remapJar { - //dependsOn(shadowJar) - //input = shadowJar.get().archiveFile + dependsOn(shadowJar) + input = shadowJar.get().archiveFile } withType(JavaCompile::class) { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4413138c..b82aa23a4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From 9601498e2141874aecd1eeb2b91b68da7b20e81a Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 24 Jun 2024 14:18:02 -0400 Subject: [PATCH 12/15] fix new crash --- .../BlockEntityWithoutLevelRendererRegistry.java | 4 ++++ .../BlockEntityWithoutLevelRendererMixin.java | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java b/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java index 4a3669aec..388e94591 100644 --- a/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java +++ b/src/main/java/net/frozenblock/lib/block/api/entity/BlockEntityWithoutLevelRendererRegistry.java @@ -36,4 +36,8 @@ public static Optional getBlockEntity(Block block) { return Optional.ofNullable(BLOCK_TO_BLOCK_ENTITY_MAP.get(block)); } + public static boolean hasBlock(Block block) { + return BLOCK_TO_BLOCK_ENTITY_MAP.containsKey(block); + } + } diff --git a/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java index 693cfbaa1..230165091 100644 --- a/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/block/mixin/entity/client/BlockEntityWithoutLevelRendererMixin.java @@ -32,7 +32,6 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Slice; -import java.util.Optional; @Mixin(BlockEntityWithoutLevelRenderer.class) public class BlockEntityWithoutLevelRendererMixin { @@ -51,12 +50,13 @@ public class BlockEntityWithoutLevelRendererMixin { ) ) ) - public boolean trailierTales$selectCoffin( + public boolean frozenLib$selectBlockEntity( BlockState instance, Block block, Operation original, - @Share("frozenLib$blockEntity") LocalRef> customBlockEntity + @Share("frozenLib$block") LocalRef customBlock ) { - customBlockEntity.set(BlockEntityWithoutLevelRendererRegistry.getBlockEntity(instance.getBlock())); - return original.call(instance, block) || customBlockEntity.get().isPresent(); + Block usedBlock = instance.getBlock(); + customBlock.set(usedBlock); + return original.call(instance, block) || BlockEntityWithoutLevelRendererRegistry.hasBlock(usedBlock); } @WrapOperation( @@ -67,11 +67,11 @@ public class BlockEntityWithoutLevelRendererMixin { ordinal = 0 ) ) - public boolean trailierTales$replaceWithCoffin( + public boolean frozenLib$replaceWithNewBlockEntity( BlockEntityRenderDispatcher instance, BlockEntity blockEntity, PoseStack poseStack, MultiBufferSource bufferSource, int packedLight, int packedOverlay, Operation original, - @Share("frozenLib$blockEntity") LocalRef> customBlockEntity + @Share("frozenLib$block") LocalRef customBlock ) { - blockEntity = customBlockEntity.get().orElse(blockEntity); + blockEntity = BlockEntityWithoutLevelRendererRegistry.getBlockEntity(customBlock.get()).orElse(blockEntity); return original.call(instance, blockEntity, poseStack, bufferSource, packedLight, packedOverlay); } From c521b11b280f9f480c44f30efdb8ed2265d3b9e8 Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:19:28 -0400 Subject: [PATCH 13/15] Fix removable tags not working properly --- .../net/frozenblock/lib/item/mixin/ItemStackMixin.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/frozenblock/lib/item/mixin/ItemStackMixin.java b/src/main/java/net/frozenblock/lib/item/mixin/ItemStackMixin.java index 3bd33b220..931fd7235 100644 --- a/src/main/java/net/frozenblock/lib/item/mixin/ItemStackMixin.java +++ b/src/main/java/net/frozenblock/lib/item/mixin/ItemStackMixin.java @@ -46,9 +46,7 @@ public final class ItemStackMixin implements ItemStackExtension { // Removable Item Tags - CustomData data = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); - - data.update(compound -> { + CustomData.update(DataComponents.CUSTOM_DATA, stack, compound -> { for (String key : RemovableItemTags.keys()) { if (RemovableItemTags.canRemoveTag(key, level, entity, slot, selected)) { compound.remove(key); @@ -86,8 +84,7 @@ public final class ItemStackMixin implements ItemStackExtension { @Unique private static void frozenLib$fixEmptyTags(ItemStack stack) { - CustomData data = stack.getOrDefault(DataComponents.CUSTOM_DATA, CustomData.EMPTY); - data.update(compound -> { + CustomData.update(DataComponents.CUSTOM_DATA, stack, compound -> { for (String key : RemovableItemTags.keys()) { if (RemovableItemTags.shouldRemoveTagOnStackMerge(key)) { compound.remove(key); From fc40c3db6efb90c3aa5718e49b2cfd0ec026ca0f Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 24 Jun 2024 19:41:26 -0400 Subject: [PATCH 14/15] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7a58316a..08325f735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,3 +7,4 @@ Put changelog here: ----------------- - Optimized getting of `useWindOnNonFrozenServers` - Added the `BlockEntityWithoutLevelRendererRegistry` to make rendering of items using Block Entities easier. +- Fixed removable tags causing ItemStacks to remain unstackable after said tags have been removed. From a90223d3443f6875a5a2815f589ffed1ceb6ed3f Mon Sep 17 00:00:00 2001 From: AViewFromTheTop <87103914+AViewFromTheTop@users.noreply.github.com> Date: Mon, 24 Jun 2024 21:08:00 -0400 Subject: [PATCH 15/15] backport --- build.gradle.kts | 2 +- gradle.properties | 10 +-- .../net/frozenblock/lib/FrozenClient.java | 2 +- .../java/net/frozenblock/lib/FrozenMain.java | 12 ++++ .../lib/FrozenSharedConstants.java | 2 +- .../entity/BillboardBlockEntityRenderer.java | 2 +- .../config/impl/network/ConfigSyncPacket.java | 4 +- .../entrypoint/api/FrozenModInitializer.java | 2 +- .../gravity/impl/GravityRenderingImpl.java | 51 +++++++-------- .../ingamedevtools/item/LootTableWhacker.java | 2 +- .../lib/integration/api/ModIntegration.java | 2 +- .../lib/integration/api/ModIntegrations.java | 4 +- .../impl/network/CooldownChangePacket.java | 4 +- .../impl/network/CooldownTickCountPacket.java | 4 +- .../impl/network/ForcedCooldownPacket.java | 4 +- .../lib/item/mixin/ServerPlayerMixin.java | 5 +- .../liquid/render/api/LiquidRenderUtils.java | 62 +++++++++---------- .../lib/menu/mixin/ScreenMixin.java | 2 +- .../lib/recipe/api/FrozenRecipeProvider.java | 2 +- .../impl/network/EntityScreenShakePacket.java | 4 +- .../RemoveEntityScreenShakePacket.java | 4 +- .../impl/network/RemoveScreenShakePacket.java | 4 +- .../impl/network/ScreenShakePacket.java | 4 +- .../screenshake/mixin/ServerPlayerMixin.java | 5 +- .../mixin/client/GameRendererMixin.java | 6 +- .../FadingDistanceSwitchingSoundPacket.java | 4 +- .../api/networking/FlyBySoundPacket.java | 4 +- .../networking/LocalPlayerSoundPacket.java | 4 +- .../api/networking/LocalSoundPacket.java | 4 +- ...stanceSwitchingRestrictionSoundPacket.java | 4 +- .../MovingRestrictionSoundPacket.java | 4 +- ...rtingMovingRestrictionSoundLoopPacket.java | 2 +- .../BlockSoundGroupManager.java | 8 +-- .../api/ClientSpottingIconMethods.java | 2 +- .../impl/SpottingIconPacket.java | 4 +- .../impl/SpottingIconRemovePacket.java | 4 +- .../mixin/client/EntityRendererMixin.java | 13 ++-- .../mixin/client/LevelRendererMixin.java | 5 +- .../lib/stencil/api/StencilRenderer.java | 6 +- .../networking/WindDisturbancePacket.java | 4 +- .../wind/impl/networking/WindSyncPacket.java | 4 +- .../lib/worldgen/biome/api/FrozenBiome.java | 2 +- .../api/FrozenConfiguredFeatureUtils.java | 4 +- .../feature/api/FrozenPlacementUtils.java | 2 +- .../mixin/SinglePoolElementMixin.java | 7 +-- .../registry/impl/event/DelayedRegistry.java | 6 -- .../registry/impl/sync/ClientPackets.java | 6 +- .../registry/impl/sync/ServerPackets.java | 13 ++-- .../api/QuiltDataFixerBuilder.java | 11 +--- .../datafixerupper/api/QuiltDataFixes.java | 3 +- .../frozenblock/lib/core/api/StringUtil.kt | 4 +- .../lib/testmod/FrozenTestClient.java | 6 +- .../lib/testmod/FrozenTestMain.java | 2 +- .../lib/testmod/config/TestConfig.kt | 6 +- .../lib/testmod/config/gui/TestConfigGui.java | 2 +- .../testmod/datagen/FrozenLibTestDatagen.java | 2 +- .../lib/testmod/mixin/CreeperMixin.java | 3 +- .../lib/testmod/mixin/PhantomMixin.java | 3 +- .../lib/testmod/mixin/PlayerMixin.java | 3 +- .../lib/testmod/mixin/WardenMixin.java | 3 +- .../testmod/worldgen/TestSurfaceRules.java | 4 +- src/testmod/resources/fabric.mod.json | 2 +- 62 files changed, 182 insertions(+), 193 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a0cfb9db4..4de2384f7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -281,7 +281,7 @@ tasks { processResources { val properties = HashMap() properties["version"] = project.version - properties["minecraft_version"] = "~1.21-"//minecraft_version + properties["minecraft_version"] = minecraft_version properties["fabric_loader_version"] = ">=$min_loader_version" properties["fabric_api_version"] = ">=$fabric_api_version" diff --git a/gradle.properties b/gradle.properties index b25a79a9c..7071a5d3f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -12,11 +12,11 @@ # Fabric Properties # Get new versions at https://fabricmc.net/develop and https://lambdaurora.dev/tools/import_quilt.html - minecraft_version=1.21 - quilt_mappings=1.21-pre4+build.1 + minecraft_version=1.20.6 + quilt_mappings=1.20.5+build.1 parchment_mappings=1.20.6:2024.06.02 loader_version=0.15.11 - min_loader_version=0.15.11 + min_loader_version=0.15.10 # Mod Properties mod_version = 1.7.4 @@ -25,7 +25,7 @@ archives_base_name = FrozenLib # Dependencies - fabric_api_version=0.100.0+1.21 + fabric_api_version=0.100.0+1.20.6 fabric_kotlin_version=1.11.0+kotlin.2.0.0 toml4j_version=0.7.2 jankson_version=1.2.3 @@ -34,6 +34,6 @@ fresult_version=3.1 # External Mods - modmenu_version=11.0.0-beta.1 + modmenu_version=10.0.0-beta.1 cloth_config_version=14.0.126 terrablender_version=1.20.2-3.2.0.14 diff --git a/src/main/java/net/frozenblock/lib/FrozenClient.java b/src/main/java/net/frozenblock/lib/FrozenClient.java index 558be3161..e91bc3b5a 100644 --- a/src/main/java/net/frozenblock/lib/FrozenClient.java +++ b/src/main/java/net/frozenblock/lib/FrozenClient.java @@ -59,7 +59,7 @@ public void onInitializeClient() { particleRegistry.register(FrozenParticleTypes.DEBUG_POS, DebugPosParticle.Provider::new); - Panoramas.addPanorama(ResourceLocation.withDefaultNamespace("textures/gui/title/background/panorama")); + Panoramas.addPanorama(new ResourceLocation("textures/gui/title/background/panorama")); var resourceLoader = ResourceManagerHelper.get(PackType.CLIENT_RESOURCES); resourceLoader.registerReloadListener(BlockSoundGroupManager.INSTANCE); diff --git a/src/main/java/net/frozenblock/lib/FrozenMain.java b/src/main/java/net/frozenblock/lib/FrozenMain.java index ddd5d5e56..41bae6779 100644 --- a/src/main/java/net/frozenblock/lib/FrozenMain.java +++ b/src/main/java/net/frozenblock/lib/FrozenMain.java @@ -153,4 +153,16 @@ public void onInitialize(String modId, ModContainer container) { } }); } + + @Contract("_ -> new") + @Deprecated(forRemoval = true) + public static @NotNull ResourceLocation resourceLocation(String path) { + return new ResourceLocation(FrozenSharedConstants.MOD_ID, path); + } + + @Deprecated(forRemoval = true) + public static @NotNull String string(String path) { + return resourceLocation(path).toString(); + } + } diff --git a/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java b/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java index 1b5a19483..fe3e64467 100644 --- a/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java +++ b/src/main/java/net/frozenblock/lib/FrozenSharedConstants.java @@ -43,7 +43,7 @@ public final class FrozenSharedConstants { @Contract("_ -> new") @NotNull public static ResourceLocation id(String path) { - return ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, path); + return new ResourceLocation(FrozenSharedConstants.MOD_ID, path); } @NotNull diff --git a/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java b/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java index bcd414c83..f3269e324 100644 --- a/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java +++ b/src/main/java/net/frozenblock/lib/block/api/entity/BillboardBlockEntityRenderer.java @@ -63,7 +63,7 @@ public void render(@NotNull T entity, float tickDelta, @NotNull PoseStack poseSt poseStack.translate(0.5, 0, 0.5); poseStack.pushPose(); poseStack.mulPose(this.rotation); - this.base.render(poseStack, vertexConsumers.getBuffer(RenderType.entityCutout(this.getTexture(entity))), light, overlay); + this.base.render(poseStack, vertexConsumers.getBuffer(RenderType.entityCutout(this.getTexture(entity))), light, overlay, 1.0F, 1.0F, 1.0F, 1.0F); poseStack.popPose(); } diff --git a/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java b/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java index 2e30b6a36..e07f434ad 100644 --- a/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java +++ b/src/main/java/net/frozenblock/lib/config/impl/network/ConfigSyncPacket.java @@ -55,8 +55,8 @@ public record ConfigSyncPacket( public static final int PERMISSION_LEVEL = 2; - public static final Type> PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("config_sync_packet") + public static final Type> PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("config_sync_packet") ); public static final StreamCodec> CODEC = StreamCodec.ofMember(ConfigSyncPacket::write, ConfigSyncPacket::create); diff --git a/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java b/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java index 9760d61d2..5c0580fa4 100644 --- a/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java +++ b/src/main/java/net/frozenblock/lib/entrypoint/api/FrozenModInitializer.java @@ -49,7 +49,7 @@ public ModContainer container() { } public ResourceLocation id(String path) { - return ResourceLocation.fromNamespaceAndPath(this.modId, path); + return new ResourceLocation(this.modId, path); } public T register(Registry registry, String path, T value) { diff --git a/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java b/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java index ca783ec7d..8d48000ff 100644 --- a/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java +++ b/src/main/java/net/frozenblock/lib/gravity/impl/GravityRenderingImpl.java @@ -39,12 +39,13 @@ public final class GravityRenderingImpl { private GravityRenderingImpl() {} - private static final ResourceLocation FORCEFIELD_LOCATION = ResourceLocation.withDefaultNamespace("textures/misc/forcefield.png"); + private static final ResourceLocation FORCEFIELD_LOCATION = new ResourceLocation("textures/misc/forcefield.png"); public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStack poseStack) { // not working properly if (true) return; RenderSystem.defaultBlendFunc(); + BufferBuilder bufferBuilder = Tesselator.getInstance().getBuilder(); double y = camera.getPosition().y(); for (GravityBelt gravityBelt : GravityAPI.getAllBelts(level)) { poseStack.pushPose(); @@ -62,19 +63,19 @@ public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStac float k = 130; RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); - var firstBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - firstBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 0.0f); - firstBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 0.0f); - firstBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 1.0f); - firstBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 1.0f); - BufferUploader.drawWithShader(firstBuffer.build()); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 1.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 1.0f).endVertex(); + BufferUploader.drawWithShader(bufferBuilder.end()); - var secondBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - secondBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 0.0f); - secondBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 0.0f); - secondBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 1.0f); - secondBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 1.0f); - BufferUploader.drawWithShader(secondBuffer.build()); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 1.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 1.0f).endVertex(); + BufferUploader.drawWithShader(bufferBuilder.end()); poseStack.popPose(); } } @@ -92,19 +93,19 @@ public static void renderGravityBelts(ClientLevel level, Camera camera, PoseStac float k = 130; RenderSystem.setShader(GameRenderer::getPositionTexShader); RenderSystem.setShaderTexture(0, FORCEFIELD_LOCATION); - var firstBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - firstBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 0.0f); - firstBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 0.0f); - firstBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 1.0f); - firstBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 1.0f); - BufferUploader.drawWithShader(firstBuffer.build()); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 1.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 1.0f).endVertex(); + BufferUploader.drawWithShader(bufferBuilder.end()); - var secondBuffer = Tesselator.getInstance().begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - secondBuffer.addVertex(matrix4f3, -k, 0F, k).setUv(0.0f, 0.0f); - secondBuffer.addVertex(matrix4f3, k, 0F, k).setUv(1.0f, 0.0f); - secondBuffer.addVertex(matrix4f3, k, 0F, -k).setUv(1.0f, 1.0f); - secondBuffer.addVertex(matrix4f3, -k, 0F, -k).setUv(0.0f, 1.0f); - BufferUploader.drawWithShader(secondBuffer.build()); + bufferBuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferBuilder.vertex(matrix4f3, -k, 0F, k).uv(0.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, k).uv(1.0f, 0.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, k, 0F, -k).uv(1.0f, 1.0f).endVertex(); + bufferBuilder.vertex(matrix4f3, -k, 0F, -k).uv(0.0f, 1.0f).endVertex(); + BufferUploader.drawWithShader(bufferBuilder.end()); poseStack.popPose(); } } diff --git a/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java b/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java index d97dbc382..a2fe4eaa0 100644 --- a/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java +++ b/src/main/java/net/frozenblock/lib/ingamedevtools/item/LootTableWhacker.java @@ -55,7 +55,7 @@ public InteractionResult useOn(@NotNull UseOnContext context) { } if (stack.has(DataComponents.CUSTOM_NAME)) { String id = stack.getHoverName().getString(); - ResourceLocation location = ResourceLocation.parse(id); + ResourceLocation location = new ResourceLocation(id); ResourceKey key = ResourceKey.create(Registries.LOOT_TABLE, location); if (!level.isClientSide) { if (level.getBlockEntity(blockPos) instanceof RandomizableContainerBlockEntity loot) { diff --git a/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java b/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java index 03fdecb70..3978b4ecc 100644 --- a/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java +++ b/src/main/java/net/frozenblock/lib/integration/api/ModIntegration.java @@ -53,7 +53,7 @@ public String getID() { } public ResourceLocation id(String path) { - return ResourceLocation.fromNamespaceAndPath(this.modRegistryID, path); + return new ResourceLocation(this.modRegistryID, path); } public Block getBlock(String path) { diff --git a/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java b/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java index a4d431ecf..d6becb5dc 100644 --- a/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java +++ b/src/main/java/net/frozenblock/lib/integration/api/ModIntegrations.java @@ -40,7 +40,7 @@ private ModIntegrations() { * @return A {@link ModIntegrationSupplier}. */ public static ModIntegrationSupplier register(Supplier integration, String srcModID, String modID) { - return Registry.register(FrozenRegistry.MOD_INTEGRATION, ResourceLocation.fromNamespaceAndPath(srcModID, modID), new ModIntegrationSupplier<>(integration, modID)); + return Registry.register(FrozenRegistry.MOD_INTEGRATION, new ResourceLocation(srcModID, modID), new ModIntegrationSupplier<>(integration, modID)); } /** @@ -53,7 +53,7 @@ public static ModIntegrationSupplier register(Supplier * @return A {@link ModIntegrationSupplier}. */ public static ModIntegrationSupplier register(Supplier integration, Supplier unloadedIntegration, String srcModID, String modID) { - return Registry.register(FrozenRegistry.MOD_INTEGRATION, ResourceLocation.fromNamespaceAndPath(srcModID, modID), new ModIntegrationSupplier<>(integration, unloadedIntegration, modID)); + return Registry.register(FrozenRegistry.MOD_INTEGRATION, new ResourceLocation(srcModID, modID), new ModIntegrationSupplier<>(integration, unloadedIntegration, modID)); } public static List> getIntegrationSuppliers() { diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java index 790a80f7a..046c32d5f 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownChangePacket.java @@ -31,8 +31,8 @@ public record CooldownChangePacket( int additional ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("cooldown_change_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("cooldown_change_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(CooldownChangePacket::write, CooldownChangePacket::new); diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java index 924d03652..44b214853 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/CooldownTickCountPacket.java @@ -26,8 +26,8 @@ public record CooldownTickCountPacket(int count) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("cooldown_tick_count_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("cooldown_tick_count_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(CooldownTickCountPacket::new, CooldownTickCountPacket::count).cast(); diff --git a/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java b/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java index 7cb0b0186..3809d22dc 100644 --- a/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java +++ b/src/main/java/net/frozenblock/lib/item/impl/network/ForcedCooldownPacket.java @@ -32,8 +32,8 @@ public record ForcedCooldownPacket( int endTime ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("forced_cooldown_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("forced_cooldown_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(ForcedCooldownPacket::write, ForcedCooldownPacket::new); diff --git a/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java b/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java index d75c2716b..98d4dfd58 100644 --- a/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java +++ b/src/main/java/net/frozenblock/lib/item/mixin/ServerPlayerMixin.java @@ -25,7 +25,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.portal.DimensionTransition; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -67,14 +66,14 @@ public void tick(CallbackInfo info) { } @Inject(method = "changeDimension", at = @At(value = "HEAD")) - public void frozenLib$changeDimensionSaveCooldowns(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { + public void frozenLib$changeDimensionSaveCooldowns(ServerLevel destination, CallbackInfoReturnable info) { CompoundTag tempTag = new CompoundTag(); SaveableItemCooldowns.saveCooldowns(tempTag, ServerPlayer.class.cast(this)); this.frozenLib$savedCooldownTag = tempTag; } @Inject(method = "changeDimension", at = @At(value = "RETURN")) - public void frozenLib$changeDimensionLoadCooldowns(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { + public void frozenLib$changeDimensionLoadCooldowns(ServerLevel destination, CallbackInfoReturnable info) { if (this.frozenLib$savedCooldownTag != null) { this.frozenLib$savedItemCooldowns = Optional.of(SaveableItemCooldowns.readCooldowns(this.frozenLib$savedCooldownTag)); } diff --git a/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java b/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java index d1f7112d2..36f3e4940 100644 --- a/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java +++ b/src/main/java/net/frozenblock/lib/liquid/render/api/LiquidRenderUtils.java @@ -93,9 +93,9 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos southEastHeight = calculateAverageHeight(level, fluid, n, t, u, pos.relative(Direction.SOUTH).relative(Direction.EAST)); southWestHeight = calculateAverageHeight(level, fluid, n, t, v, pos.relative(Direction.SOUTH).relative(Direction.WEST)); } - float d = pos.getX() & 0xF; - float e = pos.getY() & 0xF; - float w = pos.getZ() & 0xF; + double d = pos.getX() & 0xF; + double e = pos.getY() & 0xF; + double w = pos.getZ() & 0xF; y = shouldRenderDown ? 0.001f : 0.0f; if (shouldRenderUp && !isFaceOccludedByNeighbor(level, pos, Direction.UP, Math.min(Math.min(northWestHeight, southWestHeight), Math.min(southEastHeight, northEastHeight)), upBlockState, blockState)) { float ak; @@ -132,15 +132,15 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos float an = k * f; ao = k * g; ap = k * h; - vertex(vertexConsumer, d + 0.0f, e + northWestHeight, w + 0.0f, an, ao, ap, z, aa, am); - vertex(vertexConsumer, d + 0.0f, e + southWestHeight, w + 1.0f, an, ao, ap, ab, ac, am); - vertex(vertexConsumer, d + 1.0f, e + southEastHeight, w + 1.0f, an, ao, ap, ad, ae, am); - vertex(vertexConsumer, d + 1.0f, e + northEastHeight, w + 0.0f, an, ao, ap, af, ag, am); + vertex(vertexConsumer, d + 0.0, e + northWestHeight, w + 0.0, an, ao, ap, z, aa, am); + vertex(vertexConsumer, d + 0.0, e + southWestHeight, w + 1.0, an, ao, ap, ab, ac, am); + vertex(vertexConsumer, d + 1.0, e + southEastHeight, w + 1.0, an, ao, ap, ad, ae, am); + vertex(vertexConsumer, d + 1.0, e + northEastHeight, w + 0.0, an, ao, ap, af, ag, am); if (fluidState.shouldRenderBackwardUpFace(level, pos.above()) || !blockState.equals(downBlockState)) { - vertex(vertexConsumer, d + 0.0f, e + northWestHeight, w + 0.0f, an, ao, ap, z, aa, am); - vertex(vertexConsumer, d + 1.0f, e + northEastHeight, w + 0.0f, an, ao, ap, af, ag, am); - vertex(vertexConsumer, d + 1.0f, e + southEastHeight, w + 1.0f, an, ao, ap, ad, ae, am); - vertex(vertexConsumer, d + 0.0f, e + southWestHeight, w + 1.0f, an, ao, ap, ab, ac, am); + vertex(vertexConsumer, d + 0.0, e + northWestHeight, w + 0.0, an, ao, ap, z, aa, am); + vertex(vertexConsumer, d + 1.0, e + northEastHeight, w + 0.0, an, ao, ap, af, ag, am); + vertex(vertexConsumer, d + 1.0, e + southEastHeight, w + 1.0, an, ao, ap, ad, ae, am); + vertex(vertexConsumer, d + 0.0, e + southWestHeight, w + 1.0, an, ao, ap, ab, ac, am); } } if (shouldRenderDown) { @@ -152,30 +152,30 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos ac = j * f; ae = j * g; ag = j * h; - vertex(vertexConsumer, d, e + y, w + 1.0f, ac, ae, ag, z, af, aq); + vertex(vertexConsumer, d, e + y, w + 1.0, ac, ae, ag, z, af, aq); vertex(vertexConsumer, d, e + y, w, ac, ae, ag, z, ad, aq); - vertex(vertexConsumer, d + 1.0f, e + y, w, ac, ae, ag, ab, ad, aq); - vertex(vertexConsumer, d + 1.0f, e + y, w + 1.0f, ac, ae, ag, ab, af, aq); + vertex(vertexConsumer, d + 1.0, e + y, w, ac, ae, ag, ab, ad, aq); + vertex(vertexConsumer, d + 1.0, e + y, w + 1.0, ac, ae, ag, ab, af, aq); if (!downFluidState.equals(fluidState) && downBlockState.getBlock() != blockState.getBlock() && !downBlockState.canOcclude()) { - vertex(vertexConsumer, d, e + y, w + 1.0f, ac, ae, ag, z, af, aq); - vertex(vertexConsumer, d + 1.0f, e + y, w + 1.0f, ac, ae, ag, z, ad, aq); - vertex(vertexConsumer, d + 1.0f, e + y, w, ac, ae, ag, ab, ad, aq); + vertex(vertexConsumer, d, e + y, w + 1.0, ac, ae, ag, z, af, aq); + vertex(vertexConsumer, d + 1.0, e + y, w + 1.0, ac, ae, ag, z, ad, aq); + vertex(vertexConsumer, d + 1.0, e + y, w, ac, ae, ag, ab, ad, aq); vertex(vertexConsumer, d, e + y, w, ac, ae, ag, ab, af, aq); } } int ar = getLightColor(level, pos); for (Direction direction : Direction.Plane.HORIZONTAL) { - float av; - float au; - float at; - float as; + double av; + double au; + double at; + double as; float aa; if (!(switch (direction) { case NORTH -> { af = northWestHeight; aa = northEastHeight; as = d; - at = d + 1.0f; + at = d + 1.0; au = w + 0.001f; av = w + 0.001f; yield shouldRenderNorth; @@ -183,10 +183,10 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos case SOUTH -> { af = southEastHeight; aa = southWestHeight; - as = d + 1.0f; + as = d + 1.0; at = d; - au = w + 1.0f - 0.001f; - av = w + 1.0f - 0.001f; + au = w + 1.0 - 0.001f; + av = w + 1.0 - 0.001f; yield bl5; } case WEST -> { @@ -194,17 +194,17 @@ public static void tesselateWithSingleTexture(BlockAndTintGetter level, BlockPos aa = northWestHeight; as = d + 0.001f; at = d + 0.001f; - au = w + 1.0f; + au = w + 1.0; av = w; yield bl6; } default -> { af = northEastHeight; aa = southEastHeight; - as = d + 1.0f - 0.001f; - at = d + 1.0f - 0.001f; + as = d + 1.0 - 0.001f; + at = d + 1.0 - 0.001f; au = w; - av = w + 1.0f; + av = w + 1.0; yield bl7; } }) || isFaceOccludedByNeighbor(level, pos, direction, Math.max(af, aa), level.getBlockState(pos.relative(direction)), level.getBlockState(pos.relative(direction)))) continue; @@ -276,8 +276,8 @@ public static float getHeight(BlockAndTintGetter world, Fluid fluid, BlockPos po } //vertex - public static void vertex(VertexConsumer consumer, float x, float y, float z, float red, float green, float blue, float u, float v, int packedLight) { - consumer.addVertex(x, y, z).setColor(red, green, blue, 1.0f).setUv(u, v).setLight(packedLight).setNormal(0.0f, 1.0f, 0.0f); + public static void vertex(VertexConsumer consumer, double x, double y, double z, float red, float green, float blue, float u, float v, int packedLight) { + consumer.vertex(x, y, z).color(red, green, blue, 1.0f).uv(u, v).uv2(packedLight).normal(0.0f, 1.0f, 0.0f).endVertex(); } public static int getLightColor(BlockAndTintGetter level, BlockPos pos) { diff --git a/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java b/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java index 8ec1457c1..14b23c772 100644 --- a/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java +++ b/src/main/java/net/frozenblock/lib/menu/mixin/ScreenMixin.java @@ -43,7 +43,7 @@ private static CubeMap multiplePanoramas(ResourceLocation baseImageLocation, Ope String path = panLocation.getPath(); for(int i = 0; i < 6; ++i) { //Panorama isn't valid if one of the six images isn't found; move on to the next ResourceLocation in the list. - if (Minecraft.getInstance().getResourceManager().getResource(ResourceLocation.fromNamespaceAndPath(namespace, path + "_" + i + ".png")).isEmpty()) { + if (Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation(namespace, path + "_" + i + ".png")).isEmpty()) { FrozenLogUtils.logWarning("Unable to use panorama at " + namespace + ":" + path + ", proper resource pack may not be loaded!", FrozenSharedConstants.UNSTABLE_LOGGING); break; } diff --git a/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java b/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java index 1b2c1cff4..4e8b8056a 100644 --- a/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java +++ b/src/main/java/net/frozenblock/lib/recipe/api/FrozenRecipeProvider.java @@ -96,7 +96,7 @@ public static void colorWithDyes(RecipeOutput recipeOutput, @NotNull List .requires(Ingredient.of(dyeableItems.stream().filter(item2x -> !item2x.equals(item2)).map(ItemStack::new))) .group(group) .unlockedBy("has_needed_dye", RecipeProvider.has(item)) - .save(recipeOutput, ResourceLocation.fromNamespaceAndPath(modID, "dye_" + RecipeProvider.getItemName(item2))); + .save(recipeOutput, new ResourceLocation(modID, "dye_" + RecipeProvider.getItemName(item2))); } } } diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java index 01074035b..88fa8fdde 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/EntityScreenShakePacket.java @@ -32,8 +32,8 @@ public record EntityScreenShakePacket( int ticks ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("screen_shake_entity_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("screen_shake_entity_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(EntityScreenShakePacket::write, EntityScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java index c159cce9e..40bf10ff7 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveEntityScreenShakePacket.java @@ -28,8 +28,8 @@ public record RemoveEntityScreenShakePacket( int entityId ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("remove_entity_screen_shakes_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("remove_entity_screen_shakes_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(RemoveEntityScreenShakePacket::new, RemoveEntityScreenShakePacket::entityId).cast(); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java index 52bc6a37d..f1900631f 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/RemoveScreenShakePacket.java @@ -25,8 +25,8 @@ public record RemoveScreenShakePacket() implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("remove_screen_shakes_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("remove_screen_shakes_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(RemoveScreenShakePacket::write, RemoveScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java b/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java index f6e0c678a..698513d36 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java +++ b/src/main/java/net/frozenblock/lib/screenshake/impl/network/ScreenShakePacket.java @@ -33,8 +33,8 @@ public record ScreenShakePacket( int ticks ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("screen_shake_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("screen_shake_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(ScreenShakePacket::write, ScreenShakePacket::new); diff --git a/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java b/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java index 29f2b70fd..0bf6999bd 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java +++ b/src/main/java/net/frozenblock/lib/screenshake/mixin/ServerPlayerMixin.java @@ -24,7 +24,6 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerGamePacketListenerImpl; import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.portal.DimensionTransition; import org.jetbrains.annotations.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -57,7 +56,7 @@ public class ServerPlayerMixin { } @Inject(method = "changeDimension", at = @At(value = "HEAD")) - public void frozenLib$changeDimensionSaveScreenShakes(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { + public void frozenLib$changeDimensionSaveScreenShakes(ServerLevel destination, CallbackInfoReturnable info) { CompoundTag tempTag = new CompoundTag(); EntityScreenShakeManager entityScreenShakeManager = ((EntityScreenShakeInterface)ServerPlayer.class.cast(this)).getScreenShakeManager(); entityScreenShakeManager.save(tempTag); @@ -65,7 +64,7 @@ public class ServerPlayerMixin { } @Inject(method = "changeDimension", at = @At(value = "RETURN")) - public void frozenLib$changeDimensionLoadScreenShakes(DimensionTransition dimensionTransition, CallbackInfoReturnable cir) { + public void frozenLib$changeDimensionLoadScreenShakes(ServerLevel destination, CallbackInfoReturnable info) { if (this.frozenLib$savedScreenShakesTag != null) { EntityScreenShakeManager entityScreenShakeManager = ((EntityScreenShakeInterface)ServerPlayer.class.cast(this)).getScreenShakeManager(); entityScreenShakeManager.load(this.frozenLib$savedScreenShakesTag); diff --git a/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java b/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java index 50ff29872..ec5a3201b 100644 --- a/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/screenshake/mixin/client/GameRendererMixin.java @@ -18,10 +18,8 @@ package net.frozenblock.lib.screenshake.mixin.client; import com.llamalad7.mixinextras.injector.ModifyExpressionValue; -import com.llamalad7.mixinextras.sugar.Local; import com.mojang.blaze3d.vertex.PoseStack; import net.frozenblock.lib.screenshake.api.client.ScreenShaker; -import net.minecraft.client.DeltaTracker; import net.minecraft.client.renderer.GameRenderer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -30,8 +28,8 @@ public class GameRendererMixin { @ModifyExpressionValue(method = "renderLevel", at = @At(value = "NEW", target = "()Lcom/mojang/blaze3d/vertex/PoseStack;")) - public PoseStack frozenLib$shakeLevel(PoseStack matrixStack, DeltaTracker tracker, @Local(ordinal = 0) float deltaTime) { - ScreenShaker.shake(matrixStack, deltaTime); + public PoseStack frozenLib$shakeLeve(PoseStack matrixStack, float partialTicks, long finishTimeNano) { + ScreenShaker.shake(matrixStack, partialTicks); return matrixStack; } diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java index fc3bf94a5..8c1060cc7 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/FadingDistanceSwitchingSoundPacket.java @@ -40,8 +40,8 @@ public record FadingDistanceSwitchingSoundPacket( float maxDist ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("fading_distance_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("fading_distance_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(FadingDistanceSwitchingSoundPacket::write, FadingDistanceSwitchingSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java index c02586a5d..f270a168e 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/FlyBySoundPacket.java @@ -41,8 +41,8 @@ public record FlyBySoundPacket( float volume, float pitch ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("flyby_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("flyby_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(FlyBySoundPacket::write, FlyBySoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java index 8004fd19b..b1a9e1a1d 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalPlayerSoundPacket.java @@ -28,8 +28,8 @@ import org.jetbrains.annotations.NotNull; public record LocalPlayerSoundPacket(Holder sound, float volume, float pitch) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("local_player_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("local_player_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(LocalPlayerSoundPacket::write, LocalPlayerSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java index 791a0ac03..2045a3e89 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/LocalSoundPacket.java @@ -37,8 +37,8 @@ public record LocalSoundPacket( float pitch, boolean distanceDelay ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("local_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("local_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(LocalSoundPacket::write, LocalSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java index 16b3959c9..52e51dd3f 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingFadingDistanceSwitchingRestrictionSoundPacket.java @@ -43,8 +43,8 @@ public record MovingFadingDistanceSwitchingRestrictionSoundPacket( boolean looping ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("moving_fading_restriction_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("moving_fading_restriction_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(MovingFadingDistanceSwitchingRestrictionSoundPacket::write, MovingFadingDistanceSwitchingRestrictionSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java index e30111ebe..3dcd07f03 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/MovingRestrictionSoundPacket.java @@ -40,8 +40,8 @@ public record MovingRestrictionSoundPacket( boolean looping ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("moving_restriction_sound_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("moving_restriction_sound_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(MovingRestrictionSoundPacket::write, MovingRestrictionSoundPacket::new); diff --git a/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java b/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java index ea1e38d20..edbf5dfd9 100644 --- a/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java +++ b/src/main/java/net/frozenblock/lib/sound/api/networking/StartingMovingRestrictionSoundLoopPacket.java @@ -39,7 +39,7 @@ public record StartingMovingRestrictionSoundLoopPacket( ResourceLocation predicateId, boolean stopOnDeath ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("starting_moving_restriction_looping_sound_packet")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("starting_moving_restriction_looping_sound_packet")); public static final StreamCodec CODEC = StreamCodec.ofMember(StartingMovingRestrictionSoundLoopPacket::write, StartingMovingRestrictionSoundLoopPacket::new); public StartingMovingRestrictionSoundLoopPacket(@NotNull RegistryFriendlyByteBuf buf) { diff --git a/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java b/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java index 35747a156..23b49bbd3 100644 --- a/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java +++ b/src/main/java/net/frozenblock/lib/sound/impl/block_sound_group/BlockSoundGroupManager.java @@ -89,7 +89,7 @@ public void addBlock(ResourceLocation key, SoundType sounds, BooleanSupplier con * This will only work with vanilla blocks. */ public void addBlock(String id, SoundType sounds, BooleanSupplier condition) { - var key = ResourceLocation.parse(id); + var key = new ResourceLocation(id); addBlock(key, sounds, condition); } @@ -97,7 +97,7 @@ public void addBlock(String id, SoundType sounds, BooleanSupplier condition) { * Adds a block with the specified namespace and id. */ public void addBlock(String namespace, String id, SoundType sounds, BooleanSupplier condition) { - var key = ResourceLocation.fromNamespaceAndPath(namespace, id); + var key = new ResourceLocation(namespace, id); addBlock(key, sounds, condition); } @@ -127,7 +127,7 @@ public void addBlockTag(TagKey tag, SoundType sounds, BooleanSupplier con } public static ResourceLocation getPath(ResourceLocation blockId) { - return ResourceLocation.fromNamespaceAndPath(blockId.getNamespace(), DIRECTORY + "/" + blockId.getPath() + ".json"); + return new ResourceLocation(blockId.getNamespace(), DIRECTORY + "/" + blockId.getPath() + ".json"); } @Override @@ -187,7 +187,7 @@ private void addOverwrite(ResourceLocation id, Resource resource) { return; } - ResourceLocation overwriteId = ResourceLocation.fromNamespaceAndPath(id.getNamespace(), id.getPath().substring((DIRECTORY + "/").length())); + ResourceLocation overwriteId = new ResourceLocation(id.getNamespace(), id.getPath().substring((DIRECTORY + "/").length())); overwrites.put(overwriteId, result.result().orElseThrow().getFirst()); } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java b/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java index 69d770866..dec62952e 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/api/ClientSpottingIconMethods.java @@ -26,7 +26,7 @@ public class ClientSpottingIconMethods { public static boolean hasTexture(ResourceLocation resourceLocation) { - return Minecraft.getInstance().getResourceManager().getResource(ResourceLocation.fromNamespaceAndPath(resourceLocation.getNamespace(), resourceLocation.getPath())).isPresent(); + return Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation(resourceLocation.getNamespace(), resourceLocation.getPath())).isPresent(); } } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java index 18fe26464..be17de4bd 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconPacket.java @@ -32,8 +32,8 @@ public record SpottingIconPacket( ResourceLocation restrictionID ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("spotting_icon_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("spotting_icon_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(SpottingIconPacket::write, SpottingIconPacket::new); diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java index 5b625b1ae..877e36ad3 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/impl/SpottingIconRemovePacket.java @@ -28,8 +28,8 @@ public record SpottingIconRemovePacket( int entityId ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("spotting_icon_remove_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("spotting_icon_remove_packet") ); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT .map(SpottingIconRemovePacket::new, SpottingIconRemovePacket::entityId) diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java index 778b72b8f..292e71846 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/EntityRendererMixin.java @@ -71,11 +71,12 @@ public abstract class EntityRendererMixin implements EntityRen @Unique private static void frozenLib$vertex(@NotNull VertexConsumer vertexConsumer, PoseStack.Pose pose, int i, float f, int j, int u, int v, int alpha) { - vertexConsumer.addVertex(pose, f - 0.5F, (float)j - 0.5F, 0.0F) - .setColor(255, 255, 255, alpha) - .setUv((float)u, (float)v) - .setOverlay(OverlayTexture.NO_OVERLAY) - .setLight(i) - .setNormal(pose, 0.0F, 1.0F, 0.0F); + vertexConsumer.vertex(pose, f - 0.5F, (float)j - 0.5F, 0.0F) + .color(255, 255, 255, alpha) + .uv((float)u, (float)v) + .overlayCoords(OverlayTexture.NO_OVERLAY) + .uv2(i) + .normal(pose, 0.0F, 1.0F, 0.0F) + .endVertex(); } } diff --git a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java index 8c3cd3fa2..69435d19b 100644 --- a/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java +++ b/src/main/java/net/frozenblock/lib/spotting_icons/mixin/client/LevelRendererMixin.java @@ -21,7 +21,6 @@ import com.mojang.blaze3d.vertex.PoseStack; import net.frozenblock.lib.spotting_icons.impl.EntityRenderDispatcherWithIcon; import net.minecraft.client.Camera; -import net.minecraft.client.DeltaTracker; import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.LevelRenderer; @@ -56,7 +55,7 @@ public class LevelRendererMixin { private ClientLevel level; @Inject(method = "renderLevel", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/client/renderer/RenderBuffers;bufferSource()Lnet/minecraft/client/renderer/MultiBufferSource$BufferSource;", shift = At.Shift.AFTER)) - public void renderLevel(DeltaTracker deltaTracker, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightmapTextureManager, Matrix4f projectionMatrix, Matrix4f matrix4f, CallbackInfo ci, @Local(ordinal = 0) float deltaTime, @Local PoseStack poseStack) { + public void renderLevel(float partialTick, long finishNanoTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projectionMatrix, Matrix4f matrix2, CallbackInfo info, @Local PoseStack poseStack) { if (this.level != null) { MultiBufferSource.BufferSource bufferSource = this.renderBuffers.bufferSource(); for (Entity entity : this.level.entitiesForRendering()) { @@ -69,7 +68,7 @@ public void renderLevel(DeltaTracker deltaTracker, boolean renderBlockOutline, C entity.yOld = entity.getY(); entity.zOld = entity.getZ(); } - this.renderEntityIcon(entity, d, e, f, deltaTime, poseStack, bufferSource); + this.renderEntityIcon(entity, d, e, f, partialTick, poseStack, bufferSource); } } } diff --git a/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java b/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java index 8788a167d..9b1141c47 100644 --- a/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java +++ b/src/main/java/net/frozenblock/lib/stencil/api/StencilRenderer.java @@ -48,9 +48,9 @@ public static void render(Triangle[] triangles, Matrix4f matrix4f, MultiBufferSo for (RenderType renderType : DYNAMIC_LIGHT) { VertexConsumer vertexConsumer = multiBufferSource.getBuffer(renderType); for (Triangle triangle : triangles) { - vertexConsumer.addVertex(matrix4f, triangle.p0.x, triangle.p0.y, triangle.p0.z).setColor(j, k, l, m); - vertexConsumer.addVertex(matrix4f, triangle.p2.x, triangle.p2.y, triangle.p2.z).setColor(j, k, l, m); - vertexConsumer.addVertex(matrix4f, triangle.p1.x, triangle.p1.y, triangle.p1.z).setColor(j, k, l, m); + vertexConsumer.vertex(matrix4f, triangle.p0.x, triangle.p0.y, triangle.p0.z).color(j, k, l, m).endVertex(); + vertexConsumer.vertex(matrix4f, triangle.p2.x, triangle.p2.y, triangle.p2.z).color(j, k, l, m).endVertex(); + vertexConsumer.vertex(matrix4f, triangle.p1.x, triangle.p1.y, triangle.p1.z).color(j, k, l, m).endVertex(); } } } diff --git a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java index 1c5310eca..4103657fa 100644 --- a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java +++ b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindDisturbancePacket.java @@ -35,8 +35,8 @@ public record WindDisturbancePacket( long posOrID ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("wind_disturbance_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("wind_disturbance_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(WindDisturbancePacket::write, WindDisturbancePacket::new); diff --git a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java index 523436c57..405405d0a 100644 --- a/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java +++ b/src/main/java/net/frozenblock/lib/wind/impl/networking/WindSyncPacket.java @@ -31,8 +31,8 @@ public record WindSyncPacket( Vec3 commandWind ) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>( - FrozenSharedConstants.id("wind_sync_packet") + public static final Type PACKET_TYPE = CustomPacketPayload.createType( + FrozenSharedConstants.string("wind_sync_packet") ); public static final StreamCodec CODEC = StreamCodec.ofMember(WindSyncPacket::write, WindSyncPacket::create); diff --git a/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java b/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java index cbfc02003..02dc78e0b 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java +++ b/src/main/java/net/frozenblock/lib/worldgen/biome/api/FrozenBiome.java @@ -42,7 +42,7 @@ public abstract class FrozenBiome { private static final List BIOMES = new ArrayList<>(); - private final ResourceKey key = ResourceKey.create(Registries.BIOME, ResourceLocation.fromNamespaceAndPath(this.modID(), this.biomeID())); + private final ResourceKey key = ResourceKey.create(Registries.BIOME, new ResourceLocation(this.modID(), this.biomeID())); protected FrozenBiome() { BIOMES.add(this); diff --git a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java index 0546a58ef..d05f4e7bb 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java +++ b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenConfiguredFeatureUtils.java @@ -39,7 +39,7 @@ private FrozenConfiguredFeatureUtils() { } public static ResourceKey> createKey(String namespace, String path) { - return ResourceKey.create(Registries.CONFIGURED_FEATURE, ResourceLocation.fromNamespaceAndPath(namespace, path)); + return ResourceKey.create(Registries.CONFIGURED_FEATURE, new ResourceLocation(namespace, path)); } public static Holder> register(DynamicRegistryManagerSetupContext context, DynamicRegistryManagerSetupContext.RegistryMap registries, String namespace, String id, Feature feature) { @@ -49,7 +49,7 @@ private FrozenConfiguredFeatureUtils() { public static , C extends ConfiguredFeature> Holder.Reference register(DynamicRegistryManagerSetupContext context, DynamicRegistryManagerSetupContext.RegistryMap registries, @NotNull String namespace, @NotNull String id, F feature, @NotNull FC config) { var configuredRegistry = registries.get(Registries.CONFIGURED_FEATURE); final ConfiguredFeature configuredFeature = new ConfiguredFeature<>(feature, config); - Registry.register(configuredRegistry, ResourceLocation.fromNamespaceAndPath(namespace, id), configuredFeature); + Registry.register(configuredRegistry, new ResourceLocation(namespace, id), configuredFeature); var featureEntry = getExact(registries, configuredFeature); return (Holder.Reference) featureEntry; } diff --git a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java index ba85253b6..4f028fbf5 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java +++ b/src/main/java/net/frozenblock/lib/worldgen/feature/api/FrozenPlacementUtils.java @@ -36,7 +36,7 @@ private FrozenPlacementUtils() { } public static ResourceKey createKey(String namespace, String path) { - return ResourceKey.create(Registries.PLACED_FEATURE, ResourceLocation.fromNamespaceAndPath(namespace, path)); + return ResourceKey.create(Registries.PLACED_FEATURE, new ResourceLocation(namespace, path)); } public static Holder register( diff --git a/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java b/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java index ff8b2a4e6..aaa6ed09b 100644 --- a/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java +++ b/src/main/java/net/frozenblock/lib/worldgen/structure/mixin/SinglePoolElementMixin.java @@ -23,7 +23,6 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.level.levelgen.structure.pools.SinglePoolElement; import net.minecraft.world.level.levelgen.structure.pools.StructureTemplatePool; -import net.minecraft.world.level.levelgen.structure.templatesystem.LiquidSettings; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureProcessorList; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import org.spongepowered.asm.mixin.Final; @@ -33,7 +32,6 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.util.Optional; @Mixin(SinglePoolElement.class) public class SinglePoolElementMixin { @@ -43,9 +41,8 @@ public class SinglePoolElementMixin { @Mutable protected Either template; - @SuppressWarnings("OptionalUsedAsFieldOrParameterType") - @Inject(method = "", at = @At("TAIL")) - public void replaceStructure(Either template, Holder processors, StructureTemplatePool.Projection projection, Optional overrideLiquidSettings, CallbackInfo info) { + @Inject(method = "(Lcom/mojang/datafixers/util/Either;Lnet/minecraft/core/Holder;Lnet/minecraft/world/level/levelgen/structure/pools/StructureTemplatePool$Projection;)V", at = @At("TAIL")) + public void replaceStructure(Either template, Holder processors, StructureTemplatePool.Projection projection, CallbackInfo info) { if (template.left().isPresent()) { ResourceLocation id = template.left().get(); if (StructurePoolElementIdReplacements.RESOURCE_LOCATION_REPLACEMENTS.containsKey(id)) { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java index dbd8a8ae8..c1b9f4a9b 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/event/DelayedRegistry.java @@ -95,12 +95,6 @@ public Lifecycle registryLifecycle() { return this.wrapped.registryLifecycle(); } - @Override - @NotNull - public Optional> getAny() { - return this.wrapped.getAny(); - } - @Override @NotNull public Set keySet() { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java index 30891afa2..96da51a9b 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ClientPackets.java @@ -42,7 +42,7 @@ public final class ClientPackets { * */ public record Handshake(int version) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/handshake_client")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/handshake_client")); public static final StreamCodec CODEC = ByteBufCodecs.VAR_INT.map(Handshake::new, Handshake::version).cast(); @Override @@ -67,7 +67,7 @@ public Type type() { * */ public record ModProtocol(Object2IntOpenHashMap protocols) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/mod_protocol")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/mod_protocol")); public static final StreamCodec CODEC = StreamCodec.ofMember(ModProtocol::write, ModProtocol::new); public ModProtocol(FriendlyByteBuf buf) { @@ -105,7 +105,7 @@ public Type type() { * Ends registry sync. No data */ public record End() implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(FrozenSharedConstants.id("registry_sync/end")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(FrozenSharedConstants.string("registry_sync/end")); public static final StreamCodec CODEC = StreamCodec.ofMember(End::write, End::new); public End(FriendlyByteBuf buf) { diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java index 7f873b48d..6a359ed85 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/core/registry/impl/sync/ServerPackets.java @@ -26,7 +26,6 @@ import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.quiltmc.qsl.frozenblock.core.registry.api.sync.ModProtocolDef; @@ -46,7 +45,7 @@ public final class ServerPackets { * */ public record Handshake(IntList supportedVersions) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/handshake")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/handshake")); public static final StreamCodec CODEC = StreamCodec.ofMember(Handshake::write, Handshake::new); public Handshake(@NotNull FriendlyByteBuf buf) { @@ -67,7 +66,7 @@ public Type type() { * Ends registry sync. No data */ public record End() implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/end")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/end")); public static final StreamCodec CODEC = StreamCodec.ofMember(End::write, End::new); public End(FriendlyByteBuf buf) { @@ -98,7 +97,7 @@ public Type type() { * */ public record ErrorStyle(Component errorHeader, Component errorFooter, boolean showError) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/error_style")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/error_style")); public static final StreamCodec CODEC = StreamCodec.ofMember(ErrorStyle::write, ErrorStyle::new); public ErrorStyle(@NotNull FriendlyByteBuf buf) { @@ -135,7 +134,7 @@ public Type type() { * */ public record ModProtocol(String prioritizedId, Collection protocols) implements CustomPacketPayload { - public static final Type PACKET_TYPE = new Type<>(ServerPackets.id("registry_sync/mod_protocol")); + public static final Type PACKET_TYPE = CustomPacketPayload.createType(ServerPackets.id("registry_sync/mod_protocol")); public static final StreamCodec CODEC = StreamCodec.ofMember(ModProtocol::write, ModProtocol::new); public ModProtocol(@NotNull FriendlyByteBuf buf) { @@ -154,7 +153,7 @@ public Type type() { } } - private static ResourceLocation id(String path) { - return FrozenSharedConstants.id(path); + private static String id(String path) { + return FrozenSharedConstants.string(path); } } diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java index 57af09b40..b4f4fdda1 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixerBuilder.java @@ -24,7 +24,6 @@ import java.util.Set; import java.util.concurrent.Executor; import java.util.function.Supplier; -import net.minecraft.Util; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -58,18 +57,14 @@ public int getDataVersion() { /** * Builds the final {@code DataFixer}. *

- * This will build either an {@linkplain #build() unoptimized fixer} or an - * {@linkplain #build(Set, Supplier) optimized fixer}, depending on the vanilla game's settings. + * This will build either an {@linkplain #buildUnoptimized() unoptimized fixer} or an + * {@linkplain #buildOptimized(Set, Executor) optimized fixer}, depending on the vanilla game's settings. * * @param executorGetter the executor supplier, only invoked if the game is using optimized data fixers * @return the newly built data fixer */ @Contract(value = "_, _ -> new") public @NotNull DataFixer build(Set types, @NotNull Supplier executorGetter) { - return types.isEmpty() ? this.build().fixer() : Util.make(() -> { - var result = this.build(); - result.optimize(types, executorGetter.get()); - return result.fixer(); - }); + return types.isEmpty() ? this.buildUnoptimized() : this.buildOptimized(types, executorGetter.get()); } } diff --git a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java index 8e88a4e30..ab5c061aa 100644 --- a/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java +++ b/src/main/java/org/quiltmc/qsl/frozenblock/misc/datafixerupper/api/QuiltDataFixes.java @@ -32,7 +32,6 @@ import net.fabricmc.loader.api.ModContainer; import net.minecraft.SharedConstants; import net.minecraft.nbt.CompoundTag; -import net.minecraft.util.datafix.DataFixTypes; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Range; @@ -188,7 +187,7 @@ public static DataFixer buildFixer(@NotNull QuiltDataFixerBuilder dataFixerBuild new ThreadFactoryBuilder().setNameFormat("FrozenLib Quilt Datafixer Bootstrap").setDaemon(true).setPriority(1).build() ); - return dataFixerBuilder.build(DataFixTypes.TYPES_FOR_LEVEL_LIST, executor); + return dataFixerBuilder.build(SharedConstants.DATA_FIX_TYPES_TO_OPTIMIZE, executor); } /** diff --git a/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt b/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt index f6c64c432..eca7a1635 100644 --- a/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt +++ b/src/main/kotlin/net/frozenblock/lib/core/api/StringUtil.kt @@ -22,9 +22,9 @@ import java.net.URI fun String.uri(): URI = URI.create(this) -fun vanillaId(path: String): ResourceLocation = ResourceLocation.withDefaultNamespace(path) +fun vanillaId(path: String): ResourceLocation = ResourceLocation(path) val String.asResourceLocation: ResourceLocation get() { - return ResourceLocation.parse(this) + return ResourceLocation(this) } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java index de3c46838..3fe39754e 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestClient.java @@ -35,8 +35,8 @@ public final class FrozenTestClient implements ClientModInitializer { @Override public void onInitializeClient() { FlyBySoundHub.AUTO_ENTITIES_AND_SOUNDS.put(EntityType.ARROW, new FlyBySoundHub.FlyBySound(1.0F, 1.0F, SoundSource.NEUTRAL, SoundEvents.AXE_SCRAPE)); - SplashTextAPI.addSplashLocation(ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, "texts/splashes.txt")); - Panoramas.addPanorama(ResourceLocation.fromNamespaceAndPath(FrozenSharedConstants.MOD_ID, "textures/gui/title/background/panorama")); - Panoramas.addPanorama(ResourceLocation.fromNamespaceAndPath("this_will_throw_an_error", "textures/gui/title/background/panorama")); + SplashTextAPI.addSplashLocation(new ResourceLocation(FrozenSharedConstants.MOD_ID, "texts/splashes.txt")); + Panoramas.addPanorama(new ResourceLocation(FrozenSharedConstants.MOD_ID, "textures/gui/title/background/panorama")); + Panoramas.addPanorama(new ResourceLocation("this_will_throw_an_error", "textures/gui/title/background/panorama")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java index 402df459f..1a6d2037e 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/FrozenTestMain.java @@ -117,6 +117,6 @@ private static void applyDataFixes(ModContainer mod) { } public static ResourceLocation id(String path) { - return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); + return new ResourceLocation(MOD_ID, path); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt b/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt index 0f8d2ecaa..badddc8db 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt +++ b/src/testmod/java/net/frozenblock/lib/testmod/config/TestConfig.kt @@ -73,14 +73,14 @@ data class TestConfig( @JvmField @Comment("This is a sound event typed entry.") - var randomSound: TypedEntry> = TypedEntry.create( + var randomSound: TypedEntry> = TypedEntry( SOUND_HOLDER_TYPE, SoundEvents.BREEZE_WIND_CHARGE_BURST ), @JvmField @Comment("This is a Vec3 list typed entry.") - var typedVecList: TypedEntry> = TypedEntry.create( + var typedVecList: TypedEntry> = TypedEntry( VEC_LIST_TYPE, listOf( Vec3(0.0, 0.0, 0.0), @@ -114,7 +114,7 @@ data class TestConfig( XjsConfig( FrozenTestMain.MOD_ID, TestConfig::class.java, - XjsFormat.DJS_FORMATTED + XjsFormat.XJS_FORMATTED ) ) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java b/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java index 55ee0f660..c2e211184 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/config/gui/TestConfigGui.java @@ -40,7 +40,7 @@ public static void setupEntries(ConfigCategory category, ConfigEntryBuilder entr var config = TestConfig.get(true); var defaultConfig = TestConfig.INSTANCE.defaultInstance(); var subMenu = config.subMenu; - category.setBackground(ResourceLocation.withDefaultNamespace("textures/block/packed_mud.png")); + category.setBackground(new ResourceLocation("textures/block/packed_mud.png")); var test = category.addEntry(entryBuilder.startBooleanToggle(text("test_toggle"), config.testToggle) .setDefaultValue(defaultConfig.testToggle) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java b/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java index 9f941d787..9028e60a3 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/datagen/FrozenLibTestDatagen.java @@ -125,7 +125,7 @@ public TestAdvancementLootTableProvider(FabricDataOutput output, CompletableFutu } @Override - public void generate(BiConsumer, LootTable.Builder> output) { + public void generate(@NotNull HolderLookup.Provider provider, BiConsumer, LootTable.Builder> output) { output.accept( ResourceKey.create(Registries.LOOT_TABLE, FrozenTestMain.id("test_loottable")), LootTable.lootTable() diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java index 57764510f..99cb61edf 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/CreeperMixin.java @@ -18,7 +18,6 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; -import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.world.entity.EntityType; @@ -35,7 +34,7 @@ public class CreeperMixin { @Inject(method = "", at = @At(value = "TAIL")) public void initWithIcon(EntityType entityType, Level level, CallbackInfo info) { Creeper creeper = Creeper.class.cast(this); - ((EntitySpottingIconInterface) creeper).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/creeper.png"), 16, 20, FrozenSharedConstants.id("default")); + ((EntitySpottingIconInterface) creeper).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/creeper.png"), 16, 20, FrozenMain.resourceLocation("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java index 34d0063b9..ccdef8be9 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PhantomMixin.java @@ -18,7 +18,6 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; -import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.world.entity.EntityType; @@ -35,6 +34,6 @@ public class PhantomMixin { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(EntityType entityType, Level level, CallbackInfo ci) { Phantom phantom = Phantom.class.cast(this); - ((EntitySpottingIconInterface) phantom).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/phantom.png"), 16, 20, FrozenSharedConstants.id("default")); + ((EntitySpottingIconInterface) phantom).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/phantom.png"), 16, 20, FrozenMain.resourceLocation("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java index 0aab7a691..4124818d8 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/PlayerMixin.java @@ -19,7 +19,6 @@ import com.mojang.authlib.GameProfile; import net.frozenblock.lib.FrozenMain; -import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; import net.minecraft.core.BlockPos; @@ -37,6 +36,6 @@ public class PlayerMixin { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(Level level, BlockPos pos, float yRot, GameProfile gameProfile, CallbackInfo ci) { Player player = Player.class.cast(this); - ((EntitySpottingIconInterface) player).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/player.png"), 0, 1, FrozenSharedConstants.id("default")); + ((EntitySpottingIconInterface) player).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/player.png"), 0, 1, FrozenMain.resourceLocation("default")); } } diff --git a/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java b/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java index 23e615106..4dbbe4a9c 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/mixin/WardenMixin.java @@ -18,7 +18,6 @@ package net.frozenblock.lib.testmod.mixin; import net.frozenblock.lib.FrozenMain; -import net.frozenblock.lib.FrozenSharedConstants; import net.frozenblock.lib.screenshake.api.ScreenShakeManager; import net.frozenblock.lib.spotting_icons.impl.EntitySpottingIconInterface; import net.frozenblock.lib.testmod.FrozenTestMain; @@ -43,7 +42,7 @@ private WardenMixin(EntityType entityType, Level level) { @Inject(method = "", at = @At("TAIL")) private void initWithIcon(EntityType entityType, Level level, CallbackInfo ci) { Warden warden = Warden.class.cast(this); - ((EntitySpottingIconInterface) warden).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/warden.png"), 8, 12, FrozenSharedConstants.id("default")); + ((EntitySpottingIconInterface) warden).getSpottingIconManager().setIcon(FrozenTestMain.id("textures/spotting_icons/warden.png"), 8, 12, FrozenMain.resourceLocation("default")); } @Inject(method = "doHurtTarget", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/monster/warden/Warden;playSound(Lnet/minecraft/sounds/SoundEvent;FF)V")) diff --git a/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java b/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java index 75db82d99..7bcac17c8 100644 --- a/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java +++ b/src/testmod/java/net/frozenblock/lib/testmod/worldgen/TestSurfaceRules.java @@ -83,7 +83,7 @@ public void addEndSurfaceRules(List context) { @Override public void addGenericSurfaceRules(List context) { context.add(new FrozenDimensionBoundRuleSource( - ResourceLocation.withDefaultNamespace("overworld"), + new ResourceLocation("overworld"), SurfaceRules.sequence( SurfaceRules.ifTrue( SurfaceRules.isBiome(Biomes.BIRCH_FOREST), @@ -92,7 +92,7 @@ public void addGenericSurfaceRules(List context) ) )); context.add(new FrozenDimensionBoundRuleSource( - ResourceLocation.withDefaultNamespace("the_nether"), + new ResourceLocation("the_nether"), SurfaceRules.sequence( SurfaceRules.ifTrue( SurfaceRules.isBiome(Biomes.WARPED_FOREST), diff --git a/src/testmod/resources/fabric.mod.json b/src/testmod/resources/fabric.mod.json index d13793bd6..3aeed3838 100644 --- a/src/testmod/resources/fabric.mod.json +++ b/src/testmod/resources/fabric.mod.json @@ -31,7 +31,7 @@ "depends": { "fabricloader": ">=0.14.22", "fabric-api": ">=0.90.0", - "minecraft": "~1.21-", + "minecraft": "~1.20.2-", "java": ">=21" }, "breaks": {