Fixed most compiletime errors
This commit is contained in:
parent
e232184b68
commit
a974fab707
58 changed files with 449 additions and 679 deletions
|
@ -41,7 +41,9 @@ import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback;
|
|||
import com.google.common.base.Stopwatch;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class CommandRegistry {
|
||||
public static void register() {
|
||||
|
@ -62,45 +64,18 @@ public class CommandRegistry {
|
|||
)
|
||||
.then(Commands.literal("tpnext")
|
||||
.requires(source -> source.hasPermission(Commands.LEVEL_OWNERS))
|
||||
.executes(ctx -> teleportToNextBiome(ctx))
|
||||
.executes(CommandRegistry::teleportToNextBiome)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static final Map<Holder<Biome>, BlockState> biomeMap = new HashMap<>();
|
||||
private static final int biomeMapIdx = 0;
|
||||
private static final BlockState[] states = {
|
||||
Blocks.RED_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.BLUE_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.YELLOW_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.LIME_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.PINK_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.GREEN_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.WHITE_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.BLACK_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.ORANGE_STAINED_GLASS.defaultBlockState(),
|
||||
Blocks.LIGHT_BLUE_STAINED_GLASS.defaultBlockState()
|
||||
};
|
||||
private static final BlockState[] states2 = {
|
||||
Blocks.RED_CONCRETE.defaultBlockState(),
|
||||
Blocks.BLUE_CONCRETE.defaultBlockState(),
|
||||
Blocks.YELLOW_CONCRETE.defaultBlockState(),
|
||||
Blocks.LIME_CONCRETE.defaultBlockState(),
|
||||
Blocks.PINK_CONCRETE.defaultBlockState(),
|
||||
Blocks.GREEN_CONCRETE.defaultBlockState(),
|
||||
Blocks.WHITE_CONCRETE.defaultBlockState(),
|
||||
Blocks.BLACK_CONCRETE.defaultBlockState(),
|
||||
Blocks.ORANGE_CONCRETE.defaultBlockState(),
|
||||
Blocks.LIGHT_BLUE_CONCRETE.defaultBlockState()
|
||||
};
|
||||
|
||||
|
||||
private static int find_poi(CommandContext<CommandSourceStack> ctx, BCLPoiType poi) throws CommandSyntaxException {
|
||||
final CommandSourceStack source = ctx.getSource();
|
||||
final ServerPlayer player = source.getPlayerOrException();
|
||||
Vec3 pos = source.getPosition();
|
||||
final ServerLevel level = source.getLevel();
|
||||
MutableBlockPos mPos = new BlockPos(pos).mutable();
|
||||
MutableBlockPos mPos = new BlockPos((int) pos.x, (int) pos.y, (int) pos.z).mutable();
|
||||
System.out.println("Searching POI: " + poi.key);
|
||||
Optional<BlockPos> found = poi.findPoiAround(level, mPos, false, level.getWorldBorder());
|
||||
System.out.println("Found at: " + found.orElse(null));
|
||||
|
@ -119,9 +94,7 @@ public class CommandRegistry {
|
|||
private static final int SAMPLE_RESOLUTION_HORIZONTAL = 32;
|
||||
private static final int SAMPLE_RESOLUTION_VERTICAL = 64;
|
||||
private static final DynamicCommandExceptionType ERROR_BIOME_NOT_FOUND = new DynamicCommandExceptionType(
|
||||
(object) -> {
|
||||
return Component.literal("The next biome (" + object + ") was not found.");
|
||||
});
|
||||
(object) -> Component.literal("The next biome (" + object + ") was not found."));
|
||||
|
||||
private static int teleportToNextBiome(CommandContext<CommandSourceStack> ctx) throws CommandSyntaxException {
|
||||
final CommandSourceStack source = ctx.getSource();
|
||||
|
@ -137,7 +110,11 @@ public class CommandRegistry {
|
|||
.setStyle(Style.EMPTY.withColor(ChatFormatting.DARK_GREEN)), false);
|
||||
biomeIndex = (biomeIndex + 1) % biomes.size();
|
||||
|
||||
final BlockPos currentPosition = new BlockPos(source.getPosition());
|
||||
final BlockPos currentPosition = new BlockPos(
|
||||
(int) source.getPosition().x,
|
||||
(int) source.getPosition().y,
|
||||
(int) source.getPosition().z
|
||||
);
|
||||
final BlockPos biomePosition = source.getLevel()
|
||||
.findClosestBiome3d(
|
||||
b -> b.unwrapKey().orElseThrow().location().equals(biome.getID()),
|
||||
|
@ -158,7 +135,7 @@ public class CommandRegistry {
|
|||
double yPos = source.getPosition().y();
|
||||
boolean didWrap = false;
|
||||
do {
|
||||
target = new BlockPos(biomePosition.getX(), yPos, biomePosition.getZ());
|
||||
target = new BlockPos(biomePosition.getX(), (int) yPos, biomePosition.getZ());
|
||||
state = player.level.getBlockState(target);
|
||||
yPos--;
|
||||
if (yPos <= player.level.getMinBuildHeight() + 1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue