Skip to content

Commit

Permalink
Minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
samolego committed Aug 5, 2023
1 parent c4429c4 commit 8b0a332
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -57,7 +56,7 @@ public static void registerNode(LiteralCommandNode<CommandSourceStack> editNode,

private static int changeType(CommandContext<CommandSourceStack> 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
Expand All @@ -79,7 +78,7 @@ private static int changeType(CommandContext<CommandSourceStack> 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",
Expand All @@ -105,7 +104,7 @@ private static int resetType(CommandContext<CommandSourceStack> 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
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8b0a332

Please sign in to comment.