Skip to content

Commit

Permalink
Add wall-mounted table
Browse files Browse the repository at this point in the history
  • Loading branch information
a0a7 committed Oct 24, 2023
1 parent 7b5d8f2 commit 10e2214
Show file tree
Hide file tree
Showing 13 changed files with 247 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// 1.20.1 2023-10-23T01:42:08.8452152 Registrate Provider for interiors [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
// 1.20.1 2023-10-23T20:54:07.494388 Registrate Provider for interiors [Recipes, Advancements, Loot Tables, Tags (blocks), Tags (items), Tags (fluids), Tags (entity_types), Blockstates, Item models, Lang (en_us/en_ud)]
dac4dc6c457ea01bd692bf04a477e10b86e9d1fd assets/interiors/blockstates/black_chair.json
4d399955b93d26635e956647d6485e5724507212 assets/interiors/blockstates/black_floor_chair.json
03e0323d415b74208d8190dade3d392f8f0c048d assets/interiors/blockstates/blue_chair.json
Expand Down Expand Up @@ -31,12 +31,13 @@ e8f78119325719be5b24fad59f8370b964edba38 assets/interiors/blockstates/purple_flo
dae54bc64e2c0bb0ef2e975c5e0f7ace6fa58981 assets/interiors/blockstates/red_chair.json
71d8b617e881565a64d4e522193468bd6025d0dd assets/interiors/blockstates/red_floor_chair.json
b98b8b83997e55f1313fdc8664108538b4d75c32 assets/interiors/blockstates/seatwood_planks.json
7bb67f393d77052741572e90b68205ff26fc095c assets/interiors/blockstates/wall_mounted_table.json
1da926a10ecf848e745fa6ecc3c14016c6ed7915 assets/interiors/blockstates/white_chair.json
1d593b33b68d224e3baef0538c4633f7273a4e12 assets/interiors/blockstates/white_floor_chair.json
91c806a356c0fc3be084e90b7a32ff4b72a09304 assets/interiors/blockstates/yellow_chair.json
af0805221514ea68d57dd577898708e254e04ea8 assets/interiors/blockstates/yellow_floor_chair.json
b5b48efdf16f0490f11efc98dd59b2c5054606ea assets/interiors/lang/en_ud.json
a91ea8c816b566f7d0c0c1508e768d4f1d21b80d assets/interiors/lang/en_us.json
c97e4ecbff6acca331520273efd6ed004269c4f4 assets/interiors/lang/en_ud.json
966b3276a9c3fad64bf34e47a48b81f72d541267 assets/interiors/lang/en_us.json
33ca50a314a7e994abc35bf1b06e4dbc731788de assets/interiors/models/block/chair/black_chair_both.json
3f81247cdd1f036882cd9a9fe9fb98f8a294dada assets/interiors/models/block/chair/black_chair_both_cropped.json
221c5647c64d557006e282eb285371a2ead3184b assets/interiors/models/block/chair/black_chair_left.json
Expand Down Expand Up @@ -342,6 +343,7 @@ afa972860269234fb8c8aafad002f17754bbda7b assets/interiors/models/item/purple_cha
d99b5f35cfa274777c0a39fec9941a49a68340b6 assets/interiors/models/item/red_chair.json
639fe8b28ec650880e48d2cb40f642baad12c4fb assets/interiors/models/item/red_floor_chair.json
2145cd5d4d88116d14eaf04ac1b6299f2972aba0 assets/interiors/models/item/seatwood_planks.json
02283ca314898eb4a55f4847fbb1ae7d05dde610 assets/interiors/models/item/wall_mounted_table.json
4c35d8d738e5d1ad1f399a4375b10c4df35f028a assets/interiors/models/item/white_chair.json
f43b00e93010772c091c29549df8c288deffa22f assets/interiors/models/item/white_floor_chair.json
bbd1b62664bddcae11dd7f5b1ad7d3a9cf93ef22 assets/interiors/models/item/yellow_chair.json
Expand Down Expand Up @@ -490,6 +492,7 @@ a93cab79de18735afaf109d1541dce936798affb data/interiors/loot_tables/blocks/purpl
ffed89b97ee18bef74dcb160ea8bb7ffec20b76a data/interiors/loot_tables/blocks/red_chair.json
7cf377a3313848525cbe59a384d5fc93ba980263 data/interiors/loot_tables/blocks/red_floor_chair.json
371ab396ae664ecb3598f638967b3f8a1cecce68 data/interiors/loot_tables/blocks/seatwood_planks.json
6327bbedee5ea772359d1897c604a3d62ca98017 data/interiors/loot_tables/blocks/wall_mounted_table.json
518c097e0e2a31b7d2d911539a2d075929cb5d3a data/interiors/loot_tables/blocks/white_chair.json
d435e2557857b449d6726c9a84c1cf85f00a69b0 data/interiors/loot_tables/blocks/white_floor_chair.json
760556cf409e487bdde0d0a25f6dae24fd4ed7ee data/interiors/loot_tables/blocks/yellow_chair.json
Expand Down Expand Up @@ -610,6 +613,6 @@ c1cd74c7db25c4f08788105dbd657215fd4c11f0 data/interiors/recipes/crafting/floor_c
768ea8990a742492106377a0b38c608639dc4990 data/interiors/tags/blocks/floor_chairs.json
498005f0a5be03ce5d106b8a9c08e0b7ab15196b data/interiors/tags/items/chairs.json
768ea8990a742492106377a0b38c608639dc4990 data/interiors/tags/items/floor_chairs.json
c3f5bee71ad070022657f036d365cacb4ecbf696 data/minecraft/tags/blocks/mineable/axe.json
9d5db4771961863f7976459ae65a058e652c0ad4 data/minecraft/tags/blocks/mineable/axe.json
99571a331f4c6ea2d1add7bf80ffad851e794cb8 data/minecraft/tags/blocks/planks.json
99571a331f4c6ea2d1add7bf80ffad851e794cb8 data/minecraft/tags/items/planks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"variants": {
"facing=east": {
"model": "interiors:block/wall_table",
"y": 90
},
"facing=north": {
"model": "interiors:block/wall_table"
},
"facing=south": {
"model": "interiors:block/wall_table",
"y": 180
},
"facing=west": {
"model": "interiors:block/wall_table",
"y": 270
}
}
}
11 changes: 6 additions & 5 deletions src/generated/resources/assets/interiors/lang/en_ud.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"block.interiors.brown_floor_chair": "ɹıɐɥƆ ɹooןℲ uʍoɹᗺ",
"block.interiors.chair.tooltip": "ᴚIⱯHƆ",
"block.interiors.chair.tooltip.behaviour1": "˙‾ɹıɐɥƆ‾ ǝɥʇ ǝʌɐǝן oʇ ʇɟıɥs-Ꞁ ssǝɹԀ ˙‾ɹıɐɥƆ‾ ǝɥʇ uo ɹǝʎɐןd ǝɥʇ sʇıS",
"block.interiors.chair.tooltip.behaviour2": "˙ǝzıs ʞɔɐq ‾ɹıɐɥƆ‾ sǝןbbo⟘",
"block.interiors.chair.tooltip.behaviour3": "¡ǝɔuo ʇɐ ɥʇoq ǝןbboʇ oʇ ʞɔıןƆ-ᴚ + ʇɟıɥS ˙sʇsǝɹɯɹⱯ ‾ɹıɐɥƆ‾ ןɐnpıʌıpuI sǝןbbo⟘",
"block.interiors.chair.tooltip.behaviour2": "˙sʇsǝɹɯɹⱯ ‾ɹıɐɥƆ‾ ןɐnpıʌıpuI sǝןbbo⟘",
"block.interiors.chair.tooltip.behaviour3": "˙ǝzıs ʞɔɐq ‾ɹıɐɥƆ‾ sǝןbbo⟘",
"block.interiors.chair.tooltip.condition1": "pǝʞɔıןƆ-ᴚ uǝɥM",
"block.interiors.chair.tooltip.condition2": "ɥɔuǝɹM ɥʇıʍ pǝʞɔıןƆ-ᴚ sı ǝɔɐɟ ʞɔɐq uǝɥM",
"block.interiors.chair.tooltip.condition3": "ɥɔuǝɹM ɥʇıʍ pǝʞɔıןƆ-ᴚ ǝɹɐ sǝɔɐɟ ɹǝɥʇo uǝɥM",
"block.interiors.chair.tooltip.summary": "¡ooʇ ‾ǝɹnʇıuɹnɟ‾ ɹoɟ uoıʇdo buıןɐǝddɐ uⱯ ˙‾uoıʇdɐɹʇuoɔ‾ ɐ oʇuo ɹǝʎɐןd ɐ ɹoɥɔuɐ ןןıM ¡ǝpıɹ ǝɥʇ ʎoظuǝ puɐ uʍop ɟןǝsɹnoʎ ʇıS",
"block.interiors.chair.tooltip.condition2": "ɥɔuǝɹM ɥʇıʍ pǝʞɔıןƆ-ᴚ uǝɥM",
"block.interiors.chair.tooltip.condition3": "ɥɔuǝɹM ɥʇıʍ pǝʞɔıןƆ-ᴚ + ʇɟıɥS uǝɥM",
"block.interiors.chair.tooltip.summary": "¡ooʇ ‾ǝɹnʇıuɹnɟ‾ ɔıʇɐʇs ɹoɟ uoıʇdo buıןɐǝddɐ uⱯ ˙‾uoıʇdɐɹʇuoɔ‾ ɐ oʇuo ɹǝʎɐןd ɐ ɹoɥɔuɐ ןןıM ¡ǝpıɹ ǝɥʇ ʎoظuǝ puɐ uʍop ɟןǝsɹnoʎ ʇıS",
"block.interiors.cyan_chair": "ɹıɐɥƆ uɐʎƆ",
"block.interiors.cyan_floor_chair": "ɹıɐɥƆ ɹooןℲ uɐʎƆ",
"block.interiors.gray_chair": "ɹıɐɥƆ ʎɐɹ⅁",
Expand All @@ -39,6 +39,7 @@
"block.interiors.red_chair": "ɹıɐɥƆ pǝᴚ",
"block.interiors.red_floor_chair": "ɹıɐɥƆ ɹooןℲ pǝᴚ",
"block.interiors.seatwood_planks": "sʞuɐןԀ pooʍʇɐǝS",
"block.interiors.wall_mounted_table": "ǝןqɐ⟘ pǝʇunoW ןןɐM",
"block.interiors.white_chair": "ɹıɐɥƆ ǝʇıɥM",
"block.interiors.white_floor_chair": "ɹıɐɥƆ ɹooןℲ ǝʇıɥM",
"block.interiors.yellow_chair": "ɹıɐɥƆ ʍoןןǝʎ",
Expand Down
11 changes: 6 additions & 5 deletions src/generated/resources/assets/interiors/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"block.interiors.brown_floor_chair": "Brown Floor Chair",
"block.interiors.chair.tooltip": "CHAIR",
"block.interiors.chair.tooltip.behaviour1": "Sits the player on the _Chair_. Press L-shift to leave the _Chair_.",
"block.interiors.chair.tooltip.behaviour2": "Toggles _Chair_ back size.",
"block.interiors.chair.tooltip.behaviour3": "Toggles Individual _Chair_ Armrests. Shift + R-Click to toggle both at once!",
"block.interiors.chair.tooltip.behaviour2": "Toggles Individual _Chair_ Armrests.",
"block.interiors.chair.tooltip.behaviour3": "Toggles _Chair_ back size.",
"block.interiors.chair.tooltip.condition1": "When R-Clicked",
"block.interiors.chair.tooltip.condition2": "When back face is R-Clicked with Wrench",
"block.interiors.chair.tooltip.condition3": "When other faces are R-Clicked with Wrench",
"block.interiors.chair.tooltip.summary": "Sit yourself down and enjoy the ride! Will anchor a player onto a _contraption_. An appealing option for _furniture_ too!",
"block.interiors.chair.tooltip.condition2": "When R-Clicked with Wrench",
"block.interiors.chair.tooltip.condition3": "When Shift + R-Clicked with Wrench",
"block.interiors.chair.tooltip.summary": "Sit yourself down and enjoy the ride! Will anchor a player onto a _contraption_. An appealing option for static _furniture_ too!",
"block.interiors.cyan_chair": "Cyan Chair",
"block.interiors.cyan_floor_chair": "Cyan Floor Chair",
"block.interiors.gray_chair": "Gray Chair",
Expand All @@ -39,6 +39,7 @@
"block.interiors.red_chair": "Red Chair",
"block.interiors.red_floor_chair": "Red Floor Chair",
"block.interiors.seatwood_planks": "Seatwood Planks",
"block.interiors.wall_mounted_table": "Wall Mounted Table",
"block.interiors.white_chair": "White Chair",
"block.interiors.white_floor_chair": "White Floor Chair",
"block.interiors.yellow_chair": "Yellow Chair",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"type": "minecraft:block",
"pools": [
{
"bonus_rolls": 0.0,
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
],
"entries": [
{
"type": "minecraft:item",
"name": "interiors:wall_mounted_table"
}
],
"rolls": 1.0
}
],
"random_sequence": "interiors:blocks/wall_mounted_table"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"values": [
"interiors:seatwood_planks",
"interiors:wall_mounted_table",
"interiors:white_floor_chair",
"interiors:orange_floor_chair",
"interiors:magenta_floor_chair",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package com.sudolev.interiors.content.block;

import com.simibubi.create.foundation.block.ProperWaterloggedBlock;

import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Mirror;
import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.DirectionProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;

public class WallMountedTable extends Block implements ProperWaterloggedBlock {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

private static final VoxelShape SHAPE = Block.box(2, 12, 0, 14, 16, 16);

public WallMountedTable(Properties properties) {
super(properties);
registerDefaultState(defaultBlockState().setValue(WATERLOGGED, false));
}

@Override
public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return switch(state.getValue(FACING)) {
case NORTH -> SHAPE;
case SOUTH -> SHAPE;
case WEST -> rotateShape(Direction.NORTH, Direction.EAST, SHAPE);
default -> rotateShape(Direction.NORTH, Direction.EAST, SHAPE);
};
}

@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter level, BlockPos pos, CollisionContext context) {
return getShape(state, level, pos, context);
}


@Override
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(FACING).add(WATERLOGGED);
}

public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape shape) {
VoxelShape[] buffer = new VoxelShape[]{ shape, Shapes.empty() };

int times = (to.ordinal() - from.get2DDataValue() + 4) % 4;
for(int i = 0; i < times; i++) {
buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.create(1 - maxZ, minY, minX, 1 - minZ, maxY, maxX)));
buffer[0] = buffer[1];
buffer[1] = Shapes.empty();
}

return buffer[0];
}


@Override
public BlockState rotate(BlockState state, Rotation rotation) {
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
}

@Override
public BlockState getStateForPlacement(BlockPlaceContext context) {
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite());
}

@Override
public BlockState mirror(BlockState state, Mirror mirror) {
return state.rotate(mirror.getRotation(state.getValue(FACING)));
}
}
19 changes: 19 additions & 0 deletions src/main/java/com/sudolev/interiors/content/registry/CIBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraftforge.client.model.generators.ConfiguredModel;

import com.sudolev.interiors.CreateInteriors;
import com.sudolev.interiors.content.block.WallMountedTable;
import com.sudolev.interiors.content.block.seat.BigChairBlock;
import com.sudolev.interiors.content.block.seat.BigSeatMovementBehaviour;
import com.sudolev.interiors.content.block.seat.ChairBlock;
Expand All @@ -57,6 +58,24 @@ public final class CIBlocks {
.build()
.register();

public static final BlockEntry<WallMountedTable> WALL_MOUNTED_TABLE = REGISTRATE.block("wall_mounted_table", WallMountedTable::new)
.initialProperties(SharedProperties::wooden)
.properties(p -> p.mapColor(DyeColor.ORANGE))
.transform(axeOnly())
.blockstate((context, provider) -> provider.getVariantBuilder(context.get())
.forAllStatesExcept(state -> {
String facing = state.getValue(ChairBlock.FACING).getSerializedName();
int rotation = facing(state);

return ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile(provider.modLoc("block/wall_table"))).rotationY(rotation)
.build();
}, WATERLOGGED))
.item()
.model(AssetLookup.customBlockItemModel("wall_table"))
.build()
.register();

public static final DyedBlockList<FloorChairBlock> FLOOR_CHAIRS = new DyedBlockList<>(color -> {
String colorName = color.getSerializedName();
return REGISTRATE.block(colorName + "_floor_chair", p -> new FloorChairBlock(p, color))
Expand Down
10 changes: 5 additions & 5 deletions src/main/resources/assets/interiors/lang/default/tooltips.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"block.interiors.chair.tooltip": "CHAIR",
"block.interiors.chair.tooltip.summary": "Sit yourself down and enjoy the ride! Will anchor a player onto a _contraption_. An appealing option for _furniture_ too!",
"block.interiors.chair.tooltip.summary": "Sit yourself down and enjoy the ride! Will anchor a player onto a _contraption_. An appealing option for static _furniture_ too!",
"block.interiors.chair.tooltip.condition1": "When R-Clicked",
"block.interiors.chair.tooltip.behaviour1": "Sits the player on the _Chair_. Press L-shift to leave the _Chair_.",
"block.interiors.chair.tooltip.condition2": "When back face is R-Clicked with Wrench",
"block.interiors.chair.tooltip.behaviour2": "Toggles _Chair_ back size.",
"block.interiors.chair.tooltip.condition3": "When other faces are R-Clicked with Wrench",
"block.interiors.chair.tooltip.behaviour3": "Toggles Individual _Chair_ Armrests. Shift + R-Click to toggle both at once!"
"block.interiors.chair.tooltip.condition2": "When R-Clicked with Wrench",
"block.interiors.chair.tooltip.behaviour2": "Toggles Individual _Chair_ Armrests.",
"block.interiors.chair.tooltip.condition3": "When Shift + R-Clicked with Wrench",
"block.interiors.chair.tooltip.behaviour3": "Toggles _Chair_ back size."
}
65 changes: 65 additions & 0 deletions src/main/resources/assets/interiors/models/block/wall_table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"credit": "Made with Blockbench",
"textures": {
"1": "interiors:block/wall_table/top",
"2": "interiors:block/wall_table/side",
"particle": "interiors:block/seatwood_planks"
},
"elements": [
{
"name": "table",
"from": [2, 12, 0],
"to": [14, 16, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 14, 8]},
"faces": {
"north": {"uv": [0, 4, 12, 8], "texture": "#2"},
"east": {"uv": [0, 0, 16, 4], "texture": "#2"},
"south": {"uv": [0, 4, 12, 8], "texture": "#2"},
"west": {"uv": [0, 0, 16, 4], "texture": "#2"},
"up": {"uv": [0, 0, 16, 12], "rotation": 270, "texture": "#1"},
"down": {"uv": [0, 0, 16, 12], "rotation": 90, "texture": "#1"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.3, 0.3, 0.3]
},
"gui": {
"rotation": [30, 225, 0],
"translation": [0, -4, 0],
"scale": [0.7, 0.7, 0.7]
},
"fixed": {
"rotation": [0, 90, 0],
"translation": [0, -5.75, 1]
}
},
"groups": [
{
"name": "VoxelShapes",
"origin": [8, 8, 8],
"color": 0,
"children": [0]
}
]
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/main/resources/data/interiors/recipes/wall_table.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"group": "building",
"pattern": [
"#X#"
],
"key": {
"#": {
"tag": "minecraft:planks"
},
"X": {
"tag": "minecraft:wooden_slabs"
}
},
"result": {
"item": "interiors:wall_mounted_table",
"count": 4
}
}

0 comments on commit 10e2214

Please sign in to comment.