Skip to content

Commit

Permalink
removed MACHINE_SATE block state property
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Dec 20, 2023
1 parent 615dd23 commit df9510a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ public void setMachineState(MachineState newState) {
MachineState old = this.machineState;
this.machineState = newState;
if (level != null) {
setMachineStateBlockState(machineState);
sidedSync(true);
if (!level.isClientSide) {
if (old == MachineState.ACTIVE) {
Expand All @@ -542,14 +541,6 @@ public void setMachineState(MachineState newState) {
}
}

protected void setMachineStateBlockState(MachineState newState){
BlockState state = getBlockState();
if (newState == MachineState.ACTIVE || newState == MachineState.IDLE){
state = state.setValue(BlockMachine.MACHINE_STATE, newState);
getLevel().setBlockAndUpdate(getBlockPos(), state);
}
}

public CoverFactory[] getValidCovers() {
return AntimatterAPI.all(CoverFactory.class).toArray(new CoverFactory[0]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,6 @@ public void setMachineState(MachineState newState) {
//result.updateState(this, result); //TODO changing state element
}

@Override
protected void setMachineStateBlockState(MachineState newState){
BlockState state = getBlockState();
if (newState == MachineState.ACTIVE || newState == MachineState.IDLE || newState == MachineState.INVALID_STRUCTURE){
state = state.setValue(BlockMultiMachine.MACHINE_STATE, newState);
getLevel().setBlockAndUpdate(getBlockPos(), state);
}
}

@Override
public void setBlockState(BlockState p_155251_) {
BlockState old = this.getBlockState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
import static muramasa.antimatter.machine.MachineFlag.*;

public class BlockMachine extends BlockBasic implements IItemBlockProvider, EntityBlock {
public static final EnumProperty<MachineState> MACHINE_STATE = EnumProperty.create("machine_state", MachineState.class, MachineState.IDLE, MachineState.ACTIVE);

@Getter
protected Machine<?> type;
@Getter
Expand Down Expand Up @@ -110,9 +108,9 @@ public VoxelShape getShape(BlockState state, BlockGetter level, BlockPos pos, Co
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
if (type == null) return; // means this is the first run
if (type.isVerticalFacingAllowed()) {
builder.add(BlockStateProperties.FACING).add(MACHINE_STATE);
builder.add(BlockStateProperties.FACING);
} else {
builder.add(BlockStateProperties.HORIZONTAL_FACING).add(MACHINE_STATE);
builder.add(BlockStateProperties.HORIZONTAL_FACING);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import net.minecraft.world.level.block.state.properties.EnumProperty;

public class BlockMultiMachine extends BlockMachine {
public static final EnumProperty<MachineState> MACHINE_STATE = EnumProperty.create("machine_state", MachineState.class, MachineState.INVALID_STRUCTURE, MachineState.IDLE, MachineState.ACTIVE);

public BlockMultiMachine(Machine<?> type, Tier tier) {
super(type, tier);
}
Expand All @@ -21,9 +19,9 @@ public BlockMultiMachine(Machine<?> type, Tier tier) {
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
if (type == null) return; // means this is the first run
if (type.isVerticalFacingAllowed()) {
builder.add(BlockStateProperties.FACING).add(MACHINE_STATE);
builder.add(BlockStateProperties.FACING);
} else {
builder.add(BlockStateProperties.HORIZONTAL_FACING).add(MACHINE_STATE);
builder.add(BlockStateProperties.HORIZONTAL_FACING);
}
}

Expand Down

0 comments on commit df9510a

Please sign in to comment.