mirror of
https://github.com/TeamMidnightDust/Puddles.git
synced 2025-12-16 12:05:10 +01:00
Puddles 1.2.1 - Update to 1.18.2
This commit is contained in:
@@ -20,9 +20,9 @@ public class PuddlesClient implements ClientModInitializer {
|
||||
ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
||||
int waterColor;
|
||||
if (client.world != null && client.player != null) {
|
||||
Biome biome = client.world.getBiome(client.player.getBlockPos());
|
||||
Biome biome = client.world.getBiome(client.player.getBlockPos()).value();
|
||||
waterColor = biome.getWaterColor();
|
||||
} else waterColor = BuiltinBiomes.PLAINS.getWaterColor();
|
||||
} else waterColor = 4159204;
|
||||
|
||||
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> waterColor, Puddles.Puddle);
|
||||
});
|
||||
|
||||
@@ -3,10 +3,10 @@ package eu.midnightdust.puddles.config;
|
||||
import eu.midnightdust.lib.config.MidnightConfig;
|
||||
|
||||
public class PuddlesConfig extends MidnightConfig {
|
||||
@Entry // Enable or disable hats for contributors, friends and donors.
|
||||
@Entry(max = 10000) // Enable or disable hats for contributors, friends and donors.
|
||||
public static int puddleSpawnRate = 1;
|
||||
@Entry
|
||||
@Entry(max = 10000)
|
||||
public static int snowStackChance = 1;
|
||||
@Entry
|
||||
@Entry(max = 10000)
|
||||
public static int evaporationChance = 5;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.profiler.Profiler;
|
||||
import net.minecraft.util.registry.RegistryEntry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.*;
|
||||
import net.minecraft.world.chunk.WorldChunk;
|
||||
@@ -24,11 +25,10 @@ import java.util.function.Supplier;
|
||||
@SuppressWarnings("deprecation")
|
||||
@Mixin(ServerWorld.class)
|
||||
public abstract class MixinServerWorld extends World {
|
||||
protected MixinServerWorld(MutableWorldProperties properties, RegistryKey<World> registryRef, DimensionType dimensionType, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long seed) {
|
||||
super(properties, registryRef, dimensionType, profiler, isClient, debugWorld, seed);
|
||||
}
|
||||
|
||||
@Shadow protected abstract BlockPos getSurface(BlockPos pos);
|
||||
protected MixinServerWorld(MutableWorldProperties properties, RegistryKey<World> registryRef, RegistryEntry<DimensionType> registryEntry, Supplier<Profiler> profiler, boolean isClient, boolean debugWorld, long seed) {
|
||||
super(properties, registryRef, registryEntry, profiler, isClient, debugWorld, seed);
|
||||
}
|
||||
|
||||
@Inject(at = @At("TAIL"),method = "tickChunk")
|
||||
public void puddles$tickChunk(WorldChunk chunk, int randomTickSpeed, CallbackInfo ci) {
|
||||
@@ -42,7 +42,7 @@ public abstract class MixinServerWorld extends World {
|
||||
if (PuddlesConfig.puddleSpawnRate != 0) {
|
||||
profiler.push("puddles");
|
||||
if (bl && random.nextInt(10000 / PuddlesConfig.puddleSpawnRate) == 0) {
|
||||
pos = this.getSurface(getRandomPosInChunk(x, 0, z, 15));
|
||||
pos = this.getTopPosition(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, getRandomPosInChunk(x, 0, z, 15));
|
||||
if (this.hasRain(pos) && getBlockState(pos.down()).isSideSolidFullSquare(this, pos, Direction.UP) && Puddles.Puddle.canPlaceAt(null,this,pos)) {
|
||||
setBlockState(pos, Puddles.Puddle.getDefaultState());
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public abstract class MixinServerWorld extends World {
|
||||
if (PuddlesConfig.snowStackChance != 0) {
|
||||
profiler.push("extra_snow");
|
||||
if (bl && random.nextInt(10000 / PuddlesConfig.snowStackChance) == 0) {
|
||||
pos = this.getSurface(getRandomPosInChunk(x, 0, z, 15));
|
||||
pos = this.getTopPosition(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, getRandomPosInChunk(x, 0, z, 15));
|
||||
if (this.getBlockState(pos).getBlock() == Blocks.SNOW && getBlockState(pos.down()).isSideSolidFullSquare(this, pos, Direction.UP)) {
|
||||
int layer = getBlockState(pos).get(Properties.LAYERS);
|
||||
if (layer < 5) {
|
||||
|
||||
Reference in New Issue
Block a user