Skip to content

Commit

Permalink
feat: Update to Minecraft 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
BlayTheNinth committed Oct 10, 2024
1 parent 56647bc commit 2452c7f
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 59 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
- Updated to Minecraft 1.21.1
- Added bonemeal items to c:fertilizers tag
- Updated to Minecraft 1.21.2
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.blay09.mods.fertilization;

import com.google.common.collect.Lists;
import net.blay09.mods.balm.api.config.BalmConfigData;
import net.blay09.mods.balm.api.config.Comment;
import net.blay09.mods.balm.api.config.Config;
import net.blay09.mods.balm.api.config.ExpectedType;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;

import java.util.List;
import java.util.Set;

@Config(Fertilization.MOD_ID)
public class FertilizationConfigData implements BalmConfigData {
Expand Down Expand Up @@ -41,27 +41,28 @@ public class FertilizationConfigData implements BalmConfigData {
public int floristsBoneMealMaxRange = 3;

@Comment("List of blocks that can be duplicated by using Florist's Bone Meal on them.")
public List<String> flowerBlocks = Lists.newArrayList(
"minecraft:poppy",
"minecraft:dandelion",
"minecraft:blue_orchid",
"minecraft:allium",
"minecraft:azure_bluet",
"minecraft:red_tulip",
"minecraft:orange_tulip",
"minecraft:white_tulip",
"minecraft:pink_tulip",
"minecraft:oxeye_daisy",
"minecraft:rose_bush",
"minecraft:peony",
"minecraft:lilac",
"minecraft:sunflower",
"minecraft:cornflower",
"minecraft:lily_of_the_valley");
@ExpectedType(ResourceLocation.class)
public Set<ResourceLocation> flowerBlocks = Set.of(
ResourceLocation.withDefaultNamespace("poppy"),
ResourceLocation.withDefaultNamespace("dandelion"),
ResourceLocation.withDefaultNamespace("blue_orchid"),
ResourceLocation.withDefaultNamespace("allium"),
ResourceLocation.withDefaultNamespace("azure_bluet"),
ResourceLocation.withDefaultNamespace("red_tulip"),
ResourceLocation.withDefaultNamespace("orange_tulip"),
ResourceLocation.withDefaultNamespace("white_tulip"),
ResourceLocation.withDefaultNamespace("pink_tulip"),
ResourceLocation.withDefaultNamespace("oxeye_daisy"),
ResourceLocation.withDefaultNamespace("rose_bush"),
ResourceLocation.withDefaultNamespace("peony"),
ResourceLocation.withDefaultNamespace("lilac"),
ResourceLocation.withDefaultNamespace("sunflower"),
ResourceLocation.withDefaultNamespace("cornflower"),
ResourceLocation.withDefaultNamespace("lily_of_the_valley"));

public boolean isFlowerBlock(Block block) {
ResourceLocation registryName = BuiltInRegistries.BLOCK.getKey(block);
return flowerBlocks.contains(registryName.toString());
final var id = BuiltInRegistries.BLOCK.getKey(block);
return flowerBlocks.contains(id);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.dispenser.BlockSource;
import net.minecraft.core.dispenser.OptionalDispenseItemBehavior;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.DispenserBlock;
Expand All @@ -19,9 +22,9 @@ public class ModItems {
public static FloristsBoneMealItem floristsBoneMeal;

public static void initialize(BalmItems items) {
items.registerItem(() -> compressedBoneMeal = new CompressedBoneMealItem(items.itemProperties()), id("compressed_bonemeal"));
items.registerItem(() -> extremelyCompressedBoneMeal = new ExtremelyCompressedBoneMealItem(items.itemProperties()), id("extremely_compressed_bonemeal"));
items.registerItem(() -> floristsBoneMeal = new FloristsBoneMealItem(items.itemProperties()), id("florists_bonemeal"));
items.registerItem((identifier) -> compressedBoneMeal = new CompressedBoneMealItem(defaultProperties(identifier)), id("compressed_bonemeal"));
items.registerItem((identifier) -> extremelyCompressedBoneMeal = new ExtremelyCompressedBoneMealItem(defaultProperties(identifier)), id("extremely_compressed_bonemeal"));
items.registerItem((identifier) -> floristsBoneMeal = new FloristsBoneMealItem(defaultProperties(identifier)), id("florists_bonemeal"));

items.registerCreativeModeTab(() -> new ItemStack(ModItems.compressedBoneMeal), id("fertilization"));
}
Expand Down Expand Up @@ -53,4 +56,11 @@ private static ResourceLocation id(String name) {
return ResourceLocation.fromNamespaceAndPath(Fertilization.MOD_ID, name);
}

private static ResourceKey<Item> itemId(ResourceLocation identifier) {
return ResourceKey.create(Registries.ITEM, identifier);
}

private static Item.Properties defaultProperties(ResourceLocation identifier) {
return new Item.Properties().setId(itemId(identifier));
}
}
Original file line number Diff line number Diff line change
@@ -1,46 +1,56 @@
package net.blay09.mods.fertilization.fabric.datagen;

import net.blay09.mods.fertilization.Fertilization;
import net.blay09.mods.fertilization.item.ModItems;
import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricRecipeProvider;
import net.minecraft.core.HolderLookup;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.RecipeOutput;
import net.minecraft.data.recipes.RecipeProvider;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;

import java.util.concurrent.CompletableFuture;

import static net.minecraft.data.recipes.ShapedRecipeBuilder.shaped;

public class ModRecipeProvider extends FabricRecipeProvider {
public ModRecipeProvider(FabricDataOutput output, CompletableFuture<HolderLookup.Provider> provider) {
super(output, provider);
}

@Override
public void buildRecipes(RecipeOutput exporter) {
shaped(RecipeCategory.MISC, ModItems.compressedBoneMeal)
.pattern("BB")
.pattern("BB")
.define('B', Items.BONE_MEAL)
.unlockedBy("has_bone_meal", has(Items.BONE_MEAL))
.save(exporter);
protected RecipeProvider createRecipeProvider(HolderLookup.Provider registryLookup, RecipeOutput exporter) {
return new RecipeProvider(registryLookup, exporter) {
@Override
public void buildRecipes() {
shaped(RecipeCategory.MISC, ModItems.compressedBoneMeal)
.pattern("BB")
.pattern("BB")
.define('B', Items.BONE_MEAL)
.unlockedBy("has_bone_meal", has(Items.BONE_MEAL))
.save(exporter);

shaped(RecipeCategory.MISC, ModItems.extremelyCompressedBoneMeal)
.pattern("BBB")
.pattern("BBB")
.pattern("BBB")
.define('B', ModItems.compressedBoneMeal)
.unlockedBy("has_compressed_bone_meal", has(ModItems.compressedBoneMeal))
.save(exporter);

shaped(RecipeCategory.MISC, ModItems.extremelyCompressedBoneMeal)
.pattern("BBB")
.pattern("BBB")
.pattern("BBB")
.define('B', ModItems.compressedBoneMeal)
.unlockedBy("has_compressed_bone_meal", has(ModItems.compressedBoneMeal))
.save(exporter);
shaped(RecipeCategory.MISC, ModItems.floristsBoneMeal, 2)
.pattern("BF")
.pattern("FB")
.define('B', Items.BONE_MEAL)
.define('F', ItemTags.FLOWERS)
.unlockedBy("has_bone_meal", has(Items.BONE_MEAL))
.save(exporter);
}
};
}

shaped(RecipeCategory.MISC, ModItems.floristsBoneMeal, 2)
.pattern("BF")
.pattern("FB")
.define('B', Items.BONE_MEAL)
.define('F', ItemTags.FLOWERS)
.unlockedBy("has_bone_meal", has(Items.BONE_MEAL))
.save(exporter);
@Override
public String getName() {
return Fertilization.MOD_ID;
}
}
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ mod_id = fertilization
mod_name= Fertilization
mod_main=Fertilization
description=Adds additional variants of bone meal for all your fertilization needs.
version = 21.1.1
version = 21.2.0
group = net.blay09.mods
homepage=https://mods.twelveiterations.com/mc/fertilization
sources=https://github.com/TwelveIterationMods/Fertilization
Expand All @@ -19,16 +19,16 @@ modrinth_release_type = release
modrinth_project_id = dJhpNOys

# Minecraft
minecraft_version = 1.21.1
minecraft_version = 1.21.2-pre1
minimum_minecraft_version = 1.21
minecraft_versions = 1.21,1.21.1
minecraft_versions = 1.21,1.21.1,1.21.2-pre1
minecraft_version_range = [1.21,)
pack_format_number = 18
java_version = 21

# Balm
balm_version = 21.0.14-SNAPSHOT
balm_version_range = [21.0.0,)
balm_version = 21.2.1-SNAPSHOT
balm_version_range = [21.2.0,)

# Forge
forge_version = 52.0.2
Expand All @@ -41,8 +41,8 @@ neoforge_version_range = [21-beta,)
neoforge_loader_version_range = [1,)

# Fabric
fabric_version = 0.102.1+1.21.1
fabric_loader_version = 0.15.11
fabric_version = 0.105.3+1.21.2
fabric_loader_version = 0.16.5

# Dependencies
mixin_version=0.8.5
Expand All @@ -54,6 +54,6 @@ org.gradle.daemon=false
mod_author = BlayTheNinth
credits = BlayTheNinth
kuma_version = [21.0,22)
neo_form_version = 1.21.1-20240808.144430
neo_form_version = 1.21.2-pre1-20241008.174159
parchment_minecraft = 1.21
parchment_version = 2024.06.23
19 changes: 19 additions & 0 deletions repositories.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ repositories {
url = 'https://jitpack.io'
content {
includeGroup "com.github.BlueMap-Minecraft"
includeGroup "com.github.mattidragon"
}
}

Expand All @@ -65,4 +66,22 @@ repositories {
includeGroup "de.siphalor"
}
}

maven {
url = "https://dl.cloudsmith.io/public/novamachina-mods/release/maven/"
content {
includeGroup "novamachina.novacore"
includeGroup "novamachina.exnihilosequentia"
}
}

exclusiveContent {
forRepository {
maven {
name = 'Minecraft'
url = 'https://libraries.minecraft.net/'
}
}
filter { includeGroupAndSubgroups("com.mojang") }
}
}
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ plugins {

include("common")
include("fabric")
include("neoforge")
include("forge")
//include("neoforge")
//include("forge")

0 comments on commit 2452c7f

Please sign in to comment.