diff --git a/common/src/main/java/org/samo_lego/taterzens/commands/edit/TypeCommand.java b/common/src/main/java/org/samo_lego/taterzens/commands/edit/TypeCommand.java index a01ebb293..7217276a3 100644 --- a/common/src/main/java/org/samo_lego/taterzens/commands/edit/TypeCommand.java +++ b/common/src/main/java/org/samo_lego/taterzens/commands/edit/TypeCommand.java @@ -17,7 +17,6 @@ import net.minecraft.world.entity.EntityType; import org.samo_lego.taterzens.Taterzens; import org.samo_lego.taterzens.commands.NpcCommand; -import org.samo_lego.taterzens.compatibility.DisguiseLibCompatibility; import static net.minecraft.commands.Commands.argument; import static net.minecraft.commands.Commands.literal; @@ -57,7 +56,7 @@ public static void registerNode(LiteralCommandNode editNode, private static int changeType(CommandContext context) throws CommandSyntaxException { CommandSourceStack source = context.getSource(); - if(!DISGUISELIB_LOADED) { + if (!DISGUISELIB_LOADED) { source.sendFailure(translate("advert.disguiselib.required") .withStyle(ChatFormatting.RED) .withStyle(style -> style @@ -79,7 +78,7 @@ private static int changeType(CommandContext context) throws nbt.putString("id", disguise.toString()); EntityType.loadEntityRecursive(nbt, source.getLevel(), (entityx) -> { - DisguiseLibCompatibility.disguiseAs(taterzen, entityx); + Taterzens.getInstance().getPlatform().disguiseAs(taterzen, entityx); source.sendSuccess(() -> translate( "taterzens.command.entity_type.set", @@ -105,7 +104,7 @@ private static int resetType(CommandContext context) throws return -1; } return NpcCommand.selectedTaterzenExecutor(source.getEntityOrException(), taterzen -> { - DisguiseLibCompatibility.clearDisguise(taterzen); + Taterzens.getInstance().getPlatform().clearDisguise(taterzen); source.sendSuccess(() -> successText("taterzens.command.entity_type.reset", taterzen.getName().getString()), false diff --git a/common/src/main/java/org/samo_lego/taterzens/compatibility/DisguiseLibCompatibility.java b/common/src/main/java/org/samo_lego/taterzens/compatibility/DisguiseLibCompatibility.java deleted file mode 100644 index e01f030f0..000000000 --- a/common/src/main/java/org/samo_lego/taterzens/compatibility/DisguiseLibCompatibility.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.samo_lego.taterzens.compatibility; - -import net.minecraft.world.entity.Entity; -import org.samo_lego.taterzens.npc.TaterzenNPC; -import xyz.nucleoid.disguiselib.api.EntityDisguise; - -/** - * Just DisguiseLib methods in their own - * class, in order to make - * the mod run without the lib as well. - */ -public class DisguiseLibCompatibility { - - public static void disguiseAs(TaterzenNPC taterzen, Entity entity) { - ((EntityDisguise) taterzen).disguiseAs(entity); - } - - public static void clearDisguise(TaterzenNPC taterzen) { - ((EntityDisguise) taterzen).removeDisguise(); - } -} diff --git a/common/src/main/java/org/samo_lego/taterzens/platform/Platform.java b/common/src/main/java/org/samo_lego/taterzens/platform/Platform.java index 6fea45e7f..14d013640 100644 --- a/common/src/main/java/org/samo_lego/taterzens/platform/Platform.java +++ b/common/src/main/java/org/samo_lego/taterzens/platform/Platform.java @@ -2,6 +2,8 @@ import net.minecraft.commands.CommandSourceStack; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import org.samo_lego.taterzens.npc.TaterzenNPC; import java.nio.file.Path; @@ -45,4 +47,9 @@ public abstract class Platform { public void openEditorGui(ServerPlayer player) { } + + + public abstract void disguiseAs(TaterzenNPC taterzen, Entity entity); + + public abstract void clearDisguise(TaterzenNPC taterzen); } diff --git a/fabric/src/main/java/org/samo_lego/taterzens/fabric/platform/FabricPlatform.java b/fabric/src/main/java/org/samo_lego/taterzens/fabric/platform/FabricPlatform.java index f3805b691..9d2c0029d 100644 --- a/fabric/src/main/java/org/samo_lego/taterzens/fabric/platform/FabricPlatform.java +++ b/fabric/src/main/java/org/samo_lego/taterzens/fabric/platform/FabricPlatform.java @@ -8,12 +8,14 @@ import net.minecraft.core.Registry; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityDimensions; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.MobCategory; import org.samo_lego.taterzens.fabric.mixin.AMappedRegistry; import org.samo_lego.taterzens.npc.TaterzenNPC; import org.samo_lego.taterzens.platform.Platform; +import xyz.nucleoid.disguiselib.api.EntityDisguise; import java.nio.file.Path; import java.util.Collections; @@ -78,4 +80,15 @@ public void openEditorGui(ServerPlayer player) { SimpleGui editorGUI = createCommandGui(player, null, npcNode, Collections.singletonList("npc"), false); editorGUI.open(); } + + @Override + public void disguiseAs(TaterzenNPC taterzen, Entity entity) { + ((EntityDisguise) taterzen).disguiseAs(entity); + } + + @Override + public void clearDisguise(TaterzenNPC taterzen) { + ((EntityDisguise) taterzen).removeDisguise(); + } + } diff --git a/forge/src/main/java/org/samo_lego/taterzens/forge/platform/ForgePlatform.java b/forge/src/main/java/org/samo_lego/taterzens/forge/platform/ForgePlatform.java index 5743f854b..d391b80be 100644 --- a/forge/src/main/java/org/samo_lego/taterzens/forge/platform/ForgePlatform.java +++ b/forge/src/main/java/org/samo_lego/taterzens/forge/platform/ForgePlatform.java @@ -51,6 +51,16 @@ public void registerTaterzenType() { .build(NPC_ID.getPath())); } + @Override + public void clearDisguise(TaterzenNPC taterzen) { + + } + + @Override + public void disguiseAs(TaterzenNPC taterzen, Entity entity) { + + } + @Override public void openEditorGui(ServerPlayer player) { player.sendSystemMessage(TextUtil.translate("taterzens.gui.forge")); diff --git a/gradle.properties b/gradle.properties index 0e796f19a..a30b8756d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,9 +8,8 @@ loader_version=0.14.22 #Fabric api fabric_version=0.86.1+1.20.1 - #Forge -forge_version=46.0.12 +forge_version=47.1.43 enable_forge=true # Mod Properties mod_version=1.11.7