From 249bb8ba80dcff8ae4b9279b55c9742448d78fba Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Tue, 28 May 2024 08:31:44 +0100 Subject: [PATCH 1/5] fix: opening map via sidebar button was ignoring gamestage limits https://github.com/FTBTeam/FTB-Mods-Issues/issues/185 --- .../ftb/mods/ftbchunks/client/FTBChunksClient.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 8dd4a405..1ecdd8ff 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -319,12 +319,14 @@ public boolean skipBlock(BlockState state) { } public EventResult customClick(CustomClickEvent event) { - if (event.id().equals(BUTTON_ID_MAP)) { - openGui(); - return EventResult.interruptTrue(); - } else if (event.id().equals(BUTTON_ID_CLAIM)) { - ChunkScreen.openChunkScreen(); - return EventResult.interruptTrue(); + if (FTBChunksWorldConfig.playerHasMapStage(Minecraft.getInstance().player)) { + if (event.id().equals(BUTTON_ID_MAP)) { + openGui(); + return EventResult.interruptTrue(); + } else if (event.id().equals(BUTTON_ID_CLAIM)) { + ChunkScreen.openChunkScreen(); + return EventResult.interruptTrue(); + } } return EventResult.pass(); From 7e3fdf6f15a20c542beaa5d8b5f8e7ec5d618456 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Mon, 10 Jun 2024 10:37:25 +0100 Subject: [PATCH 2/5] build: version -> 2006.1.1, changelog updated --- CHANGELOG.md | 5 +++++ gradle.properties | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index edff620a..2b1f88ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2006.1.1] + +### Fixed +* Fixed the sidebar map buttons ignoring any GameStages restrictions in force + ## [2006.1.0] ### Changed diff --git a/gradle.properties b/gradle.properties index 6c1f538d..6eea1869 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,7 +5,7 @@ org.gradle.daemon=false mod_id=ftbchunks archives_base_name=ftb-chunks maven_group=dev.ftb.mods -mod_version=2006.1.0 +mod_version=2006.1.1 mod_author=FTB Team minecraft_version=1.20.6 From 0363b14af6b00d81cd66b8c7e0129d402bb549cc Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Sun, 16 Jun 2024 13:50:58 +0100 Subject: [PATCH 3/5] feat: port to 1.21 & migrate to mpp --- build.gradle | 81 ++++++++- common/build.gradle | 35 +--- .../ftb/mods/ftbchunks/ColorMapLoader.java | 4 +- .../ftb/mods/ftbchunks/api/FTBChunksAPI.java | 2 +- .../ftbchunks/api/FTBChunksProperties.java | 28 ++- .../ftb/mods/ftbchunks/api/FTBChunksTags.java | 14 +- .../ftbchunks/client/FTBChunksClient.java | 159 +++++++++--------- .../client/FTBChunksRenderTypes.java | 7 +- .../ftbchunks/client/gui/ChunkScreen.java | 4 +- .../client/gui/WaypointEditorScreen.java | 2 +- .../ftbchunks/client/map/ChunkUpdateTask.java | 4 +- .../mods/ftbchunks/client/map/MapManager.java | 10 +- .../client/map/color/ColorUtils.java | 8 +- .../ftbchunks/client/mapicon/EntityIcons.java | 5 +- .../ftbchunks/data/ChunkTeamDataImpl.java | 2 +- .../mods/ftbchunks/data/TeamMemberData.java | 2 +- .../mods/ftbchunks/util/DimensionFilter.java | 5 +- fabric/build.gradle | 53 +----- .../client/fabric/FTBChunksClientImpl.java | 2 +- forge/build.gradle | 52 +----- gradle.properties | 23 +-- neoforge/build.gradle | 52 +----- .../mods/ftbchunks/neoforge/ForceLoading.java | 4 +- settings.gradle | 2 +- 24 files changed, 233 insertions(+), 327 deletions(-) diff --git a/build.gradle b/build.gradle index 5a0a8e98..84b03715 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false + id "me.modmuss50.mod-publish-plugin" version "0.5.1" } architectury { @@ -68,6 +69,84 @@ allprojects { java { withSourcesJar() } + + publishing { + repositories { + if (ftbPublishing.ftbToken) { + maven { + url ftbPublishing.ftbURL + credentials { + username = ftbPublishing.ftbUser + password = ftbPublishing.ftbToken + } + } + } + + if (ftbPublishing.sapsToken) { + maven { + url ftbPublishing.sapsURL + credentials { + username = ftbPublishing.sapsUser + password = ftbPublishing.sapsToken + } + } + } + } + } } -task curseforgePublish +publishMods { + dryRun = providers.environmentVariable("CURSEFORGE_KEY").getOrNull() == null + changelog = providers.environmentVariable("CHANGELOG").getOrElse("No changelog provided") + version = mod_version + + // TODO: Migrate to something else + def tag = providers.environmentVariable("TAG").getOrElse("release") + type = tag == "beta" ? BETA : (tag == "alpha" ? ALPHA : STABLE) + + def createOptions = (String projectName) -> { + publishOptions { + file = project.provider { project(":$projectName").tasks.remapJar }.flatMap { it.archiveFile } + displayName = "[${projectName.toUpperCase()}][${minecraft_version}] ${readable_name} ${mod_version}" + modLoaders.add(projectName.toLowerCase()) + } + } + + def fabricOptions = createOptions("fabric") + def neoForgeOptions = createOptions("neoforge") +// def forgeOptions = createOptions("forge") + + def curseForgeOptions = curseforgeOptions { + accessToken = providers.environmentVariable("CURSEFORGE_KEY") + minecraftVersions.add("${minecraft_version}") + javaVersions.add(JavaVersion.VERSION_21) + } + + curseforge("curseforgeFabric") { + from(curseForgeOptions, fabricOptions) + projectId = curseforge_id_fabric + requires('architectury-api') + requires('fabric-api') + requires('ftb-library-fabric') + requires('ftb-teams-fabric') + optional('ftb-ranks-fabric') + } + + curseforge("curseforgeNeoForge") { + from(curseForgeOptions, neoForgeOptions) + projectId = curseforge_id_forge + requires('architectury-api') + requires('ftb-library-forge') + requires('ftb-teams-forge') + optional('ftb-ranks-forge') + } + +// curseforge("curseforgeForge") { +// from(curseForgeOptions, forgeOptions) +// projectId = curseforge_id_forge +// requires('architectury-api') +// requires('ftb-library-forge') +// requires('ftb-teams-forge') +// optional('ftb-ranks-forge') +// } +} diff --git a/common/build.gradle b/common/build.gradle index 62bc7f0c..3deef3ec 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,13 +1,11 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" - modApi "dev.architectury:architectury:${rootProject.architectury_version}" + modApi "dev.architectury:architectury:${rootProject.architectury_api_version}" modImplementation("dev.ftb.mods:ftb-library:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams:${rootProject.ftb_teams_version}") { transitive = false } } -def ENV = System.getenv() - architectury { common(/* "forge", */ "fabric", "neoforge") } @@ -32,35 +30,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -// TODO: ask @maxneedssnacks -//afterEvaluate { -// tasks { -// remapJar { -// remapAccessWidener = false -// } -// } -//} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/ColorMapLoader.java b/common/src/main/java/dev/ftb/mods/ftbchunks/ColorMapLoader.java index 5d8eb66b..5d47d184 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/ColorMapLoader.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/ColorMapLoader.java @@ -32,7 +32,7 @@ protected JsonObject prepare(ResourceManager resourceManager, ProfilerFiller pro for (String namespace : resourceManager.getNamespaces()) { try { - for (Resource resource : resourceManager.getResourceStack(new ResourceLocation(namespace, "ftbchunks_block_colors.json"))) { + for (Resource resource : resourceManager.getResourceStack(ResourceLocation.fromNamespaceAndPath(namespace, "ftbchunks_block_colors.json"))) { try (Reader reader = new InputStreamReader(resource.open(), StandardCharsets.UTF_8)) { for (Map.Entry entry : gson.fromJson(reader, JsonObject.class).entrySet()) { if (entry.getKey().startsWith("#")) { @@ -91,7 +91,7 @@ protected void apply(JsonObject object, ResourceManager resourceManager, Profile BlockColor col = BlockColors.getFromType(entry.getValue().getAsString()); if (col != null) { - BLOCK_ID_TO_COLOR_MAP.put(new ResourceLocation(entry.getKey()), col); + BLOCK_ID_TO_COLOR_MAP.put(ResourceLocation.tryParse(entry.getKey()), col); } } } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksAPI.java b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksAPI.java index f05ee29e..af5dc4bb 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksAPI.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksAPI.java @@ -49,7 +49,7 @@ public static FTBChunksClientAPI clientApi() { * @return a new resource location */ public static ResourceLocation rl(String path) { - return new ResourceLocation(MOD_ID, path); + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); } /** diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksProperties.java b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksProperties.java index dd6e380c..b651ced0 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksProperties.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksProperties.java @@ -1,11 +1,9 @@ package dev.ftb.mods.ftbchunks.api; -import dev.ftb.mods.ftbchunks.FTBChunks; import dev.ftb.mods.ftbteams.api.property.BooleanProperty; import dev.ftb.mods.ftbteams.api.property.PrivacyMode; import dev.ftb.mods.ftbteams.api.property.PrivacyProperty; import dev.ftb.mods.ftbteams.api.property.StringListProperty; -import net.minecraft.resources.ResourceLocation; import java.util.ArrayList; @@ -14,34 +12,34 @@ */ public class FTBChunksProperties { public static final BooleanProperty ALLOW_ALL_FAKE_PLAYERS - = new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_fake_players"), false); + = new BooleanProperty(FTBChunksAPI.rl("allow_fake_players"), false); public static final StringListProperty ALLOW_NAMED_FAKE_PLAYERS - = new StringListProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_named_fake_players"), new ArrayList<>()); + = new StringListProperty(FTBChunksAPI.rl("allow_named_fake_players"), new ArrayList<>()); public static final BooleanProperty ALLOW_FAKE_PLAYERS_BY_ID - = new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_fake_players_by_id"), true); + = new BooleanProperty(FTBChunksAPI.rl("allow_fake_players_by_id"), true); public static final PrivacyProperty ENTITY_INTERACT_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("entity_interact_mode"), PrivacyMode.ALLIES); public static final PrivacyProperty NONLIVING_ENTITY_ATTACK_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "nonliving_entity_attack_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("nonliving_entity_attack_mode"), PrivacyMode.ALLIES); public static final BooleanProperty ALLOW_EXPLOSIONS - = new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_explosions"), false); + = new BooleanProperty(FTBChunksAPI.rl("allow_explosions"), false); public static final BooleanProperty ALLOW_MOB_GRIEFING - = new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_mob_griefing"), false); + = new BooleanProperty(FTBChunksAPI.rl("allow_mob_griefing"), false); public static final PrivacyProperty CLAIM_VISIBILITY - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "claim_visibility"), PrivacyMode.PUBLIC); + = new PrivacyProperty(FTBChunksAPI.rl("claim_visibility"), PrivacyMode.PUBLIC); public static final PrivacyProperty LOCATION_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "location_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("location_mode"), PrivacyMode.ALLIES); public static final BooleanProperty ALLOW_PVP - = new BooleanProperty(new ResourceLocation(FTBChunks.MOD_ID, "allow_pvp"), true); + = new BooleanProperty(FTBChunksAPI.rl("allow_pvp"), true); // FTB Chunks on Forge adds two separate block edit & interact properties public static final PrivacyProperty BLOCK_EDIT_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_edit_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("block_edit_mode"), PrivacyMode.ALLIES); public static final PrivacyProperty BLOCK_INTERACT_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_interact_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("block_interact_mode"), PrivacyMode.ALLIES); // FTB Chunks on Fabric adds a combined block edit & interact property public static final PrivacyProperty BLOCK_EDIT_AND_INTERACT_MODE - = new PrivacyProperty(new ResourceLocation(FTBChunks.MOD_ID, "block_edit_and_interact_mode"), PrivacyMode.ALLIES); + = new PrivacyProperty(FTBChunksAPI.rl("block_edit_and_interact_mode"), PrivacyMode.ALLIES); } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksTags.java b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksTags.java index 796e1722..3c0898db 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksTags.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/api/FTBChunksTags.java @@ -1,8 +1,6 @@ package dev.ftb.mods.ftbchunks.api; -import dev.ftb.mods.ftbchunks.FTBChunks; import net.minecraft.core.registries.Registries; -import net.minecraft.resources.ResourceLocation; import net.minecraft.tags.TagKey; import net.minecraft.world.entity.EntityType; import net.minecraft.world.item.Item; @@ -11,22 +9,22 @@ public class FTBChunksTags { public static class Blocks { public static final TagKey EDIT_WHITELIST_TAG - = TagKey.create(Registries.BLOCK, new ResourceLocation(FTBChunks.MOD_ID, "edit_whitelist")); + = TagKey.create(Registries.BLOCK, FTBChunksAPI.rl("edit_whitelist")); public static final TagKey INTERACT_WHITELIST_TAG - = TagKey.create(Registries.BLOCK, new ResourceLocation(FTBChunks.MOD_ID, "interact_whitelist")); + = TagKey.create(Registries.BLOCK, FTBChunksAPI.rl("interact_whitelist")); } public static class Items { public static final TagKey RIGHT_CLICK_BLACKLIST_TAG - = TagKey.create(Registries.ITEM, new ResourceLocation(FTBChunks.MOD_ID, "right_click_blacklist")); + = TagKey.create(Registries.ITEM, FTBChunksAPI.rl("right_click_blacklist")); public static final TagKey RIGHT_CLICK_WHITELIST_TAG - = TagKey.create(Registries.ITEM, new ResourceLocation(FTBChunks.MOD_ID, "right_click_whitelist")); + = TagKey.create(Registries.ITEM, FTBChunksAPI.rl("right_click_whitelist")); } public static class Entities { public static final TagKey> ENTITY_INTERACT_WHITELIST_TAG - = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "entity_interact_whitelist")); + = TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("entity_interact_whitelist")); public static final TagKey> NONLIVING_ENTITY_ATTACK_WHITELIST_TAG - = TagKey.create(Registries.ENTITY_TYPE, new ResourceLocation(FTBChunks.MOD_ID, "nonliving_entity_attack_whitelist")); + = TagKey.create(Registries.ENTITY_TYPE, FTBChunksAPI.rl("nonliving_entity_attack_whitelist")); } } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 1ecdd8ff..2cafe814 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -30,6 +30,7 @@ import dev.ftb.mods.ftbchunks.client.map.*; import dev.ftb.mods.ftbchunks.client.map.color.ColorUtils; import dev.ftb.mods.ftbchunks.client.mapicon.*; +import dev.ftb.mods.ftbchunks.data.ChunkSyncInfo; import dev.ftb.mods.ftbchunks.net.PartialPackets; import dev.ftb.mods.ftbchunks.net.SendGeneralDataPacket.GeneralChunkData; import dev.ftb.mods.ftblibrary.config.ColorConfig; @@ -52,10 +53,7 @@ import it.unimi.dsi.fastutil.ints.IntOpenHashSet; import it.unimi.dsi.fastutil.longs.Long2IntMap; import net.minecraft.ChatFormatting; -import net.minecraft.client.Camera; -import net.minecraft.client.KeyMapping; -import net.minecraft.client.Minecraft; -import net.minecraft.client.Screenshot; +import net.minecraft.client.*; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.PauseScreen; import net.minecraft.client.gui.screens.Screen; @@ -98,24 +96,22 @@ import java.util.*; -import dev.ftb.mods.ftbchunks.data.ChunkSyncInfo; - public enum FTBChunksClient { INSTANCE; - private static final ResourceLocation BUTTON_ID_MAP = new ResourceLocation("ftbchunks:open_gui"); - private static final ResourceLocation BUTTON_ID_CLAIM = new ResourceLocation("ftbchunks:open_claim_gui"); + private static final ResourceLocation BUTTON_ID_MAP = FTBChunksAPI.rl("open_gui"); + private static final ResourceLocation BUTTON_ID_CLAIM = FTBChunksAPI.rl("open_claim_gui"); - public static final ResourceLocation CIRCLE_MASK = new ResourceLocation("ftbchunks:textures/circle_mask.png"); - public static final ResourceLocation CIRCLE_BORDER = new ResourceLocation("ftbchunks:textures/circle_border.png"); - public static final ResourceLocation SQUARE_MASK = new ResourceLocation("ftbchunks:textures/square_mask.png"); - public static final ResourceLocation SQUARE_BORDER = new ResourceLocation("ftbchunks:textures/square_border.png"); - public static final ResourceLocation PLAYER = new ResourceLocation("ftbchunks:textures/player.png"); + public static final ResourceLocation CIRCLE_MASK = FTBChunksAPI.rl("textures/circle_mask.png"); + public static final ResourceLocation CIRCLE_BORDER = FTBChunksAPI.rl("textures/circle_border.png"); + public static final ResourceLocation SQUARE_MASK = FTBChunksAPI.rl("textures/square_mask.png"); + public static final ResourceLocation SQUARE_BORDER = FTBChunksAPI.rl("textures/square_border.png"); + public static final ResourceLocation PLAYER = FTBChunksAPI.rl("textures/player.png"); public static final ResourceLocation[] COMPASS = { - new ResourceLocation("ftbchunks:textures/compass_e.png"), - new ResourceLocation("ftbchunks:textures/compass_n.png"), - new ResourceLocation("ftbchunks:textures/compass_w.png"), - new ResourceLocation("ftbchunks:textures/compass_s.png"), + FTBChunksAPI.rl("textures/compass_e.png"), + FTBChunksAPI.rl("textures/compass_n.png"), + FTBChunksAPI.rl("textures/compass_w.png"), + FTBChunksAPI.rl("textures/compass_s.png"), }; public KeyMapping openMapKey; @@ -435,16 +431,18 @@ public int generateTextureId(int w, int h) { return textureId; } - public void renderHud(GuiGraphics graphics, float tickDelta) { + public void renderHud(GuiGraphics graphics, DeltaTracker tickDelta) { Minecraft mc = Minecraft.getInstance(); if (mc.player == null || mc.level == null || MapManager.getInstance().isEmpty() || MapDimension.getCurrent().isEmpty()) { return; } - double playerX = Mth.lerp(tickDelta, prevPlayerX, currentPlayerX); - double playerY = Mth.lerp(tickDelta, prevPlayerY, currentPlayerY); - double playerZ = Mth.lerp(tickDelta, prevPlayerZ, currentPlayerZ); + float partialTicks = tickDelta.getGameTimeDeltaPartialTick(false); + + double playerX = Mth.lerp(partialTicks, prevPlayerX, currentPlayerX); + double playerY = Mth.lerp(partialTicks, prevPlayerY, currentPlayerY); + double playerZ = Mth.lerp(partialTicks, prevPlayerZ, currentPlayerZ); double guiScale = mc.getWindow().getGuiScale(); int scaledWidth = mc.getWindow().getGuiScaledWidth(); int scaledHeight = mc.getWindow().getGuiScaledHeight(); @@ -541,7 +539,7 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { int alpha = FTBChunksClientConfig.MINIMAP_VISIBILITY.get(); Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder buffer = tessellator.getBuilder(); + BufferBuilder buffer = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); RenderSystem.enableDepthTest(); @@ -553,15 +551,15 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { // Draw the minimap cutout mask - see AdvancementTab for a vanilla example of using colorMask() RenderSystem.colorMask(false, false, false, false); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderColor(1F, 1F, 1F, 1F); RenderSystem.setShaderTexture(0, FTBChunksClientConfig.SQUARE_MINIMAP.get() ? SQUARE_MASK : CIRCLE_MASK); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - buffer.vertex(m, -halfSizeF + border, -halfSizeF + border, 0F).color(255, 255, 255, 255).uv(0F, 0F).endVertex(); - buffer.vertex(m, -halfSizeF + border, halfSizeF - border, 0F).color(255, 255, 255, 255).uv(0F, 1F).endVertex(); - buffer.vertex(m, halfSizeF - border, halfSizeF - border, 0F).color(255, 255, 255, 255).uv(1F, 1F).endVertex(); - buffer.vertex(m, halfSizeF - border, -halfSizeF + border, 0F).color(255, 255, 255, 255).uv(1F, 0F).endVertex(); - tessellator.end(); + buffer.addVertex(m, -halfSizeF + border, -halfSizeF + border, 0F).setColor(255, 255, 255, 255).setUv(0F, 0F); + buffer.addVertex(m, -halfSizeF + border, halfSizeF - border, 0F).setColor(255, 255, 255, 255).setUv(0F, 1F); + buffer.addVertex(m, halfSizeF - border, halfSizeF - border, 0F).setColor(255, 255, 255, 255).setUv(1F, 1F); + buffer.addVertex(m, halfSizeF - border, -halfSizeF + border, 0F).setColor(255, 255, 255, 255).setUv(1F, 0F); + BufferUploader.drawWithShader(buffer.buildOrThrow()); + RenderSystem.colorMask(true, true, true, true); // minimap rotation @@ -575,36 +573,36 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { float offZ = 0.5F + (float) ((MathUtils.mod(playerZ, 16D) / 16D - 0.5D) / (double) FTBChunks.TILES); float zws = 2F / (FTBChunks.TILES * zoom); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderTexture(0, minimapTextureId); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - buffer.vertex(m, -halfSizeBorderF, -halfSizeBorderF, 0F).color(255, 255, 255, alpha).uv(offX - zws, offZ - zws).endVertex(); - buffer.vertex(m, -halfSizeBorderF, halfSizeBorderF, 0F).color(255, 255, 255, alpha).uv(offX - zws, offZ + zws).endVertex(); - buffer.vertex(m, halfSizeBorderF, halfSizeBorderF, 0F).color(255, 255, 255, alpha).uv(offX + zws, offZ + zws).endVertex(); - buffer.vertex(m, halfSizeBorderF, -halfSizeBorderF, 0F).color(255, 255, 255, alpha).uv(offX + zws, offZ - zws).endVertex(); - tessellator.end(); + buffer = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(m, -halfSizeBorderF, -halfSizeBorderF, 0F).setColor(255, 255, 255, alpha).setUv(offX - zws, offZ - zws); + buffer.addVertex(m, -halfSizeBorderF, halfSizeBorderF, 0F).setColor(255, 255, 255, alpha).setUv(offX - zws, offZ + zws); + buffer.addVertex(m, halfSizeBorderF, halfSizeBorderF, 0F).setColor(255, 255, 255, alpha).setUv(offX + zws, offZ + zws); + buffer.addVertex(m, halfSizeBorderF, -halfSizeBorderF, 0F).setColor(255, 255, 255, alpha).setUv(offX + zws, offZ - zws); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.disableDepthTest(); RenderSystem.depthFunc(GL11.GL_LEQUAL); RenderSystem.defaultBlendFunc(); // draw the map border - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderTexture(0, FTBChunksClientConfig.SQUARE_MINIMAP.get() ? SQUARE_BORDER : CIRCLE_BORDER); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - buffer.vertex(m, -halfSizeF, -halfSizeF, 0F).color(255, 255, 255, alpha).uv(0F, 0F).endVertex(); - buffer.vertex(m, -halfSizeF, halfSizeF, 0F).color(255, 255, 255, alpha).uv(0F, 1F).endVertex(); - buffer.vertex(m, halfSizeF, halfSizeF, 0F).color(255, 255, 255, alpha).uv(1F, 1F).endVertex(); - buffer.vertex(m, halfSizeF, -halfSizeF, 0F).color(255, 255, 255, alpha).uv(1F, 0F).endVertex(); - tessellator.end(); + buffer = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(m, -halfSizeF, -halfSizeF, 0F).setColor(255, 255, 255, alpha).setUv(0F, 0F); + buffer.addVertex(m, -halfSizeF, halfSizeF, 0F).setColor(255, 255, 255, alpha).setUv(0F, 1F); + buffer.addVertex(m, halfSizeF, halfSizeF, 0F).setColor(255, 255, 255, alpha).setUv(1F, 1F); + buffer.addVertex(m, halfSizeF, -halfSizeF, 0F).setColor(255, 255, 255, alpha).setUv(1F, 0F); + BufferUploader.drawWithShader(buffer.buildOrThrow()); RenderSystem.setShader(GameRenderer::getPositionColorShader); - buffer.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); - buffer.vertex(m, -halfSizeF, 0, 0F).color(0, 0, 0, 30).endVertex(); - buffer.vertex(m, halfSizeF, 0, 0F).color(0, 0, 0, 30).endVertex(); - buffer.vertex(m, 0, -halfSizeF, 0F).color(0, 0, 0, 30).endVertex(); - buffer.vertex(m, 0, halfSizeF, 0F).color(0, 0, 0, 30).endVertex(); - tessellator.end(); + buffer = tessellator.begin(VertexFormat.Mode.DEBUG_LINES, DefaultVertexFormat.POSITION_COLOR); + buffer.addVertex(m, -halfSizeF, 0, 0F).setColor(0, 0, 0, 30); + buffer.addVertex(m, halfSizeF, 0, 0F).setColor(0, 0, 0, 30); + buffer.addVertex(m, 0, -halfSizeF, 0F).setColor(0, 0, 0, 30); + buffer.addVertex(m, 0, halfSizeF, 0F).setColor(0, 0, 0, 30); + BufferUploader.drawWithShader(buffer.buildOrThrow()); poseStack.popPose(); @@ -621,13 +619,13 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { MapIconEvent.MINIMAP.invoker().accept(new MapIconEvent(dim.dimension, mapIcons, MapType.MINIMAP)); if (mapIcons.size() >= 2) { - mapIcons.sort(new MapIconComparator(mc.player.position(), tickDelta)); + mapIcons.sort(new MapIconComparator(mc.player.position(), tickDelta.getGameTimeDeltaPartialTick(false))); } } for (MapIcon icon : mapIcons) { // map icons (waypoints, entities...) - Vec3 pos = icon.getPos(tickDelta); + Vec3 pos = icon.getPos(tickDelta.getGameTimeDeltaPartialTick(false)); double distance = MathUtils.dist(playerX, playerZ, pos.x, pos.z); double d = distance * scale * zoom; @@ -664,13 +662,13 @@ public void renderHud(GuiGraphics graphics, float tickDelta) { poseStack.scale(size / 16F, size / 16F, 1F); m = poseStack.last().pose(); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - buffer.vertex(m, -1, -1, 0).color(255, 255, 255, 200).uv(0F, 0F).endVertex(); - buffer.vertex(m, -1, 1, 0).color(255, 255, 255, 200).uv(0F, 1F).endVertex(); - buffer.vertex(m, 1, 1, 0).color(255, 255, 255, 200).uv(1F, 1F).endVertex(); - buffer.vertex(m, 1, -1, 0).color(255, 255, 255, 200).uv(1F, 0F).endVertex(); - tessellator.end(); + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); + buffer = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(m, -1, -1, 0).setColor(255, 255, 255, 200).setUv(0F, 0F); + buffer.addVertex(m, -1, 1, 0).setColor(255, 255, 255, 200).setUv(0F, 1F); + buffer.addVertex(m, 1, 1, 0).setColor(255, 255, 255, 200).setUv(1F, 1F); + buffer.addVertex(m, 1, -1, 0).setColor(255, 255, 255, 200).setUv(1F, 0F); + BufferUploader.drawWithShader(buffer.buildOrThrow()); poseStack.popPose(); } @@ -711,14 +709,14 @@ private void drawMinimapCompassPoints(float minimapRotation, int size, double ha float wx = (float) (minimapX + halfSizeD + Math.cos(angle) * d); float wy = (float) (minimapY + halfSizeD + Math.sin(angle) * d); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); + RenderSystem.setShader(GameRenderer::getPositionTexColorShader); RenderSystem.setShaderTexture(0, COMPASS[face]); - buffer.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - buffer.vertex(m, wx - ws, wy - ws, 0).color(255, 255, 255, 255).uv(0F, 0F).endVertex(); - buffer.vertex(m, wx - ws, wy + ws, 0).color(255, 255, 255, 255).uv(0F, 1F).endVertex(); - buffer.vertex(m, wx + ws, wy + ws, 0).color(255, 255, 255, 255).uv(1F, 1F).endVertex(); - buffer.vertex(m, wx + ws, wy - ws, 0).color(255, 255, 255, 255).uv(1F, 0F).endVertex(); - tessellator.end(); + buffer = tessellator.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX_COLOR); + buffer.addVertex(m, wx - ws, wy - ws, 0).setColor(255, 255, 255, 255).setUv(0F, 0F); + buffer.addVertex(m, wx - ws, wy + ws, 0).setColor(255, 255, 255, 255).setUv(0F, 1F); + buffer.addVertex(m, wx + ws, wy + ws, 0).setColor(255, 255, 255, 255).setUv(1F, 1F); + buffer.addVertex(m, wx + ws, wy - ws, 0).setColor(255, 255, 255, 255).setUv(1F, 0F); + BufferUploader.drawWithShader(buffer.buildOrThrow()); } } @@ -759,14 +757,14 @@ private List buildMinimapTextData(Minecraft mc, double playerX, doubl return res; } - private void drawInWorldIcons(Minecraft mc, GuiGraphics graphics, float tickDelta, double playerX, double playerY, double playerZ, int scaledWidth, int scaledHeight) { + private void drawInWorldIcons(Minecraft mc, GuiGraphics graphics, DeltaTracker tickDelta, double playerX, double playerY, double playerZ, int scaledWidth, int scaledHeight) { GuiHelper.setupDrawing(); float scaledWidth2 = scaledWidth / 2F; float scaledHeight2 = scaledHeight / 2F; InWorldMapIcon focusedIcon = null; for (MapIcon icon : mapIcons) { - Vec3 pos = icon.getPos(tickDelta); + Vec3 pos = icon.getPos(tickDelta.getGameTimeDeltaPartialTick(false)); double playerDist = MathUtils.dist(pos.x, pos.y, pos.z, playerX, playerY, playerZ); if (icon.isVisible(MapType.WORLD_ICON, playerDist, false)) { @@ -813,9 +811,14 @@ private void drawInWorldIcons(Minecraft mc, GuiGraphics graphics, float tickDelt } inWorldMapIcons.clear(); + + // Cleanup after the Gui.setupDrawing + RenderSystem.disableBlend(); + RenderSystem.setShaderColor(1F, 1F, 1F, 1F); + RenderSystem.disableDepthTest(); } - public void renderWorldLast(PoseStack poseStack, Matrix4f projectionMatrix, Matrix4f modelViewMatrix, Camera camera, float tickDelta) { + public void renderWorldLast(PoseStack poseStack, Matrix4f projectionMatrix, Matrix4f modelViewMatrix, Camera camera, DeltaTracker tickDelta) { Minecraft mc = Minecraft.getInstance(); if (mc.options.hideGui || MapManager.getInstance().isEmpty() || mc.level == null || mc.player == null @@ -873,20 +876,20 @@ private static void drawWaypointBeacon(PoseStack poseStack, Vec3 cameraPos, Vert Matrix4f m = poseStack.last().pose(); - depthBuffer.vertex(m, -s, yMin, s).color(r, g, b, alpha).uv(0F, 1F).endVertex(); - depthBuffer.vertex(m, -s, y1, s).color(r, g, b, alpha).uv(0F, 0F).endVertex(); - depthBuffer.vertex(m, s, y1, -s).color(r, g, b, alpha).uv(1F, 0F).endVertex(); - depthBuffer.vertex(m, s, yMin, -s).color(r, g, b, alpha).uv(1F, 1F).endVertex(); + depthBuffer.addVertex(m, -s, yMin, s).setColor(r, g, b, alpha).setUv(0F, 1F); + depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 0F); + depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 0F); + depthBuffer.addVertex(m, s, yMin, -s).setColor(r, g, b, alpha).setUv(1F, 1F); - depthBuffer.vertex(m, -s, y1, s).color(r, g, b, alpha).uv(0F, 1F).endVertex(); - depthBuffer.vertex(m, -s, y2, s).color(r, g, b, 0).uv(0F, 0F).endVertex(); - depthBuffer.vertex(m, s, y2, -s).color(r, g, b, 0).uv(1F, 0F).endVertex(); - depthBuffer.vertex(m, s, y1, -s).color(r, g, b, alpha).uv(1F, 1F).endVertex(); + depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 1F); + depthBuffer.addVertex(m, -s, y2, s).setColor(r, g, b, 0).setUv(0F, 0F); + depthBuffer.addVertex(m, s, y2, -s).setColor(r, g, b, 0).setUv(1F, 0F); + depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 1F); poseStack.popPose(); } - private List findVisibleWaypoints(Player player, float tickDelta) { + private List findVisibleWaypoints(Player player, DeltaTracker tickDelta) { return MapManager.getInstance().map(manager -> { List visibleWaypoints = new ArrayList<>(); @@ -911,7 +914,7 @@ private List findVisibleWaypoints(Player player, float tickDelta) } } - visibleWaypoints.sort(new MapIconComparator(player.position(), tickDelta)); + visibleWaypoints.sort(new MapIconComparator(player.position(), tickDelta.getGameTimeDeltaPartialTick(false))); return visibleWaypoints; }).orElse(List.of()); diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java index c6ad269c..5c62e044 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java @@ -2,6 +2,7 @@ import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.VertexFormat; +import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; import net.minecraft.client.renderer.RenderStateShard; import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; @@ -9,9 +10,9 @@ import java.util.OptionalDouble; public class FTBChunksRenderTypes extends RenderStateShard { - public static final ResourceLocation WAYPOINT_BEAM = new ResourceLocation("ftbchunks:textures/waypoint_beam.png"); + public static final ResourceLocation WAYPOINT_BEAM = FTBChunksAPI.rl("textures/waypoint_beam.png"); - public static final RenderType WAYPOINTS_DEPTH = RenderType.create("ftbchunks_waypoints_depth", DefaultVertexFormat.POSITION_COLOR_TEX, VertexFormat.Mode.QUADS, 256, false, false, RenderType.CompositeState.builder() + public static final RenderType WAYPOINTS_DEPTH = RenderType.create("ftbchunks_waypoints_depth", DefaultVertexFormat.POSITION_TEX_COLOR, VertexFormat.Mode.QUADS, 256, false, false, RenderType.CompositeState.builder() .setLineState(new LineStateShard(OptionalDouble.empty())) .setLayeringState(NO_LAYERING) .setTextureState(new TextureStateShard(WAYPOINT_BEAM, true, false)) @@ -24,4 +25,4 @@ public class FTBChunksRenderTypes extends RenderStateShard { private FTBChunksRenderTypes(String s, Runnable r0, Runnable r1) { super(s, r0, r1); } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreen.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreen.java index c6bd3739..986aba34 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreen.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/ChunkScreen.java @@ -6,6 +6,7 @@ import dev.ftb.mods.ftbchunks.FTBChunks; import dev.ftb.mods.ftbchunks.FTBChunksWorldConfig; import dev.ftb.mods.ftbchunks.api.ClaimResult; +import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; import dev.ftb.mods.ftbchunks.client.FTBChunksClient; import dev.ftb.mods.ftbchunks.client.map.MapChunk; import dev.ftb.mods.ftbchunks.client.map.MapDimension; @@ -32,7 +33,6 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.ChunkPos; import org.lwjgl.glfw.GLFW; @@ -42,7 +42,7 @@ import static dev.ftb.mods.ftbchunks.net.RequestChunkChangePacket.ChunkChangeOp; public class ChunkScreen extends BaseScreen { - private static final ImageIcon FORCE_LOAD_ICON = new ImageIcon(new ResourceLocation(FTBChunks.MOD_ID, "textures/force_loaded.png")); + private static final ImageIcon FORCE_LOAD_ICON = new ImageIcon(FTBChunksAPI.rl("textures/force_loaded.png")); private final MapDimension dimension; private final List chunkButtons = new ArrayList<>(); diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointEditorScreen.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointEditorScreen.java index bbe4b048..0d7adb1f 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointEditorScreen.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/gui/WaypointEditorScreen.java @@ -31,7 +31,7 @@ public class WaypointEditorScreen extends BaseScreen { public static final Color4I COLOR_BACKGROUND = Color4I.rgba(0xC0333333); - private static final Icon PEARL_ICON = ImageIcon.getIcon(new ResourceLocation("minecraft", "textures/item/ender_pearl.png")); + private static final Icon PEARL_ICON = ImageIcon.getIcon(ResourceLocation.fromNamespaceAndPath("minecraft", "textures/item/ender_pearl.png")); public static final Theme THEME = new Theme() { @Override diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/ChunkUpdateTask.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/ChunkUpdateTask.java index bffbfe98..44c356c1 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/ChunkUpdateTask.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/ChunkUpdateTask.java @@ -28,7 +28,7 @@ public class ChunkUpdateTask implements MapTask, BiomeManager.NoiseBiomeSource { array[i] = i; } }); - private static final ResourceLocation AIR = new ResourceLocation("minecraft:air"); + private static final ResourceLocation AIR = ResourceLocation.fromNamespaceAndPath("minecraft", "air"); private static long debugLastTime = 0L; private MapManager manager; @@ -177,4 +177,4 @@ public Holder getNoiseBiome(int x, int y, int z) { return level.getNoiseBiome(x, y, z); } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapManager.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapManager.java index d038d33c..c7d54620 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapManager.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/MapManager.java @@ -60,7 +60,7 @@ private MapManager(UUID serverId, Path directory) { needsSave = false; blockColorIndexMap = new Int2ObjectOpenHashMap<>(); - blockColorIndexMap.defaultReturnValue(new ResourceLocation("minecraft:air")); + blockColorIndexMap.defaultReturnValue(ResourceLocation.fromNamespaceAndPath("minecraft", "air")); blockColorIndexMapReverse = new Object2IntOpenHashMap<>(); blockColorIndexMapReverse.defaultReturnValue(0); biomeColorIndexMap = new Int2ObjectOpenHashMap<>(); @@ -78,7 +78,7 @@ private MapManager(UUID serverId, Path directory) { s = s.trim(); if (s.length() >= 3) { - ResourceKey key = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(s)); + ResourceKey key = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(s)); dimensions.put(key, new MapDimension(this, key, directory)); } } @@ -95,7 +95,7 @@ private MapManager(UUID serverId, Path directory) { if (!s.isEmpty()) { String[] s1 = s.split(" ", 2); int i = Integer.decode(s1[0]); - ResourceLocation loc = new ResourceLocation(s1[1]); + ResourceLocation loc = ResourceLocation.tryParse(s1[1]); blockColorIndexMap.put(i, loc); blockColorIndexMapReverse.put(loc, i); } @@ -113,7 +113,7 @@ private MapManager(UUID serverId, Path directory) { if (!s.isEmpty()) { String[] s1 = s.split(" ", 2); int i = Integer.decode(s1[0]); - ResourceLocation loc = new ResourceLocation(s1[1]); + ResourceLocation loc = ResourceLocation.tryParse(s1[1]); ResourceKey key = ResourceKey.create(Registries.BIOME, loc); biomeColorIndexMap.put(i, key); } @@ -360,4 +360,4 @@ public void checkForRegionPurge() { pendingRegionPurge = null; } } -} \ No newline at end of file +} diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/color/ColorUtils.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/color/ColorUtils.java index 6c492b94..d8c19395 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/color/ColorUtils.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/map/color/ColorUtils.java @@ -1,9 +1,9 @@ package dev.ftb.mods.ftbchunks.client.map.color; import com.mojang.blaze3d.platform.NativeImage; +import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; import dev.ftb.mods.ftblibrary.icon.Color4I; import net.minecraft.client.Minecraft; -import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FastColor; import net.minecraft.util.Mth; @@ -40,7 +40,7 @@ public static Color4I reduce(Color4I c) { if (reducedColorPalette == null) { reducedColorPalette = new Color4I[0]; - try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("ftbchunks:textures/reduced_color_palette.png")).orElseThrow().open()) { + try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(FTBChunksAPI.rl("textures/reduced_color_palette.png")).orElseThrow().open()) { NativeImage image = NativeImage.read(stream); int w = image.getWidth(); int h = image.getHeight(); @@ -90,7 +90,7 @@ public static Color4I[] getTopographyPalette() { if (topographyPalette == null) { topographyPalette = new Color4I[0]; - try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("ftbchunks:textures/topography_palette.png")).orElseThrow().open()) { + try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(FTBChunksAPI.rl("textures/topography_palette.png")).orElseThrow().open()) { NativeImage image = NativeImage.read(stream); int w = image.getWidth(); int h = image.getHeight(); @@ -116,7 +116,7 @@ public static Color4I[][] getLightMapPalette() { if (lightMapPalette == null) { lightMapPalette = new Color4I[0][0]; - try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(new ResourceLocation("ftbchunks:textures/lightmap_palette.png")).orElseThrow().open()) { + try (InputStream stream = Minecraft.getInstance().getResourceManager().getResource(FTBChunksAPI.rl("textures/lightmap_palette.png")).orElseThrow().open()) { NativeImage image = NativeImage.read(stream); int w = image.getWidth(); int h = image.getHeight(); diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityIcons.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityIcons.java index b15c1bb9..368cf6f3 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityIcons.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/mapicon/EntityIcons.java @@ -3,6 +3,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import dev.architectury.registry.registries.RegistrarManager; import dev.ftb.mods.ftbchunks.FTBChunks; +import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; import dev.ftb.mods.ftbchunks.client.FTBChunksClientConfig; import dev.ftb.mods.ftblibrary.icon.Color4I; import dev.ftb.mods.ftblibrary.icon.Icon; @@ -39,14 +40,14 @@ protected Map, Icon> prepare(ResourceManager resourceManager, Prof continue; } - ResourceLocation invisible = new ResourceLocation("ftbchunks:textures/faces/" + id.getNamespace() + "/" + id.getPath() + ".invisible"); + ResourceLocation invisible = FTBChunksAPI.rl("textures/faces/" + id.getNamespace() + "/" + id.getPath() + ".invisible"); if (resourceManager.getResource(invisible).isPresent()) { map.put(t, Color4I.empty()); continue; } - ResourceLocation texture = new ResourceLocation("ftbchunks:textures/faces/" + id.getNamespace() + "/" + id.getPath() + ".png"); + ResourceLocation texture = FTBChunksAPI.rl("textures/faces/" + id.getNamespace() + "/" + id.getPath() + ".png"); if (resourceManager.getResource(texture).isPresent()) { map.put(t, Icon.getIcon(texture)); diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java index b3eadcbf..ee05962c 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/ChunkTeamDataImpl.java @@ -383,7 +383,7 @@ public void deserializeNBT(CompoundTag tag) { CompoundTag chunksTag = tag.getCompound("chunks"); for (String key : chunksTag.getAllKeys()) { - ResourceKey dimKey = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(key)); + ResourceKey dimKey = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(key)); ListTag chunksListTag = chunksTag.getList(key, Tag.TAG_COMPOUND); for (int i = 0; i < chunksListTag.size(); i++) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/data/TeamMemberData.java b/common/src/main/java/dev/ftb/mods/ftbchunks/data/TeamMemberData.java index f0b24c6b..c99f4f59 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/data/TeamMemberData.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/data/TeamMemberData.java @@ -85,7 +85,7 @@ private static Set readOriginalClaims(CompoundTag tag) { Set res = new HashSet<>(); for (String dimStr : tag.getAllKeys()) { try { - ResourceKey dimKey = ResourceKey.create(Registries.DIMENSION, new ResourceLocation(dimStr)); + ResourceKey dimKey = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(dimStr)); Set cdpSet = new HashSet<>(); tag.getList(dimStr, Tag.TAG_COMPOUND).forEach(el -> { if (el instanceof CompoundTag c) { diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java b/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java index f3131d3e..a6e3f51f 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/util/DimensionFilter.java @@ -56,11 +56,12 @@ private static class WildcardedRLMatcher implements Predicate private final Set reslocs = new ObjectOpenHashSet<>(); public WildcardedRLMatcher(Collection toMatch) { + ResourceLocation location; for (String s : toMatch) { if (s.endsWith(":*")) { namespaces.add(s.split(":")[0]); - } else if (ResourceLocation.isValidResourceLocation(s)) { - reslocs.add(new ResourceLocation(s)); + } else if ((location = ResourceLocation.tryParse(s)) != null) { + reslocs.add(location); } } } diff --git a/fabric/build.gradle b/fabric/build.gradle index c54fbc37..27ead1d3 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,10 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } -def ENV = System.getenv() - architectury { platformSetupLoomIde() fabric() @@ -56,7 +53,7 @@ artifacts { dependencies { modApi "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}" modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}" - modApi "dev.architectury:architectury-fabric:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-fabric:${rootProject.architectury_api_version}" modImplementation("dev.ftb.mods:ftb-library-fabric:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams-fabric:${rootProject.ftb_teams_version}") { transitive = false } @@ -79,7 +76,7 @@ processResources { filesMatching("fabric.mod.json") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "fabricapiversion": project.fabric_api_version, "mcversion": project.minecraft_version, "ftblibraryversion": project.ftb_library_version, @@ -113,28 +110,6 @@ components.java { } } -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id_fabric - releaseType = ftbPublishing.relType - addGameVersion "Fabric" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'fabric-api' - requiredDependency 'ftb-library-fabric' - requiredDependency 'ftb-teams-fabric' - optionalDependency 'ftb-ranks-fabric' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } -} - publishing { publications { mavenForge(MavenPublication) { @@ -143,28 +118,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/fabric/src/main/java/dev/ftb/mods/ftbchunks/client/fabric/FTBChunksClientImpl.java b/fabric/src/main/java/dev/ftb/mods/ftbchunks/client/fabric/FTBChunksClientImpl.java index 9c557476..40b74061 100644 --- a/fabric/src/main/java/dev/ftb/mods/ftbchunks/client/fabric/FTBChunksClientImpl.java +++ b/fabric/src/main/java/dev/ftb/mods/ftbchunks/client/fabric/FTBChunksClientImpl.java @@ -11,7 +11,7 @@ public static void registerPlatform() { } private static void renderWorldLastFabric(WorldRenderContext context) { - FTBChunksClient.INSTANCE.renderWorldLast(context.matrixStack(), context.projectionMatrix(), context.positionMatrix(), context.camera(), context.tickDelta()); + FTBChunksClient.INSTANCE.renderWorldLast(context.matrixStack(), context.projectionMatrix(), context.positionMatrix(), context.camera(), context.tickCounter()); } public static boolean doesKeybindMatch(KeyMapping keyMapping, int keyCode, int scanCode, int modifiers) { diff --git a/forge/build.gradle b/forge/build.gradle index a853b1a1..c186bb4f 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -1,10 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } -def ENV = System.getenv() - architectury { platformSetupLoomIde() forge() @@ -36,7 +33,7 @@ artifacts { dependencies { forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}" - modApi "dev.architectury:architectury-forge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-forge:${rootProject.architectury_api_version}" modImplementation("dev.ftb.mods:ftb-library-forge:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams-forge:${rootProject.ftb_teams_version}") { transitive = false } @@ -58,7 +55,7 @@ processResources { filesMatching("META-INF/mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "forgeversion": project.forge_version, "forgeshortversion": project.forge_version.split("\\.")[0], "mcversion": project.minecraft_version, @@ -110,27 +107,6 @@ sourceSets.each { it.java.destinationDirectory = dir } -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id_forge - releaseType = ftbPublishing.relType - addGameVersion "Forge" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - requiredDependency 'ftb-teams-forge' - optionalDependency 'ftb-ranks-forge' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } -} - publishing { publications { mavenForge(MavenPublication) { @@ -139,28 +115,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/gradle.properties b/gradle.properties index 6eea1869..9d0ff3cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,22 +4,25 @@ org.gradle.daemon=false # Mod mod_id=ftbchunks archives_base_name=ftb-chunks +readable_name=FTB Chunks maven_group=dev.ftb.mods -mod_version=2006.1.1 mod_author=FTB Team -minecraft_version=1.20.6 +mod_version=2100.1.0 +minecraft_version=1.21 # Deps -forge_version=50.0.9 -neoforge_version=20.6.100-beta -neoforge_loader_version=1 -fabric_loader_version=0.15.10 -fabric_api_version=0.99.0+1.20.6 -architectury_version=12.1.3 +#forge_version=50.0.9 +neoforge_version=21.0.10-beta -ftb_library_version=2006.1.1 -ftb_teams_version=2006.1.0 +# https://maven.neoforged.net/#/releases/net/neoforged/fancymodloader/loader +neoforge_loader_version=4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.1+1.21 +architectury_api_version=13.0.1 + +ftb_library_version=2100.1.0-SNAPSHOT +ftb_teams_version=2100.1.0-SNAPSHOT curseforge_id_forge=314906 curseforge_id_fabric=472657 diff --git a/neoforge/build.gradle b/neoforge/build.gradle index b570c9a4..12ee8b3b 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -1,10 +1,7 @@ plugins { id "com.github.johnrengelman.shadow" version "7.0.0" - id "com.matthewprenger.cursegradle" version "1.4.0" } -def ENV = System.getenv() - architectury { platformSetupLoomIde() neoForge() @@ -36,7 +33,7 @@ repositories { dependencies { neoForge "net.neoforged:neoforge:${rootProject.neoforge_version}" - modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_version}" + modApi "dev.architectury:architectury-neoforge:${rootProject.architectury_api_version}" modImplementation("dev.ftb.mods:ftb-library-neoforge:${rootProject.ftb_library_version}") { transitive = false } modImplementation("dev.ftb.mods:ftb-teams-neoforge:${rootProject.ftb_teams_version}") { transitive = false } @@ -58,7 +55,7 @@ processResources { filesMatching("META-INF/neoforge.mods.toml") { expand "version": project.version, - "archversion": project.architectury_version, + "archversion": project.architectury_api_version, "neoforgeversion": project.neoforge_version, "neoforgeloaderversion": project.neoforge_loader_version, "mcversion": project.minecraft_version, @@ -104,27 +101,6 @@ components.java { } } -if (ENV.CURSEFORGE_KEY) { - curseforge { - apiKey = ENV.CURSEFORGE_KEY - project { - id = project.curseforge_id_forge - releaseType = ftbPublishing.relType - addGameVersion "NeoForge" - addGameVersion project.minecraft_version - mainArtifact(remapJar.archiveFile) - relations { - requiredDependency 'architectury-api' - requiredDependency 'ftb-library-forge' - requiredDependency 'ftb-teams-forge' - optionalDependency 'ftb-ranks-forge' - } - changelog = ENV.CHANGELOG // expected to exist if ENV.CURSEFORGE_KEY does - changelogType = 'markdown' - } - } -} - publishing { publications { mavenForge(MavenPublication) { @@ -133,28 +109,4 @@ publishing { from components.java } } - - repositories { - if (ftbPublishing.ftbToken) { - maven { - url ftbPublishing.ftbURL - credentials { - username = ftbPublishing.ftbUser - password = ftbPublishing.ftbToken - } - } - } - - if (ftbPublishing.sapsToken) { - maven { - url ftbPublishing.sapsURL - credentials { - username = ftbPublishing.sapsUser - password = ftbPublishing.sapsToken - } - } - } - } } - -rootProject.tasks.getByName("curseforgePublish").dependsOn tasks.getByName("curseforge") diff --git a/neoforge/src/main/java/dev/ftb/mods/ftbchunks/neoforge/ForceLoading.java b/neoforge/src/main/java/dev/ftb/mods/ftbchunks/neoforge/ForceLoading.java index df4ea70c..aec1d523 100644 --- a/neoforge/src/main/java/dev/ftb/mods/ftbchunks/neoforge/ForceLoading.java +++ b/neoforge/src/main/java/dev/ftb/mods/ftbchunks/neoforge/ForceLoading.java @@ -1,10 +1,10 @@ package dev.ftb.mods.ftbchunks.neoforge; import dev.ftb.mods.ftbchunks.FTBChunks; +import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; import dev.ftb.mods.ftbchunks.data.ClaimedChunkImpl; import dev.ftb.mods.ftbchunks.data.ClaimedChunkManagerImpl; import dev.ftb.mods.ftblibrary.math.ChunkDimPos; -import net.minecraft.resources.ResourceLocation; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.ChunkPos; import net.neoforged.bus.api.IEventBus; @@ -23,7 +23,7 @@ static void setup(IEventBus modEventBus) { } private static void registerTicketController(RegisterTicketControllersEvent event) { - ticketController = new TicketController(new ResourceLocation(FTBChunks.MOD_ID, "default"), ForceLoading::validateLoadedChunks); + ticketController = new TicketController(FTBChunksAPI.rl("default"), ForceLoading::validateLoadedChunks); event.register(ticketController); } diff --git a/settings.gradle b/settings.gradle index e070e314..81bf9345 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,4 +8,4 @@ pluginManagement { include "common", "fabric", /* "forge", */ "neoforge" -rootProject.name = 'FTB-Chunks-1.20.6' +rootProject.name = 'FTB-Chunks-1.21' From 7e1051dcddea5b94d2d5c58a1dd180e811679c28 Mon Sep 17 00:00:00 2001 From: Michael Hillcox Date: Sun, 16 Jun 2024 14:41:33 +0100 Subject: [PATCH 4/5] fix: use correct release task --- .github/workflows/release.yml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 715eb75b..5d42e34b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,7 +10,7 @@ jobs: !contains(github.event.head_commit.message, '[ciskip]') uses: FTBTeam/mods-meta/.github/workflows/standard-release.yml@main with: - curse-publish-task: curseforge + curse-publish-task: publishMods java-version: 21 secrets: ftb-maven-token: ${{ secrets.FTB_MAVEN_TOKEN }} diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ed1d832b..e7ba1508 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ #Tue Dec 19 01:11:27 EET 2017 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 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From 88d1de6f7942074abedc60658e8f9c70c0145444 Mon Sep 17 00:00:00 2001 From: Des Herriott Date: Mon, 17 Jun 2024 10:42:04 +0100 Subject: [PATCH 5/5] fix: made waypoint beams work again Now using vanilla's beacon beam render type, no need for a custom one --- .../ftbchunks/client/FTBChunksClient.java | 34 +++++++++++++------ .../client/FTBChunksRenderTypes.java | 28 --------------- 2 files changed, 23 insertions(+), 39 deletions(-) delete mode 100644 common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java index 2cafe814..b9155386 100644 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java +++ b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksClient.java @@ -60,6 +60,8 @@ import net.minecraft.client.player.AbstractClientPlayer; import net.minecraft.client.player.LocalPlayer; import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.core.BlockPos; import net.minecraft.core.GlobalPos; import net.minecraft.core.Holder; @@ -99,6 +101,7 @@ public enum FTBChunksClient { INSTANCE; + public static final ResourceLocation WAYPOINT_BEAM = FTBChunksAPI.rl("textures/waypoint_beam.png"); private static final ResourceLocation BUTTON_ID_MAP = FTBChunksAPI.rl("open_gui"); private static final ResourceLocation BUTTON_ID_CLAIM = FTBChunksAPI.rl("open_claim_gui"); @@ -843,7 +846,8 @@ public void renderWorldLast(PoseStack poseStack, Matrix4f projectionMatrix, Matr poseStack.pushPose(); poseStack.translate(-cameraPos.x, -cameraPos.y, -cameraPos.z); - VertexConsumer depthBuffer = mc.renderBuffers().bufferSource().getBuffer(FTBChunksRenderTypes.WAYPOINTS_DEPTH); + RenderType renderType = RenderType.beaconBeam(WAYPOINT_BEAM, true); + VertexConsumer depthBuffer = mc.renderBuffers().bufferSource().getBuffer(renderType); float y1 = (float) (cameraPos.y + 30D); float y2 = y1 + 70F; @@ -856,7 +860,7 @@ public void renderWorldLast(PoseStack poseStack, Matrix4f projectionMatrix, Matr poseStack.popPose(); - mc.renderBuffers().bufferSource().endBatch(FTBChunksRenderTypes.WAYPOINTS_DEPTH); + mc.renderBuffers().bufferSource().endBatch(renderType); } private static void drawWaypointBeacon(PoseStack poseStack, Vec3 cameraPos, VertexConsumer depthBuffer, float y1, float y2, int yMin, WaypointIcon waypoint) { @@ -876,15 +880,23 @@ private static void drawWaypointBeacon(PoseStack poseStack, Vec3 cameraPos, Vert Matrix4f m = poseStack.last().pose(); - depthBuffer.addVertex(m, -s, yMin, s).setColor(r, g, b, alpha).setUv(0F, 1F); - depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 0F); - depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 0F); - depthBuffer.addVertex(m, s, yMin, -s).setColor(r, g, b, alpha).setUv(1F, 1F); - - depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 1F); - depthBuffer.addVertex(m, -s, y2, s).setColor(r, g, b, 0).setUv(0F, 0F); - depthBuffer.addVertex(m, s, y2, -s).setColor(r, g, b, 0).setUv(1F, 0F); - depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 1F); + depthBuffer.addVertex(m, -s, yMin, s).setColor(r, g, b, alpha).setUv(0F, 1F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 0F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 0F). + setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, s, yMin, -s).setColor(r, g, b, alpha).setUv(1F, 1F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + + depthBuffer.addVertex(m, -s, y1, s).setColor(r, g, b, alpha).setUv(0F, 1F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, -s, y2, s).setColor(r, g, b, 0).setUv(0F, 0F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, s, y2, -s).setColor(r, g, b, 0).setUv(1F, 0F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); + depthBuffer.addVertex(m, s, y1, -s).setColor(r, g, b, alpha).setUv(1F, 1F) + .setOverlay(OverlayTexture.NO_OVERLAY).setLight(0xF000F0).setNormal(poseStack.last(), 0f, 1f, 0f); poseStack.popPose(); } diff --git a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java b/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java deleted file mode 100644 index 5c62e044..00000000 --- a/common/src/main/java/dev/ftb/mods/ftbchunks/client/FTBChunksRenderTypes.java +++ /dev/null @@ -1,28 +0,0 @@ -package dev.ftb.mods.ftbchunks.client; - -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.VertexFormat; -import dev.ftb.mods.ftbchunks.api.FTBChunksAPI; -import net.minecraft.client.renderer.RenderStateShard; -import net.minecraft.client.renderer.RenderType; -import net.minecraft.resources.ResourceLocation; - -import java.util.OptionalDouble; - -public class FTBChunksRenderTypes extends RenderStateShard { - public static final ResourceLocation WAYPOINT_BEAM = FTBChunksAPI.rl("textures/waypoint_beam.png"); - - public static final RenderType WAYPOINTS_DEPTH = RenderType.create("ftbchunks_waypoints_depth", DefaultVertexFormat.POSITION_TEX_COLOR, VertexFormat.Mode.QUADS, 256, false, false, RenderType.CompositeState.builder() - .setLineState(new LineStateShard(OptionalDouble.empty())) - .setLayeringState(NO_LAYERING) - .setTextureState(new TextureStateShard(WAYPOINT_BEAM, true, false)) - .setShaderState(RENDERTYPE_BEACON_BEAM_SHADER) - .setTransparencyState(TRANSLUCENT_TRANSPARENCY) - .setWriteMaskState(COLOR_WRITE) - .setCullState(CULL) - .createCompositeState(false)); - - private FTBChunksRenderTypes(String s, Runnable r0, Runnable r1) { - super(s, r0, r1); - } -}