diff --git a/portals-api/src/main/java/net/quiltservertools/interdimensional/portals/PortalBlock.java b/portals-api/src/main/java/net/quiltservertools/interdimensional/portals/PortalBlock.java index c23e09b..20887bb 100644 --- a/portals-api/src/main/java/net/quiltservertools/interdimensional/portals/PortalBlock.java +++ b/portals-api/src/main/java/net/quiltservertools/interdimensional/portals/PortalBlock.java @@ -1,10 +1,7 @@ package net.quiltservertools.interdimensional.portals; import eu.pb4.polymer.block.VirtualBlock; -import net.minecraft.block.Block; -import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; -import net.minecraft.block.ShapeContext; +import net.minecraft.block.*; import net.minecraft.entity.Entity; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.state.StateManager; @@ -27,6 +24,11 @@ public Block getVirtualBlock() { return Blocks.NETHER_PORTAL; } + @Override + public BlockState getVirtualBlockState(BlockState state) { + return Blocks.NETHER_PORTAL.getDefaultState().with(NetherPortalBlock.AXIS, state.get(PortalBlock.AXIS)); + } + @Override public void sendPacketsAfterCreation(ServerPlayerEntity player, BlockPos pos, BlockState blockState) { VirtualBlock.super.sendPacketsAfterCreation(player, pos, blockState); diff --git a/src/main/kotlin/net/quiltservertools/interdimensional/command/DeleteCommand.kt b/src/main/kotlin/net/quiltservertools/interdimensional/command/DeleteCommand.kt index ec74cd0..5bb958d 100644 --- a/src/main/kotlin/net/quiltservertools/interdimensional/command/DeleteCommand.kt +++ b/src/main/kotlin/net/quiltservertools/interdimensional/command/DeleteCommand.kt @@ -1,23 +1,23 @@ package net.quiltservertools.interdimensional.command -import net.quiltservertools.interdimensional.world.RuntimeWorldManager.getHandle -import net.quiltservertools.interdimensional.world.RuntimeWorldManager.remove import com.mojang.brigadier.context.CommandContext import com.mojang.brigadier.tree.LiteralCommandNode import me.lucko.fabric.api.permissions.v0.Permissions -import net.minecraft.command.argument.DimensionArgumentType import net.minecraft.server.command.CommandManager import net.minecraft.server.command.ServerCommandSource import net.minecraft.server.world.ServerWorld +import net.quiltservertools.interdimensional.command.argument.ServerDimensionArgument +import net.quiltservertools.interdimensional.world.RuntimeWorldManager.getHandle +import net.quiltservertools.interdimensional.world.RuntimeWorldManager.remove object DeleteCommand : Command { override fun register(): LiteralCommandNode { return CommandManager.literal("delete") - .then(CommandManager.argument("dimension", DimensionArgumentType.dimension()) + .then(ServerDimensionArgument.dimension("dimension") .requires(Permissions.require("interdimensional.commands.delete", 4)) .executes { ctx: CommandContext -> delete( - DimensionArgumentType.getDimensionArgument(ctx, "dimension"), + ServerDimensionArgument.get(ctx, "dimension"), ctx.source ) }) diff --git a/src/main/kotlin/net/quiltservertools/interdimensional/command/PortalCommand.kt b/src/main/kotlin/net/quiltservertools/interdimensional/command/PortalCommand.kt index 0db3675..895927f 100644 --- a/src/main/kotlin/net/quiltservertools/interdimensional/command/PortalCommand.kt +++ b/src/main/kotlin/net/quiltservertools/interdimensional/command/PortalCommand.kt @@ -1,24 +1,21 @@ package net.quiltservertools.interdimensional.command -import net.quiltservertools.interdimensional.command.InterdimensionalCommand.success -import net.quiltservertools.interdimensional.world.Portal -import net.quiltservertools.interdimensional.world.PortalManager -import com.mojang.brigadier.arguments.BoolArgumentType import com.mojang.brigadier.arguments.StringArgumentType import com.mojang.brigadier.tree.LiteralCommandNode import me.lucko.fabric.api.permissions.v0.Permissions -import net.quiltservertools.interdimensional.portals.portal.PortalIgnitionSource import net.minecraft.command.argument.BlockStateArgument import net.minecraft.command.argument.BlockStateArgumentType -import net.minecraft.command.argument.ColorArgumentType -import net.minecraft.command.argument.DimensionArgumentType import net.minecraft.server.command.CommandManager.argument import net.minecraft.server.command.CommandManager.literal import net.minecraft.server.command.ServerCommandSource -import net.minecraft.server.world.ServerWorld import net.minecraft.util.Formatting import net.minecraft.util.Identifier +import net.quiltservertools.interdimensional.command.InterdimensionalCommand.success import net.quiltservertools.interdimensional.command.argument.PortalOptionsArgumentType +import net.quiltservertools.interdimensional.command.argument.ServerDimensionArgument +import net.quiltservertools.interdimensional.portals.portal.PortalIgnitionSource +import net.quiltservertools.interdimensional.world.Portal +import net.quiltservertools.interdimensional.world.PortalManager object PortalCommand : Command { override fun register(): LiteralCommandNode { @@ -27,10 +24,7 @@ object PortalCommand : Command { .then( literal("add").then( argument("name", StringArgumentType.string()).then( - argument( - "destination", - DimensionArgumentType.dimension() - ) + ServerDimensionArgument.dimension("dimension") .then( argument( "frame_block", @@ -40,7 +34,7 @@ object PortalCommand : Command { return@executes add( it.source, StringArgumentType.getString(it, "name"), - DimensionArgumentType.getDimensionArgument(it, "destination").registryKey.value, + ServerDimensionArgument.get(it, "destination").registryKey.value, BlockStateArgumentType.getBlockState(it, "frame_block"), "" ) @@ -52,7 +46,7 @@ object PortalCommand : Command { return@executes add( it.source, StringArgumentType.getString(it, "name"), - DimensionArgumentType.getDimensionArgument(it, "destination").registryKey.value, + ServerDimensionArgument.get(it, "destination").registryKey.value, BlockStateArgumentType.getBlockState(it, "frame_block"), StringArgumentType.getString(it, "options") )