1.21.3 + Actions!
This commit is contained in:
@@ -82,6 +82,12 @@ public class EntityPlayerActionPack
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityPlayerActionPack stop(ActionType type) {
|
||||
Action previous = actions.remove(type);
|
||||
if (previous != null) type.stop(player, previous);
|
||||
return this;
|
||||
}
|
||||
|
||||
public EntityPlayerActionPack setSneaking(boolean doSneak)
|
||||
{
|
||||
sneaking = doSneak;
|
||||
@@ -314,12 +320,12 @@ public class EntityPlayerActionPack
|
||||
BlockHitResult blockHit = (BlockHitResult) hit;
|
||||
BlockPos pos = blockHit.getBlockPos();
|
||||
Direction side = blockHit.getSide();
|
||||
if (pos.getY() < player.getWorld().getTopY() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos))
|
||||
if (pos.getY() < player.getServerWorld().getTopYInclusive() - (side == Direction.UP ? 1 : 0) && world.canPlayerModifyAt(player, pos))
|
||||
{
|
||||
ActionResult result = player.interactionManager.interactBlock(player, world, player.getStackInHand(hand), hand, blockHit);
|
||||
if (result.isAccepted())
|
||||
if (result instanceof ActionResult.Success success)
|
||||
{
|
||||
if (result.shouldSwingHand()) player.swingHand(hand);
|
||||
if (success.swingSource() == ActionResult.SwingSource.SERVER) player.swingHand(hand);
|
||||
ap.itemUseCooldown = 3;
|
||||
return true;
|
||||
}
|
||||
@@ -402,7 +408,7 @@ public class EntityPlayerActionPack
|
||||
boolean blockBroken = false;
|
||||
if (player.interactionManager.getGameMode().isCreative())
|
||||
{
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY(), -1);
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopYInclusive(), -1);
|
||||
ap.blockHitDelay = 5;
|
||||
blockBroken = true;
|
||||
}
|
||||
@@ -410,9 +416,9 @@ public class EntityPlayerActionPack
|
||||
{
|
||||
if (ap.currentBlock != null)
|
||||
{
|
||||
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.getWorld().getTopY(), -1);
|
||||
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, side, player.getWorld().getTopYInclusive(), -1);
|
||||
}
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopY(), -1);
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, side, player.getWorld().getTopYInclusive(), -1);
|
||||
boolean notAir = !state.isAir();
|
||||
if (notAir && ap.curBlockDamageMP == 0)
|
||||
{
|
||||
@@ -435,7 +441,7 @@ public class EntityPlayerActionPack
|
||||
ap.curBlockDamageMP += state.calcBlockBreakingDelta(player, player.getWorld(), pos);
|
||||
if (ap.curBlockDamageMP >= 1)
|
||||
{
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.getWorld().getTopY(), -1);
|
||||
player.interactionManager.processBlockBreakingAction(pos, PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, side, player.getWorld().getTopYInclusive(), -1);
|
||||
ap.currentBlock = null;
|
||||
ap.blockHitDelay = 5;
|
||||
blockBroken = true;
|
||||
@@ -457,7 +463,7 @@ public class EntityPlayerActionPack
|
||||
EntityPlayerActionPack ap = ((ServerPlayerInterface) player).getActionPack();
|
||||
if (ap.currentBlock == null) return;
|
||||
player.getWorld().setBlockBreakingInfo(-1, ap.currentBlock, -1);
|
||||
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.getWorld().getTopY(), -1);
|
||||
player.interactionManager.processBlockBreakingAction(ap.currentBlock, PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, Direction.DOWN, player.getWorld().getTopYInclusive(), -1);
|
||||
ap.currentBlock = null;
|
||||
}
|
||||
},
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraft.network.DisconnectionInfo;
|
||||
import net.minecraft.network.NetworkSide;
|
||||
import net.minecraft.network.packet.c2s.common.SyncedClientOptions;
|
||||
import net.minecraft.network.packet.c2s.play.ClientStatusC2SPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityPositionS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntityPositionSyncS2CPacket;
|
||||
import net.minecraft.network.packet.s2c.play.EntitySetHeadYawS2CPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.ServerTask;
|
||||
@@ -42,6 +42,7 @@ import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.TeleportTarget;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@@ -78,13 +79,13 @@ public class MinionFakePlayer extends ServerPlayerEntity {
|
||||
instance.programmable = canProgram;
|
||||
instance.fixStartingPosition = () -> instance.refreshPositionAndAngles(pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
|
||||
server.getPlayerManager().onPlayerConnect(new FakeClientConnection(NetworkSide.SERVERBOUND), instance, new ConnectedClientData(profile, 0, instance.getClientOptions(), false));
|
||||
instance.teleport(level, pos.x, pos.y, pos.z, (float) yaw, (float) pitch);
|
||||
instance.teleport(level, pos.x, pos.y, pos.z, Set.of(), (float) yaw, (float) pitch, true);
|
||||
instance.setHealth(20.0F);
|
||||
instance.unsetRemoved();
|
||||
instance.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT).setBaseValue(0.6F);
|
||||
instance.getAttributeInstance(EntityAttributes.STEP_HEIGHT).setBaseValue(0.6F);
|
||||
instance.interactionManager.changeGameMode(GameMode.SURVIVAL);
|
||||
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(instance, (byte) (instance.headYaw * 256 / 360)), level.getRegistryKey());//instance.dimension);
|
||||
server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), level.getRegistryKey());//instance.dimension);
|
||||
server.getPlayerManager().sendToDimension(EntityPositionSyncS2CPacket.create(instance), level.getRegistryKey());//instance.dimension);
|
||||
//instance.world.getChunkManager(). updatePosition(instance);
|
||||
instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes)
|
||||
instance.getAbilities().flying = false;
|
||||
@@ -116,14 +117,14 @@ public class MinionFakePlayer extends ServerPlayerEntity {
|
||||
server.getPlayerManager().onPlayerConnect(new FakeClientConnection(NetworkSide.SERVERBOUND), instance, new ConnectedClientData(profile, 0, instance.getClientOptions(), false));
|
||||
System.out.println(instance.getPos());
|
||||
if(pos != null && rot != null) {
|
||||
instance.teleport(level, pos.x, pos.y, pos.z, rot.x, rot.y);
|
||||
instance.teleport(level, pos.x, pos.y, pos.z, Set.of(), rot.x, rot.y, true);
|
||||
}
|
||||
instance.setVelocity(0,0,0);
|
||||
instance.setHealth(20.0F);
|
||||
instance.unsetRemoved();
|
||||
instance.interactionManager.changeGameMode(GameMode.SURVIVAL);
|
||||
server.getPlayerManager().sendToDimension(new EntitySetHeadYawS2CPacket(instance, (byte) (instance.headYaw * 256 / 360)), level.getRegistryKey());//instance.dimension);
|
||||
server.getPlayerManager().sendToDimension(new EntityPositionS2CPacket(instance), level.getRegistryKey());//instance.dimension);
|
||||
server.getPlayerManager().sendToDimension(EntityPositionSyncS2CPacket.create(instance), level.getRegistryKey());//instance.dimension);
|
||||
//instance.world.getChunkManager(). updatePosition(instance);
|
||||
instance.dataTracker.set(PLAYER_MODEL_PARTS, (byte) 0x7f); // show all model layers (incl. capes)
|
||||
instance.getAbilities().flying = false;
|
||||
@@ -259,7 +260,7 @@ public class MinionFakePlayer extends ServerPlayerEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity teleportTo(TeleportTarget target)
|
||||
public ServerPlayerEntity teleportTo(TeleportTarget target)
|
||||
{
|
||||
super.teleportTo(target);
|
||||
if (notInAnyWorld) {
|
||||
@@ -316,7 +317,7 @@ public class MinionFakePlayer extends ServerPlayerEntity {
|
||||
@Override
|
||||
protected void drop(ServerWorld world, DamageSource damageSource) {
|
||||
super.drop(world, damageSource);
|
||||
dropStack(toItemStack());
|
||||
dropStack(world, toItemStack());
|
||||
}
|
||||
|
||||
private ItemStack toItemStack() {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.github.skippyall.minions.fakeplayer;
|
||||
|
||||
import net.minecraft.entity.player.PlayerPosition;
|
||||
import net.minecraft.network.ClientConnection;
|
||||
import net.minecraft.network.packet.Packet;
|
||||
import net.minecraft.network.packet.s2c.play.PositionFlag;
|
||||
@@ -33,9 +34,9 @@ public class NetHandlerPlayServerFake extends ServerPlayNetworkHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTeleport(double d, double e, double f, float g, float h, Set<PositionFlag> set)
|
||||
public void requestTeleport(PlayerPosition pos, Set<PositionFlag> set)
|
||||
{
|
||||
super.requestTeleport(d, e, f, g, h, set);
|
||||
super.requestTeleport(pos, set);
|
||||
if (player.getServerWorld().getPlayerByUuid(player.getUuid()) != null) {
|
||||
syncWithPlayerPosition();
|
||||
player.getServerWorld().getChunkManager().updatePosition(player);
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class TextInput {
|
||||
public static CompletableFuture<String> inputText(ServerPlayerEntity player, Text title, String defaultText) {
|
||||
@@ -24,4 +25,23 @@ public class TextInput {
|
||||
gui.open();
|
||||
return future;
|
||||
}
|
||||
|
||||
public static <T> CompletableFuture<T> inputParse(ServerPlayerEntity player, Text title, String defaultValue, Function<String, T> parser, Text failureMessage) {
|
||||
return inputText(player, title, String.valueOf(defaultValue)).thenCompose(string -> {
|
||||
try {
|
||||
return CompletableFuture.completedFuture(parser.apply(string));
|
||||
} catch (Exception e) {
|
||||
player.sendMessage(failureMessage);
|
||||
return CompletableFuture.failedFuture(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static CompletableFuture<Integer> inputInt(ServerPlayerEntity player, Text title, String defaultValue) {
|
||||
return inputParse(player, title, defaultValue, Integer::parseInt, Text.translatable("minions.command.input.int.fail"));
|
||||
}
|
||||
|
||||
public static CompletableFuture<Float> inputFloat(ServerPlayerEntity player, Text title, String defaultValue) {
|
||||
return inputParse(player, title, defaultValue, Float::parseFloat, Text.translatable("minions.command.input.float.fail"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.math.Vec2f;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import xyz.nucleoid.packettweaker.PacketContext;
|
||||
|
||||
public class MinionItem extends Item implements PolymerItem {
|
||||
private final boolean canProgram;
|
||||
@@ -28,13 +29,13 @@ public class MinionItem extends Item implements PolymerItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
|
||||
public Item getPolymerItem(ItemStack itemStack, PacketContext player) {
|
||||
return Items.ARMOR_STAND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPolymerItemStack(ItemStack stack, TooltipType tooltipType, RegistryWrapper.WrapperLookup lookup, ServerPlayerEntity player) {
|
||||
ItemStack out = PolymerItemUtils.createItemStack(stack, lookup, player);
|
||||
public ItemStack getPolymerItemStack(ItemStack stack, TooltipType tooltipType, PacketContext player) {
|
||||
ItemStack out = PolymerItemUtils.createItemStack(stack, tooltipType, player);
|
||||
out.set(DataComponentTypes.ENCHANTMENT_GLINT_OVERRIDE, true);
|
||||
return out;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import eu.pb4.sgui.api.gui.SimpleGui;
|
||||
import io.github.skippyall.minions.command.CommandExecutor;
|
||||
import io.github.skippyall.minions.fakeplayer.EntityPlayerActionPack;
|
||||
import io.github.skippyall.minions.fakeplayer.MinionFakePlayer;
|
||||
import io.github.skippyall.minions.input.TextInput;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.screen.ScreenHandlerType;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
@@ -15,8 +16,19 @@ public class ActionModules {
|
||||
minion.getMinionActionPack().start(actionType, EntityPlayerActionPack.Action.once());
|
||||
}
|
||||
|
||||
public static void intervalExecutor(EntityPlayerActionPack.ActionType actionType, ServerPlayerEntity player, MinionFakePlayer minion) {
|
||||
minion.getMinionActionPack().start(actionType, EntityPlayerActionPack.Action.interval());
|
||||
public static void executeContinuous(EntityPlayerActionPack.ActionType actionType, ServerPlayerEntity player, MinionFakePlayer minion) {
|
||||
minion.getMinionActionPack().start(actionType, EntityPlayerActionPack.Action.continuous());
|
||||
}
|
||||
|
||||
public static void executeInterval(EntityPlayerActionPack.ActionType actionType, ServerPlayerEntity player, MinionFakePlayer minion) {
|
||||
TextInput.inputFloat(player, Text.translatable("minions.command.action.interval.enter"), "3.5").thenAccept(interval -> {
|
||||
int ticks = Math.round(interval * 20);
|
||||
minion.getMinionActionPack().start(actionType, EntityPlayerActionPack.Action.interval(ticks));
|
||||
});
|
||||
}
|
||||
|
||||
public static void executeStop(EntityPlayerActionPack.ActionType actionType, ServerPlayerEntity player, MinionFakePlayer minion) {
|
||||
minion.getMinionActionPack().stop(actionType);
|
||||
}
|
||||
|
||||
public static CommandExecutor detailSelectionExecutor(EntityPlayerActionPack.ActionType actionType, Text actionName) {
|
||||
@@ -29,6 +41,21 @@ public class ActionModules {
|
||||
.setName(Text.translatable("minions.command.action.once", actionName))
|
||||
.setCallback(() -> executeOnce(actionType, player, minion))
|
||||
);
|
||||
gui.setSlot(3, new GuiElementBuilder()
|
||||
.setItem(Items.REPEATING_COMMAND_BLOCK)
|
||||
.setName(Text.translatable("minions.command.action.continuous", actionName))
|
||||
.setCallback(() -> executeContinuous(actionType, player, minion))
|
||||
);
|
||||
gui.setSlot(5, new GuiElementBuilder()
|
||||
.setItem(Items.CHAIN_COMMAND_BLOCK)
|
||||
.setName(Text.translatable("minions.command.action.interval", actionName))
|
||||
.setCallback(() -> executeInterval(actionType, player, minion))
|
||||
);
|
||||
gui.setSlot(3, new GuiElementBuilder()
|
||||
.setItem(Items.BARRIER)
|
||||
.setName(Text.translatable("minions.command.action.stop", actionName))
|
||||
.setCallback(() -> executeStop(actionType, player, minion))
|
||||
);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,11 @@ import java.util.List;
|
||||
import static io.github.skippyall.minions.module.Modules.register;
|
||||
|
||||
public class MobSpawningModule {
|
||||
public static final SimpleModuleItem MOB_SPAWNING_MODULE = register(Identifier.of(Minions.MOD_ID, "mob_spawning_module"), new SimpleModuleItem(List.of(), List.of(), Items.SPAWNER));
|
||||
public static final SimpleModuleItem MOB_SPAWNING_MODULE =
|
||||
register(
|
||||
Identifier.of(Minions.MOD_ID, "mob_spawning_module"),
|
||||
new SimpleModuleItem(List.of(), List.of(), Items.SPAWNER)
|
||||
);
|
||||
|
||||
public static boolean canMinionSpawnMobs(MinionFakePlayer minion) {
|
||||
return minion.getModuleInventory().hasModule(MOB_SPAWNING_MODULE);
|
||||
|
||||
@@ -6,19 +6,38 @@ import net.minecraft.item.Items;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static io.github.skippyall.minions.module.Modules.register;
|
||||
|
||||
public class MountModule {
|
||||
public static final SimpleModuleItem MOUNT_MODULE = register(Identifier.of(Minions.MOD_ID, "mount_module"),
|
||||
new SimpleModuleItem(new ArrayList<>(), Arrays.asList(
|
||||
new SimpleCommand(Text.of("Mount"), Text.of("Mount the minion to the nearest mountable Entity"), Items.MINECART, (player, minion) -> minion.getMinionActionPack().mount(true)),
|
||||
new SimpleCommand(Text.of("Dismount"), Text.of("Dismount the minion"), Items.BARRIER, (player, minion) -> minion.getMinionActionPack().dismount())
|
||||
), Items.MINECART)
|
||||
public static final SimpleCommand MOUNT_COMMAND = new SimpleCommand(
|
||||
Text.of("Mount"),
|
||||
Text.of("Mount the minion to the nearest mountable Entity"),
|
||||
Items.MINECART,
|
||||
(player, minion) -> minion.getMinionActionPack().mount(true)
|
||||
);
|
||||
|
||||
public static void registerMe() {}
|
||||
public static final SimpleCommand DISMOUNT_COMMAND = new SimpleCommand(
|
||||
Text.of("Dismount"),
|
||||
Text.of("Dismount the minion"),
|
||||
Items.BARRIER,
|
||||
(player, minion) -> minion.getMinionActionPack().dismount()
|
||||
);
|
||||
|
||||
public static final SimpleModuleItem MOUNT_MODULE =
|
||||
register(Identifier.of(Minions.MOD_ID, "mount_module"),
|
||||
new SimpleModuleItem(
|
||||
List.of(),
|
||||
List.of(
|
||||
MOUNT_COMMAND,
|
||||
DISMOUNT_COMMAND
|
||||
),
|
||||
Items.MINECART
|
||||
)
|
||||
);
|
||||
|
||||
public static void registerMe() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,43 +12,45 @@ import java.util.List;
|
||||
import static io.github.skippyall.minions.module.Modules.register;
|
||||
|
||||
public class MoveModule {
|
||||
public static final SimpleCommand WALK_COMMAND = new SimpleCommand(Text.literal("Walk"), Text.literal("Walk a specific amount of blocks forward"), Items.IRON_BOOTS, (player, minion) -> {
|
||||
TextInput.inputText(player, Text.literal("Amount of Blocks"), "1")
|
||||
.thenAccept(string -> {
|
||||
try {
|
||||
float blocks = Float.parseFloat(string);
|
||||
minion.moveForward(blocks);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(Text.literal("No valid number"));
|
||||
}
|
||||
});
|
||||
});
|
||||
public static final SimpleCommand WALK_COMMAND =
|
||||
new SimpleCommand(
|
||||
Text.literal("Walk"),
|
||||
Text.literal("Walk a specific amount of blocks forward"),
|
||||
Items.IRON_BOOTS,
|
||||
(player, minion) -> TextInput.inputFloat(player, Text.literal("Amount of Blocks"), "1")
|
||||
.thenAccept(minion::moveForward)
|
||||
);
|
||||
|
||||
public static final SimpleCommand TURN_RIGHT_COMMAND = new SimpleCommand(Text.literal("Turn Right"), Text.literal("Turn a specific amount of degrees right"), Items.COMPASS, ((player, minion) -> {
|
||||
TextInput.inputText(player, Text.literal("Degrees"), "90")
|
||||
.thenAccept(string -> {
|
||||
try {
|
||||
float degrees = Float.parseFloat(string);
|
||||
minion.getMinionActionPack().turn(degrees, 0);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(Text.literal("No valid number"));
|
||||
}
|
||||
});
|
||||
}));
|
||||
public static final SimpleCommand TURN_RIGHT_COMMAND =
|
||||
new SimpleCommand(
|
||||
Text.literal("Turn Right"),
|
||||
Text.literal("Turn a specific amount of degrees right"),
|
||||
Items.COMPASS,
|
||||
(player, minion) -> TextInput.inputFloat(player, Text.literal("Degrees"), "90")
|
||||
.thenAccept(degrees -> minion.getMinionActionPack().turn(degrees, 0))
|
||||
);
|
||||
|
||||
public static final SimpleCommand TURN_LEFT_COMMAND = new SimpleCommand(Text.literal("Turn Left"), Text.literal("Turn a specific amount of degrees left"), Items.COMPASS, ((player, minion) -> {
|
||||
TextInput.inputText(player, Text.literal("Degrees"), "90")
|
||||
.thenAccept(string -> {
|
||||
try {
|
||||
float degrees = Float.parseFloat(string);
|
||||
minion.getMinionActionPack().turn(-degrees, 0);
|
||||
} catch (NumberFormatException e) {
|
||||
player.sendMessage(Text.literal("No valid number"));
|
||||
}
|
||||
});
|
||||
}));
|
||||
public static final SimpleCommand TURN_LEFT_COMMAND =
|
||||
new SimpleCommand(
|
||||
Text.literal("Turn Left"),
|
||||
Text.literal("Turn a specific amount of degrees left"),
|
||||
Items.COMPASS,
|
||||
(player, minion) -> TextInput.inputFloat(player, Text.literal("Degrees"), "90")
|
||||
.thenAccept(degrees -> minion.getMinionActionPack().turn(-degrees, 0))
|
||||
);
|
||||
|
||||
public static final SimpleModuleItem MOVE_MODULE = register(Identifier.of(Minions.MOD_ID, "move_module"), new SimpleModuleItem(List.of(), List.of(WALK_COMMAND, TURN_RIGHT_COMMAND, TURN_LEFT_COMMAND), Items.IRON_BOOTS));
|
||||
public static final SimpleModuleItem MOVE_MODULE =
|
||||
register(Identifier.of(Minions.MOD_ID, "move_module"),
|
||||
new SimpleModuleItem(
|
||||
List.of(),
|
||||
List.of(
|
||||
WALK_COMMAND,
|
||||
TURN_RIGHT_COMMAND,
|
||||
TURN_LEFT_COMMAND
|
||||
),
|
||||
Items.IRON_BOOTS
|
||||
)
|
||||
);
|
||||
|
||||
public static void registerMe() {}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,7 @@ import io.github.skippyall.minions.command.Command;
|
||||
import io.github.skippyall.minions.program.block.CodeBlock;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import xyz.nucleoid.packettweaker.PacketContext;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -33,7 +32,7 @@ public class SimpleModuleItem extends Item implements PolymerItem, ModuleItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
|
||||
public Item getPolymerItem(ItemStack itemStack, PacketContext context) {
|
||||
return vanillaItem;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user