-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
247 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/generated/resources/assets/interiors/blockstates/wall_mounted_table.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/generated/resources/data/interiors/loot_tables/blocks/wall_mounted_table.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
1 change: 1 addition & 0 deletions
1
src/generated/resources/data/minecraft/tags/blocks/mineable/axe.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/com/sudolev/interiors/content/block/WallMountedTable.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
src/main/resources/assets/interiors/lang/default/tooltips.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
65
src/main/resources/assets/interiors/models/block/wall_table.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
} | ||
] | ||
} |
Binary file added
BIN
+292 Bytes
src/main/resources/assets/interiors/textures/block/wall_table/side.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+287 Bytes
src/main/resources/assets/interiors/textures/block/wall_table/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} | ||
} |