mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
Make bukkit work
This commit is contained in:
parent
23f47de10a
commit
8e0d64dccd
@ -0,0 +1,12 @@
|
||||
package com.dfsek.terra.bukkit.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
|
||||
public class BukkitUtils {
|
||||
public static boolean isLiquid(BlockData blockState) {
|
||||
Material material = blockState.getMaterial();
|
||||
return material == Material.WATER || material == Material.LAVA;
|
||||
}
|
||||
}
|
@ -1,6 +1,9 @@
|
||||
package com.dfsek.terra.bukkit.world;
|
||||
|
||||
import com.dfsek.terra.bukkit.util.BukkitUtils;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.LimitedRegion;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -47,10 +50,15 @@ public class BukkitProtoWorld implements ProtoWorld {
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
access(x, y, z, () -> {
|
||||
delegate.setBlockData(x, y, z, BukkitAdapter.adapt(data));
|
||||
BlockData bukkitData = BukkitAdapter.adapt(data);
|
||||
delegate.setBlockData(x, y, z, bukkitData);
|
||||
if(physics) {
|
||||
if (BukkitUtils.isLiquid(bukkitData)) {
|
||||
delegate.scheduleFluidUpdate(x, y, z);
|
||||
} else {
|
||||
delegate.scheduleBlockUpdate(x, y, z);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user