diff --git a/src/generated/resources/assets/functionalstorage/lang/en_us.json b/src/generated/resources/assets/functionalstorage/lang/en_us.json index 17a78ac..701b46b 100644 --- a/src/generated/resources/assets/functionalstorage/lang/en_us.json +++ b/src/generated/resources/assets/functionalstorage/lang/en_us.json @@ -70,5 +70,6 @@ "storageupgrade.desc": "Multiplies the block storage by ", "upgrade.type": "Type: ", "upgrade.type.storage": "Storage", - "upgrade.type.utility": "Utility" + "upgrade.type.utility": "Utility", + "frameddrawer.use": "How 2 Change Texture: \nInside a crafting window place the block you want use the texture of for the outside of the drawer in the first slot of the crafting window, on the second slot put the block that will be used for the texture on the inside of the framed drawer and on the third slot put a framed drawer. \n" } \ No newline at end of file diff --git a/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json b/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json new file mode 100644 index 0000000..a09a119 --- /dev/null +++ b/src/generated/resources/data/functionalstorage/recipes/compacting_framed_drawer.json @@ -0,0 +1,51 @@ +{ + "type": "forge:conditional", + "recipes": [ + { + "conditions": [ + { + "values": [ + { + "item": "functionalstorage:compacting_framed_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": [ + { + "item": "functionalstorage:framed_1" + }, + { + "item": "functionalstorage:framed_2" + }, + { + "item": "functionalstorage:framed_4" + } + ], + "I": { + "tag": "forge:ingots/iron" + } + }, + "result": { + "item": "functionalstorage:compacting_framed_drawer" + } + } + } + ] +} \ No newline at end of file diff --git a/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java b/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java index 23ad51c..7acd7ce 100644 --- a/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java +++ b/src/main/java/com/buuz135/functionalstorage/FunctionalStorage.java @@ -22,7 +22,6 @@ import com.buuz135.functionalstorage.recipe.DrawerlessWoodIngredient; import com.buuz135.functionalstorage.recipe.FramedDrawerRecipe; import com.buuz135.functionalstorage.util.*; import com.hrznstudio.titanium.block.BasicBlock; -import com.hrznstudio.titanium.block.BasicTileBlock; import com.hrznstudio.titanium.datagenerator.loot.TitaniumLootTableProvider; import com.hrznstudio.titanium.datagenerator.model.BlockItemModelGeneratorProvider; import com.hrznstudio.titanium.event.handler.EventManager; @@ -154,10 +153,12 @@ public class FunctionalStorage extends ModuleController { WOOD_TYPES.addAll(List.of(DrawerWoodType.values())); for (DrawerType value : DrawerType.values()) { for (IWoodType woodType : WOOD_TYPES) { - String name = woodType.getName() + "_" + value.getSlots(); + var name = woodType.getName() + "_" + value.getSlots(); if (woodType == DrawerWoodType.FRAMED){ - DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new FramedDrawerBlock(value), blockRegistryObject -> () -> - new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties().tab(TAB)))); + var pair = getRegistries().registerBlockWithTileItem(name, () -> new FramedDrawerBlock(value), blockRegistryObject -> () -> + new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties().tab(TAB))); + DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(pair); + CompactingFramedDrawerBlock.FRAMED.add(pair.getLeft()); } else { DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new DrawerBlock(woodType, value), blockRegistryObject -> () -> new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties().tab(TAB)))); diff --git a/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java index 61b8110..9498e4c 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/CompactingFramedDrawerBlock.java @@ -3,24 +3,23 @@ package com.buuz135.functionalstorage.block; import com.buuz135.functionalstorage.FunctionalStorage; import com.buuz135.functionalstorage.block.tile.CompactingDrawerTile; import com.buuz135.functionalstorage.block.tile.CompactingFramedDrawerTile; -import com.buuz135.functionalstorage.block.tile.DrawerTile; -import com.buuz135.functionalstorage.block.tile.FramedDrawerTile; -import com.buuz135.functionalstorage.client.model.FramedDrawerModelData; -import com.buuz135.functionalstorage.util.DrawerWoodType; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.TileUtil; +import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.data.recipes.FinishedRecipe; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -28,17 +27,17 @@ import net.minecraft.world.level.storage.loot.LootContext; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.HitResult; import net.minecraftforge.common.Tags; -import net.minecraftforge.items.ItemHandlerHelper; -import net.minecraftforge.registries.ForgeRegistries; -import org.apache.commons.lang3.tuple.Pair; +import net.minecraftforge.registries.RegistryObject; import org.jetbrains.annotations.Nullable; -import java.util.HashMap; +import java.util.ArrayList; import java.util.List; import java.util.function.Consumer; public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{ + public static List> FRAMED = new ArrayList<>(); + public CompactingFramedDrawerBlock(String name) { super(name); } @@ -85,6 +84,17 @@ public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{ @Override public void registerRecipe(Consumer consumer) { - + TitaniumShapedRecipeBuilder.shapedRecipe(this) + .pattern("SSS").pattern("PDP").pattern("SIS") + .define('S', Blocks.STONE) + .define('P', Blocks.PISTON) + .define('D', Ingredient.of(FRAMED.stream().map(itemSupplier -> new ItemStack(itemSupplier.get())))) + .define('I', Tags.Items.INGOTS_IRON) + .save(consumer); + } + @Override + public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List components, TooltipFlag p_49819_) { + components.add(new TranslatableComponent("frameddrawer.use").withStyle(ChatFormatting.GRAY)); + super.appendHoverText(p_49816_, p_49817_, components, p_49819_); } } diff --git a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java index 6d4a2ee..b64d3df 100644 --- a/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java +++ b/src/main/java/com/buuz135/functionalstorage/block/FramedDrawerBlock.java @@ -11,18 +11,18 @@ import com.buuz135.functionalstorage.util.IWoodType; import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder; import com.hrznstudio.titanium.util.ItemHandlerUtil; import com.hrznstudio.titanium.util.TileUtil; +import net.minecraft.ChatFormatting; import net.minecraft.core.BlockPos; import net.minecraft.core.NonNullList; import net.minecraft.data.recipes.FinishedRecipe; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.tooltip.TooltipComponent; -import net.minecraft.world.item.BlockItem; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; +import net.minecraft.world.item.*; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; @@ -136,4 +136,10 @@ public class FramedDrawerBlock extends DrawerBlock{ } } + + @Override + public void appendHoverText(ItemStack p_49816_, @Nullable BlockGetter p_49817_, List components, TooltipFlag p_49819_) { + components.add(new TranslatableComponent("frameddrawer.use").withStyle(ChatFormatting.GRAY)); + super.appendHoverText(p_49816_, p_49817_, components, p_49819_); + } } diff --git a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java index 7c59044..455546a 100644 --- a/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java +++ b/src/main/java/com/buuz135/functionalstorage/data/FunctionalStorageLangProvider.java @@ -68,5 +68,6 @@ public class FunctionalStorageLangProvider extends LanguageProvider { this.add("linkingtool.ender.frequency", "Frequency: "); this.add("linkingtool.ender.clear", "Sneak + Right Click in the air to clear frequency."); this.add("drawer.block.contents", "Contents: "); + this.add("frameddrawer.use", "How 2 Change Texture: \nInside a crafting window place the block you want use the texture of for the outside of the drawer in the first slot of the crafting window, on the second slot put the block that will be used for the texture on the inside of the framed drawer and on the third slot put a framed drawer. \n"); } }