Reformated

This commit is contained in:
Frank 2022-06-08 20:57:21 +02:00
parent 079b51e3f6
commit 852e5a6abc
385 changed files with 6924 additions and 5656 deletions

View file

@ -1,5 +1,9 @@
package org.betterx.bclib.interfaces;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.client.resources.model.UnbakedModel;
import net.minecraft.resources.ResourceLocation;
@ -8,10 +12,6 @@ import net.minecraft.world.level.block.state.BlockState;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.client.models.ModelsHelper;
import org.betterx.bclib.client.models.PatternsHelper;
import java.util.Map;
import java.util.Optional;
import org.jetbrains.annotations.Nullable;
@ -24,19 +24,23 @@ public interface BlockModelProvider extends ItemModelProvider {
}
@Environment(EnvType.CLIENT)
default UnbakedModel getModelVariant(ResourceLocation stateId,
BlockState blockState,
Map<ResourceLocation, UnbakedModel> modelCache) {
default UnbakedModel getModelVariant(
ResourceLocation stateId,
BlockState blockState,
Map<ResourceLocation, UnbakedModel> modelCache
) {
ResourceLocation modelId = new ResourceLocation(stateId.getNamespace(), "block/" + stateId.getPath());
registerBlockModel(stateId, modelId, blockState, modelCache);
return ModelsHelper.createBlockSimple(modelId);
}
@Environment(EnvType.CLIENT)
default void registerBlockModel(ResourceLocation stateId,
ResourceLocation modelId,
BlockState blockState,
Map<ResourceLocation, UnbakedModel> modelCache) {
default void registerBlockModel(
ResourceLocation stateId,
ResourceLocation modelId,
BlockState blockState,
Map<ResourceLocation, UnbakedModel> modelCache
) {
if (!modelCache.containsKey(modelId)) {
BlockModel model = getBlockModel(stateId, blockState);
if (model != null) {

View file

@ -1,13 +1,13 @@
package org.betterx.bclib.interfaces;
import org.betterx.bclib.client.models.ModelsHelper;
import net.minecraft.client.renderer.block.model.BlockModel;
import net.minecraft.resources.ResourceLocation;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import org.betterx.bclib.client.models.ModelsHelper;
public interface ItemModelProvider {
@Environment(EnvType.CLIENT)
default BlockModel getItemModel(ResourceLocation resourceLocation) {

View file

@ -1,22 +1,24 @@
package org.betterx.bclib.interfaces;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.mixin.common.SurfaceRulesContextAccessor;
import com.mojang.serialization.Codec;
import com.mojang.serialization.Lifecycle;
import org.betterx.bclib.BCLib;
import org.betterx.bclib.mixin.common.SurfaceRulesContextAccessor;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceKey;
import java.util.function.Function;
public interface NumericProvider {
ResourceKey<Registry<Codec<? extends NumericProvider>>> NUMERIC_PROVIDER_REGISTRY = ResourceKey.createRegistryKey(
BCLib.makeID("worldgen/numeric_provider"));
Registry<Codec<? extends NumericProvider>> NUMERIC_PROVIDER = new MappedRegistry<>(NUMERIC_PROVIDER_REGISTRY,
Lifecycle.experimental(),
null);
Registry<Codec<? extends NumericProvider>> NUMERIC_PROVIDER = new MappedRegistry<>(
NUMERIC_PROVIDER_REGISTRY,
Lifecycle.experimental(),
null
);
Codec<NumericProvider> CODEC = NUMERIC_PROVIDER.byNameCodec()
.dispatch(NumericProvider::pcodec, Function.identity());
int getNumber(SurfaceRulesContextAccessor context);

View file

@ -9,9 +9,11 @@ import net.minecraft.world.level.LevelAccessor;
@FunctionalInterface
public interface SpawnRule<M extends Mob> {
boolean canSpawn(EntityType<M> type,
LevelAccessor world,
MobSpawnType spawnReason,
BlockPos pos,
RandomSource random);
boolean canSpawn(
EntityType<M> type,
LevelAccessor world,
MobSpawnType spawnReason,
BlockPos pos,
RandomSource random
);
}

View file

@ -1,9 +1,9 @@
package org.betterx.bclib.interfaces;
import net.minecraft.world.level.block.state.BlockState;
import org.betterx.bclib.api.v2.levelgen.surface.SurfaceRuleBuilder;
import net.minecraft.world.level.block.state.BlockState;
public interface SurfaceMaterialProvider {
BlockState getTopMaterial();
BlockState getUnderMaterial();