Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.20 Port #476

Open
wants to merge 27 commits into
base: 1.18
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d6ef4a5
bump gradle
sisby-folk May 15, 2023
b322998
bump all versions to 1.19.2
sisby-folk May 15, 2023
1ecea78
bump arch loom and gradle to match
sisby-folk May 15, 2023
e0e484b
fix text construction
sisby-folk May 15, 2023
ccabdd6
Revert "bump arch loom and gradle to match"
sisby-folk May 15, 2023
5bca310
use loom 1.1
sisby-folk May 15, 2023
5eb1e0a
fix text and mixin target
sisby-folk May 15, 2023
0b23681
text and resource loader minor patches
sisby-folk May 15, 2023
2f97f7b
StructureFeature -> StructureType
sisby-folk May 15, 2023
36aa4a5
another resource stream fix
sisby-folk May 15, 2023
513678a
don't cache priorities (biome categories don't exist)
sisby-folk May 15, 2023
a72e943
Biome categories don't exist anymore (no fallbacks)
sisby-folk May 15, 2023
f23dbab
forge renamed their config screen
sisby-folk May 15, 2023
0b04430
some forge biome tags are now vanilla
sisby-folk May 15, 2023
a4c9380
not-my-typo: scaning -> scanning
sisby-folk May 15, 2023
a61ff06
fix literaltexts, remove commented code, remove unused method, use st…
sisby-folk May 24, 2023
8b7f924
smash guessFittingTextureSet
sisby-folk May 25, 2023
7db3f5a
accidentally used a private for a platform method
sisby-folk May 25, 2023
733485f
don't unnecessarily re-retrieve biome tag
sisby-folk Jun 12, 2023
d8b8ffc
fix biomeIsPlateau visibility
sisby-folk Jul 7, 2023
274d0f0
fix performance and clean
sisby-folk Oct 1, 2023
ec01126
fix biome access on forge
sisby-folk Oct 12, 2023
2307dc3
bump versions
sisby-folk Oct 14, 2023
3e73805
update to minecraft 1.20
sisby-folk Oct 14, 2023
2f49a90
update metadata
sisby-folk Oct 14, 2023
0d11e97
lower fapi version
sisby-folk Oct 15, 2023
885eaf7
fix marker creation text field
kallmetony Jan 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "0.12.0-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.1.+" apply false
id "me.shedaniel.unified-publishing" version "0.1.+"
id "maven-publish"
}
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/hunternif/mc/api/AtlasAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.registry.Registries;

import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -33,7 +33,7 @@ public static int getVersion() {
}

public static Item getAtlasItem() {
return Registry.ITEM.get(new Identifier("antiqueatlas:antique_atlas"));
return Registries.ITEM.get(new Identifier("antiqueatlas:antique_atlas"));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
import hunternif.mc.impl.atlas.core.GlobalTileDataHandler;
import hunternif.mc.impl.atlas.core.PlayerEventHandler;
import hunternif.mc.impl.atlas.core.TileDataHandler;
import hunternif.mc.impl.atlas.core.scaning.TileDetectorBase;
import hunternif.mc.impl.atlas.core.scaning.WorldScanner;
import hunternif.mc.impl.atlas.core.scanning.WorldScanner;
import hunternif.mc.impl.atlas.event.RecipeCraftedCallback;
import hunternif.mc.impl.atlas.event.RecipeCraftedHandler;
import hunternif.mc.impl.atlas.item.AntiqueAtlasItems;
Expand Down Expand Up @@ -55,8 +54,6 @@ public static AtlasIdData getAtlasIdData(World world) {
}

public static void init() {
TileDetectorBase.scanBiomeTypes();

AutoConfig.register(AntiqueAtlasConfig.class, JanksonConfigSerializer::new);
CONFIG = AutoConfig.getConfigHolder(AntiqueAtlasConfig.class).getConfig();

Expand Down
13 changes: 6 additions & 7 deletions common/src/main/java/hunternif/mc/impl/atlas/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceReloader;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;
import net.minecraft.util.registry.BuiltinRegistries;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.biome.Biome;

import java.util.Map;
Expand Down Expand Up @@ -63,15 +62,15 @@ public void initClient() {
* we need the ClientWorld loaded here.
*/
public static void assignCustomBiomeTextures(ClientWorld world) {
for (Map.Entry<RegistryKey<Biome>, Biome> biome : BuiltinRegistries.BIOME.getEntrySet()) {
Identifier id = BuiltinRegistries.BIOME.getId(biome.getValue());
for (Map.Entry<RegistryKey<Biome>, Biome> biome : world.getRegistryManager().get(RegistryKeys.BIOME).getEntrySet()) {
Identifier id = world.getRegistryManager().get(RegistryKeys.BIOME).getId(biome.getValue());
if (!TileTextureMap.instance().isRegistered(id)) {
TileTextureMap.instance().autoRegister(id, biome.getKey());
}
}

for (Map.Entry<RegistryKey<Biome>, Biome> entry : world.getRegistryManager().get(Registry.BIOME_KEY).getEntrySet()) {
Identifier id = world.getRegistryManager().get(Registry.BIOME_KEY).getId(entry.getValue());
for (Map.Entry<RegistryKey<Biome>, Biome> entry : world.getRegistryManager().get(RegistryKeys.BIOME).getEntrySet()) {
Identifier id = world.getRegistryManager().get(RegistryKeys.BIOME).getId(entry.getValue());
if (!TileTextureMap.instance().isRegistered(id)) {
TileTextureMap.instance().autoRegister(id, entry.getKey());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.registry.RegistryKey;
import net.minecraft.world.World;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.mojang.blaze3d.systems.RenderSystem;
import hunternif.mc.api.client.AtlasClientAPI;
import hunternif.mc.impl.atlas.AntiqueAtlasMod;
import hunternif.mc.impl.atlas.item.AntiqueAtlasItems;
import hunternif.mc.impl.atlas.client.gui.GuiAtlas;
import hunternif.mc.impl.atlas.core.WorldData;
import hunternif.mc.impl.atlas.item.AntiqueAtlasItems;
import hunternif.mc.impl.atlas.item.AtlasItem;
import hunternif.mc.impl.atlas.marker.DimensionMarkersData;
import hunternif.mc.impl.atlas.marker.Marker;
Expand All @@ -16,21 +16,20 @@
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3f;
import net.minecraft.world.World;
import org.joml.Quaternionf;
import org.lwjgl.opengl.GL11;

import java.util.List;

@Environment(EnvType.CLIENT)
public class OverlayRenderer extends DrawableHelper {
public class OverlayRenderer {
/**
* Number of blocks per chunk in minecraft. This is certianly stored
* somewhere else, but I couldn't be bothered to find it.
Expand Down Expand Up @@ -148,7 +147,7 @@ private void drawPlayer(VertexConsumerProvider buffer, MatrixStack matrices, int
matrices.push();

matrices.translate((int) ((GuiAtlas.WIDTH * 1.5F) / 2F), (int) ((GuiAtlas.HEIGHT * 1.5F) / 2F), 0);
matrices.multiply(new Quaternion(Vec3f.POSITIVE_Z, this.player.getHeadYaw() + 180, true));
matrices.multiply(new Quaternionf(RotationAxis.POSITIVE_Z.rotationDegrees(this.player.getHeadYaw() + 180)));
matrices.translate(-AntiqueAtlasMod.CONFIG.playerIconWidth / 2.0, -AntiqueAtlasMod.CONFIG.playerIconHeight / 2.0, 0);

Textures.PLAYER.drawWithLight(buffer, matrices, 0, 0, AntiqueAtlasMod.CONFIG.playerIconWidth, AntiqueAtlasMod.CONFIG.playerIconHeight, light);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public CompletableFuture<Map<Identifier, ITexture>> load(ResourceManager manager
return CompletableFuture.supplyAsync(() -> {
Map<Identifier, ITexture> textures = new HashMap<>();

for (Identifier id : manager.findResources("textures/gui/tiles", (s) -> s.endsWith(".png"))) {
for (Identifier id : manager.findResources("textures/gui/tiles", id -> id.toString().endsWith(".png")).keySet()) {
// id now contains the physical file path of the texture
try {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;
Expand Down Expand Up @@ -40,14 +41,14 @@ public CompletableFuture<Collection<TextureSet>> load(ResourceManager manager, P
Map<Identifier, TextureSet> sets = new HashMap<>();

try {
for (Identifier id : manager.findResources("atlas/texture_sets", (s) -> s.endsWith(".json"))) {
for (Identifier id : manager.findResources("atlas/texture_sets", id -> id.toString().endsWith(".json")).keySet()) {
Identifier texture_id = new Identifier(
id.getNamespace(),
id.getPath().replace("atlas/texture_sets/", "").replace(".json", "")
);

try {
Resource resource = manager.getResource(id);
Resource resource = manager.getResource(id).orElseThrow(IOException::new);
try (
InputStream stream = resource.getInputStream();
InputStreamReader reader = new InputStreamReader(stream)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import hunternif.mc.impl.atlas.AntiqueAtlasMod;
import hunternif.mc.impl.atlas.core.scaning.TileHeightType;
import hunternif.mc.impl.atlas.core.scanning.TileHeightType;
import hunternif.mc.impl.atlas.resource.ResourceReloadListener;
import hunternif.mc.impl.atlas.util.Log;
import net.fabricmc.api.EnvType;
Expand All @@ -13,6 +13,7 @@
import net.minecraft.util.Identifier;
import net.minecraft.util.profiler.Profiler;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collection;
Expand Down Expand Up @@ -45,11 +46,11 @@ public CompletableFuture<Map<Identifier, Identifier>> load(ResourceManager manag
Map<Identifier, Identifier> map = new HashMap<>();

try {
for (Identifier id : manager.findResources("atlas/tiles", (s) -> s.endsWith(".json"))) {
for (Identifier id : manager.findResources("atlas/tiles", id -> id.toString().endsWith(".json")).keySet()) {
Identifier tile_id = new Identifier(id.getNamespace(), id.getPath().replace("atlas/tiles/", "").replace(".json", ""));

try {
Resource resource = manager.getResource(id);
Resource resource = manager.getResource(id).orElseThrow(IOException::new);
try (InputStream stream = resource.getInputStream(); InputStreamReader reader = new InputStreamReader(stream)) {
JsonObject object = JsonParser.parseReader(reader).getAsJsonObject();

Expand Down
Loading
Loading