From 3d98eef20510a761034d952ee5ad8e5ccd91e81d Mon Sep 17 00:00:00 2001 From: Aurora Date: Fri, 25 Sep 2020 22:49:12 +0200 Subject: [PATCH] continue working on fabric module --- buildSrc/build.gradle.kts | 6 +-- gradle.properties | 2 +- settings.gradle.kts | 2 + .../sk89q/worldedit/fabric/FabricAdapter.java | 3 +- .../worldedit/fabric/FabricBiomeRegistry.java | 5 --- .../worldedit/fabric/FabricBlockRegistry.java | 5 --- .../sk89q/worldedit/fabric/FabricPlayer.java | 10 +++++ .../sk89q/worldedit/fabric/FabricWorld.java | 39 ++++++++++++------- .../internal/FabricWorldNativeAccess.java | 3 +- 9 files changed, 45 insertions(+), 30 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 8fd3e4448..54a574ccc 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -52,11 +52,11 @@ dependencies { implementation("com.github.jengelman.gradle.plugins:shadow:5.2.0") implementation("net.ltgt.apt-eclipse:net.ltgt.apt-eclipse.gradle.plugin:0.21") implementation("net.ltgt.apt-idea:net.ltgt.apt-idea.gradle.plugin:0.21") - //implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0") + implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.16.0") //implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0") //implementation("net.minecraftforge.gradle:ForgeGradle:3.0.181") - //implementation("net.fabricmc:fabric-loom:$loomVersion") - //implementation("net.fabricmc:sponge-mixin:$mixinVersion") + implementation("net.fabricmc:fabric-loom:$loomVersion") + implementation("net.fabricmc:sponge-mixin:$mixinVersion") implementation("gradle.plugin.com.mendhak.gradlecrowdin:plugin:0.1.0") implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0") } diff --git a/gradle.properties b/gradle.properties index 71973855b..fb8e7f222 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,5 +7,5 @@ org.gradle.configureondemand=true org.gradle.parallel=true org.gradle.caching=true -loom.version=0.4.33 +loom.version=0.5-SNAPSHOT mixin.version=0.8.1+build.21 diff --git a/settings.gradle.kts b/settings.gradle.kts index 8b3b222f8..7131e8139 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,3 +7,5 @@ listOf("bukkit", "core", "fabric").forEach { include("worldedit-$it") } include("worldedit-libs:core:ap") + +include("worldedit-core:doctools") diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricAdapter.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricAdapter.java index 53b74c3f7..b4d826eb4 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricAdapter.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricAdapter.java @@ -65,7 +65,8 @@ import static com.google.common.base.Preconditions.checkNotNull; public final class FabricAdapter { - private static @Nullable MinecraftServer server; + @Nullable + private static MinecraftServer server; private static MinecraftServer requireServer() { return Objects.requireNonNull(server, "No server injected"); diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBiomeRegistry.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBiomeRegistry.java index d78b95bd5..b6971a0e7 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBiomeRegistry.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBiomeRegistry.java @@ -32,11 +32,6 @@ import net.minecraft.util.Util; */ class FabricBiomeRegistry implements BiomeRegistry { - @Override - public Component getRichName(BiomeType biomeType) { - return TranslatableComponent.of(Util.createTranslationKey("biome", new Identifier(biomeType.getId()))); - } - @Deprecated @Override public BiomeData getData(BiomeType biome) { diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBlockRegistry.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBlockRegistry.java index 0c1ff52eb..51b873714 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBlockRegistry.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricBlockRegistry.java @@ -38,11 +38,6 @@ public class FabricBlockRegistry extends BundledBlockRegistry { private final Map materialMap = new HashMap<>(); - @Override - public Component getRichName(BlockType blockType) { - return TranslatableComponent.of(FabricAdapter.adapt(blockType).getTranslationKey()); - } - @Override public BlockMaterial getMaterial(BlockType blockType) { Block block = FabricAdapter.adapt(blockType); diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlayer.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlayer.java index f200565b0..542ea3426 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlayer.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricPlayer.java @@ -198,6 +198,11 @@ public class FabricPlayer extends AbstractPlayerActor { return FabricWorldEdit.inst.getPermissionsProvider().hasPermission(player, perm); } + @Override + public void setPermission(String permission, boolean value) { + + } + @Nullable @Override public T getFacet(Class cls) { @@ -252,6 +257,11 @@ public class FabricPlayer extends AbstractPlayerActor { } } + @Override + public void sendTitle(Component title, Component sub) { + + } + @Override public SessionKey getSessionKey() { return new SessionKeyImpl(player.getUuid(), player.getName().getString()); diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricWorld.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricWorld.java index f4cb08d8c..390059b53 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricWorld.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/FabricWorld.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.fabric; +import com.boydti.fawe.beta.IChunkGet; +import com.boydti.fawe.beta.implementation.packet.ChunkPacket; import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; @@ -35,6 +37,7 @@ import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; +import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.fabric.internal.ExtendedMinecraftServer; import com.sk89q.worldedit.fabric.internal.FabricWorldNativeAccess; @@ -176,6 +179,21 @@ public class FabricWorld extends AbstractWorld { return getName() + "_" + getDimensionRegistryKey(getWorld()); } + @Override + public void refreshChunk(int chunkX, int chunkZ) { + + } + + @Override + public IChunkGet get(int x, int z) { + return null; + } + + @Override + public void sendFakeChunk(@Nullable Player player, ChunkPacket packet) { + + } + @Override public Path getStoragePath() { final World world = getWorld(); @@ -213,6 +231,11 @@ public class FabricWorld extends AbstractWorld { return false; } + @Override + public boolean setTile(int x, int y, int z, CompoundTag tile) throws WorldEditException { + return false; + } + @Override public boolean fullySupports3DBiomes() { BiomeAccessType biomeAccessType = getWorld().getDimension().getBiomeAccessType(); @@ -295,20 +318,8 @@ public class FabricWorld extends AbstractWorld { } @Override - public boolean regenerate(Region region, Extent extent, RegenOptions options) { - // Don't even try to regen if it's going to fail. - ChunkManager provider = getWorld().getChunkManager(); - if (!(provider instanceof ServerChunkManager)) { - return false; - } - - try { - doRegen(region, extent, options); - } catch (Exception e) { - throw new IllegalStateException("Regen failed", e); - } - - return true; + public boolean regenerate(Region region, EditSession editSession) { + return false; } private void doRegen(Region region, Extent extent, RegenOptions options) throws Exception { diff --git a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/internal/FabricWorldNativeAccess.java b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/internal/FabricWorldNativeAccess.java index 5e839b3ea..7c0482310 100644 --- a/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/internal/FabricWorldNativeAccess.java +++ b/worldedit-fabric/src/main/java/com/sk89q/worldedit/fabric/internal/FabricWorldNativeAccess.java @@ -31,10 +31,11 @@ import net.minecraft.server.world.ServerChunkManager; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.WorldChunk; +import org.jetbrains.annotations.Nullable; import java.lang.ref.WeakReference; import java.util.Objects; -import javax.annotation.Nullable; + public class FabricWorldNativeAccess implements WorldNativeAccess { private static final int UPDATE = 1;