This commit is contained in:
shedaniel
2021-09-23 02:44:15 +08:00
parent c3ffa8d976
commit ffe3fbe3f4
15 changed files with 24 additions and 174 deletions

View File

@@ -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);
}
}

View File

@@ -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 {

View File

@@ -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);
}
}

View File

@@ -36,8 +36,6 @@ public interface GenerationProperties {
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts();
interface Mutable extends GenerationProperties {
Mutable setSurfaceBuilder(ConfiguredSurfaceBuilder<?> builder);