Update to new LZ API. Switch to new Vector3d API
This commit is contained in:
parent
6852af1e5f
commit
ecb20540e4
16 changed files with 41 additions and 43 deletions
|
@ -3,7 +3,7 @@
|
|||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
|
||||
libzontreck=1201.11.022724.1602
|
||||
libzontreck=1201.13.041224.0752
|
||||
|
||||
## Environment Properties
|
||||
|
||||
|
@ -48,7 +48,7 @@ mod_name=Aria's Essentials
|
|||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=GPLv3
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1201.2.030324.2002
|
||||
mod_version=1201.2.041224.0757
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
|
|
|
@ -21,10 +21,8 @@ public class DelHomeCommand {
|
|||
Commands.literal("rmhome")
|
||||
.executes(c->rmHome(c.getSource(), "default"))
|
||||
.then(Commands.argument("nickname", StringArgumentType.string())
|
||||
.suggests(HomesSuggestionProvider.PROVIDER)
|
||||
.executes(c -> rmHome(c.getSource(), StringArgumentType.getString(c, "nickname")))
|
||||
)
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
|
|
|
@ -23,7 +23,7 @@ public class HomeCommand {
|
|||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("home").executes(c-> home(c.getSource(), "default"))
|
||||
.then(Commands.argument("nickname", StringArgumentType.string()).suggests(HomesSuggestionProvider.PROVIDER).executes(c -> home(c.getSource(), StringArgumentType.getString(c, "nickname")))));
|
||||
.then(Commands.argument("nickname", StringArgumentType.string())));
|
||||
|
||||
//dispatcher.register(Commands.literal("sethome").then(Commands.argument("nickname", StringArgumentType.string())).executes(command -> {
|
||||
//String arg = StringArgumentType.getString(command, "nickname");
|
||||
|
|
|
@ -17,8 +17,8 @@ import dev.zontreck.essentials.homes.Home;
|
|||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2i;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -69,7 +69,7 @@ public class SetHomeCommand {
|
|||
Vec3 position = p.position();
|
||||
Vec2 rot = p.getRotationVector();
|
||||
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.serverLevel());
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3d(position), new Vector2i(rot), p.serverLevel());
|
||||
BlockState bs = p.serverLevel().getBlockState(dest.Position.moveDown().asBlockPos());
|
||||
|
||||
Home newhome = new Home(p, homeName, dest, new ItemStack(p.getBlockStateOn().getBlock().asItem()));
|
||||
|
|
|
@ -2,7 +2,7 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
|
||||
import dev.zontreck.essentials.AriasEssentials;
|
||||
import dev.zontreck.essentials.configs.server.AEServerConfig;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -25,7 +25,7 @@ public class TeleportActioner
|
|||
|
||||
public static boolean isBlacklistedDimension(ServerLevel level)
|
||||
{
|
||||
WorldPosition pos = new WorldPosition(Vector3.ZERO, level);
|
||||
WorldPosition pos = new WorldPosition(Vector3d.ZERO, level);
|
||||
return AEServerConfig.getInstance().teleport.Blacklist.contains(pos.Dimension);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package dev.zontreck.essentials.commands.teleport;
|
|||
import java.time.Instant;
|
||||
import java.util.UUID;
|
||||
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -42,7 +42,7 @@ public class TeleportContainer implements Comparable{
|
|||
|
||||
public TeleportContainer(ServerPlayer f_p, Vec3 f_pos, Vec2 f_rot, ServerLevel f_dim) {
|
||||
SetTeleportDestination(f_p, f_pos, f_rot, f_dim);
|
||||
world_pos = new WorldPosition(new Vector3(f_pos), f_dim);
|
||||
world_pos = new WorldPosition(new Vector3d(f_pos), f_dim);
|
||||
}
|
||||
|
||||
private void SetTeleportDestination(ServerPlayer f_p, Vec3 f_pos, Vec2 f_rot, ServerLevel f_dim) {
|
||||
|
@ -50,7 +50,7 @@ public class TeleportContainer implements Comparable{
|
|||
Position = f_pos;
|
||||
Rotation = f_rot;
|
||||
Dimension = f_dim;
|
||||
world_pos = new WorldPosition(new Vector3(f_pos), f_dim);
|
||||
world_pos = new WorldPosition(new Vector3d(f_pos), f_dim);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
package dev.zontreck.essentials.commands.teleport;
|
||||
|
||||
import dev.zontreck.libzontreck.vectors.Vector2;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.api.Vector2;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2i;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -13,20 +14,20 @@ import net.minecraft.server.level.ServerLevel;
|
|||
**/
|
||||
public class TeleportDestination extends WorldPosition
|
||||
{
|
||||
public Vector2 Rotation;
|
||||
public Vector2i Rotation;
|
||||
|
||||
public TeleportDestination(CompoundTag tag) throws InvalidDeserialization
|
||||
{
|
||||
super(tag, true);
|
||||
Rotation = new Vector2(tag.getString("Rotation"));
|
||||
Rotation = Vector2i.parseString(tag.getString("Rotation"));
|
||||
}
|
||||
public TeleportDestination(Vector3 pos, Vector2 rot, String dim)
|
||||
public TeleportDestination(Vector3d pos, Vector2i rot, String dim)
|
||||
{
|
||||
super(pos, dim);
|
||||
Rotation = rot;
|
||||
}
|
||||
|
||||
public TeleportDestination(Vector3 pos, Vector2 rot, ServerLevel dim)
|
||||
public TeleportDestination(Vector3d pos, Vector2i rot, ServerLevel dim)
|
||||
{
|
||||
super(pos,dim);
|
||||
Rotation=rot;
|
||||
|
|
|
@ -15,8 +15,8 @@ import dev.zontreck.essentials.warps.Warp;
|
|||
import dev.zontreck.essentials.warps.WarpsProvider;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2i;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -50,7 +50,7 @@ public class RTPWarpCommand {
|
|||
Vec3 position = p.position();
|
||||
Vec2 rot = p.getRotationVector();
|
||||
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.serverLevel());
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3d(position), new Vector2i(rot), p.serverLevel());
|
||||
Warp warp = new Warp(p.getUUID(), string, true, true, dest, new ItemStack(p.getFeetBlockState().getBlock().asItem()));
|
||||
WarpCreatedEvent event = new WarpCreatedEvent(warp);
|
||||
if(MinecraftForge.EVENT_BUS.post(event))
|
||||
|
|
|
@ -15,8 +15,8 @@ import dev.zontreck.essentials.warps.Warp;
|
|||
import dev.zontreck.essentials.warps.WarpsProvider;
|
||||
import dev.zontreck.libzontreck.chat.ChatColor;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2i;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
@ -52,7 +52,7 @@ public class SetWarpCommand {
|
|||
Vec3 position = p.position();
|
||||
Vec2 rot = p.getRotationVector();
|
||||
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3(position), new Vector2(rot), p.serverLevel());
|
||||
TeleportDestination dest = new TeleportDestination(new Vector3d(position), new Vector2i(rot), p.serverLevel());
|
||||
BlockState bs = p.serverLevel().getBlockState(dest.Position.moveDown().asBlockPos());
|
||||
|
||||
Warp w = new Warp(p.getUUID(), string, false, true, dest, new ItemStack(bs.getBlock().asItem()));
|
||||
|
|
|
@ -15,7 +15,7 @@ import dev.zontreck.essentials.warps.Warp;
|
|||
import dev.zontreck.essentials.warps.WarpsProvider;
|
||||
import dev.zontreck.libzontreck.chat.Clickable;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
|
@ -69,7 +69,7 @@ public class WarpCommand {
|
|||
{
|
||||
return;
|
||||
}
|
||||
dest.Position = Vector3.ZERO;
|
||||
dest.Position = Vector3d.ZERO;
|
||||
RandomPositionFactory.beginRTP(p, f_dim);
|
||||
return;
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -30,7 +30,7 @@ import dev.zontreck.libzontreck.util.ChatHelpers;
|
|||
import dev.zontreck.libzontreck.util.heads.HeadCache;
|
||||
import dev.zontreck.libzontreck.util.heads.HeadUtilities;
|
||||
import dev.zontreck.libzontreck.vectors.Vector2i;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.network.chat.*;
|
||||
|
@ -118,7 +118,7 @@ public class WarpsCommand {
|
|||
TeleportDestination dest = warp.destination;
|
||||
if(warpType == 1)
|
||||
{
|
||||
dest.Position = Vector3.ZERO;
|
||||
dest.Position = Vector3d.ZERO;
|
||||
RandomPositionFactory.beginRTP(p, warp.destination.getActualDimension());
|
||||
chestGui.close();
|
||||
return;
|
||||
|
|
|
@ -38,7 +38,6 @@ public class ModBlockLootTablesProvider extends BlockLootSubProvider
|
|||
dropSelf(ModBlocks.CLINKER_BRICK_STAINED_BLOCK.get());
|
||||
createSlabItemTable(ModBlocks.CLINKER_BRICK_STAINED_SLAB);
|
||||
dropSelf(ModBlocks.CLINKER_BRICK_STAINED_STAIRS.get());
|
||||
dropSelf(ModBlocks.CLINKER_BRICK_SASTOR_CORNER_BLOCK.get());
|
||||
dropSelf(ModBlocks.CLINKER_BRICK_WALL.get());
|
||||
|
||||
dropSelf(ModBlocks.SLAG_BRICK_BLOCK.get());
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package dev.zontreck.essentials.events;
|
||||
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
|
|
@ -2,7 +2,8 @@ package dev.zontreck.essentials.rtp;
|
|||
|
||||
import dev.zontreck.ariaslib.util.Lists;
|
||||
import dev.zontreck.essentials.AriasEssentials;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3i;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -30,7 +31,7 @@ public class RTP {
|
|||
private int tries;
|
||||
|
||||
public RTP(ServerLevel level) {
|
||||
position = new WorldPosition(new Vector3(0, -60, 0), WorldPosition.getDim(level));
|
||||
position = new WorldPosition(new Vector3d(0, -60, 0), WorldPosition.getDim(level));
|
||||
dimension = position.getActualDimension();
|
||||
|
||||
if (position.getActualDimension().dimensionType().hasCeiling()) {
|
||||
|
@ -105,11 +106,11 @@ public class RTP {
|
|||
|
||||
Random rng = new Random(Instant.now().getEpochSecond());
|
||||
|
||||
Vector3 pos;
|
||||
Vector3d pos;
|
||||
BlockPos bpos;
|
||||
|
||||
do {
|
||||
pos = new Vector3(rng.nextDouble(0xFFFF), -60, rng.nextDouble(0xFFFF));
|
||||
pos = new Vector3d(rng.nextDouble(0xFFFF), -60, rng.nextDouble(0xFFFF));
|
||||
|
||||
pos = spiralPositions(pos);
|
||||
position.Position = pos;
|
||||
|
@ -124,18 +125,18 @@ public class RTP {
|
|||
ChunkStatus status = ChunkStatus.SPAWN;
|
||||
dimension.getChunk(bpos.getX() >> 4, bpos.getZ() >> 4, status);
|
||||
|
||||
Vector3 pos = new Vector3(dimension.getHeightmapPos(heightMapType, bpos));
|
||||
Vector3d pos = new Vector3d(dimension.getHeightmapPos(heightMapType, bpos));
|
||||
return dimension.getWorldBorder().isWithinBounds(pos.asBlockPos());
|
||||
}
|
||||
|
||||
private Vector3 spiralPositions(Vector3 position) {
|
||||
Vec3i posi = position.asMinecraftVec3i();
|
||||
private Vector3d spiralPositions(Vector3d position) {
|
||||
Vec3i posi = position.asVec3i();
|
||||
BlockPos startBlockPos = new BlockPos(posi.getX(), dimension.getSeaLevel(), posi.getZ());
|
||||
|
||||
for (BlockPos pos : BlockPos.spiralAround(startBlockPos, 16, Direction.WEST, Direction.NORTH)) {
|
||||
if (isSafe(pos)) {
|
||||
// Set the new position
|
||||
return new Vector3(pos);
|
||||
return new Vector3d(pos);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package dev.zontreck.essentials.rtp;
|
|||
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportActioner;
|
||||
import dev.zontreck.essentials.commands.teleport.TeleportContainer;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3d;
|
||||
import dev.zontreck.libzontreck.vectors.WorldPosition;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
|
@ -19,7 +19,7 @@ public class RandomPositionFactory {
|
|||
public static RTP beginRTPSearch(ServerLevel level)
|
||||
{
|
||||
RTP tmp = new RTP(level);
|
||||
tmp.position = new WorldPosition(new Vector3(0,0,0), WorldPosition.getDim(level));
|
||||
tmp.position = new WorldPosition(new Vector3d(0,0,0), WorldPosition.getDim(level));
|
||||
Thread tx = new Thread(new RandomPositionLocator(tmp));
|
||||
tx.setName("RTPTask");
|
||||
tx.start();
|
||||
|
|
|
@ -66,7 +66,7 @@ side="BOTH"
|
|||
[[dependencies.${mod_id}]]
|
||||
modId="libzontreck"
|
||||
mandatory=true
|
||||
versionRange="[1201.11,1201.12)"
|
||||
versionRange="[1201.13,1201.14)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue