Skip to content

Commit

Permalink
Puddles 1.2.1 - Update to 1.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Motschen committed Mar 25, 2022
1 parent 5d4fd11 commit bf576ad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '0.9-SNAPSHOT'
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_16
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down Expand Up @@ -44,7 +44,7 @@ tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"

// Minecraft 1.17 (21w19a) upwards uses Java 16.
it.options.release = 16
it.options.release = 17
}

java {
Expand Down
13 changes: 7 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.17.1
yarn_mappings=1.17.1+build.63
loader_version=0.12.3
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.2
loader_version=0.13.3


# Mod Properties
mod_version = 1.2.0
mod_version = 1.2.1
maven_group = eu.midnightdust
archives_base_name = puddles

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.41.0+1.17
midnightlib_version=0.2.9
fabric_version=0.48.0+1.18.2
midnightlib_version=0.4.0
4 changes: 2 additions & 2 deletions src/main/java/eu/midnightdust/puddles/PuddlesClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public void onInitializeClient() {
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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand All @@ -24,11 +25,10 @@
@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) {
Expand All @@ -42,7 +42,7 @@ protected MixinServerWorld(MutableWorldProperties properties, RegistryKey<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());
}
Expand All @@ -53,7 +53,7 @@ protected MixinServerWorld(MutableWorldProperties properties, RegistryKey<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) {
Expand Down

0 comments on commit bf576ad

Please sign in to comment.