use of org.spongepowered.api.block.tileentity.TileEntity in project ClearMob by axle2005.
the class ClearTileEntity method run.
public static void run(ClearMob plugin, List<TileEntityType> list, Collection<World> worlds, CommandSource src) {
int removedentities = 0;
Collection<TileEntity> e = new ArrayList<TileEntity>();
for (World world : worlds) {
for (TileEntity entity : world.getTileEntities()) {
e.add(entity);
}
}
if (!e.isEmpty()) {
for (TileEntity entity : e) {
for (int i = 0; i <= list.size() - 1; i++) {
if ((entity.getType().equals(list.get(i)))) {
entity.getLocation().removeBlock(Cause.source(Sponge.getPluginManager().fromInstance(plugin).get()).build());
removedentities++;
}
}
}
}
feedback(plugin, src, removedentities);
}
use of org.spongepowered.api.block.tileentity.TileEntity in project Skree by Skelril.
the class GoldRushInstance method findChestAndKeys.
private void findChestAndKeys() {
keyRoom.forAll((pt) -> {
BlockState block = getRegion().getExtent().getBlock(pt);
if (block.getType() == BlockTypes.CHEST) {
// TODO Sponge port
Optional<TileEntity> optTileEnt = getRegion().getExtent().getTileEntity(pt);
if (optTileEnt.isPresent() && optTileEnt.get() instanceof IInventory) {
((IInventory) optTileEnt.get()).clear();
}
chestBlocks.add(new Location<>(getRegion().getExtent(), pt));
} else if (block.getType() == BlockTypes.WALL_SIGN) {
Optional<org.spongepowered.api.block.tileentity.TileEntity> optTileEnt = getRegion().getExtent().getTileEntity(pt);
if (!optTileEnt.isPresent()) {
return;
}
locks.add(new Location<>(getRegion().getExtent(), pt));
}
});
}
use of org.spongepowered.api.block.tileentity.TileEntity in project ClearMob by axle2005.
the class ClearTileEntity method run.
public static void run(ClearMob plugin, TileEntityType tile, Collection<World> worlds, CommandSource src) {
int removedentities = 0;
Collection<TileEntity> e = new ArrayList<TileEntity>();
for (World world : worlds) {
for (TileEntity entity : world.getTileEntities()) {
e.add(entity);
}
}
if (!e.isEmpty()) {
for (TileEntity entity : e) {
if ((entity.getType().equals(tile))) {
entity.getLocation().removeBlock(Cause.source(Sponge.getPluginManager().fromInstance(plugin).get()).build());
removedentities++;
}
}
}
feedback(plugin, src, removedentities);
}
Aggregations