This commit is contained in:
Ridanis 2022-07-08 23:30:52 +02:00
commit 44e21de341
6 changed files with 92 additions and 22 deletions

View File

@ -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"
}

View File

@ -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"
}
}
}
]
}

View File

@ -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))));

View File

@ -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<RegistryObject<Block>> FRAMED = new ArrayList<>();
public CompactingFramedDrawerBlock(String name) {
super(name);
}
@ -85,6 +84,17 @@ public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{
@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', 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<Component> components, TooltipFlag p_49819_) {
components.add(new TranslatableComponent("frameddrawer.use").withStyle(ChatFormatting.GRAY));
super.appendHoverText(p_49816_, p_49817_, components, p_49819_);
}
}

View File

@ -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<Component> components, TooltipFlag p_49819_) {
components.add(new TranslatableComponent("frameddrawer.use").withStyle(ChatFormatting.GRAY));
super.appendHoverText(p_49816_, p_49817_, components, p_49819_);
}
}

View File

@ -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");
}
}