Skip to content

Commit

Permalink
Update blockstate property to IEProperties.OPEN
Browse files Browse the repository at this point in the history
 - IEProperties.ACTIVE was used before
 - New property better describes state
  • Loading branch information
voidsong-dragonfly committed Jun 22, 2024
1 parent beebaa0 commit 12bcdcd
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class IEProperties

public static final BooleanProperty MULTIBLOCKSLAVE = BooleanProperty.create("multiblockslave");
public static final BooleanProperty ACTIVE = BooleanProperty.create("active");
public static final BooleanProperty OPEN = BooleanProperty.create("open");
public static final BooleanProperty MIRRORED = BooleanProperty.create("mirrored");

public static final BooleanProperty UP = BooleanProperty.create("up");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,11 +716,11 @@ private void createLadderBlock(Supplier<? extends Block> b, ModelFile model, Mod
{
builder.partialState()
.with(IEProperties.FACING_HORIZONTAL, d)
.with(IEProperties.ACTIVE, false)
.with(IEProperties.OPEN, false)
.setModels(new ConfiguredModel(model, 0, getAngle(d, 180), true));
builder.partialState()
.with(IEProperties.FACING_HORIZONTAL, d)
.with(IEProperties.ACTIVE, true)
.with(IEProperties.OPEN, true)
.setModels(new ConfiguredModel(modelOpen, 0, getAngle(d, 180), false));
}
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, Co
else
{
Direction ladderSide = state.getValue(LadderBlock.FACING);
return state.getValue(IEProperties.ACTIVE) ? Shapes.joinUnoptimized(base, FRAMES_OPEN.get(ladderSide), BooleanOp.OR) : Shapes.joinUnoptimized(base, FRAMES.get(ladderSide), BooleanOp.OR);
return state.getValue(IEProperties.OPEN) ? Shapes.joinUnoptimized(base, FRAMES_OPEN.get(ladderSide), BooleanOp.OR) : Shapes.joinUnoptimized(base, FRAMES.get(ladderSide), BooleanOp.OR);
}
}

Expand All @@ -104,7 +104,7 @@ public BlockState getStateForPlacement(BlockPlaceContext ctx)
{
BlockState baseState = super.getStateForPlacement(ctx);
if(baseState==null) return baseState;
baseState = baseState.setValue(IEProperties.ACTIVE, false);
baseState = baseState.setValue(IEProperties.OPEN, false);
if(type==CoverType.NONE)
return baseState;
else
Expand All @@ -122,7 +122,7 @@ public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos)

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

@Override
Expand All @@ -131,7 +131,7 @@ public InteractionResult useHammer(BlockState state, Level world, BlockPos pos,
if (player==null) return InteractionResult.FAIL;
if(type!=CoverType.NONE&&player.isShiftKeyDown())
{
boolean b = world.setBlockAndUpdate(pos, state.setValue(IEProperties.ACTIVE, !state.getValue(IEProperties.ACTIVE)));
boolean b = world.setBlockAndUpdate(pos, state.setValue(IEProperties.OPEN, !state.getValue(IEProperties.OPEN)));
if(b)
return InteractionResult.SUCCESS;
else
Expand Down

0 comments on commit 12bcdcd

Please sign in to comment.