Added textures

This commit is contained in:
Buuz135 2022-07-09 17:02:51 +02:00
parent 44e21de341
commit edcb4cf47b
12 changed files with 58 additions and 39 deletions

View File

@ -45,7 +45,9 @@ import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraft.world.item.crafting.RecipeSerializer;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ColorHandlerEvent;
@ -160,13 +162,13 @@ public class FunctionalStorage extends ModuleController {
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 -> () ->
DRAWER_TYPES.computeIfAbsent(value, drawerType -> new ArrayList<>()).add(getRegistries().registerBlockWithTileItem(name, () -> new DrawerBlock(woodType, value, BlockBehaviour.Properties.copy(woodType.getPlanks())), blockRegistryObject -> () ->
new DrawerBlock.DrawerItem((DrawerBlock) blockRegistryObject.get(), new Item.Properties().tab(TAB))));
}
}
DRAWER_TYPES.get(value).forEach(blockRegistryObject -> TAB.addIconStacks(() -> new ItemStack(blockRegistryObject.getLeft().get())));
}
COMPACTING_DRAWER = getRegistries().registerBlockWithTile("compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer"));
COMPACTING_DRAWER = getRegistries().registerBlockWithTile("compacting_drawer", () -> new CompactingDrawerBlock("compacting_drawer", BlockBehaviour.Properties.copy(Blocks.STONE_BRICKS)));
FRAMED_COMPACTING_DRAWER = getRegistries().registerBlockWithTile("compacting_framed_drawer", () -> new CompactingFramedDrawerBlock("compacting_framed_drawer"));
DRAWER_CONTROLLER = getRegistries().registerBlockWithTile("storage_controller", DrawerControllerBlock::new);
LINKING_TOOL = getRegistries().registerGeneric(Item.class, "linking_tool", LinkingToolItem::new);

View File

@ -70,8 +70,8 @@ public class CompactingDrawerBlock extends RotatableBlock<CompactingDrawerTile>
}
public CompactingDrawerBlock(String name) {
super(name, Properties.copy(Blocks.STONE_BRICKS), CompactingDrawerTile.class);
public CompactingDrawerBlock(String name, Properties properties) {
super(name, properties, CompactingDrawerTile.class);
setItemGroup(FunctionalStorage.TAB);
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(DrawerBlock.LOCKED, false));
}

View File

@ -3,6 +3,7 @@ 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.FramedDrawerTile;
import com.hrznstudio.titanium.recipe.generator.TitaniumShapedRecipeBuilder;
import com.hrznstudio.titanium.util.TileUtil;
import net.minecraft.ChatFormatting;
@ -39,7 +40,7 @@ public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{
public static List<RegistryObject<Block>> FRAMED = new ArrayList<>();
public CompactingFramedDrawerBlock(String name) {
super(name);
super(name, Properties.copy(Blocks.STONE).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false));
}
@Override
@ -74,7 +75,7 @@ public class CompactingFramedDrawerBlock extends CompactingDrawerBlock{
@Override
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) {
BlockEntity entity = level.getBlockEntity(pos);
if (entity instanceof CompactingFramedDrawerTile framedDrawerTile){
if (entity instanceof FramedDrawerTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()){
ItemStack stack = new ItemStack(this);
stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT());
return stack;

View File

@ -38,6 +38,7 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
@ -121,14 +122,15 @@ public class DrawerBlock extends RotatableBlock<DrawerTile> {
private final FunctionalStorage.DrawerType type;
private final IWoodType woodType;
public DrawerBlock(IWoodType woodType, FunctionalStorage.DrawerType type) {
super(woodType.getName() + "_" + type.getSlots(), Properties.copy(woodType.getPlanks()), DrawerTile.class);
public DrawerBlock(IWoodType woodType, FunctionalStorage.DrawerType type, BlockBehaviour.Properties properties) {
super(woodType.getName() + "_" + type.getSlots(), properties, DrawerTile.class);
this.woodType = woodType;
this.type = type;
setItemGroup(FunctionalStorage.TAB);
registerDefaultState(defaultBlockState().setValue(RotatableBlock.FACING_HORIZONTAL, Direction.NORTH).setValue(LOCKED, false));
}
@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_206840_1_) {
super.createBlockStateDefinition(p_206840_1_);

View File

@ -25,9 +25,12 @@ import net.minecraft.world.inventory.tooltip.TooltipComponent;
import net.minecraft.world.item.*;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
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;
import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.HitResult;
@ -46,7 +49,7 @@ import java.util.function.Consumer;
public class FramedDrawerBlock extends DrawerBlock{
public FramedDrawerBlock(FunctionalStorage.DrawerType type) {
super(DrawerWoodType.FRAMED, type);
super(DrawerWoodType.FRAMED, type, Properties.copy(Blocks.OAK_PLANKS).noOcclusion().isViewBlocking((p_61036_, p_61037_, p_61038_) -> false));
}
@Override
@ -69,6 +72,7 @@ public class FramedDrawerBlock extends DrawerBlock{
data.put("particle", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("particle"))));
data.put("front", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front"))));
data.put("side", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("side"))));
data.put("front_divider", ForgeRegistries.ITEMS.getValue(new ResourceLocation(tag.getString("front_divider"))));
return new FramedDrawerModelData(data);
}
return null;
@ -80,6 +84,7 @@ public class FramedDrawerBlock extends DrawerBlock{
style.putString("particle", first.getItem().getRegistryName().toString());
style.putString("side", first.getItem().getRegistryName().toString());
style.putString("front", second.getItem().getRegistryName().toString());
style.putString("front_divider", first.getItem().getRegistryName().toString());
drawer.getOrCreateTag().put("Style", style);
return drawer;
}
@ -102,7 +107,7 @@ public class FramedDrawerBlock extends DrawerBlock{
@Override
public ItemStack getCloneItemStack(BlockState state, HitResult target, BlockGetter level, BlockPos pos, Player player) {
BlockEntity entity = level.getBlockEntity(pos);
if (entity instanceof FramedDrawerTile framedDrawerTile){
if (entity instanceof FramedDrawerTile framedDrawerTile && framedDrawerTile.getFramedDrawerModelData() != null && !framedDrawerTile.getFramedDrawerModelData().getDesign().isEmpty()){
ItemStack stack = new ItemStack(this);
stack.getOrCreateTag().put("Style", framedDrawerTile.getFramedDrawerModelData().serializeNBT());
return stack;

View File

@ -29,9 +29,9 @@
"to": [15, 9, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, -8]},
"faces": {
"north": {"uv": [1, 7, 15, 9], "texture": "#side", "cullface": "north"},
"up": {"uv": [15, 7, 1, 9], "texture": "#side"},
"down": {"uv": [1, 9, 15, 7], "rotation": 180, "texture": "#side"}
"north": {"uv": [1, 7, 15, 9], "texture": "#front_divider", "cullface": "north"},
"up": {"uv": [15, 7, 1, 9], "texture": "#front_divider"},
"down": {"uv": [1, 9, 15, 7], "rotation": 180, "texture": "#front_divider"}
}
},
{

View File

@ -50,9 +50,9 @@
"to": [9, 15, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, -8]},
"faces": {
"north": {"uv": [7, 1, 9, 15], "texture": "#side", "cullface": "north"},
"east": {"uv": [9, 1, 7, 15], "texture": "#side"},
"west": {"uv": [9, 1, 7, 15], "texture": "#side"}
"north": {"uv": [7, 1, 9, 15], "texture": "#front_divider", "cullface": "north"},
"east": {"uv": [9, 1, 7, 15], "texture": "#front_divider"},
"west": {"uv": [9, 1, 7, 15], "texture": "#front_divider"}
}
},
{
@ -61,9 +61,9 @@
"to": [15, 9, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, -8]},
"faces": {
"north": {"uv": [1, 7, 7, 9], "texture": "#side", "cullface": "north"},
"up": {"uv": [7, 7, 1, 9], "texture": "#side"},
"down": {"uv": [7, 7, 1, 9], "texture": "#side"}
"north": {"uv": [1, 7, 7, 9], "texture": "#front_divider", "cullface": "north"},
"up": {"uv": [7, 7, 1, 9], "texture": "#front_divider"},
"down": {"uv": [7, 7, 1, 9], "texture": "#front_divider"}
}
},
{
@ -72,9 +72,9 @@
"to": [7, 9, 2],
"rotation": {"angle": 0, "axis": "y", "origin": [-8, 0, -8]},
"faces": {
"north": {"uv": [9, 7, 15, 9], "texture": "#side", "cullface": "north"},
"up": {"uv": [15, 7, 9, 9], "texture": "#side"},
"down": {"uv": [15, 7, 9, 9], "texture": "#side"}
"north": {"uv": [9, 7, 15, 9], "texture": "#front_divider", "cullface": "north"},
"up": {"uv": [15, 7, 9, 9], "texture": "#front_divider"},
"down": {"uv": [15, 7, 9, 9], "texture": "#front_divider"}
}
},
{

View File

@ -2,12 +2,13 @@
"loader": "functionalstorage:framed",
"credit": "Made with Blockbench",
"textures": {
"front": "functionalstorage:blocks/compacting_drawer_front",
"particle": "functionalstorage:blocks/compacting_drawer_side",
"side": "functionalstorage:blocks/compacting_drawer_side",
"front": "functionalstorage:blocks/framed_side",
"particle": "functionalstorage:blocks/framed_side",
"side": "functionalstorage:blocks/framed_side",
"front_divider": "functionalstorage:blocks/framed_front_compacting",
"lock_icon": "functionalstorage:blocks/unlock"
},
"retextured": [ "particle", "side", "front" ],
"retextured": [ "particle", "side", "front", "front_divider" ],
"elements": [
{
"from": [9, 1, 0.5],
@ -99,9 +100,9 @@
"from": [1, 7, 0],
"to": [15, 9, 1],
"faces": {
"north": {"uv": [1, 7, 15, 9], "texture": "#side", "cullface": "north"},
"up": {"uv": [15, 8, 1, 7], "texture": "#side"},
"down": {"uv": [15, 8, 1, 9], "texture": "#side"}
"north": {"uv": [1, 7, 15, 9], "texture": "#front_divider", "cullface": "north"},
"up": {"uv": [15, 8, 1, 7], "texture": "#front_divider"},
"down": {"uv": [15, 8, 1, 9], "texture": "#front_divider"}
}
},
{
@ -109,10 +110,10 @@
"from": [7, 1, 0],
"to": [9, 7, 1],
"faces": {
"north": {"uv": [7, 9, 9, 15], "texture": "#side", "cullface": "north"},
"east": {"uv": [7, 9, 8, 15], "texture": "#side"},
"south": {"uv": [0, 0, 2, 6], "texture": "#side"},
"west": {"uv": [8, 9, 9, 15], "texture": "#side"}
"north": {"uv": [7, 9, 9, 15], "texture": "#front_divider", "cullface": "north"},
"east": {"uv": [7, 9, 8, 15], "texture": "#front_divider"},
"south": {"uv": [0, 0, 2, 6], "texture": "#front_divider"},
"west": {"uv": [8, 9, 9, 15], "texture": "#front_divider"}
}
},
{

View File

@ -2,7 +2,9 @@
"loader": "functionalstorage:framed",
"parent": "functionalstorage:block/base_x_1",
"textures": {
"front": "functionalstorage:blocks/framed_side",
"particle": "functionalstorage:blocks/framed_side",
"side": "functionalstorage:blocks/framed_side"
},
"retextured": [ "particle", "side", "front" ]
"retextured": [ "particle", "side", "front", "front_divider" ]
}

View File

@ -2,7 +2,10 @@
"loader": "functionalstorage:framed",
"parent": "functionalstorage:block/base_x_2_framed",
"textures": {
"front": "functionalstorage:blocks/framed_side",
"front_divider": "functionalstorage:blocks/framed_front_2",
"particle": "functionalstorage:blocks/framed_side",
"side": "functionalstorage:blocks/framed_side"
},
"retextured": [ "particle", "side", "front" ]
"retextured": [ "particle", "side", "front", "front_divider" ]
}

View File

@ -2,7 +2,10 @@
"loader": "functionalstorage:framed",
"parent": "functionalstorage:block/base_x_4_framed",
"textures": {
"front": "functionalstorage:blocks/framed_side",
"particle": "functionalstorage:blocks/framed_side",
"side": "functionalstorage:blocks/framed_side",
"front_divider": "functionalstorage:blocks/framed_front_4"
},
"retextured": [ "particle", "side", "front" ]
"retextured": [ "particle", "side", "front", "front_divider" ]
}