Skip to content

Commit

Permalink
initial port to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
gliscowo committed Jun 1, 2022
1 parent cde7dad commit ce9f56d
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 33 deletions.
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
//file:noinspection GradlePackageVersionRange
plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'
id 'io.github.juuxel.loom-quiltflower-mini' version '1.2.1'
id 'io.github.juuxel.loom-quiltflower' version '1.7.1'
}

version = "${project.mod_version}+${project.minecraft_base_version}"
Expand Down
18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_base_version=1.18
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3
# check these on https://fabricmc.net/develop
minecraft_base_version=1.19
minecraft_version=1.19-pre3
yarn_mappings=1.19-pre3+build.4
loader_version=0.14.6
# Mod Properties
mod_version=0.2.13
maven_group=com.glisco
archives_base_name=isometric-renders
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.48.0+1.18.2
fabric_version=0.53.4+1.19

# https://maven.wispforest.io/io/wispforest/worldmesher/
worldmesher_version=0.2.6+1.18
worldmesher_version=0.2.7+1.19

# https://maven.wispforest.io/io/wispforest/exo/
exo_version=0.1.4+1.18
exo_version=0.1.4+1.19

# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.5.4+1.18
owo_version=0.7.3-pre9+1.19
4 changes: 0 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ pluginManagement {
url = 'https://maven.fabricmc.net/'
}
gradlePluginPortal()
maven {
name = 'Cotton'
url = 'https://server.bbkr.space/artifactory/libs-release/'
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.util.registry.DynamicRegistryManager;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.glfw.GLFW;
Expand All @@ -28,8 +30,9 @@ public class IsometricRendersClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
final var registryAccess = new CommandRegistryAccess(DynamicRegistryManager.BUILTIN.get());
IsoRenderCommand.register(ClientCommandManager.DISPATCHER, registryAccess);

IsoRenderCommand.register(ClientCommandManager.DISPATCHER);
ImageExporter.init();

HudRenderCallback.EVENT.register((matrixStack, tickDelta) -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import com.glisco.isometricrenders.screen.ItemAtlasRenderScreen;
import com.glisco.isometricrenders.util.RuntimeConfig;
import com.mojang.blaze3d.systems.RenderSystem;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.suggestion.SuggestionProvider;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.block.BlockState;
import net.minecraft.block.BlockWithEntity;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.MinecraftClient;
import net.minecraft.command.CommandRegistryAccess;
import net.minecraft.command.CommandSource;
import net.minecraft.command.argument.*;
import net.minecraft.entity.Entity;
Expand All @@ -27,7 +28,7 @@
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.hit.BlockHitResult;
Expand All @@ -42,8 +43,8 @@
import java.util.function.Function;

import static com.glisco.isometricrenders.util.Translate.msg;
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument;
import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument;
import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;

public class IsoRenderCommand {

Expand All @@ -58,7 +59,7 @@ public class IsoRenderCommand {

static {
CLIENT_SUMMONABLE_ENTITIES = (context, builder) -> CommandSource.suggestFromIdentifier(Registry.ENTITY_TYPE.stream().filter(EntityType::isSummonable),
builder, EntityType::getId, entityType -> new TranslatableText(Util.createTranslationKey("entity", EntityType.getId(entityType)))
builder, EntityType::getId, entityType -> Text.translatable(Util.createTranslationKey("entity", EntityType.getId(entityType)))
);

ITEM_GROUPS = (context, builder) ->
Expand All @@ -80,14 +81,14 @@ private static void cacheNamespaces() {
});
}

public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher) {
dispatcher.register(literal("isorender").then(literal("block").executes(context -> executeBlockTarget(context.getSource())).then(argument("block", BlockStateArgumentType.blockState()).executes(context -> {
public static void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess access) {
dispatcher.register(literal("isorender").then(literal("block").executes(context -> executeBlockTarget(context.getSource())).then(argument("block", BlockStateArgumentType.blockState(access)).executes(context -> {
final BlockStateArgument blockStateArgument = context.getArgument("block", BlockStateArgument.class);
final BlockState blockState = blockStateArgument.getBlockState();
return executeBlockState(context.getSource(), blockState, ((BlockStateArgumentAccessor) blockStateArgument).getData());
}))).then(literal("item").executes(context -> {
return executeItem(context.getSource(), context.getSource().getPlayer().getMainHandStack().copy());
}).then(argument("item", ItemStackArgumentType.itemStack()).executes(context -> {
}).then(argument("item", ItemStackArgumentType.itemStack(access)).executes(context -> {
final ItemStack stack = ItemStackArgumentType.getItemStackArgument(context, "item").createStack(1, false);
return executeItem(context.getSource(), stack);
}))).then(literal("entity").executes(context -> {
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/com/glisco/isometricrenders/util/Translate.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
package com.glisco.isometricrenders.util;

import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.MutableText;
import net.minecraft.text.TranslatableText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

public class Translate {

private static final String MESSAGE_PREFIX = "message.isometric-renders.prefix";

public static TranslatableText make(String key, Object... args) {
return new TranslatableText("message.isometric-renders." + key, args);
public static MutableText make(String key, Object... args) {
return Text.translatable("message.isometric-renders." + key, args);
}

public static TranslatableText gui(String key, Object... args) {
return new TranslatableText("gui.isometric-renders." + key, args);
public static MutableText gui(String key, Object... args) {
return Text.translatable("gui.isometric-renders." + key, args);
}

public static MutableText msg(String key, Object... args) {
return new TranslatableText(MESSAGE_PREFIX).append(make(key, args).formatted(Formatting.GRAY));
return Text.translatable(MESSAGE_PREFIX).append(make(key, args).formatted(Formatting.GRAY));
}

public static void commandFeedback(CommandContext<FabricClientCommandSource> context, String key, Object... args) {
Expand Down

0 comments on commit ce9f56d

Please sign in to comment.