made goban rotateable

This commit is contained in:
DaniTheSkunk 2022-10-30 04:21:34 +00:00
parent 3608df6160
commit 77524a86b0
10 changed files with 136 additions and 11 deletions

View File

@ -1,9 +1,13 @@
package com.danitheskunk.skunkstuff.Blocks;
import net.minecraft.core.BlockPos;
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.DirectionalBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.Property;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -21,7 +25,20 @@ public class BlockGoban extends Block {
}
@Override
public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
public VoxelShape getShape(BlockState state, BlockGetter world,
BlockPos pos, CollisionContext context) {
return AABB;
}
protected void createBlockStateDefinition(StateDefinition.Builder<Block,
BlockState> builder) {
builder.add(DirectionalBlock.FACING);
}
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
return (BlockState) this.defaultBlockState().setValue(
DirectionalBlock.FACING,
ctx.getNearestLookingDirection().getOpposite()
);
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/acacia_goban"
},
"facing=east": {
"model": "skunkstuff:block/acacia_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/acacia_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/acacia_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/birch_goban"
},
"facing=east": {
"model": "skunkstuff:block/birch_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/birch_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/birch_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/crimson_goban"
},
"facing=east": {
"model": "skunkstuff:block/crimson_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/crimson_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/crimson_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/dark_oak_goban"
},
"facing=east": {
"model": "skunkstuff:block/dark_oak_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/dark_oak_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/dark_oak_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/jungle_goban"
},
"facing=east": {
"model": "skunkstuff:block/jungle_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/jungle_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/jungle_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/mangrove_goban"
},
"facing=east": {
"model": "skunkstuff:block/mangrove_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/mangrove_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/mangrove_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/oak_goban"
},
"facing=east": {
"model": "skunkstuff:block/oak_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/oak_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/oak_goban",
"y": 270
}
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/spruce_goban"
},
"facing=east": {
"model": "skunkstuff:block/spruce_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/spruce_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/spruce_goban",
"y": 270
}
}
}

View File

@ -1,7 +1,19 @@
{
"variants": {
"": {
"facing=north": {
"model": "skunkstuff:block/warped_goban"
},
"facing=east": {
"model": "skunkstuff:block/warped_goban",
"y": 90
},
"facing=south": {
"model": "skunkstuff:block/warped_goban",
"y": 180
},
"facing=west": {
"model": "skunkstuff:block/warped_goban",
"y": 270
}
}
}