2023-05-23 20:30:21 +02:00
|
|
|
package com.minelittlepony.unicopia.block;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.server.world.ZapAppleStageStore;
|
|
|
|
|
|
|
|
import net.minecraft.block.*;
|
|
|
|
import net.minecraft.server.world.ServerWorld;
|
|
|
|
import net.minecraft.util.math.*;
|
|
|
|
import net.minecraft.util.math.random.Random;
|
|
|
|
|
|
|
|
public class ZapAppleLeavesPlaceholderBlock extends AirBlock {
|
|
|
|
|
|
|
|
ZapAppleLeavesPlaceholderBlock() {
|
|
|
|
super(AbstractBlock.Settings.of(Material.AIR).noCollision().dropsNothing().air());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean hasRandomTicks(BlockState state) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Deprecated
|
|
|
|
@Override
|
|
|
|
public void scheduledTick(BlockState state, ServerWorld world, BlockPos pos, Random random) {
|
|
|
|
super.scheduledTick(state, world, pos, random);
|
|
|
|
|
|
|
|
ZapAppleStageStore store = ZapAppleStageStore.get(world);
|
|
|
|
ZapAppleStageStore.Stage newStage = store.getStage();
|
|
|
|
if (!world.isDay() && ZapAppleStageStore.Stage.HIBERNATING.mustChangeIntoInstantly(newStage)) {
|
2023-05-25 12:56:18 +02:00
|
|
|
world.setBlockState(pos, newStage.getNewState(state));
|
|
|
|
BaseZapAppleLeavesBlock.onStageChanged(store, newStage, world, state, pos, random);
|
2023-05-23 20:30:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
world.scheduleBlockTick(pos, this, 1);
|
|
|
|
}
|
|
|
|
}
|