mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
21w37a
This commit is contained in:
2
.github/workflows/dev_pr.yml
vendored
2
.github/workflows/dev_pr.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
- '**.properties'
|
||||
- '**/src/**'
|
||||
branches:
|
||||
- "1.17"
|
||||
- "1.18"
|
||||
types: [ opened, synchronize, reopened ]
|
||||
jobs:
|
||||
validate-gradle:
|
||||
|
||||
2
.github/workflows/dev_push.yml
vendored
2
.github/workflows/dev_push.yml
vendored
@@ -7,7 +7,7 @@ on:
|
||||
- '**.properties'
|
||||
- '**/src/**'
|
||||
branches:
|
||||
- "1.17"
|
||||
- "1.18"
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
norelease:
|
||||
|
||||
@@ -9,7 +9,7 @@ dependencies {
|
||||
}
|
||||
|
||||
architectury {
|
||||
common()
|
||||
common(rootProject.forgeEnabled.toBoolean())
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures() {
|
||||
return settings.features();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts() {
|
||||
return (List<Supplier<ConfiguredStructureFeature<?, ?>>>) settings.structures();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SpawnSettingsWrapped implements SpawnProperties {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ public interface GenerationProperties {
|
||||
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
|
||||
|
||||
List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts();
|
||||
|
||||
interface Mutable extends GenerationProperties {
|
||||
Mutable setSurfaceBuilder(ConfiguredSurfaceBuilder<?> builder);
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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<ProtoChunk> 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<ProtoChunk> 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
"HorseTameInvoker",
|
||||
"LivingDeathInvoker",
|
||||
"MixinBaseSpawner",
|
||||
"MixinBlockEntityExtension",
|
||||
"MixinBlockItem",
|
||||
"MixinBucketItem",
|
||||
"MixinCatSpawner",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -6,7 +6,7 @@ dependencies {
|
||||
}
|
||||
|
||||
architectury {
|
||||
common()
|
||||
common(rootProject.forgeEnabled.toBoolean())
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
||||
Reference in New Issue
Block a user