mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
normalize
This commit is contained in:
parent
ce0249f28e
commit
1f63b47500
@ -837,7 +837,7 @@ public class ProjectManager {
|
|||||||
JSONObject jj = j.getJSONObject(i);
|
JSONObject jj = j.getJSONObject(i);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Field f = o.getClass().getField(i);
|
Field f = o.getClass().getDeclaredField(i);
|
||||||
|
|
||||||
if (f.isEnumConstant() || f.getType().isEnum() || f.getType().isPrimitive()) {
|
if (f.isEnumConstant() || f.getType().isEnum() || f.getType().isPrimitive()) {
|
||||||
a.add("ERROR: Unexptected type: " + i + " into " + f.getType()
|
a.add("ERROR: Unexptected type: " + i + " into " + f.getType()
|
||||||
@ -856,7 +856,8 @@ public class ProjectManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
a.add("WARN: Unexptected Field: " + i + " in " + o.getClass());
|
a.add("WARN: Unexptected Field: " + i + " in " + o.getClass().getSimpleName() + " from "
|
||||||
|
+ m.getAbsolutePath() + " " + e.getClass().getSimpleName() + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +903,7 @@ public class ProjectManager {
|
|||||||
|
|
||||||
for (String i : j.keySet()) {
|
for (String i : j.keySet()) {
|
||||||
try {
|
try {
|
||||||
Field f = o.getClass().getField(i);
|
Field f = o.getClass().getDeclaredField(i);
|
||||||
|
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
@ -911,7 +912,7 @@ public class ProjectManager {
|
|||||||
|
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
a.add("WARN: Unreconized Field (key): " + i + " in " + file.getAbsolutePath()
|
a.add("WARN: Unreconized Field (key): " + i + " in " + file.getAbsolutePath()
|
||||||
+ ". Delete this key/value pair");
|
+ ". Delete this key/value pair: " + o.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,9 @@ public class CommandIrisStudio extends MortarCommand
|
|||||||
|
|
||||||
@Command
|
@Command
|
||||||
private CommandIrisStudioPackage pkg;
|
private CommandIrisStudioPackage pkg;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandIrisStudioVerify verify;
|
||||||
|
|
||||||
@Command
|
@Command
|
||||||
private CommandIrisStudioList list;
|
private CommandIrisStudioList list;
|
||||||
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.volmit.iris.command;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.util.KList;
|
||||||
|
import com.volmit.iris.util.MortarCommand;
|
||||||
|
import com.volmit.iris.util.MortarSender;
|
||||||
|
|
||||||
|
public class CommandIrisStudioVerify extends MortarCommand {
|
||||||
|
public CommandIrisStudioVerify() {
|
||||||
|
super("verify", "check", "v");
|
||||||
|
requiresPermission(Iris.perm.studio);
|
||||||
|
setDescription("Check project for warnings and issues");
|
||||||
|
setCategory("Studio");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args) {
|
||||||
|
if (args.length != 1) {
|
||||||
|
sender.sendMessage("/iris std verify <DIMENSION> (file name without .json)");
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.hr();
|
||||||
|
KList<String> mm = Iris.proj.analyze(Iris.instance.getDataFile("packs", args[0]));
|
||||||
|
mm.forEach((m) -> sender.sendMessage(m));
|
||||||
|
int e = 0;
|
||||||
|
int w = 0;
|
||||||
|
|
||||||
|
for (String i : mm) {
|
||||||
|
if (i.contains("ERROR")) {
|
||||||
|
e++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i.contains("WARN")) {
|
||||||
|
w++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(w + " Warning(s), " + e + " Error(s)");
|
||||||
|
|
||||||
|
sender.hr();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getArgsUsage() {
|
||||||
|
return "[dimension]";
|
||||||
|
}
|
||||||
|
}
|
@ -34,16 +34,21 @@ public class CNG {
|
|||||||
private double down;
|
private double down;
|
||||||
private double power;
|
private double power;
|
||||||
|
|
||||||
|
public NoiseGenerator getGen()
|
||||||
|
{
|
||||||
|
return generator;
|
||||||
|
}
|
||||||
|
|
||||||
public static CNG signature(RNG rng) {
|
public static CNG signature(RNG rng) {
|
||||||
return signature(rng, NoiseType.SIMPLEX);
|
return signature(rng, NoiseType.SIMPLEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CNG signature(RNG rng, NoiseType t) {
|
public static CNG signature(RNG rng, NoiseType t) {
|
||||||
// @builder
|
// @builder
|
||||||
return new CNG(rng.nextParallelRNG(17), t, 1D, 3).scale(0.012)
|
return new CNG(rng.nextParallelRNG(17), t, 1D, 1).scale(0.012)
|
||||||
.fractureWith(new CNG(rng.nextParallelRNG(18), 1, 2).scale(0.018)
|
.fractureWith(new CNG(rng.nextParallelRNG(18), 1, 2).scale(0.018)
|
||||||
.child(new CNG(rng.nextParallelRNG(19), 1, 2).scale(0.1))
|
.child(new CNG(rng.nextParallelRNG(19), 1, 1).scale(0.1))
|
||||||
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 2).scale(0.15), 24), 44)
|
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.15), 24), 44)
|
||||||
.down(0.3).patch(2.5);
|
.down(0.3).patch(2.5);
|
||||||
// @done
|
// @done
|
||||||
}
|
}
|
||||||
@ -68,6 +73,8 @@ public class CNG {
|
|||||||
scale = 1;
|
scale = 1;
|
||||||
patch = 1;
|
patch = 1;
|
||||||
fscale = 1;
|
fscale = 1;
|
||||||
|
down = 0;
|
||||||
|
up = 0;
|
||||||
fracture = null;
|
fracture = null;
|
||||||
generator = t.create(random.nextParallelRNG(33).lmax());
|
generator = t.create(random.nextParallelRNG(33).lmax());
|
||||||
this.opacity = opacity;
|
this.opacity = opacity;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.volmit.iris.noise;
|
package com.volmit.iris.noise;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.M;
|
||||||
|
|
||||||
public class CellHeightNoise implements NoiseGenerator {
|
public class CellHeightNoise implements NoiseGenerator {
|
||||||
private final FastNoise n;
|
private final FastNoise n;
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ public class CellHeightNoise implements NoiseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double filter(double noise) {
|
private double filter(double noise) {
|
||||||
return (noise / 2D) + 0.5D;
|
return M.clip((noise / 2D) + 0.5D, 0D, 1D);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,75 +1,43 @@
|
|||||||
package com.volmit.iris.noise;
|
package com.volmit.iris.noise;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.RNG;
|
||||||
|
|
||||||
public class SimplexNoise implements NoiseGenerator, OctaveNoise {
|
public class SimplexNoise implements NoiseGenerator, OctaveNoise {
|
||||||
private final OpenSimplex n;
|
private final SNG n;
|
||||||
private int octaves;
|
private int octaves;
|
||||||
|
|
||||||
public SimplexNoise(long seed) {
|
public SimplexNoise(long seed) {
|
||||||
this.n = new OpenSimplex(seed);
|
this.n = new SNG(new RNG(seed));
|
||||||
octaves = 1;
|
octaves = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double f(double v) {
|
||||||
|
return (v / 2D) + 0.5D;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double noise(double x) {
|
public double noise(double x) {
|
||||||
if (octaves <= 1) {
|
if (octaves <= 1) {
|
||||||
return (n.noise2_XBeforeY(x, 0) / 2D) + 0.5D;
|
return f(n.noise(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
double result = 0;
|
return f(n.noise(x, octaves, 1D, 1D, false));
|
||||||
double amp = 1;
|
|
||||||
double freq = 1;
|
|
||||||
double max = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < octaves; i++) {
|
|
||||||
result += ((n.noise2_XBeforeY(x * freq, 0) * amp) / 2D) + 0.5D;
|
|
||||||
max += amp;
|
|
||||||
freq *= 2;
|
|
||||||
amp *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result / max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double noise(double x, double z) {
|
public double noise(double x, double z) {
|
||||||
if (octaves <= 1) {
|
if (octaves <= 1) {
|
||||||
return (n.noise2(x, z) / 2D) + 0.5D;
|
return f(n.noise(x, z));
|
||||||
}
|
}
|
||||||
|
return f(n.noise(x, z, octaves, 1D, 1D, true));
|
||||||
double result = 0;
|
|
||||||
double amp = 1;
|
|
||||||
double freq = 1;
|
|
||||||
double max = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < octaves; i++) {
|
|
||||||
result += ((n.noise2(x * freq, z * freq) * amp) / 2D) + 0.5D;
|
|
||||||
max += amp;
|
|
||||||
freq *= 2;
|
|
||||||
amp *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result / max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double noise(double x, double y, double z) {
|
public double noise(double x, double y, double z) {
|
||||||
if (octaves <= 1) {
|
if (octaves <= 1) {
|
||||||
return (n.noise3_XZBeforeY(x, y, z) / 2D) + 0.5D;
|
return f(n.noise(x, y, z));
|
||||||
}
|
}
|
||||||
|
return f(n.noise(x, y, z, octaves, 1D, 1D, true));
|
||||||
double result = 0;
|
|
||||||
double amp = 1;
|
|
||||||
double freq = 1;
|
|
||||||
double max = 0;
|
|
||||||
|
|
||||||
for (int i = 0; i < octaves; i++) {
|
|
||||||
result += ((n.noise3_XZBeforeY(x * freq, y * freq, z * freq) * amp) / 2D) + 0.5D;
|
|
||||||
max += amp;
|
|
||||||
freq *= 2;
|
|
||||||
amp *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result / max;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.volmit.iris.noise;
|
package com.volmit.iris.noise;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.M;
|
||||||
|
|
||||||
public class VascularNoise implements NoiseGenerator {
|
public class VascularNoise implements NoiseGenerator {
|
||||||
private final FastNoise n;
|
private final FastNoise n;
|
||||||
|
|
||||||
@ -11,7 +13,7 @@ public class VascularNoise implements NoiseGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private double filter(double noise) {
|
private double filter(double noise) {
|
||||||
return 1D - ((noise / 2D) + 0.5D);
|
return M.clip(1D - ((noise / 2D) + 0.5D), 0D, 1D);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -123,7 +123,7 @@ public class IrisBiomeDecorator
|
|||||||
|
|
||||||
if(layerVarianceGenerators == null)
|
if(layerVarianceGenerators == null)
|
||||||
{
|
{
|
||||||
layerGenerators = new KMap<>();
|
layerVarianceGenerators = new KMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!layerVarianceGenerators.containsKey(key))
|
if(!layerVarianceGenerators.containsKey(key))
|
||||||
|
@ -20,8 +20,7 @@ import lombok.Setter;
|
|||||||
* @author cyberpwn
|
* @author cyberpwn
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class MortarSender implements CommandSender
|
public class MortarSender implements CommandSender {
|
||||||
{
|
|
||||||
private CommandSender s;
|
private CommandSender s;
|
||||||
private String tag;
|
private String tag;
|
||||||
|
|
||||||
@ -32,17 +31,14 @@ public class MortarSender implements CommandSender
|
|||||||
/**
|
/**
|
||||||
* Wrap a command sender
|
* Wrap a command sender
|
||||||
*
|
*
|
||||||
* @param s
|
* @param s the command sender
|
||||||
* the command sender
|
|
||||||
*/
|
*/
|
||||||
public MortarSender(CommandSender s)
|
public MortarSender(CommandSender s) {
|
||||||
{
|
|
||||||
tag = "";
|
tag = "";
|
||||||
this.s = s;
|
this.s = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MortarSender(CommandSender s, String tag)
|
public MortarSender(CommandSender s, String tag) {
|
||||||
{
|
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
this.s = s;
|
this.s = s;
|
||||||
}
|
}
|
||||||
@ -50,11 +46,9 @@ public class MortarSender implements CommandSender
|
|||||||
/**
|
/**
|
||||||
* Set a command tag (prefix for sendMessage)
|
* Set a command tag (prefix for sendMessage)
|
||||||
*
|
*
|
||||||
* @param tag
|
* @param tag the tag
|
||||||
* the tag
|
|
||||||
*/
|
*/
|
||||||
public void setTag(String tag)
|
public void setTag(String tag) {
|
||||||
{
|
|
||||||
this.tag = tag;
|
this.tag = tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +57,7 @@ public class MortarSender implements CommandSender
|
|||||||
*
|
*
|
||||||
* @return the command tag
|
* @return the command tag
|
||||||
*/
|
*/
|
||||||
public String getTag()
|
public String getTag() {
|
||||||
{
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,8 +66,7 @@ public class MortarSender implements CommandSender
|
|||||||
*
|
*
|
||||||
* @return true if it is
|
* @return true if it is
|
||||||
*/
|
*/
|
||||||
public boolean isPlayer()
|
public boolean isPlayer() {
|
||||||
{
|
|
||||||
return getS() instanceof Player;
|
return getS() instanceof Player;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +75,7 @@ public class MortarSender implements CommandSender
|
|||||||
*
|
*
|
||||||
* @return a casted player
|
* @return a casted player
|
||||||
*/
|
*/
|
||||||
public Player player()
|
public Player player() {
|
||||||
{
|
|
||||||
return (Player) getS();
|
return (Player) getS();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,117 +84,102 @@ public class MortarSender implements CommandSender
|
|||||||
*
|
*
|
||||||
* @return the command sender
|
* @return the command sender
|
||||||
*/
|
*/
|
||||||
public CommandSender getS()
|
public CommandSender getS() {
|
||||||
{
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPermissionSet(String name)
|
public boolean isPermissionSet(String name) {
|
||||||
{
|
|
||||||
return s.isPermissionSet(name);
|
return s.isPermissionSet(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isPermissionSet(Permission perm)
|
public boolean isPermissionSet(Permission perm) {
|
||||||
{
|
|
||||||
return s.isPermissionSet(perm);
|
return s.isPermissionSet(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(String name)
|
public boolean hasPermission(String name) {
|
||||||
{
|
|
||||||
return s.hasPermission(name);
|
return s.hasPermission(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(Permission perm)
|
public boolean hasPermission(Permission perm) {
|
||||||
{
|
|
||||||
return s.hasPermission(perm);
|
return s.hasPermission(perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value)
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
||||||
{
|
|
||||||
return s.addAttachment(plugin, name, value);
|
return s.addAttachment(plugin, name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin)
|
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||||
{
|
|
||||||
return s.addAttachment(plugin);
|
return s.addAttachment(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks)
|
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
||||||
{
|
|
||||||
return s.addAttachment(plugin, name, value, ticks);
|
return s.addAttachment(plugin, name, value, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks)
|
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||||
{
|
|
||||||
return s.addAttachment(plugin, ticks);
|
return s.addAttachment(plugin, ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeAttachment(PermissionAttachment attachment)
|
public void removeAttachment(PermissionAttachment attachment) {
|
||||||
{
|
|
||||||
s.removeAttachment(attachment);
|
s.removeAttachment(attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recalculatePermissions()
|
public void recalculatePermissions() {
|
||||||
{
|
|
||||||
s.recalculatePermissions();
|
s.recalculatePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<PermissionAttachmentInfo> getEffectivePermissions()
|
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||||
{
|
|
||||||
return s.getEffectivePermissions();
|
return s.getEffectivePermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOp()
|
public boolean isOp() {
|
||||||
{
|
|
||||||
return s.isOp();
|
return s.isOp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOp(boolean value)
|
public void setOp(boolean value) {
|
||||||
{
|
|
||||||
s.setOp(value);
|
s.setOp(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void hr() {
|
||||||
|
s.sendMessage("========================================================");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String message)
|
public void sendMessage(String message) {
|
||||||
{
|
|
||||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag()) + message);
|
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag()) + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendMessage(String[] messages)
|
public void sendMessage(String[] messages) {
|
||||||
{
|
for (String str : messages)
|
||||||
for(String str : messages)
|
|
||||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag() + str));
|
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag() + str));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Server getServer()
|
public Server getServer() {
|
||||||
{
|
|
||||||
return s.getServer();
|
return s.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName() {
|
||||||
{
|
|
||||||
return s.getName();
|
return s.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Spigot spigot()
|
public Spigot spigot() {
|
||||||
{
|
|
||||||
return s.spigot();
|
return s.spigot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user