Skip to content

Commit

Permalink
🐛 Loong table is no longer need multipart.
Browse files Browse the repository at this point in the history
Signed-off-by: 秋雨落 <[email protected]>
  • Loading branch information
qyl27 committed Jun 28, 2024
1 parent cd3a050 commit 015ead0
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,52 +378,67 @@ else if (block instanceof SixSideBlock sixSideBlock){
simpleBlock(BlockRegistry.DEEPSLATE_HEMATITE_ORE.get());
simpleBlock(BlockRegistry.NETHER_COBALT_ORE.get());

getMultipartBuilder(BlockRegistry.LONG_TABLE.get())
.part()
getVariantBuilder(BlockRegistry.LONG_TABLE.get())
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.X)
.with(LongTableBlock.LEFT, false)
.with(LongTableBlock.RIGHT, false)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table")))
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.X)
.condition(LongTableBlock.LEFT, false)
.condition(LongTableBlock.RIGHT, false)
.end()
.part()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.X)
.with(LongTableBlock.LEFT, false)
.with(LongTableBlock.RIGHT, true)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_left")))
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.X)
.condition(LongTableBlock.LEFT, false)
.condition(LongTableBlock.RIGHT, true)
.end()
.part()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.X)
.with(LongTableBlock.LEFT, true)
.with(LongTableBlock.RIGHT, false)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_right")))
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.X)
.condition(LongTableBlock.LEFT, true)
.condition(LongTableBlock.RIGHT, false)
.end()
.part()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.X)
.with(LongTableBlock.LEFT, true)
.with(LongTableBlock.RIGHT, true)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_both")))
.addModel()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.Y)
.with(LongTableBlock.LEFT, false)
.with(LongTableBlock.RIGHT, false)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table")))
.rotationY(90)
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.Z)
.condition(LongTableBlock.LEFT, false)
.condition(LongTableBlock.RIGHT, false)
.end()
.part()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.Y)
.with(LongTableBlock.LEFT, false)
.with(LongTableBlock.RIGHT, true)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_left")))
.rotationY(90)
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.Z)
.condition(LongTableBlock.LEFT, false)
.condition(LongTableBlock.RIGHT, true)
.end()
.part()
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.Y)
.with(LongTableBlock.LEFT, true)
.with(LongTableBlock.RIGHT, false)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_right")))
.rotationY(90)
.addModel()
.condition(LongTableBlock.AXIS, Direction.Axis.Z)
.condition(LongTableBlock.LEFT, true)
.condition(LongTableBlock.RIGHT, false)
.end();
.partialState()
.with(LongTableBlock.AXIS, Direction.Axis.Y)
.with(LongTableBlock.LEFT, true)
.with(LongTableBlock.RIGHT, true)
.modelForState()
.modelFile(models().getExistingFile(modLoc("block/long_table_both")))
.rotationY(90)
.addModel();
}

private ResourceLocation blockLoc(Block block){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
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.Level;
import net.minecraft.world.level.block.Block;
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;
import net.minecraft.world.level.block.state.properties.EnumProperty;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
Expand Down Expand Up @@ -125,4 +128,10 @@ private boolean isTableBlock(Level level, BlockPos pos) {
public BaseBlockProperty getProperty() {
return property;
}

@Override
public VoxelShape getShape(BlockState pState, BlockGetter pLevel, BlockPos pPos, CollisionContext pContext) {
// Todo: voxel shape for long table.
return super.getShape(pState, pLevel, pPos, pContext);
}
}

0 comments on commit 015ead0

Please sign in to comment.