mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
Block Ticking API
This commit is contained in:
parent
1158ad3a6a
commit
63ca8a9302
2 changed files with 31 additions and 0 deletions
|
@ -78,6 +78,12 @@ public class CraftBlock implements Block {
|
||||||
return this.world.getBlockState(this.position);
|
return this.world.getBlockState(this.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Paper start
|
||||||
|
public net.minecraft.world.level.material.FluidState getNMSFluid() {
|
||||||
|
return this.world.getFluidState(this.position);
|
||||||
|
}
|
||||||
|
// Paper end
|
||||||
|
|
||||||
public BlockPos getPosition() {
|
public BlockPos getPosition() {
|
||||||
return this.position;
|
return this.position;
|
||||||
}
|
}
|
||||||
|
@ -709,5 +715,23 @@ public class CraftBlock implements Block {
|
||||||
public boolean isValidTool(ItemStack itemStack) {
|
public boolean isValidTool(ItemStack itemStack) {
|
||||||
return getDrops(itemStack).size() != 0;
|
return getDrops(itemStack).size() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
final ServerLevel level = this.world.getMinecraftWorld();
|
||||||
|
this.getNMS().tick(level, this.position, level.random);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fluidTick() {
|
||||||
|
this.getNMSFluid().tick(this.world.getMinecraftWorld(), this.position, this.getNMS());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void randomTick() {
|
||||||
|
final ServerLevel level = this.world.getMinecraftWorld();
|
||||||
|
this.getNMS().randomTick(level, this.position, level.random);
|
||||||
|
}
|
||||||
// Paper end
|
// Paper end
|
||||||
}
|
}
|
||||||
|
|
|
@ -761,4 +761,11 @@ public class CraftBlockData implements BlockData {
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
// Paper end - destroy speed API
|
// Paper end - destroy speed API
|
||||||
|
|
||||||
|
// Paper start - Block tick API
|
||||||
|
@Override
|
||||||
|
public boolean isRandomlyTicked() {
|
||||||
|
return this.state.isRandomlyTicking();
|
||||||
|
}
|
||||||
|
// Paper end - Block tick API
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue