Create Temporally Blocks
Using the example, the Spectral Block (Cast by spells):
You will need a Block that extends BlockWithEntity (Or anyone related)
public class SpectralBlock extends BlockWithEntity {
public SpectralBlock() {
super(
//ITEM SETTINGS HERE
);
}
}
Now just
createBlockEntity
create aBlockEntityTimer
and set the max time
public class SpectralBlock extends BlockWithEntity {
public SpectralBlock() {
super(
//ITEM SETTINGS HERE
);
}
@Nullable
@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
BlockEntityTimer blockEntityTimer = new BlockEntityTimer(pos, state);
blockEntityTimer.setMaxTime(1200);
return blockEntityTimer;
}
}
Now just put your own functions and features to your fantastic block ^^
Last updated