Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-05 11:00:05 +01:00
Add RandomMask (not sure if really useful)
Dieser Commit ist enthalten in:
Ursprung
f2557abf9a
Commit
21d603ce4e
@ -632,6 +632,10 @@ public class WorldEdit {
|
||||
}
|
||||
return new BiomeTypeMask(biomes);
|
||||
|
||||
case '%':
|
||||
int i = Integer.parseInt(component.substring(1));
|
||||
return new RandomMask(((double) i) / 100);
|
||||
|
||||
case '!':
|
||||
if (component.length() > 1) {
|
||||
return new InvertedMask(getBlockMaskComponent(player, session, masks, component.substring(1)));
|
||||
|
24
src/main/java/com/sk89q/worldedit/masks/RandomMask.java
Normale Datei
24
src/main/java/com/sk89q/worldedit/masks/RandomMask.java
Normale Datei
@ -0,0 +1,24 @@
|
||||
package com.sk89q.worldedit.masks;
|
||||
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.LocalPlayer;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.Vector;
|
||||
|
||||
public class RandomMask implements Mask {
|
||||
|
||||
private final double ratio;
|
||||
|
||||
public RandomMask(double ratio) {
|
||||
this.ratio = ratio;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepare(LocalSession session, LocalPlayer player, Vector target) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(EditSession editSession, Vector pos) {
|
||||
return Math.random() < ratio;
|
||||
}
|
||||
}
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren