- 39
- 2
- 0
Я наколхозил часы (простите пожалуйста) и они нормально не работают, только если навестись на них с нажатым ф3
Блок с часами:
Блок с минутами:
Блок с часами:
Блок с часами:
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
World world = (World) worldIn; //Чтобы получить The World
int time = (int) world.getWorldTime();
if(time%10==0) {
while (true) {
if (time > 24000)
time -= 24000;
else break;
}
if (time > 14999)
time -= 15000;
else
time += 15000;
int minute = time / 21;
this.hour = minute / 60;
EnumFacing facing = state.getValue(FACING);
world.setBlockState(pos, this.getDefaultState().withProperty(FACING, facing).withProperty(HOUR,hour));
}
EnumFacing facing = state.getValue(FACING);
return state.withProperty(FACING, facing).withProperty(HOUR, hour);
}
Блок с минутами:
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
World world = (World) worldIn; //Чтобы получить The World
int time = (int) world.getWorldTime();
while (true) {
if (time > 24000)
time -= 24000;
else break;
}
if (time > 14999)
time -= 15000;
else
time += 15000;
int minute = time / 21;
while (minute >= 60)
minute -= 60;
EnumFacing facing = state.getValue(FACING);
world.setBlockState(pos, this.getDefaultState().withProperty(FACING, facing).withProperty(MINUTE,minute));
return state.withProperty(FACING, facing).withProperty(MINUTE, minute);
}