Mixing up the mud

- Add mixing recipe for mud
- Add BlockTagIngredient
- Update Flywheel
- Bump version
This commit is contained in:
PepperCode1 2022-09-28 22:16:18 -07:00
parent be57d096f8
commit 80ae80b39b
9 changed files with 204 additions and 7 deletions

View file

@ -143,7 +143,7 @@ dependencies {
jarJar(group: 'com.tterrag.registrate', name: 'Registrate', version: '[MC1.19-1.1.5,)') {
jarJar.pin(it, project.registrate_version)
}
jarJar(group: 'com.jozufozu.flywheel', name: "flywheel-forge-${flywheel_minecraft_version}", version: '[0.6.6,0.6.7)') {
jarJar(group: 'com.jozufozu.flywheel', name: "flywheel-forge-${flywheel_minecraft_version}", version: '[0.6.7,0.6.8)') {
jarJar.pin(it, project.flywheel_version)
}

View file

@ -4,7 +4,7 @@ org.gradle.jvmargs = -Xmx3G
org.gradle.daemon = false
# mod version info
mod_version = 0.5.0.e
mod_version = 0.5.0.f
artifact_minecraft_version = 1.19.2
minecraft_version = 1.19.2
@ -21,7 +21,7 @@ parchment_version = 2022.08.10
# dependency versions
registrate_version = MC1.19-1.1.5
flywheel_minecraft_version = 1.19.2
flywheel_version = 0.6.6-6
flywheel_version = 0.6.7-8
jei_minecraft_version = 1.19.2
jei_version = 11.2.0.254
curios_minecraft_version = 1.19.2

View file

@ -1,4 +1,4 @@
// 1.19.2 2022-09-23T20:53:24.8287802 Create's Processing Recipes
// 1.19.2 2022-09-28T21:49:27.0879193 Create's Processing Recipes
3c94326fb730f68c1e44fe1e2ef09c9db6ffd92b data/create/recipes/compacting/andesite_from_flint.json
8d3d5b31f3601b9f681ff710e0545a483a1494c6 data/create/recipes/compacting/blaze_cake.json
8bd7f4e3a686ab520b2d55594d2018d0e9a50c91 data/create/recipes/compacting/chocolate.json
@ -564,6 +564,7 @@ e7b86d4ca5de2df474794424d93b447e5f9dcdc3 data/create/recipes/mixing/chocolate_me
4cf9a0979fb6401c51c763d71f0bb53ea2c8c32b data/create/recipes/mixing/dough_by_mixing.json
ac2a2456e2f0ccd74db6dc5ad029eb4e6781a25d data/create/recipes/mixing/honey.json
251c09ac25bb73e092fac483ceb5a9196a479919 data/create/recipes/mixing/lava_from_cobble.json
939c55202f06b50cec3c16e66e85f915f2272db2 data/create/recipes/mixing/mud_by_mixing.json
4454cb7a73571d90e19826ee394b0c9e52ac8620 data/create/recipes/mixing/tea.json
8bd950c78b4db3b7f5a9a1f42c116677049b77fc data/create/recipes/pressing/brass_ingot.json
8dee39f86784636639790b0ed1bbd5c845522952 data/create/recipes/pressing/copper_ingot.json

View file

@ -0,0 +1,19 @@
{
"type": "create:mixing",
"ingredients": [
{
"type": "create:block_tag_ingredient",
"tag": "minecraft:convertable_to_mud"
},
{
"amount": 250,
"fluid": "minecraft:water",
"nbt": {}
}
],
"results": [
{
"item": "minecraft:mud"
}
]
}

View file

@ -65,7 +65,7 @@ public class Create {
public static final String ID = "create";
public static final String NAME = "Create";
public static final String VERSION = "0.5e";
public static final String VERSION = "0.5f";
public static final Logger LOGGER = LogManager.getLogger();

View file

@ -4,8 +4,10 @@ import com.simibubi.create.AllFluids;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllRecipeTypes;
import com.simibubi.create.content.contraptions.processing.HeatCondition;
import com.simibubi.create.foundation.utility.recipe.BlockTagIngredient;
import net.minecraft.data.DataGenerator;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
@ -55,7 +57,11 @@ public class MixingRecipeGen extends ProcessingRecipeGen {
ANDESITE_ALLOY_FROM_ZINC = create("andesite_alloy_from_zinc", b -> b.require(Blocks.ANDESITE)
.require(I.zincNugget())
.output(I.andesite(), 1))
.output(I.andesite(), 1)),
MUD = create("mud_by_mixing", b -> b.require(BlockTagIngredient.create(BlockTags.CONVERTABLE_TO_MUD))
.require(Fluids.WATER, 250)
.output(Blocks.MUD, 1))
;

View file

@ -0,0 +1,20 @@
package com.simibubi.create.foundation.utility.recipe;
import com.simibubi.create.Create;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;
@EventBusSubscriber(bus = Bus.MOD)
public class AllIngredients {
@SubscribeEvent
public static void register(RegisterEvent event) {
if (event.getRegistryKey().equals(ForgeRegistries.Keys.RECIPE_SERIALIZERS)) {
CraftingHelper.register(Create.asResource("block_tag_ingredient"), BlockTagIngredient.Serializer.INSTANCE);
}
}
}

View file

@ -0,0 +1,151 @@
package com.simibubi.create.foundation.utility.recipe;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nullable;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntComparators;
import it.unimi.dsi.fastutil.ints.IntList;
import net.minecraft.core.Registry;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.entity.player.StackedContents;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.crafting.AbstractIngredient;
import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.crafting.IIngredientSerializer;
import net.minecraftforge.registries.ForgeRegistries;
public class BlockTagIngredient extends AbstractIngredient {
protected final TagKey<Block> tag;
@Nullable
protected ItemStack[] itemStacks;
@Nullable
protected IntList stackingIds;
protected BlockTagIngredient(TagKey<Block> tag) {
this.tag = tag;
}
public static BlockTagIngredient create(TagKey<Block> tag) {
return new BlockTagIngredient(tag);
}
protected void dissolve() {
if (itemStacks == null) {
List<ItemStack> list = new ArrayList<>();
for (Block block : ForgeRegistries.BLOCKS.tags().getTag(tag)) {
ItemStack stack = new ItemStack(block);
if (!stack.isEmpty()) {
list.add(stack);
}
}
itemStacks = list.toArray(ItemStack[]::new);
}
}
@Override
public ItemStack[] getItems() {
dissolve();
return itemStacks;
}
@Override
public boolean test(@Nullable ItemStack stack) {
if (stack == null) {
return false;
}
dissolve();
if (itemStacks.length == 0) {
return stack.isEmpty();
}
for (ItemStack itemStack : itemStacks) {
if (itemStack.is(stack.getItem())) {
return true;
}
}
return false;
}
@Override
public IntList getStackingIds() {
if (stackingIds == null || checkInvalidation()) {
markValid();
dissolve();
stackingIds = new IntArrayList(itemStacks.length);
for (ItemStack stack : itemStacks) {
stackingIds.add(StackedContents.getStackingIndex(stack));
}
stackingIds.sort(IntComparators.NATURAL_COMPARATOR);
}
return stackingIds;
}
public TagKey<Block> getTag() {
return tag;
}
@Override
protected void invalidate() {
itemStacks = null;
stackingIds = null;
}
@Override
public boolean isSimple() {
return true;
}
@Override
public IIngredientSerializer<? extends Ingredient> getSerializer() {
return Serializer.INSTANCE;
}
@Override
public JsonElement toJson() {
JsonObject json = new JsonObject();
json.addProperty("type", CraftingHelper.getID(Serializer.INSTANCE).toString());
json.addProperty("tag", tag.location().toString());
return json;
}
public static class Serializer implements IIngredientSerializer<BlockTagIngredient> {
public static final Serializer INSTANCE = new Serializer();
@Override
public BlockTagIngredient parse(JsonObject json) {
ResourceLocation rl = new ResourceLocation(GsonHelper.getAsString(json, "tag"));
TagKey<Block> tag = TagKey.create(Registry.BLOCK_REGISTRY, rl);
return new BlockTagIngredient(tag);
}
@Override
public BlockTagIngredient parse(FriendlyByteBuf buffer) {
ResourceLocation rl = buffer.readResourceLocation();
TagKey<Block> tag = TagKey.create(Registry.BLOCK_REGISTRY, rl);
return new BlockTagIngredient(tag);
}
@Override
public void write(FriendlyByteBuf buffer, BlockTagIngredient ingredient) {
TagKey<Block> tag = ingredient.getTag();
buffer.writeResourceLocation(tag.location());
}
}
}

View file

@ -33,6 +33,6 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="flywheel"
mandatory=true
versionRange="[0.6.6,0.6.7)"
versionRange="[0.6.7,0.6.8)"
ordering="AFTER"
side="CLIENT"