Added recipes for the compacting drawer

This commit is contained in:
Buuz135 2021-12-19 18:59:54 +01:00
parent 0a05aab4a2
commit 67d059b3d0
7 changed files with 139 additions and 0 deletions

View File

@ -54,6 +54,7 @@ e3138f15dbdc49225d5c66d2313cb4c6f1372ec3 data/functionalstorage/recipes/acacia_2
60434750145755324af7e86952e2905efc616f5e data/functionalstorage/recipes/birch_1.json
b1e0180179e45d5dcce15a0d9e4c7240b32a0f0a data/functionalstorage/recipes/birch_2.json
1bb8f4e3018ec26c7ee8179198d114f5f8a5dcd5 data/functionalstorage/recipes/birch_4.json
2f055e6a11a6e3ccb23545268552792af4b8a4a4 data/functionalstorage/recipes/compacting_drawer.json
b03ea02d6ccf84af8bf9482b2b0ddfa0284a5520 data/functionalstorage/recipes/crimson_1.json
ea3bf44b8e70ee71f488c62cc674839ede650a04 data/functionalstorage/recipes/crimson_2.json
4a2c846cccedc425748130054972d7e0f2757276 data/functionalstorage/recipes/crimson_4.json
@ -72,3 +73,4 @@ ff234dac4f0b0b4f83ffa92f2d2fb1074c68df43 data/functionalstorage/recipes/spruce_4
bcb281904eac23183c45786e3d703d24bba92be6 data/functionalstorage/recipes/warped_1.json
8fc3f76a2c57eb4d80ce86947fabebe48fa6f692 data/functionalstorage/recipes/warped_2.json
7510a8ca1f1e3bb63f4c4f4add0bb6b713feaa0b data/functionalstorage/recipes/warped_4.json
f37e620a26ceb158507c607cee6ba3b51f14c6d6 data/functionalstorage/tags/items/drawer.json

View File

@ -0,0 +1,43 @@
{
"type": "forge:conditional",
"recipes": [
{
"conditions": [
{
"values": [
{
"item": "functionalstorage:compacting_drawer",
"type": "forge:item_exists"
}
],
"type": "forge:and"
}
],
"recipe": {
"type": "minecraft:crafting_shaped",
"pattern": [
"SSS",
"PDP",
"SIS"
],
"key": {
"S": {
"item": "minecraft:stone"
},
"P": {
"item": "minecraft:piston"
},
"D": {
"tag": "functionalstorage:drawer"
},
"I": {
"tag": "forge:ingots/iron"
}
},
"result": {
"item": "functionalstorage:compacting_drawer"
}
}
}
]
}

View File

@ -0,0 +1,29 @@
{
"replace": false,
"values": [
"functionalstorage:oak_2",
"functionalstorage:spruce_2",
"functionalstorage:birch_2",
"functionalstorage:jungle_2",
"functionalstorage:acacia_2",
"functionalstorage:dark_oak_2",
"functionalstorage:crimson_2",
"functionalstorage:warped_2",
"functionalstorage:oak_4",
"functionalstorage:spruce_4",
"functionalstorage:birch_4",
"functionalstorage:jungle_4",
"functionalstorage:acacia_4",
"functionalstorage:dark_oak_4",
"functionalstorage:crimson_4",
"functionalstorage:warped_4",
"functionalstorage:oak_1",
"functionalstorage:spruce_1",
"functionalstorage:birch_1",
"functionalstorage:jungle_1",
"functionalstorage:acacia_1",
"functionalstorage:dark_oak_1",
"functionalstorage:crimson_1",
"functionalstorage:warped_1"
]
}

View File

@ -5,6 +5,7 @@ import com.buuz135.functionalstorage.block.DrawerBlock;
import com.buuz135.functionalstorage.client.CompactingDrawerRenderer;
import com.buuz135.functionalstorage.client.DrawerRenderer;
import com.buuz135.functionalstorage.data.FunctionalStorageBlockstateProvider;
import com.buuz135.functionalstorage.data.FunctionalStorageTagsProvider;
import com.buuz135.functionalstorage.util.DrawerWoodType;
import com.buuz135.functionalstorage.util.IWoodType;
import com.hrznstudio.titanium.block.BasicBlock;
@ -16,6 +17,7 @@ import com.hrznstudio.titanium.module.ModuleController;
import com.hrznstudio.titanium.recipe.generator.TitaniumRecipeProvider;
import com.hrznstudio.titanium.tab.AdvancedTitaniumTab;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.block.Block;
@ -123,5 +125,6 @@ public class FunctionalStorage extends ModuleController {
blocksToProcess.get().stream().map(block -> (BasicBlock) block).forEach(basicBlock -> basicBlock.registerRecipe(consumer));
}
});
event.getGenerator().addProvider(new FunctionalStorageTagsProvider(event.getGenerator(),new BlockTagsProvider(event.getGenerator()), MOD_ID, event.getExistingFileHelper()));
}
}

View File

@ -3,16 +3,20 @@ package com.buuz135.functionalstorage.block;
import com.buuz135.functionalstorage.FunctionalStorage;
import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile;
import com.buuz135.functionalstorage.block.tile.DrawerTile;
import com.buuz135.functionalstorage.util.StorageTags;
import com.google.common.collect.Multimap;
import com.google.common.collect.MultimapBuilder;
import com.hrznstudio.titanium.block.RotatableBlock;
import com.hrznstudio.titanium.datagenerator.loot.block.BasicBlockLootTables;
import com.hrznstudio.titanium.module.DeferredRegistryHelper;
import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder;
import com.hrznstudio.titanium.util.RayTraceUtils;
import com.hrznstudio.titanium.util.TileUtil;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.NonNullList;
import net.minecraft.data.recipes.FinishedRecipe;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
@ -32,12 +36,14 @@ import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.Tags;
import org.jetbrains.annotations.NotNull;
import javax.annotation.Nonnull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile> {
@ -149,4 +155,14 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
return NonNullList.create();
}
@Override
public void registerRecipe(Consumer<FinishedRecipe> consumer) {
TitaniumShapedRecipeBuilder.shapedRecipe(this)
.pattern("SSS").pattern("PDP").pattern("SIS")
.define('S', Blocks.STONE)
.define('P', Blocks.PISTON)
.define('D', StorageTags.DRAWER)
.define('I', Tags.Items.INGOTS_IRON)
.save(consumer);
}
}

View File

@ -0,0 +1,33 @@
package com.buuz135.functionalstorage.data;
import com.buuz135.functionalstorage.FunctionalStorage;
import com.buuz135.functionalstorage.util.StorageTags;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.tags.BlockTagsProvider;
import net.minecraft.data.tags.ItemTagsProvider;
import net.minecraft.data.tags.TagsProvider;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;
import org.jetbrains.annotations.Nullable;
import java.nio.file.Path;
public class FunctionalStorageTagsProvider extends ItemTagsProvider {
public FunctionalStorageTagsProvider(DataGenerator p_126530_, BlockTagsProvider p_126531_, String modId, @Nullable ExistingFileHelper existingFileHelper) {
super(p_126530_, p_126531_, modId, existingFileHelper);
}
@Override
protected void addTags() {
TagsProvider.TagAppender<Item> tTagAppender = this.tag(StorageTags.DRAWER);
for (FunctionalStorage.DrawerType drawerType : FunctionalStorage.DRAWER_TYPES.keySet()) {
for (RegistryObject<Block> blockRegistryObject : FunctionalStorage.DRAWER_TYPES.get(drawerType)) {
tTagAppender.add(blockRegistryObject.get().asItem());
}
}
}
}

View File

@ -0,0 +1,13 @@
package com.buuz135.functionalstorage.util;
import com.buuz135.functionalstorage.FunctionalStorage;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.Tags;
public class StorageTags {
public static Tags.IOptionalNamedTag<Item> DRAWER = ItemTags.createOptional(new ResourceLocation(FunctionalStorage.MOD_ID, "drawer"));
}