Skip to content

Commit

Permalink
Port to 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Juuxel committed Mar 24, 2023
1 parent fce2d93 commit 751d0af
Show file tree
Hide file tree
Showing 20 changed files with 85 additions and 69 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version = 1.19.3
yarn_mappings = 1.19.3+build.5
loader_version = 0.14.16
minecraft_version = 1.19.4
yarn_mappings = 1.19.4+build.1
loader_version = 0.14.18

# Mod Properties
mod_version = 2.0.1
mod_version = 2.0.2
maven_group = io.github.juuxel
archives_base_name = WoodsAndMires

# Dependencies
fabric_version = 0.75.1+1.19.3
terrablender_version = 1.19.3-2.1.0.134
fabric_version = 0.76.0+1.19.4
terrablender_version = 1.19.4-2.2.0.154
typesafe_config_version = 1.4.2
25 changes: 12 additions & 13 deletions src/data/java/juuxel/woodsandmires/data/builtin/WamBiomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import java.util.function.Consumer;

public final class WamBiomes {
// See Biome.doesNotSnow (1.19.4)
private static final float WARM_BIOME_MINIMUM_TEMPERATURE = 0.15f;

private final Registerable<Biome> registerable;

private WamBiomes(Registerable<Biome> registerable) {
Expand Down Expand Up @@ -52,7 +55,7 @@ private static int getSkyColor(float temperature) {
return OverworldBiomeCreator.getSkyColor(temperature);
}

private Biome pineForest(Biome.Precipitation precipitation, float temperature,
private Biome pineForest(float temperature,
Consumer<GenerationSettings.LookupBackedBuilder> earlyGenerationSettingsConfigurator,
Consumer<GenerationSettings.LookupBackedBuilder> generationSettingsConfigurator) {
GenerationSettings generationSettings = generationSettings(builder -> {
Expand All @@ -69,7 +72,7 @@ private Biome pineForest(Biome.Precipitation precipitation, float temperature,

generationSettingsConfigurator.accept(builder);

if (precipitation != Biome.Precipitation.SNOW) {
if (temperature >= WARM_BIOME_MINIMUM_TEMPERATURE) {
DefaultBiomeFeatures.addDefaultFlowers(builder);
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.PINE_FOREST_HEATHER_PATCH);
}
Expand Down Expand Up @@ -98,7 +101,6 @@ private Biome pineForest(Biome.Precipitation precipitation, float temperature,
.moodSound(BiomeMoodSound.CAVE)
.build()
)
.precipitation(precipitation)
.downfall(0.6f)
.temperature(temperature)
.generationSettings(generationSettings)
Expand All @@ -108,26 +110,26 @@ private Biome pineForest(Biome.Precipitation precipitation, float temperature,

private Biome pineForest() {
// noinspection CodeBlock2Expr
return pineForest(Biome.Precipitation.RAIN, 0.6f, builder -> {}, builder -> {
return pineForest(0.6f, builder -> {}, builder -> {
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.FOREST_PINE);
});
}

private Biome snowyPineForest() {
// noinspection CodeBlock2Expr
return pineForest(Biome.Precipitation.SNOW, 0f, builder -> {}, builder -> {
return pineForest(0f, builder -> {}, builder -> {
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.SNOWY_PINE_FOREST_TREES);
});
}

private Biome oldGrowthPineForest() {
return pineForest(Biome.Precipitation.RAIN, 0.4f, builder -> {}, builder -> {
return pineForest(0.4f, builder -> {}, builder -> {
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.OLD_GROWTH_PINE_FOREST_TREES);
});
}

private Biome lushPineForest() {
return pineForest(Biome.Precipitation.RAIN, 0.6f, builder -> {
return pineForest(0.6f, builder -> {
DefaultBiomeFeatures.addSavannaTallGrass(builder);
}, builder -> {
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.LUSH_PINE_FOREST_TREES);
Expand Down Expand Up @@ -164,15 +166,14 @@ private Biome pineMire() {
.skyColor(getSkyColor(0.6f))
.build()
)
.precipitation(Biome.Precipitation.RAIN)
.downfall(0.9f)
.temperature(0.6f)
.generationSettings(generationSettings)
.spawnSettings(spawnSettings)
.build();
}

private Biome fell(Biome.Precipitation precipitation, float temperature, Consumer<GenerationSettings.LookupBackedBuilder> generationSettingsConfigurator) {
private Biome fell(float temperature, Consumer<GenerationSettings.LookupBackedBuilder> generationSettingsConfigurator) {
SpawnSettings spawnSettings = spawnSettings(builder -> {
DefaultBiomeFeatures.addBatsAndMonsters(builder);

Expand All @@ -196,7 +197,6 @@ private Biome fell(Biome.Precipitation precipitation, float temperature, Consume
.moodSound(BiomeMoodSound.CAVE)
.build()
)
.precipitation(precipitation)
.downfall(0.7f)
.temperature(temperature)
.generationSettings(generationSettings)
Expand All @@ -205,7 +205,7 @@ private Biome fell(Biome.Precipitation precipitation, float temperature, Consume
}

private Biome fell() {
return fell(Biome.Precipitation.RAIN, 0.25f, builder -> {
return fell(0.25f, builder -> {
DefaultBiomeFeatures.addDefaultFlowers(builder);
builder.feature(GenerationStep.Feature.VEGETAL_DECORATION, WamPlacedFeatureKeys.FELL_HEATHER_PATCH);
DefaultBiomeFeatures.addForestGrass(builder);
Expand All @@ -222,7 +222,7 @@ private Biome fell() {
}

private Biome snowyFell() {
return fell(Biome.Precipitation.SNOW, 0f, builder -> {
return fell(0f, builder -> {
builder.feature(GenerationStep.Feature.LOCAL_MODIFICATIONS, WamPlacedFeatureKeys.FELL_BOULDER);
builder.feature(GenerationStep.Feature.LAKES, WamPlacedFeatureKeys.FELL_POND);
builder.feature(GenerationStep.Feature.SURFACE_STRUCTURES, WamPlacedFeatureKeys.FROZEN_TREASURE);
Expand Down Expand Up @@ -257,7 +257,6 @@ private Biome pinyGrove() {
.moodSound(BiomeMoodSound.CAVE)
.build()
)
.precipitation(Biome.Precipitation.SNOW)
.downfall(0.8f)
.temperature(-0.2f)
.generationSettings(generationSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minecraft.registry.RegistryEntryLookup;
import net.minecraft.registry.RegistryKey;
import net.minecraft.registry.RegistryKeys;
import net.minecraft.registry.entry.RegistryEntry;
import net.minecraft.util.math.intprovider.ClampedIntProvider;
import net.minecraft.util.math.intprovider.UniformIntProvider;
import net.minecraft.world.gen.feature.ConfiguredFeature;
Expand All @@ -31,15 +30,15 @@ private static List<PlacementModifier> cons(PlacementModifier head, List<Placeme
}

private static List<PlacementModifier> treeModifiers(PlacementModifier countModifier) {
return VegetationPlacedFeatures.modifiers(countModifier);
return VegetationPlacedFeatures.treeModifiers(countModifier);
}

private static List<PlacementModifier> countExtraTreeModifiers(int count, float extraChance, int extraCount) {
return treeModifiers(PlacedFeatures.createCountExtraModifier(count, extraChance, extraCount));
}

private static List<PlacementModifier> treeModifiersWithWouldSurvive(PlacementModifier countModifier, Block block) {
return VegetationPlacedFeatures.modifiersWithWouldSurvive(countModifier, block);
return VegetationPlacedFeatures.treeModifiersWithWouldSurvive(countModifier, block);
}

private static List<PlacementModifier> countModifiers(int count) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "rain",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "rain",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "rain",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "rain",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"woods_and_mires:mire_meadow"
]
],
"precipitation": "rain",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "snow",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "snow",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"minecraft:freeze_top_layer"
]
],
"precipitation": "snow",
"has_precipitation": true,
"spawn_costs": {},
"spawners": {
"ambient": [
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/juuxel/woodsandmires/WoodsAndMires.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package juuxel.woodsandmires;

import juuxel.woodsandmires.biome.WamBiomeModifications;
import juuxel.woodsandmires.block.WamBlockSetTypes;
import juuxel.woodsandmires.block.WamBlocks;
import juuxel.woodsandmires.block.WamSignTypes;
import juuxel.woodsandmires.block.WamWoodTypes;
import juuxel.woodsandmires.block.entity.WamBlockEntities;
import juuxel.woodsandmires.config.WamConfig;
import juuxel.woodsandmires.dev.WamDev;
Expand All @@ -23,7 +24,8 @@ public static Identifier id(String path) {
@Override
public void onInitialize() {
WamConfig.load();
WamSignTypes.init();
WamBlockSetTypes.init();
WamWoodTypes.init();
WamBlocks.init();
WamBlockEntities.register();
WamItemGroups.init();
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/juuxel/woodsandmires/block/WamBlockSetTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package juuxel.woodsandmires.block;

import juuxel.woodsandmires.WoodsAndMires;
import net.fabricmc.fabric.api.object.builder.v1.block.type.BlockSetTypeRegistry;
import net.minecraft.block.BlockSetType;

public final class WamBlockSetTypes {
public static final BlockSetType PINE = registerWood("pine");

public static void init() {
}

private static BlockSetType registerWood(String id) {
return BlockSetTypeRegistry.registerWood(WoodsAndMires.id(id));
}
}
17 changes: 8 additions & 9 deletions src/main/java/juuxel/woodsandmires/block/WamBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.sound.SoundEvents;
import org.jetbrains.annotations.Nullable;

import java.util.function.Supplier;
Expand All @@ -41,14 +40,14 @@ public final class WamBlocks {
public static final Block PINE_SLAB = new SlabBlock(copyWoodSettings(Blocks.OAK_SLAB));
public static final Block PINE_STAIRS = new StairsBlock(PINE_PLANKS.getDefaultState(), copyWoodSettings(Blocks.OAK_STAIRS));
public static final Block PINE_FENCE = new FenceBlock(copyWoodSettings(Blocks.OAK_FENCE));
public static final Block PINE_FENCE_GATE = new FenceGateBlock(copyWoodSettings(Blocks.OAK_FENCE_GATE), SoundEvents.BLOCK_FENCE_GATE_CLOSE, SoundEvents.BLOCK_FENCE_GATE_OPEN);
public static final Block PINE_DOOR = new DoorBlock(copyWoodSettings(Blocks.OAK_DOOR), SoundEvents.BLOCK_WOODEN_DOOR_CLOSE, SoundEvents.BLOCK_WOODEN_DOOR_OPEN);
public static final Block PINE_TRAPDOOR = new TrapdoorBlock(copyWoodSettings(Blocks.OAK_DOOR), SoundEvents.BLOCK_WOODEN_TRAPDOOR_CLOSE, SoundEvents.BLOCK_WOODEN_TRAPDOOR_OPEN);
public static final Block PINE_BUTTON = Blocks.createWoodenButtonBlock();
public static final Block PINE_PRESSURE_PLATE = new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, copyWoodSettings(Blocks.OAK_PRESSURE_PLATE), SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF, SoundEvents.BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON);
public static final Block PINE_SIGN = new WamSignBlock(copyWoodSettings(Blocks.OAK_SIGN), WamSignTypes.PINE);
public static final Block PINE_FENCE_GATE = new FenceGateBlock(copyWoodSettings(Blocks.OAK_FENCE_GATE), WamWoodTypes.PINE);
public static final Block PINE_DOOR = new DoorBlock(copyWoodSettings(Blocks.OAK_DOOR), WamBlockSetTypes.PINE);
public static final Block PINE_TRAPDOOR = new TrapdoorBlock(copyWoodSettings(Blocks.OAK_DOOR), WamBlockSetTypes.PINE);
public static final Block PINE_BUTTON = Blocks.createWoodenButtonBlock(WamBlockSetTypes.PINE);
public static final Block PINE_PRESSURE_PLATE = new PressurePlateBlock(PressurePlateBlock.ActivationRule.EVERYTHING, copyWoodSettings(Blocks.OAK_PRESSURE_PLATE), WamBlockSetTypes.PINE);
public static final Block PINE_SIGN = new WamSignBlock(copyWoodSettings(Blocks.OAK_SIGN), WamWoodTypes.PINE);
// We have to evaluate this *after* PINE_SIGN has registered due to the loot table condition.
public static final Supplier<Block> PINE_WALL_SIGN = Suppliers.memoize(() -> new WamWallSignBlock(copyWoodSettings(PINE_SIGN).dropsLike(PINE_SIGN), WamSignTypes.PINE));
public static final Supplier<Block> PINE_WALL_SIGN = Suppliers.memoize(() -> new WamWallSignBlock(copyWoodSettings(PINE_SIGN).dropsLike(PINE_SIGN), WamWoodTypes.PINE));
public static final Block PINE_LEAVES = Blocks.createLeavesBlock(BlockSoundGroup.GRASS);
public static final Block PINE_SAPLING = new SaplingBlock(new PineSaplingGenerator(), AbstractBlock.Settings.copy(Blocks.OAK_SAPLING));
public static final Block POTTED_PINE_SAPLING = new FlowerPotBlock(PINE_SAPLING, createFlowerPotSettings());
Expand All @@ -63,7 +62,7 @@ public final class WamBlocks {
public static final Block FIREWEED = new TallFlowerBlock(createFlowerSettings(true));
public static final Block TANSY = new BigFlowerBlock(StatusEffects.SLOW_FALLING, 10, createFlowerSettings(false));
public static final Block POTTED_TANSY = new FlowerPotBlock(TANSY, createFlowerPotSettings());
public static final Block FELL_LICHEN = new LichenBlock(createFlowerSettings(false).mapColor(MapColor.OFF_WHITE).offsetType(AbstractBlock.OffsetType.XZ));
public static final Block FELL_LICHEN = new LichenBlock(createFlowerSettings(false).mapColor(MapColor.OFF_WHITE).offset(AbstractBlock.OffsetType.XZ));
public static final Block POTTED_FELL_LICHEN = new FlowerPotBlock(FELL_LICHEN, createFlowerPotSettings());
public static final Block HEATHER = new HeatherBlock(StatusEffects.REGENERATION, 8, createFlowerSettings(false));
public static final Block POTTED_HEATHER = new FlowerPotBlock(HEATHER, createFlowerPotSettings());
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/juuxel/woodsandmires/block/WamSignBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import juuxel.woodsandmires.block.entity.WamSignBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.SignBlock;
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.SignType;
import net.minecraft.util.math.BlockPos;

public class WamSignBlock extends SignBlock {
public WamSignBlock(Settings settings, SignType signType) {
super(settings, signType);
public WamSignBlock(Settings settings, WoodType woodType) {
super(settings, woodType);
}

@Override
Expand Down
16 changes: 0 additions & 16 deletions src/main/java/juuxel/woodsandmires/block/WamSignTypes.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import juuxel.woodsandmires.block.entity.WamSignBlockEntity;
import net.minecraft.block.BlockState;
import net.minecraft.block.WallSignBlock;
import net.minecraft.block.WoodType;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.SignType;
import net.minecraft.util.math.BlockPos;

public class WamWallSignBlock extends WallSignBlock {
public WamWallSignBlock(Settings settings, SignType signType) {
super(settings, signType);
public WamWallSignBlock(Settings settings, WoodType woodType) {
super(settings, woodType);
}

@Override
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/juuxel/woodsandmires/block/WamWoodTypes.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package juuxel.woodsandmires.block;

import juuxel.woodsandmires.WoodsAndMires;
import net.fabricmc.fabric.api.object.builder.v1.block.type.WoodTypeRegistry;
import net.minecraft.block.BlockSetType;
import net.minecraft.block.WoodType;

public final class WamWoodTypes {
public static final WoodType PINE = register("pine", WamBlockSetTypes.PINE);

public static void init() {
}

private static WoodType register(String id, BlockSetType blockSetType) {
return WoodTypeRegistry.register(WoodsAndMires.id(id), blockSetType);
}
}
Loading

0 comments on commit 751d0af

Please sign in to comment.