mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 04:26:42 +00:00
Cleanup overlay/underlay mask.
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import java.util.HashSet;
|
||||
@ -6,41 +5,30 @@ import java.util.Set;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
import com.sk89q.worldedit.blocks.BlockID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 1337
|
||||
*/
|
||||
public class UnderOverlayMask implements Mask{
|
||||
public class UnderOverlayMask implements Mask {
|
||||
|
||||
boolean overlay;
|
||||
boolean wildcard;
|
||||
Set<Integer> ids = new HashSet<Integer>();
|
||||
public UnderOverlayMask(Set<Integer> ids,boolean overlay,boolean wildcard){
|
||||
|
||||
public UnderOverlayMask(Set<Integer> ids, boolean overlay) {
|
||||
addAll(ids);
|
||||
this.overlay = overlay;
|
||||
this.wildcard = wildcard;
|
||||
|
||||
}
|
||||
|
||||
public void addAll(Set<Integer> ids){
|
||||
this.ids.addAll(ids);
|
||||
}
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
if(!wildcard){
|
||||
int id = editSession.getBlock(pos.setY(pos.getBlockY() + (overlay ? -1 :1))).getType();
|
||||
if(overlay){
|
||||
return ids.contains(id);
|
||||
}
|
||||
else if(!overlay){
|
||||
return ids.contains(id);
|
||||
}
|
||||
}
|
||||
else{
|
||||
return (overlay ? editSession.getBlock(pos.setY(pos.getBlockY() + 1)).getType() != 0: editSession.getBlock(pos.setY(pos.getBlockY() - 1)).getType() != 0);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
int id = editSession.getBlock(pos.setY(pos.getBlockY() + (overlay ? -1 : 1))).getType();
|
||||
return ids.isEmpty() ? id != BlockID.AIR : ids.contains(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user