mirror of
https://github.com/architectury/architectury-api.git
synced 2026-04-02 05:27:42 -05:00
Remove @NotNull spam
Things should be non null by default, and we mark @Nullable otherwise Signed-off-by: shedaniel <daniel@shedaniel.me>
This commit is contained in:
@@ -24,7 +24,6 @@ import me.shedaniel.architectury.event.EventFactory;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.world.InteractionResultHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface ChatEvent {
|
||||
/**
|
||||
@@ -33,7 +32,6 @@ public interface ChatEvent {
|
||||
Event<Server> SERVER = EventFactory.createInteractionResultHolder();
|
||||
|
||||
interface Server {
|
||||
@NotNull
|
||||
InteractionResultHolder<Component> process(ServerPlayer player, String message, Component 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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)}.
|
||||
|
||||
@@ -32,7 +32,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 {
|
||||
@@ -93,60 +92,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)
|
||||
|
||||
@@ -26,7 +26,6 @@ import me.shedaniel.architectury.utils.Env;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.minecraft.SharedConstants;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collection;
|
||||
@@ -42,7 +41,6 @@ public final class Platform {
|
||||
* @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() {
|
||||
@@ -74,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();
|
||||
@@ -108,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));
|
||||
@@ -123,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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,20 +29,16 @@ 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) {
|
||||
return registerSupplied(id, supplier);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
RegistrySupplier<T> registerSupplied(ResourceLocation id, Supplier<T> supplier);
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
package me.shedaniel.architectury.utils;
|
||||
|
||||
import com.google.common.math.LongMath;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
@@ -161,7 +160,7 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(@NotNull Fraction fraction) {
|
||||
public int compareTo(Fraction fraction) {
|
||||
return Long.compare(numerator * fraction.denominator, denominator * fraction.numerator);
|
||||
}
|
||||
|
||||
@@ -194,4 +193,4 @@ public final class Fraction extends Number implements Comparable<Fraction> {
|
||||
if (intValue() == doubleValue()) return toDecimalString();
|
||||
return String.format("%s (%d/%d)", toDecimalString(), numerator, denominator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user