@TheRedWaffle I attempted using your suggestions. I believe I was able to initialize my property. Now lets say I want to decrement the value every time I click the block. Here is what I have so far.
public class ExampleBlock extends Block {
private IProperty<Integer> property = IntegerProperty.create("life",0,3);
public ExampleBlock() {
super(Block.Properties.create(Material.GLASS).harvestTool(ToolType.AXE).harvestLevel(0).hardnessAndResistance(0.5f, 20.0f).lightValue(16).sound(SoundType.GLASS));
this.setRegistryName("dlm", "example_block");
}
@Override
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
builder.add(property);
}
@Nullable
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(property,3);
}
@Override
public void onBlockClicked(BlockState state, World worldIn, BlockPos pos, PlayerEntity player) {
state.get(property) // How would I decrement this value?
}
}
Also,
I do not see any mention to this class or see any documentation online. Not sure how I could implement interactWith without that information.
@QuantumSoul I went ahead and updated to the lasted mdk. After poking around a bit, I found that onBlockActivated is not in the Block class. I can only find it in the BlockState class. Not sure how I could override it without making an entirely new BlockState