Turn Up/Down & Grave Compat

This commit is contained in:
skippyall
2025-04-12 19:08:25 +02:00
parent 8007778c39
commit cc69b22aba
5 changed files with 58 additions and 1 deletions
@@ -0,0 +1,20 @@
package io.github.skippyall.minions.mixins;
import com.llamalad7.mixinextras.sugar.Local;
import eu.pb4.graves.grave.Grave;
import io.github.skippyall.minions.minion.fakeplayer.MinionFakePlayer;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(Grave.class)
public class GraveCompatMixin {
@ModifyArg(method = "createBlock", at = @At(value = "INVOKE", target = "Leu/pb4/graves/grave/Grave;<init>(JLcom/mojang/authlib/GameProfile;BLnet/minecraft/util/Arm;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Identifier;Leu/pb4/graves/grave/GraveType;JJILnet/minecraft/text/Text;Ljava/util/Collection;Ljava/util/Collection;ZI)V"))
private static boolean createGrave(boolean profile, @Local(argsOnly = true) ServerPlayerEntity player) {
if(player instanceof MinionFakePlayer) {
return false;
}
return profile;
}
}
@@ -39,13 +39,33 @@ public class MoveModule {
.thenAccept(degrees -> minion.getMinionActionPack().turn(-degrees, 0))
);
public static final SimpleCommand TURN_UP_COMMAND =
new SimpleCommand(
Text.literal("Turn Up"),
Text.literal("Turn a specific amount of degrees up"),
Items.COMPASS,
(player, minion) -> TextInput.inputFloat(player, Text.literal("Degrees"), "90")
.thenAccept(degrees -> minion.getMinionActionPack().turn(0, -degrees))
);
public static final SimpleCommand TURN_DOWN_COMMAND =
new SimpleCommand(
Text.literal("Turn Down"),
Text.literal("Turn a specific amount of degrees down"),
Items.COMPASS,
(player, minion) -> TextInput.inputFloat(player, Text.literal("Degrees"), "90")
.thenAccept(degrees -> minion.getMinionActionPack().turn(0, degrees))
);
public static final SimpleModuleItem MOVE_MODULE =
register(Identifier.of(Minions.MOD_ID, "move_module"),
List.of(),
List.of(
WALK_COMMAND,
TURN_RIGHT_COMMAND,
TURN_LEFT_COMMAND
TURN_LEFT_COMMAND,
TURN_UP_COMMAND,
TURN_DOWN_COMMAND
),
Items.IRON_BOOTS
);