From ffe3fbe3f40e69aa308fc6902dd1247711799761 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Thu, 23 Sep 2021 02:44:15 +0800 Subject: [PATCH] 21w37a --- .github/workflows/dev_pr.yml | 2 +- .github/workflows/dev_push.yml | 2 +- common/build.gradle | 2 +- .../extensions/BlockEntityExtension.java | 52 ------------------- .../hooks/level/biome/BiomeHooks.java | 27 ---------- .../hooks/level/biome/BiomeProperties.java | 8 --- .../level/biome/GenerationProperties.java | 2 - .../block/fabric/BlockEntityHooksImpl.java | 13 ++--- .../fabric/MixinBlockEntityExtension.java | 42 --------------- .../mixin/fabric/MixinChunkSerializer.java | 15 +++--- .../biome/fabric/BiomeModificationsImpl.java | 14 ----- .../main/resources/architectury.mixins.json | 1 - gradle.properties | 12 +++-- settings.gradle | 4 +- testmod-common/build.gradle | 2 +- 15 files changed, 24 insertions(+), 174 deletions(-) delete mode 100644 common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java delete mode 100644 fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java diff --git a/.github/workflows/dev_pr.yml b/.github/workflows/dev_pr.yml index e0cbe32f..481df460 100644 --- a/.github/workflows/dev_pr.yml +++ b/.github/workflows/dev_pr.yml @@ -7,7 +7,7 @@ on: - '**.properties' - '**/src/**' branches: - - "1.17" + - "1.18" types: [ opened, synchronize, reopened ] jobs: validate-gradle: diff --git a/.github/workflows/dev_push.yml b/.github/workflows/dev_push.yml index dacb3641..d6c0c041 100644 --- a/.github/workflows/dev_push.yml +++ b/.github/workflows/dev_push.yml @@ -7,7 +7,7 @@ on: - '**.properties' - '**/src/**' branches: - - "1.17" + - "1.18" workflow_dispatch: inputs: norelease: diff --git a/common/build.gradle b/common/build.gradle index 8228872a..548f5957 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -9,7 +9,7 @@ dependencies { } architectury { - common() + common(rootProject.forgeEnabled.toBoolean()) } afterEvaluate { diff --git a/common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java b/common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java deleted file mode 100644 index 618f4e5b..00000000 --- a/common/src/main/java/dev/architectury/extensions/BlockEntityExtension.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.extensions; - -import dev.architectury.hooks.block.BlockEntityHooks; -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import org.jetbrains.annotations.ApiStatus; - -/** - * Extensions to {@link net.minecraft.world.level.block.entity.BlockEntity}, implement this on to your class. - */ -public interface BlockEntityExtension { - /** - * Handles data sent by {@link BlockEntityExtension#saveClientData(CompoundTag)} on the server. - */ - @Environment(EnvType.CLIENT) - void loadClientData(BlockState pos, CompoundTag tag); - - /** - * Writes data to sync to the client. - */ - CompoundTag saveClientData(CompoundTag tag); - - /** - * Sync data to the clients by {@link BlockEntityExtension#saveClientData(CompoundTag)} and {@link BlockEntityExtension#loadClientData(BlockState, CompoundTag)}. - */ - @ApiStatus.NonExtendable - default void syncData() { - BlockEntityHooks.syncData((BlockEntity) this); - } -} diff --git a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java index d9b3971c..9799a4c7 100644 --- a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java +++ b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeHooks.java @@ -95,16 +95,6 @@ public final class BiomeHooks { public BiomeCategory getCategory() { return biome.biomeCategory; } - - @Override - public float getDepth() { - return biome.depth; - } - - @Override - public float getScale() { - return biome.scale; - } } public static class MutableBiomeWrapped extends BiomeWrapped implements BiomeProperties.Mutable { @@ -155,18 +145,6 @@ public final class BiomeHooks { biome.biomeCategory = category; return this; } - - @Override - public Mutable setDepth(float depth) { - biome.depth = depth; - return this; - } - - @Override - public Mutable setScale(float scale) { - biome.scale = scale; - return this; - } } public static class ClimateWrapped implements ClimateProperties.Mutable { @@ -394,11 +372,6 @@ public final class BiomeHooks { public List>>> getFeatures() { return settings.features(); } - - @Override - public List>> getStructureStarts() { - return (List>>) settings.structures(); - } } public static class SpawnSettingsWrapped implements SpawnProperties { diff --git a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java index cdc7e034..ec17fa09 100644 --- a/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java +++ b/common/src/main/java/dev/architectury/hooks/level/biome/BiomeProperties.java @@ -32,10 +32,6 @@ public interface BiomeProperties { BiomeCategory getCategory(); - float getDepth(); - - float getScale(); - interface Mutable extends BiomeProperties { @Override ClimateProperties.Mutable getClimateProperties(); @@ -50,9 +46,5 @@ public interface BiomeProperties { SpawnProperties.Mutable getSpawnProperties(); Mutable setCategory(BiomeCategory category); - - Mutable setDepth(float depth); - - Mutable setScale(float scale); } } diff --git a/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java b/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java index 64e8f7ff..5a2ac1aa 100644 --- a/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java +++ b/common/src/main/java/dev/architectury/hooks/level/biome/GenerationProperties.java @@ -36,8 +36,6 @@ public interface GenerationProperties { List>>> getFeatures(); - List>> getStructureStarts(); - interface Mutable extends GenerationProperties { Mutable setSurfaceBuilder(ConfiguredSurfaceBuilder builder); diff --git a/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java b/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java index d50a203b..aa88f934 100644 --- a/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java +++ b/fabric/src/main/java/dev/architectury/hooks/block/fabric/BlockEntityHooksImpl.java @@ -19,7 +19,6 @@ package dev.architectury.hooks.block.fabric; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.entity.BlockEntity; @@ -42,15 +41,11 @@ public class BlockEntityHooksImpl { * limitations under the License. */ public static void syncData(BlockEntity entity) { - if (entity instanceof BlockEntityClientSerializable) { - ((BlockEntityClientSerializable) entity).sync(); + var world = Objects.requireNonNull(entity.getLevel()); + if (!(world instanceof ServerLevel)) { + throw new IllegalStateException("Cannot call sync() on the logical client! Did you check world.isClient first?"); } else { - var world = Objects.requireNonNull(entity.getLevel()); - if (!(world instanceof ServerLevel)) { - throw new IllegalStateException("Cannot call sync() on the logical client! Did you check world.isClient first?"); - } else { - ((ServerLevel) world).getChunkSource().blockChanged(entity.getBlockPos()); - } + ((ServerLevel) world).getChunkSource().blockChanged(entity.getBlockPos()); } } } diff --git a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java deleted file mode 100644 index 566b69ea..00000000 --- a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinBlockEntityExtension.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * This file is part of architectury. - * Copyright (C) 2020, 2021 architectury - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -package dev.architectury.mixin.fabric; - -import dev.architectury.extensions.BlockEntityExtension; -import net.fabricmc.fabric.api.block.entity.BlockEntityClientSerializable; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.level.block.entity.BlockEntity; -import org.spongepowered.asm.mixin.Mixin; - -@Mixin(BlockEntityExtension.class) -public interface MixinBlockEntityExtension extends BlockEntityClientSerializable { - @Override - default void fromClientTag(CompoundTag tag) { - var entity = (BlockEntity) this; - if (entity.hasLevel()) { - ((BlockEntityExtension) this).loadClientData(entity.getBlockState(), tag); - } - } - - @Override - default CompoundTag toClientTag(CompoundTag tag) { - return ((BlockEntityExtension) this).saveClientData(tag); - } -} diff --git a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java index c9720c11..04b828c6 100644 --- a/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java +++ b/fabric/src/main/java/dev/architectury/mixin/fabric/MixinChunkSerializer.java @@ -20,15 +20,14 @@ package dev.architectury.mixin.fabric; import dev.architectury.event.events.common.ChunkEvent; +import net.minecraft.core.Registry; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.entity.ai.village.poi.PoiManager; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.biome.BiomeSource; import net.minecraft.world.level.chunk.*; import net.minecraft.world.level.chunk.storage.ChunkSerializer; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager; import net.minecraft.world.level.lighting.LevelLightEngine; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -39,11 +38,11 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture; @Mixin(ChunkSerializer.class) public class MixinChunkSerializer { @Inject(method = "read", at = @At("RETURN"), locals = LocalCapture.CAPTURE_FAILHARD) - private static void load(ServerLevel serverLevel, StructureManager structureManager, PoiManager poiManager, ChunkPos chunkPos, CompoundTag compoundTag, - CallbackInfoReturnable cir, ChunkGenerator chunkGenerator, BiomeSource biomeSource, CompoundTag compoundTagLevelData, - ChunkBiomeContainer chunkBiomeContainer, UpgradeData upgradeData, ProtoTickList protoTickList, ProtoTickList protoTickList2, - boolean bl, ListTag listTag, int i, LevelChunkSection[] levelChunkSections, boolean bl2, ChunkSource chunkSource, - LevelLightEngine levelLightEngine, long l, ChunkStatus.ChunkType chunkType, ChunkAccess chunk) { - ChunkEvent.LOAD_DATA.invoker().load(chunk, serverLevel, compoundTag); + private static void load(ServerLevel serverLevel, PoiManager poiManager, ChunkPos chunkPos, CompoundTag compoundTag, + CallbackInfoReturnable cir, CompoundTag compoundTag2, UpgradeData upgradeData, + ProtoTickList protoTickList, ProtoTickList protoTickList2, boolean bl, ListTag listTag, + int i, LevelChunkSection levelChunkSections[], boolean bl2, ChunkSource chunkSource, + LevelLightEngine levelLightEngine, Registry registry, long m, ChunkStatus.ChunkType chunkType, ChunkAccess chunkAccess2) { + ChunkEvent.LOAD_DATA.invoker().load(chunkAccess2, serverLevel, compoundTag); } } diff --git a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java index 67cfdddd..1fb375f2 100644 --- a/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java +++ b/fabric/src/main/java/dev/architectury/registry/level/biome/fabric/BiomeModificationsImpl.java @@ -129,20 +129,6 @@ public class BiomeModificationsImpl { context.setCategory(category); return this; } - - @Override - @NotNull - public BiomeProperties.Mutable setDepth(float depth) { - context.setDepth(depth); - return this; - } - - @Override - @NotNull - public BiomeProperties.Mutable setScale(float scale) { - context.setScale(scale); - return this; - } }; } diff --git a/fabric/src/main/resources/architectury.mixins.json b/fabric/src/main/resources/architectury.mixins.json index 59818fa9..dc53273d 100644 --- a/fabric/src/main/resources/architectury.mixins.json +++ b/fabric/src/main/resources/architectury.mixins.json @@ -23,7 +23,6 @@ "HorseTameInvoker", "LivingDeathInvoker", "MixinBaseSpawner", - "MixinBlockEntityExtension", "MixinBlockItem", "MixinBucketItem", "MixinCatSpawner", diff --git a/gradle.properties b/gradle.properties index 404496d0..afdb86a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,21 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -minecraft_version=1.17.1 -supported_version=1.17.1 +forgeEnabled=false + +minecraft_version=21w37a +supported_version=21w37a crane_version=1.17.1+build.1 cf_type=release archives_base_name=architectury archives_base_name_snapshot=architectury-snapshot -base_version=2.5 +base_version=3.0 maven_group=dev.architectury -fabric_loader_version=0.11.6 -fabric_api_version=0.34.9+1.17 +fabric_loader_version=0.11.7 +fabric_api_version=0.40.3+1.18 mod_menu_version=2.0.0-beta.7 forge_version=37.0.69 diff --git a/settings.gradle b/settings.gradle index 9e0405ec..c224a3c0 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,9 +14,9 @@ if (JavaVersion.current().ordinal() + 1 < 16) { include("common") include("fabric") -include("forge") +//include("forge") include("testmod-common") include("testmod-fabric") -include("testmod-forge") +//include("testmod-forge") rootProject.name = "architectury" diff --git a/testmod-common/build.gradle b/testmod-common/build.gradle index dffa3f59..51e939ee 100644 --- a/testmod-common/build.gradle +++ b/testmod-common/build.gradle @@ -6,7 +6,7 @@ dependencies { } architectury { - common() + common(rootProject.forgeEnabled.toBoolean()) } configurations {