Fix the build a bit

Improved checkstyling
This commit is contained in:
Octavia Togami 2021-11-14 00:15:22 -08:00
parent 410688e7b7
commit 53559192b4
No known key found for this signature in database
GPG Key ID: CC364524D1983C99
29 changed files with 100 additions and 62 deletions

View File

@ -33,7 +33,7 @@
configure<CheckstyleExtension> {
configFile = rootProject.file("config/checkstyle/checkstyle.xml")
toolVersion = "8.34"
toolVersion = "9.1"
}
tasks.withType<Test>().configureEach {

View File

@ -1,7 +1,7 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.4.21"
kotlin("jvm") version "1.5.30"
application
}

View File

@ -299,8 +299,8 @@ public ListTag getListTag(String key) {
*
* @param key the key
* @param listType the class of the contained type
* @return a list of tags
* @param <T> the type of list
* @return a list of tags
*/
@SuppressWarnings("unchecked")
public <T extends Tag> List<T> getList(String key, Class<T> listType) {

View File

@ -308,8 +308,8 @@ public ListTag getListTag(int index) {
*
* @param index the index
* @param listType the class of the contained type
* @return a list of tags
* @param <T> the NBT type
* @return a list of tags
*/
@SuppressWarnings("unchecked")
public <T extends Tag> List<T> getList(int index, Class<T> listType) {

View File

@ -36,9 +36,8 @@ public interface BlockTool extends Tool {
* Perform the primary action of this tool.
*
* @return true to cancel the original event which triggered this action (if possible)
* @deprecated New subclasses should override
* {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
* instead
* @deprecated New subclasses should override {@link #actPrimary(Platform, LocalConfiguration, Player, LocalSession,
* Location, Direction)} instead
*/
@Deprecated
default boolean actPrimary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {

View File

@ -39,9 +39,8 @@ public interface DoubleActionBlockTool extends BlockTool {
* Perform the secondary action of this block tool.
*
* @return true to cancel the original event which triggered this action (if possible)
* @deprecated New subclasses must override
* {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession, Location, Direction)}
* instead
* @deprecated New subclasses must override {@link #actSecondary(Platform, LocalConfiguration, Player, LocalSession,
* Location, Direction)} instead
*/
@Deprecated
default boolean actSecondary(Platform server, LocalConfiguration config, Player player, LocalSession session, Location clicked) {

View File

@ -284,8 +284,7 @@ default Location getBlockIn() {
* @param pos where to move them
* @param pitch the pitch (up/down) of the player's view in degrees
* @param yaw the yaw (left/right) of the player's view in degrees
* @deprecated This method may fail without indication. Use
* {@link #trySetPosition(Vector3, float, float)} instead
* @deprecated This method may fail without indication. Use {@link #trySetPosition(Vector3, float, float)} instead
*/
@Deprecated
default void setPosition(Vector3 pos, float pitch, float yaw) {

View File

@ -132,9 +132,8 @@ public <T> Optional<AssetLoader<T>> getAssetLoader(Class<T> assetClass, String f
* Get the Asset Loaders for the given type.
*
* @param assetClass The class to get the loaders of
* @return The list of asset loaders
*
* @param <T> The asset type
* @return The list of asset loaders
*/
@SuppressWarnings("unchecked")
public <T> List<AssetLoader<T>> getAssetLoaders(Class<T> assetClass) {

View File

@ -34,6 +34,9 @@
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.util.Substring;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import org.enginehub.piston.inject.InjectedValueStore;
import org.enginehub.piston.inject.Key;
import org.enginehub.piston.inject.MapBackedValueStore;
@ -42,9 +45,6 @@
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity;
import static com.sk89q.worldedit.fabric.FabricAdapter.adaptPlayer;
import static net.minecraft.commands.Commands.argument;

View File

@ -37,11 +37,6 @@
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.item.ItemTypes;
import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
@ -54,6 +49,12 @@
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.Vec3;
import java.util.Comparator;
import java.util.Map;
import java.util.Objects;
import java.util.TreeMap;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
public final class FabricAdapter {
@ -109,11 +110,16 @@ public static Vec3 toVec3(BlockVector3 vector) {
public static net.minecraft.core.Direction adapt(Direction face) {
switch (face) {
case NORTH: return net.minecraft.core.Direction.NORTH;
case SOUTH: return net.minecraft.core.Direction.SOUTH;
case WEST: return net.minecraft.core.Direction.WEST;
case EAST: return net.minecraft.core.Direction.EAST;
case DOWN: return net.minecraft.core.Direction.DOWN;
case NORTH:
return net.minecraft.core.Direction.NORTH;
case SOUTH:
return net.minecraft.core.Direction.SOUTH;
case WEST:
return net.minecraft.core.Direction.WEST;
case EAST:
return net.minecraft.core.Direction.EAST;
case DOWN:
return net.minecraft.core.Direction.DOWN;
case UP:
default:
return net.minecraft.core.Direction.UP;
@ -125,11 +131,16 @@ public static Direction adaptEnumFacing(@Nullable net.minecraft.core.Direction f
return null;
}
switch (face) {
case NORTH: return Direction.NORTH;
case SOUTH: return Direction.SOUTH;
case WEST: return Direction.WEST;
case EAST: return Direction.EAST;
case DOWN: return Direction.DOWN;
case NORTH:
return Direction.NORTH;
case SOUTH:
return Direction.SOUTH;
case WEST:
return Direction.WEST;
case EAST:
return Direction.EAST;
case DOWN:
return Direction.DOWN;
case UP:
default:
return Direction.UP;
@ -142,6 +153,7 @@ public static BlockPos toBlockPos(BlockVector3 vector) {
/**
* Adapts property.
*
* @deprecated without replacement, use the block adapter methods
*/
@Deprecated
@ -151,6 +163,7 @@ public static Property<?> adaptProperty(net.minecraft.world.level.block.state.pr
/**
* Adapts properties.
*
* @deprecated without replacement, use the block adapter methods
*/
@Deprecated

View File

@ -21,13 +21,14 @@
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BlockCategoryRegistry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
public class FabricBlockCategoryRegistry implements BlockCategoryRegistry {
@Override

View File

@ -21,11 +21,12 @@
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.PassthroughBlockMaterial;
import javax.annotation.Nullable;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.PushReaction;
import javax.annotation.Nullable;
/**
* Fabric block material that pulls as much info as possible from the Minecraft
* Material, and passes the rest to another implementation, typically the

View File

@ -27,12 +27,13 @@
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.registry.BlockMaterial;
import com.sk89q.worldedit.world.registry.BundledBlockRegistry;
import net.minecraft.world.level.block.Block;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.OptionalInt;
import java.util.TreeMap;
import net.minecraft.world.level.block.Block;
public class FabricBlockRegistry extends BundledBlockRegistry {

View File

@ -28,12 +28,13 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.NullWorld;
import com.sk89q.worldedit.world.entity.EntityTypes;
import java.lang.ref.WeakReference;
import javax.annotation.Nullable;
import net.minecraft.core.Registry;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.resources.ResourceLocation;
import java.lang.ref.WeakReference;
import javax.annotation.Nullable;
import static com.google.common.base.Preconditions.checkNotNull;
class FabricEntity implements Entity {

View File

@ -21,13 +21,14 @@
import com.sk89q.worldedit.world.item.ItemType;
import com.sk89q.worldedit.world.registry.ItemCategoryRegistry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
import java.util.Collections;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.tags.Tag;
public class FabricItemCategoryRegistry implements ItemCategoryRegistry {
@Override

View File

@ -45,7 +45,6 @@
import net.minecraft.world.level.storage.ServerLevelData;
import org.enginehub.piston.CommandManager;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -55,6 +54,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;
class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {

View File

@ -59,10 +59,10 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.entity.BlockEntityType;
import javax.annotation.Nullable;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.UUID;
import javax.annotation.Nullable;
public class FabricPlayer extends AbstractPlayerActor {

View File

@ -98,6 +98,7 @@
import net.minecraft.world.level.storage.ServerLevelData;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import java.lang.ref.WeakReference;
import java.nio.file.Files;
import java.nio.file.Path;

View File

@ -22,6 +22,7 @@
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

View File

@ -20,13 +20,14 @@
package com.sk89q.worldedit.fabric;
import com.mojang.authlib.GameProfile;
import java.util.UUID;
import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.stats.Stat;
import net.minecraft.world.damagesource.DamageSource;
import java.util.UUID;
public class WorldEditFakePlayer extends ServerPlayer {
private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");

View File

@ -24,6 +24,7 @@
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.chunk.ChunkStatus;
import javax.annotation.Nullable;
// For now, this does nothing, but might be useful later for regen progress communication.

View File

@ -20,11 +20,12 @@
package com.sk89q.worldedit.fabric.internal;
import com.sk89q.worldedit.util.SideEffect;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import javax.annotation.Nullable;
public interface ExtendedChunk {
/**
* {@link ChunkAccess#setBlockState(BlockPos, BlockState, boolean)} with the extra

View File

@ -19,10 +19,11 @@
package com.sk89q.worldedit.fabric.internal;
import java.nio.file.Path;
import net.minecraft.server.ServerResources;
import net.minecraft.world.level.Level;
import java.nio.file.Path;
public interface ExtendedMinecraftServer {
Path getStoragePath(Level world);

View File

@ -28,16 +28,17 @@
import com.sk89q.worldedit.registry.state.Property;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.block.BlockType;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
import net.minecraft.util.StringRepresentable;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import java.util.Comparator;
import java.util.Map;
import java.util.TreeMap;
import java.util.stream.Collectors;
/**
* Raw, un-cached transformations.
*/

View File

@ -24,10 +24,6 @@
import com.sk89q.worldedit.internal.wna.WorldNativeAccess;
import com.sk89q.worldedit.util.SideEffect;
import com.sk89q.worldedit.util.SideEffectSet;
import com.sk89q.worldedit.world.storage.ChunkStore;
import java.lang.ref.WeakReference;
import java.util.Objects;
import javax.annotation.Nullable;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ChunkHolder;
@ -38,6 +34,10 @@
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.LevelChunk;
import java.lang.ref.WeakReference;
import java.util.Objects;
import javax.annotation.Nullable;
public class FabricWorldNativeAccess implements WorldNativeAccess<LevelChunk, BlockState, BlockPos> {
private static final int UPDATE = 1;
private static final int NOTIFY = 2;

View File

@ -1,3 +1,22 @@
/*
* WorldEdit, a Minecraft world manipulation toolkit
* Copyright (C) sk89q <http://www.sk89q.com>
* Copyright (C) WorldEdit team and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.fabric.mixin;
import net.minecraft.core.BlockPos;

View File

@ -20,16 +20,15 @@
package com.sk89q.worldedit.fabric.mixin;
import com.mojang.datafixers.util.Either;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;
import java.util.concurrent.CompletableFuture;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ServerChunkCache;
import net.minecraft.util.thread.BlockableEventLoop;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.ChunkStatus;
@Mixin(ServerChunkCache.class)
public interface AccessorServerChunkCache {

View File

@ -27,14 +27,12 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelHeightAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.chunk.ChunkAccess;
import net.minecraft.world.level.chunk.LevelChunk;
import net.minecraft.world.level.chunk.LevelChunkSection;
import net.minecraft.world.level.chunk.UpgradeData;
import net.minecraft.world.level.levelgen.blending.BlendingData;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

View File

@ -25,6 +25,7 @@
import com.sk89q.worldedit.fabric.FabricWorldEdit;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.resources.ResourceLocation;
import java.nio.charset.StandardCharsets;
public final class WECUIPacketHandler {