Skip to content

Commit

Permalink
Backported API 6 changes into API 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Karanum committed Sep 2, 2017
1 parent 7db1463 commit 0ff2990
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.spongepowered.api.event.Listener;
import org.spongepowered.api.event.Order;
import org.spongepowered.api.event.block.ChangeBlockEvent;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

import com.karanumcoding.adamantineshield.db.Database;
import com.karanumcoding.adamantineshield.db.queue.BlockQueueEntry;
Expand All @@ -26,7 +28,11 @@ public LiquidFlowListener(Database db) {

@Listener(order = Order.POST)
public void onLiquidFlow(ChangeBlockEvent.Pre e) {
BlockSnapshot snapshot = e.getTargetWorld().createSnapshot(e.getLocations().get(0).getBlockPosition());
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";
Expand Down

0 comments on commit 0ff2990

Please sign in to comment.