mirror of
https://github.com/architectury/architectury-api.git
synced 2026-03-28 03:56:59 -05:00
Merge remote-tracking branch 'architectury/1.16' into 1.17
# Conflicts: # common/src/main/java/me/shedaniel/architectury/event/events/ChatEvent.java # common/src/main/java/me/shedaniel/architectury/registry/BlockEntityRenderers.java # common/src/main/java/me/shedaniel/architectury/utils/Fraction.java # fabric/src/main/java/me/shedaniel/architectury/registry/fabric/BlockEntityRenderersImpl.java # gradle.properties
This commit is contained in:
@@ -19,39 +19,14 @@
|
||||
|
||||
package me.shedaniel.architectury;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import me.shedaniel.architectury.targets.ArchitecturyTarget;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public class Architectury {
|
||||
private static final String MOD_LOADER;
|
||||
private static final ImmutableMap<String,String> MOD_LOADERS = ImmutableMap.<String,String>builder()
|
||||
.put("net.fabricmc.loader.FabricLoader", "fabric")
|
||||
.put("net.minecraftforge.fml.common.Mod", "forge")
|
||||
.build();
|
||||
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public static String getModLoader() {
|
||||
return MOD_LOADER;
|
||||
}
|
||||
|
||||
static {
|
||||
List<String> loader = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : MOD_LOADERS.entrySet()) {
|
||||
try {
|
||||
Class.forName(entry.getKey(), false, Architectury.class.getClassLoader());
|
||||
loader.add(entry.getValue());
|
||||
break;
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
if (loader.isEmpty())
|
||||
throw new IllegalStateException("No detected mod loader!");
|
||||
if (loader.size() >= 2)
|
||||
LogManager.getLogger().error("Detected multiple mod loaders! Something is wrong on the classpath! " + String.join(", ", loader));
|
||||
MOD_LOADER = loader.get(0);
|
||||
return ArchitecturyTarget.getCurrentTarget();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.TextFilter;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ChatEvent {
|
||||
/**
|
||||
@@ -35,7 +34,6 @@ public interface ChatEvent {
|
||||
Event<Server> SERVER = EventFactory.createInteractionResultHolder();
|
||||
|
||||
interface Server {
|
||||
@NotNull
|
||||
InteractionResult process(ServerPlayer player, TextFilter.FilteredText message, ChatComponent component);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@ import me.shedaniel.architectury.event.Actor;
|
||||
import me.shedaniel.architectury.event.Event;
|
||||
import me.shedaniel.architectury.event.EventFactory;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CommandPerformEvent {
|
||||
@@ -33,22 +32,20 @@ public class CommandPerformEvent {
|
||||
*/
|
||||
public static final Event<Actor<CommandPerformEvent>> EVENT = EventFactory.createActorLoop();
|
||||
|
||||
@NotNull
|
||||
private ParseResults<CommandSourceStack> results;
|
||||
@Nullable
|
||||
private Throwable throwable;
|
||||
|
||||
public CommandPerformEvent(@NotNull ParseResults<CommandSourceStack> results, @Nullable Throwable throwable) {
|
||||
public CommandPerformEvent(ParseResults<CommandSourceStack> results, @Nullable Throwable throwable) {
|
||||
this.results = results;
|
||||
this.throwable = throwable;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ParseResults<CommandSourceStack> getResults() {
|
||||
return results;
|
||||
}
|
||||
|
||||
public void setResults(@NotNull ParseResults<CommandSourceStack> results) {
|
||||
public void setResults(ParseResults<CommandSourceStack> results) {
|
||||
this.results = results;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import net.fabricmc.api.Environment;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.UUID;
|
||||
@@ -44,13 +43,11 @@ public interface ClientChatEvent {
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface Client {
|
||||
@NotNull
|
||||
InteractionResultHolder<String> process(String message);
|
||||
}
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
interface ClientReceived {
|
||||
@NotNull
|
||||
InteractionResultHolder<Component> process(ChatType type, Component message, @Nullable UUID sender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public interface ClientLifecycleEvent {
|
||||
*/
|
||||
@Deprecated Event<ClientState> CLIENT_STARTED = EventFactory.createLoop();
|
||||
/**
|
||||
* Invoked when client is initialising, not available in forge.
|
||||
* Invoked when client is stopping, not available in forge.
|
||||
*/
|
||||
@Deprecated Event<ClientState> CLIENT_STOPPING = EventFactory.createLoop();
|
||||
/**
|
||||
|
||||
@@ -26,7 +26,6 @@ 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;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Extensions to {@link net.minecraft.world.level.block.entity.BlockEntity}, implement this on to your class.
|
||||
@@ -36,13 +35,12 @@ public interface BlockEntityExtension {
|
||||
* Handles data sent by {@link BlockEntityExtension#saveClientData(CompoundTag)} on the server.
|
||||
*/
|
||||
@Environment(EnvType.CLIENT)
|
||||
void loadClientData(@NotNull BlockState pos, @NotNull CompoundTag tag);
|
||||
void loadClientData(BlockState pos, CompoundTag tag);
|
||||
|
||||
/**
|
||||
* Writes data to sync to the client.
|
||||
*/
|
||||
@NotNull
|
||||
CompoundTag saveClientData(@NotNull CompoundTag tag);
|
||||
CompoundTag saveClientData(CompoundTag tag);
|
||||
|
||||
/**
|
||||
* Sync data to the clients by {@link BlockEntityExtension#saveClientData(CompoundTag)} and {@link BlockEntityExtension#loadClientData(BlockState, CompoundTag)}.
|
||||
|
||||
@@ -31,7 +31,6 @@ import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.world.level.BlockAndTintGetter;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class FluidStackHooks {
|
||||
@@ -92,60 +91,60 @@ public class FluidStackHooks {
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) {
|
||||
public static TextureAtlasSprite getStillTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@NotNull FluidStack stack) {
|
||||
public static TextureAtlasSprite getStillTexture(FluidStack stack) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getStillTexture(@NotNull Fluid fluid) {
|
||||
public static TextureAtlasSprite getStillTexture(Fluid fluid) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) {
|
||||
public static TextureAtlasSprite getFlowingTexture(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getFlowingTexture(@NotNull FluidStack stack) {
|
||||
public static TextureAtlasSprite getFlowingTexture(FluidStack stack) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Nullable
|
||||
public static TextureAtlasSprite getFlowingTexture(@NotNull Fluid fluid) {
|
||||
public static TextureAtlasSprite getFlowingTexture(Fluid fluid) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, @NotNull FluidState state) {
|
||||
public static int getColor(@Nullable BlockAndTintGetter level, @Nullable BlockPos pos, FluidState state) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static int getColor(@NotNull FluidStack stack) {
|
||||
public static int getColor(FluidStack stack) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@ExpectPlatform
|
||||
@Environment(EnvType.CLIENT)
|
||||
public static int getColor(@NotNull Fluid fluid) {
|
||||
public static int getColor(Fluid fluid) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ import java.util.OptionalInt;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class BiomeHooks {
|
||||
@NotNull
|
||||
public static BiomeProperties getBiomeProperties(Biome biome) {
|
||||
return new BiomeWrapped(biome);
|
||||
}
|
||||
@@ -74,31 +73,26 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ClimateProperties getClimateProperties() {
|
||||
return climateProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties getEffectsProperties() {
|
||||
return effectsProperties;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GenerationProperties getGenerationProperties() {
|
||||
return generationProperties;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public SpawnProperties getSpawnProperties() {
|
||||
return spawnProperties;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public BiomeCategory getCategory() {
|
||||
return biome.biomeCategory;
|
||||
}
|
||||
@@ -138,41 +132,38 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ClimateProperties.Mutable getClimateProperties() {
|
||||
public ClimateProperties.Mutable getClimateProperties() {
|
||||
return (ClimateProperties.Mutable) super.getClimateProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull EffectsProperties.Mutable getEffectsProperties() {
|
||||
public EffectsProperties.Mutable getEffectsProperties() {
|
||||
return (EffectsProperties.Mutable) super.getEffectsProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull GenerationProperties.Mutable getGenerationProperties() {
|
||||
public GenerationProperties.Mutable getGenerationProperties() {
|
||||
return (GenerationProperties.Mutable) super.getGenerationProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull SpawnProperties.Mutable getSpawnProperties() {
|
||||
public SpawnProperties.Mutable getSpawnProperties() {
|
||||
return (SpawnProperties.Mutable) super.getSpawnProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setCategory(@NotNull BiomeCategory category) {
|
||||
public Mutable setCategory(BiomeCategory category) {
|
||||
biome.biomeCategory = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setDepth(float depth) {
|
||||
biome.depth = depth;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setScale(float scale) {
|
||||
biome.scale = scale;
|
||||
return this;
|
||||
@@ -191,35 +182,30 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setPrecipitation(@NotNull Biome.Precipitation precipitation) {
|
||||
public Mutable setPrecipitation(Biome.Precipitation precipitation) {
|
||||
climateSettings.precipitation = precipitation;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setTemperature(float temperature) {
|
||||
climateSettings.temperature = temperature;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setTemperatureModifier(@NotNull Biome.TemperatureModifier temperatureModifier) {
|
||||
public Mutable setTemperatureModifier(Biome.TemperatureModifier temperatureModifier) {
|
||||
climateSettings.temperatureModifier = temperatureModifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Mutable setDownfall(float downfall) {
|
||||
climateSettings.downfall = downfall;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Biome.Precipitation getPrecipitation() {
|
||||
return climateSettings.precipitation;
|
||||
}
|
||||
@@ -230,7 +216,6 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Biome.TemperatureModifier getTemperatureModifier() {
|
||||
return climateSettings.temperatureModifier;
|
||||
}
|
||||
@@ -253,84 +238,72 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setFogColor(int color) {
|
||||
effects.fogColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setWaterColor(int color) {
|
||||
effects.waterColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setWaterFogColor(int color) {
|
||||
effects.waterFogColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setSkyColor(int color) {
|
||||
effects.skyColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride) {
|
||||
effects.foliageColorOverride = Optional.ofNullable(colorOverride);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride) {
|
||||
effects.grassColorOverride = Optional.ofNullable(colorOverride);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setGrassColorModifier(@NotNull GrassColorModifier modifier) {
|
||||
public EffectsProperties.Mutable setGrassColorModifier(GrassColorModifier modifier) {
|
||||
effects.grassColorModifier = modifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings) {
|
||||
effects.ambientParticleSettings = Optional.ofNullable(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setAmbientLoopSound(@Nullable SoundEvent sound) {
|
||||
effects.ambientLoopSoundEvent = Optional.ofNullable(sound);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings) {
|
||||
effects.ambientMoodSettings = Optional.ofNullable(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings) {
|
||||
effects.ambientAdditionsSettings = Optional.ofNullable(settings);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music) {
|
||||
effects.backgroundMusic = Optional.ofNullable(music);
|
||||
return this;
|
||||
@@ -357,49 +330,41 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public OptionalInt getFoliageColorOverride() {
|
||||
return effects.foliageColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public OptionalInt getGrassColorOverride() {
|
||||
return effects.grassColorOverride.map(OptionalInt::of).orElseGet(OptionalInt::empty);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public GrassColorModifier getGrassColorModifier() {
|
||||
return effects.grassColorModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Optional<AmbientParticleSettings> getAmbientParticle() {
|
||||
return effects.ambientParticleSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Optional<SoundEvent> getAmbientLoopSound() {
|
||||
return effects.ambientLoopSoundEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Optional<AmbientMoodSettings> getAmbientMoodSound() {
|
||||
return effects.ambientMoodSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Optional<AmbientAdditionsSettings> getAmbientAdditionsSound() {
|
||||
return effects.ambientAdditionsSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Optional<Music> getBackgroundMusic() {
|
||||
return effects.backgroundMusic;
|
||||
}
|
||||
@@ -417,22 +382,22 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder() {
|
||||
public Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder() {
|
||||
return Optional.ofNullable(settings.getSurfaceBuilder());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving) {
|
||||
public List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving) {
|
||||
return settings.getCarvers(carving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures() {
|
||||
public List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures() {
|
||||
return settings.features();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts() {
|
||||
public List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts() {
|
||||
return (List<Supplier<ConfiguredStructureFeature<?, ?>>>) settings.structures();
|
||||
}
|
||||
}
|
||||
@@ -454,13 +419,11 @@ public final class BiomeHooks {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<MobCategory, List<MobSpawnSettings.SpawnerData>> getSpawners() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> getMobSpawnCosts() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -20,22 +20,16 @@
|
||||
package me.shedaniel.architectury.hooks.biome;
|
||||
|
||||
import net.minecraft.world.level.biome.Biome.BiomeCategory;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface BiomeProperties {
|
||||
@NotNull
|
||||
ClimateProperties getClimateProperties();
|
||||
|
||||
@NotNull
|
||||
EffectsProperties getEffectsProperties();
|
||||
|
||||
@NotNull
|
||||
GenerationProperties getGenerationProperties();
|
||||
|
||||
@NotNull
|
||||
SpawnProperties getSpawnProperties();
|
||||
|
||||
@NotNull
|
||||
BiomeCategory getCategory();
|
||||
|
||||
float getDepth();
|
||||
@@ -44,28 +38,21 @@ public interface BiomeProperties {
|
||||
|
||||
interface Mutable extends BiomeProperties {
|
||||
@Override
|
||||
@NotNull
|
||||
ClimateProperties.Mutable getClimateProperties();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
EffectsProperties.Mutable getEffectsProperties();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
GenerationProperties.Mutable getGenerationProperties();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
SpawnProperties.Mutable getSpawnProperties();
|
||||
|
||||
@NotNull
|
||||
Mutable setCategory(@NotNull BiomeCategory category);
|
||||
Mutable setCategory(BiomeCategory category);
|
||||
|
||||
@NotNull
|
||||
Mutable setDepth(float depth);
|
||||
|
||||
@NotNull
|
||||
Mutable setScale(float scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,27 +24,21 @@ import net.minecraft.world.level.biome.Biome.TemperatureModifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ClimateProperties {
|
||||
@NotNull
|
||||
Precipitation getPrecipitation();
|
||||
|
||||
float getTemperature();
|
||||
|
||||
@NotNull
|
||||
TemperatureModifier getTemperatureModifier();
|
||||
|
||||
float getDownfall();
|
||||
|
||||
interface Mutable extends ClimateProperties {
|
||||
@NotNull
|
||||
Mutable setPrecipitation(@NotNull Precipitation precipitation);
|
||||
Mutable setPrecipitation(Precipitation precipitation);
|
||||
|
||||
@NotNull
|
||||
Mutable setTemperature(float temperature);
|
||||
|
||||
@NotNull
|
||||
Mutable setTemperatureModifier(@NotNull TemperatureModifier temperatureModifier);
|
||||
Mutable setTemperatureModifier(TemperatureModifier temperatureModifier);
|
||||
|
||||
@NotNull
|
||||
Mutable setDownfall(float downfall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ import net.minecraft.world.level.biome.AmbientAdditionsSettings;
|
||||
import net.minecraft.world.level.biome.AmbientMoodSettings;
|
||||
import net.minecraft.world.level.biome.AmbientParticleSettings;
|
||||
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -40,65 +39,45 @@ public interface EffectsProperties {
|
||||
|
||||
int getSkyColor();
|
||||
|
||||
@NotNull
|
||||
OptionalInt getFoliageColorOverride();
|
||||
|
||||
@NotNull
|
||||
OptionalInt getGrassColorOverride();
|
||||
|
||||
@NotNull
|
||||
GrassColorModifier getGrassColorModifier();
|
||||
|
||||
@NotNull
|
||||
Optional<AmbientParticleSettings> getAmbientParticle();
|
||||
|
||||
@NotNull
|
||||
Optional<SoundEvent> getAmbientLoopSound();
|
||||
|
||||
@NotNull
|
||||
Optional<AmbientMoodSettings> getAmbientMoodSound();
|
||||
|
||||
@NotNull
|
||||
Optional<AmbientAdditionsSettings> getAmbientAdditionsSound();
|
||||
|
||||
@NotNull
|
||||
Optional<Music> getBackgroundMusic();
|
||||
|
||||
interface Mutable extends EffectsProperties {
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setFogColor(int color);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setWaterColor(int color);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setWaterFogColor(int color);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setSkyColor(int color);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setFoliageColorOverride(@Nullable Integer colorOverride);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setGrassColorOverride(@Nullable Integer colorOverride);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setGrassColorModifier(@NotNull GrassColorModifier modifier);
|
||||
EffectsProperties.Mutable setGrassColorModifier(GrassColorModifier modifier);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setAmbientParticle(@Nullable AmbientParticleSettings settings);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setAmbientLoopSound(@Nullable SoundEvent sound);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setAmbientMoodSound(@Nullable AmbientMoodSettings settings);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setAmbientAdditionsSound(@Nullable AmbientAdditionsSettings settings);
|
||||
|
||||
@NotNull
|
||||
EffectsProperties.Mutable setBackgroundMusic(@Nullable Music music);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,23 +24,18 @@ import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||
import net.minecraft.world.level.levelgen.surfacebuilders.ConfiguredSurfaceBuilder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface GenerationProperties {
|
||||
@NotNull
|
||||
Optional<Supplier<ConfiguredSurfaceBuilder<?>>> getSurfaceBuilder();
|
||||
|
||||
@NotNull
|
||||
List<Supplier<ConfiguredWorldCarver<?>>> getCarvers(GenerationStep.Carving carving);
|
||||
|
||||
@NotNull
|
||||
List<List<Supplier<ConfiguredFeature<?, ?>>>> getFeatures();
|
||||
|
||||
@NotNull
|
||||
List<Supplier<ConfiguredStructureFeature<?, ?>>> getStructureStarts();
|
||||
|
||||
interface Mutable extends GenerationProperties {
|
||||
|
||||
@@ -22,7 +22,6 @@ package me.shedaniel.architectury.hooks.biome;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -31,16 +30,13 @@ import java.util.function.BiPredicate;
|
||||
public interface SpawnProperties {
|
||||
float getCreatureProbability();
|
||||
|
||||
@NotNull
|
||||
Map<MobCategory, List<MobSpawnSettings.SpawnerData>> getSpawners();
|
||||
|
||||
@NotNull
|
||||
Map<EntityType<?>, MobSpawnSettings.MobSpawnCost> getMobSpawnCosts();
|
||||
|
||||
boolean isPlayerSpawnFriendly();
|
||||
|
||||
interface Mutable extends SpawnProperties {
|
||||
@NotNull
|
||||
Mutable setCreatureProbability(float probability);
|
||||
|
||||
Mutable addSpawn(MobCategory category, MobSpawnSettings.SpawnerData data);
|
||||
@@ -53,7 +49,6 @@ public interface SpawnProperties {
|
||||
|
||||
Mutable clearSpawnCost(EntityType<?> entityType);
|
||||
|
||||
@NotNull
|
||||
Mutable setPlayerSpawnFriendly(boolean friendly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ package me.shedaniel.architectury.platform;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.nio.file.Path;
|
||||
@@ -30,16 +29,12 @@ import java.util.Collection;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface Mod {
|
||||
@NotNull
|
||||
String getModId();
|
||||
|
||||
@NotNull
|
||||
String getVersion();
|
||||
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
@NotNull
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
@@ -48,25 +43,19 @@ public interface Mod {
|
||||
* @param preferredSize the preferred logo size, only used in fabric
|
||||
* @return the logo file path relative to the file
|
||||
*/
|
||||
@NotNull
|
||||
Optional<String> getLogoFile(int preferredSize);
|
||||
|
||||
@NotNull
|
||||
Path getFilePath();
|
||||
|
||||
@NotNull
|
||||
Collection<String> getAuthors();
|
||||
|
||||
@Nullable
|
||||
Collection<String> getLicense();
|
||||
|
||||
@NotNull
|
||||
Optional<String> getHomepage();
|
||||
|
||||
@NotNull
|
||||
Optional<String> getSources();
|
||||
|
||||
@NotNull
|
||||
Optional<String> getIssueTracker();
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
|
||||
@@ -21,10 +21,11 @@ package me.shedaniel.architectury.platform;
|
||||
|
||||
import me.shedaniel.architectury.Architectury;
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import me.shedaniel.architectury.targets.ArchitecturyTarget;
|
||||
import me.shedaniel.architectury.utils.Env;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
@@ -37,8 +38,11 @@ public final class Platform {
|
||||
|
||||
/**
|
||||
* @return the current mod loader, either "fabric" or "forge"
|
||||
* @deprecated does not reflect the true mod loader, "quilt" is never returned,
|
||||
* use {@link ArchitecturyTarget#getCurrentTarget()} instead.
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated
|
||||
@ApiStatus.ScheduledForRemoval(inVersion = "2.0")
|
||||
public static String getModLoader() {
|
||||
return Architectury.getModLoader();
|
||||
}
|
||||
@@ -68,30 +72,25 @@ public final class Platform {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static String getMinecraftVersion() {
|
||||
return SharedConstants.getCurrentVersion().getId();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Path getGameFolder() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Path getConfigFolder() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Env getEnvironment() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static EnvType getEnv() {
|
||||
throw new AssertionError();
|
||||
@@ -102,13 +101,11 @@ public final class Platform {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Mod getMod(String id) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Optional<Mod> getOptionalMod(String id) {
|
||||
try {
|
||||
return Optional.of(getMod(id));
|
||||
@@ -117,13 +114,11 @@ public final class Platform {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Collection<Mod> getMods() {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@ExpectPlatform
|
||||
public static Collection<String> getModIds() {
|
||||
throw new AssertionError();
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.google.common.base.Predicates;
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import me.shedaniel.architectury.hooks.biome.BiomeProperties;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Predicate;
|
||||
@@ -66,10 +65,8 @@ public final class BiomeModifications {
|
||||
}
|
||||
|
||||
public interface BiomeContext {
|
||||
@NotNull
|
||||
ResourceLocation getKey();
|
||||
|
||||
@NotNull
|
||||
BiomeProperties getProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.function.Function;
|
||||
public final class BlockEntityRenderers {
|
||||
private BlockEntityRenderers() {}
|
||||
|
||||
public static <T extends BlockEntity> void registerRenderer(BlockEntityType<T> type, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<T>> provider) {
|
||||
public static <T extends BlockEntity> void registerRenderer(BlockEntityType<T> type, Function<BlockEntityRenderDispatcher, BlockEntityRenderer<? super T>> provider) {
|
||||
registerRenderer(type, (BlockEntityRendererProvider.Context context) -> provider.apply(context.getBlockEntityRenderDispatcher()));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ package me.shedaniel.architectury.registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.LazyLoadedValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -31,42 +30,36 @@ import java.util.Objects;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class DeferredRegister<T> {
|
||||
@NotNull
|
||||
private final Supplier<Registries> registriesSupplier;
|
||||
@NotNull
|
||||
private final ResourceKey<net.minecraft.core.Registry<T>> key;
|
||||
private final List<Entry<T>> entries = new ArrayList<>();
|
||||
private boolean registered = false;
|
||||
@Nullable
|
||||
private String modId;
|
||||
|
||||
private DeferredRegister(@NotNull Supplier<Registries> registriesSupplier, @NotNull ResourceKey<net.minecraft.core.Registry<T>> key, @Nullable String modId) {
|
||||
private DeferredRegister(Supplier<Registries> registriesSupplier, ResourceKey<net.minecraft.core.Registry<T>> key, @Nullable String modId) {
|
||||
this.registriesSupplier = Objects.requireNonNull(registriesSupplier);
|
||||
this.key = Objects.requireNonNull(key);
|
||||
this.modId = modId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> DeferredRegister<T> create(@NotNull String modId, @NotNull ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
public static <T> DeferredRegister<T> create(String modId, ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
LazyLoadedValue<Registries> value = new LazyLoadedValue<>(() -> Registries.get(modId));
|
||||
return new DeferredRegister<>(value::get, key, Objects.requireNonNull(modId));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static <T> DeferredRegister<T> create(@NotNull Registries registries, @NotNull ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
public static <T> DeferredRegister<T> create(Registries registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
return new DeferredRegister<>(() -> registries, key, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static <T> DeferredRegister<T> create(@NotNull Supplier<Registries> registries, @NotNull ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
public static <T> DeferredRegister<T> create(Supplier<Registries> registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
return new DeferredRegister<>(registries, key, null);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static <T> DeferredRegister<T> create(@NotNull LazyLoadedValue<Registries> registries, @NotNull ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
public static <T> DeferredRegister<T> create(LazyLoadedValue<Registries> registries, ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
return create(registries::get, key);
|
||||
}
|
||||
|
||||
@@ -110,12 +103,12 @@ public class DeferredRegister<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ResourceLocation getRegistryId() {
|
||||
public ResourceLocation getRegistryId() {
|
||||
return key.location();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ResourceLocation getId() {
|
||||
public ResourceLocation getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ import me.shedaniel.architectury.registry.registries.RegistryBuilder;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -39,7 +38,6 @@ public final class Registries {
|
||||
private final RegistryProvider provider;
|
||||
private final String modId;
|
||||
|
||||
@NotNull
|
||||
public static Registries get(String modId) {
|
||||
return REGISTRIES.computeIfAbsent(modId, Registries::new);
|
||||
}
|
||||
@@ -49,18 +47,15 @@ public final class Registries {
|
||||
this.modId = modId;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public <T> Registry<T> get(ResourceKey<net.minecraft.core.Registry<T>> key) {
|
||||
return this.provider.get(key);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public <T> Registry<T> get(net.minecraft.core.Registry<T> registry) {
|
||||
return this.provider.get(registry);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@SafeVarargs
|
||||
public final <T extends RegistryEntry<T>> RegistryBuilder<T> builder(ResourceLocation registryId, T... typeGetter) {
|
||||
if (typeGetter.length != 0) throw new IllegalStateException("array must be empty!");
|
||||
@@ -103,7 +98,6 @@ public final class Registries {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String getModId() {
|
||||
return modId;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ package me.shedaniel.architectury.registry;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Map;
|
||||
@@ -30,21 +29,17 @@ import java.util.Set;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface Registry<T> extends Iterable<T> {
|
||||
@NotNull
|
||||
default Supplier<T> delegate(ResourceLocation id) {
|
||||
return delegateSupplied(id);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
RegistrySupplier<T> delegateSupplied(ResourceLocation id);
|
||||
|
||||
@NotNull
|
||||
default Supplier<T> register(ResourceLocation id, Supplier<T> supplier) {
|
||||
default <E extends T> Supplier<E> register(ResourceLocation id, Supplier<E> supplier) {
|
||||
return registerSupplied(id, supplier);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
RegistrySupplier<T> registerSupplied(ResourceLocation id, Supplier<T> supplier);
|
||||
<E extends T> RegistrySupplier<E> registerSupplied(ResourceLocation id, Supplier<E> supplier);
|
||||
|
||||
@Nullable
|
||||
ResourceLocation getId(T obj);
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package me.shedaniel.architectury.registry;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Optional;
|
||||
@@ -32,13 +31,11 @@ public interface RegistrySupplier<T> extends Supplier<T> {
|
||||
/**
|
||||
* @return the identifier of the registry
|
||||
*/
|
||||
@NotNull
|
||||
ResourceLocation getRegistryId();
|
||||
|
||||
/**
|
||||
* @return the identifier of the entry
|
||||
*/
|
||||
@NotNull
|
||||
ResourceLocation getId();
|
||||
|
||||
/**
|
||||
@@ -54,7 +51,6 @@ public interface RegistrySupplier<T> extends Supplier<T> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
default Optional<T> toOptional() {
|
||||
return Optional.ofNullable(getOrNull());
|
||||
}
|
||||
@@ -73,7 +69,6 @@ public interface RegistrySupplier<T> extends Supplier<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
default Stream<T> stream() {
|
||||
if (!isPresent()) {
|
||||
return Stream.empty();
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* 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 me.shedaniel.architectury.registry.entity;
|
||||
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public final class EntityAttributes {
|
||||
private EntityAttributes() {}
|
||||
|
||||
/**
|
||||
* Registers default attributes to entities.
|
||||
*
|
||||
* @param type the type of entity
|
||||
* @param attribute the attributes to register
|
||||
* @see net.minecraft.world.entity.ai.attributes.DefaultAttributes
|
||||
*/
|
||||
@ExpectPlatform
|
||||
public static void register(Supplier<EntityType<? extends LivingEntity>> type, Supplier<AttributeSupplier.Builder> attribute) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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 me.shedaniel.architectury.registry.fuel;
|
||||
|
||||
import me.shedaniel.architectury.annotations.ExpectPlatform;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
|
||||
public final class FuelRegistry {
|
||||
private FuelRegistry() {}
|
||||
|
||||
/**
|
||||
* Registers a burn time for items.
|
||||
*
|
||||
* @param time the new burn time, use {@code 0} for non-fuel items,
|
||||
* and {@code -1} to use vanilla logic
|
||||
* @param items the array of items to register for
|
||||
*/
|
||||
@ExpectPlatform
|
||||
public static void register(int time, ItemLike... items) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the burn time of an {@link ItemStack}.
|
||||
*
|
||||
* @param stack the stack
|
||||
* @return the burn time of the stack, returns {@code 0} if not a fuel
|
||||
*/
|
||||
@ExpectPlatform
|
||||
public static int get(ItemStack stack) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
@@ -21,22 +21,17 @@ package me.shedaniel.architectury.registry.registries;
|
||||
|
||||
import me.shedaniel.architectury.core.RegistryEntry;
|
||||
import me.shedaniel.architectury.registry.Registry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface RegistryBuilder<T extends RegistryEntry<T>> {
|
||||
@NotNull
|
||||
Registry<T> build();
|
||||
|
||||
@NotNull
|
||||
RegistryBuilder<T> option(@NotNull RegistryOption option);
|
||||
RegistryBuilder<T> option(RegistryOption option);
|
||||
|
||||
@NotNull
|
||||
default RegistryBuilder<T> saveToDisc() {
|
||||
return option(StandardRegistryOption.SAVE_TO_DISC);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
default RegistryBuilder<T> syncToClients() {
|
||||
return option(StandardRegistryOption.SYNC_TO_CLIENTS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user