use of org.spongepowered.api.data.property.block.MatterProperty in project AdamantineShield by Karanum.
the class LiquidFlowListener method onLiquidFlow.
@Listener(order = Order.POST)
public void onLiquidFlow(ChangeBlockEvent.Pre e) {
if (e.getLocations().isEmpty())
return;
Location<World> loc = e.getLocations().get(0);
BlockSnapshot snapshot = loc.getExtent().createSnapshot(loc.getBlockPosition());
Optional<MatterProperty> matter = snapshot.getState().getProperty(MatterProperty.class);
if (matter.isPresent() && matter.get().getValue() == Matter.LIQUID) {
String name = "Water";
BlockType type = snapshot.getState().getType();
if (type == BlockTypes.LAVA || type == BlockTypes.FLOWING_LAVA)
name = "Lava";
db.addToQueue(new BlockQueueEntry(snapshot, ActionType.FLOW, name, new Date().getTime()));
}
}
Aggregations