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);
|
||||
|
||||
try {
|
||||
Field f = o.getClass().getField(i);
|
||||
Field f = o.getClass().getDeclaredField(i);
|
||||
|
||||
if (f.isEnumConstant() || f.getType().isEnum() || f.getType().isPrimitive()) {
|
||||
a.add("ERROR: Unexptected type: " + i + " into " + f.getType()
|
||||
@ -856,7 +856,8 @@ public class ProjectManager {
|
||||
}
|
||||
|
||||
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()) {
|
||||
try {
|
||||
Field f = o.getClass().getField(i);
|
||||
Field f = o.getClass().getDeclaredField(i);
|
||||
|
||||
if (f == null) {
|
||||
throw new NullPointerException();
|
||||
@ -911,7 +912,7 @@ public class ProjectManager {
|
||||
|
||||
catch (Throwable e) {
|
||||
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
|
||||
private CommandIrisStudioPackage pkg;
|
||||
|
||||
@Command
|
||||
private CommandIrisStudioVerify verify;
|
||||
|
||||
@Command
|
||||
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 power;
|
||||
|
||||
public NoiseGenerator getGen()
|
||||
{
|
||||
return generator;
|
||||
}
|
||||
|
||||
public static CNG signature(RNG rng) {
|
||||
return signature(rng, NoiseType.SIMPLEX);
|
||||
}
|
||||
|
||||
public static CNG signature(RNG rng, NoiseType t) {
|
||||
// @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)
|
||||
.child(new CNG(rng.nextParallelRNG(19), 1, 2).scale(0.1))
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 2).scale(0.15), 24), 44)
|
||||
.child(new CNG(rng.nextParallelRNG(19), 1, 1).scale(0.1))
|
||||
.fractureWith(new CNG(rng.nextParallelRNG(20), 1, 1).scale(0.15), 24), 44)
|
||||
.down(0.3).patch(2.5);
|
||||
// @done
|
||||
}
|
||||
@ -68,6 +73,8 @@ public class CNG {
|
||||
scale = 1;
|
||||
patch = 1;
|
||||
fscale = 1;
|
||||
down = 0;
|
||||
up = 0;
|
||||
fracture = null;
|
||||
generator = t.create(random.nextParallelRNG(33).lmax());
|
||||
this.opacity = opacity;
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.volmit.iris.noise;
|
||||
|
||||
import com.volmit.iris.util.M;
|
||||
|
||||
public class CellHeightNoise implements NoiseGenerator {
|
||||
private final FastNoise n;
|
||||
|
||||
@ -11,7 +13,7 @@ public class CellHeightNoise implements NoiseGenerator {
|
||||
}
|
||||
|
||||
private double filter(double noise) {
|
||||
return (noise / 2D) + 0.5D;
|
||||
return M.clip((noise / 2D) + 0.5D, 0D, 1D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,75 +1,43 @@
|
||||
package com.volmit.iris.noise;
|
||||
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
public class SimplexNoise implements NoiseGenerator, OctaveNoise {
|
||||
private final OpenSimplex n;
|
||||
private final SNG n;
|
||||
private int octaves;
|
||||
|
||||
public SimplexNoise(long seed) {
|
||||
this.n = new OpenSimplex(seed);
|
||||
this.n = new SNG(new RNG(seed));
|
||||
octaves = 1;
|
||||
}
|
||||
|
||||
public double f(double v) {
|
||||
return (v / 2D) + 0.5D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x) {
|
||||
if (octaves <= 1) {
|
||||
return (n.noise2_XBeforeY(x, 0) / 2D) + 0.5D;
|
||||
return f(n.noise(x));
|
||||
}
|
||||
|
||||
double result = 0;
|
||||
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;
|
||||
return f(n.noise(x, octaves, 1D, 1D, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x, double z) {
|
||||
if (octaves <= 1) {
|
||||
return (n.noise2(x, z) / 2D) + 0.5D;
|
||||
return f(n.noise(x, z));
|
||||
}
|
||||
|
||||
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;
|
||||
return f(n.noise(x, z, octaves, 1D, 1D, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public double noise(double x, double y, double z) {
|
||||
if (octaves <= 1) {
|
||||
return (n.noise3_XZBeforeY(x, y, z) / 2D) + 0.5D;
|
||||
return f(n.noise(x, y, z));
|
||||
}
|
||||
|
||||
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;
|
||||
return f(n.noise(x, y, z, octaves, 1D, 1D, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.volmit.iris.noise;
|
||||
|
||||
import com.volmit.iris.util.M;
|
||||
|
||||
public class VascularNoise implements NoiseGenerator {
|
||||
private final FastNoise n;
|
||||
|
||||
@ -11,7 +13,7 @@ public class VascularNoise implements NoiseGenerator {
|
||||
}
|
||||
|
||||
private double filter(double noise) {
|
||||
return 1D - ((noise / 2D) + 0.5D);
|
||||
return M.clip(1D - ((noise / 2D) + 0.5D), 0D, 1D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,7 +123,7 @@ public class IrisBiomeDecorator
|
||||
|
||||
if(layerVarianceGenerators == null)
|
||||
{
|
||||
layerGenerators = new KMap<>();
|
||||
layerVarianceGenerators = new KMap<>();
|
||||
}
|
||||
|
||||
if(!layerVarianceGenerators.containsKey(key))
|
||||
|
@ -20,8 +20,7 @@ import lombok.Setter;
|
||||
* @author cyberpwn
|
||||
*
|
||||
*/
|
||||
public class MortarSender implements CommandSender
|
||||
{
|
||||
public class MortarSender implements CommandSender {
|
||||
private CommandSender s;
|
||||
private String tag;
|
||||
|
||||
@ -32,17 +31,14 @@ public class MortarSender implements CommandSender
|
||||
/**
|
||||
* Wrap a command sender
|
||||
*
|
||||
* @param s
|
||||
* the command sender
|
||||
* @param s the command sender
|
||||
*/
|
||||
public MortarSender(CommandSender s)
|
||||
{
|
||||
public MortarSender(CommandSender s) {
|
||||
tag = "";
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
public MortarSender(CommandSender s, String tag)
|
||||
{
|
||||
public MortarSender(CommandSender s, String tag) {
|
||||
this.tag = tag;
|
||||
this.s = s;
|
||||
}
|
||||
@ -50,11 +46,9 @@ public class MortarSender implements CommandSender
|
||||
/**
|
||||
* Set a command tag (prefix for sendMessage)
|
||||
*
|
||||
* @param tag
|
||||
* the tag
|
||||
* @param tag the tag
|
||||
*/
|
||||
public void setTag(String tag)
|
||||
{
|
||||
public void setTag(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@ -63,8 +57,7 @@ public class MortarSender implements CommandSender
|
||||
*
|
||||
* @return the command tag
|
||||
*/
|
||||
public String getTag()
|
||||
{
|
||||
public String getTag() {
|
||||
return tag;
|
||||
}
|
||||
|
||||
@ -73,8 +66,7 @@ public class MortarSender implements CommandSender
|
||||
*
|
||||
* @return true if it is
|
||||
*/
|
||||
public boolean isPlayer()
|
||||
{
|
||||
public boolean isPlayer() {
|
||||
return getS() instanceof Player;
|
||||
}
|
||||
|
||||
@ -83,8 +75,7 @@ public class MortarSender implements CommandSender
|
||||
*
|
||||
* @return a casted player
|
||||
*/
|
||||
public Player player()
|
||||
{
|
||||
public Player player() {
|
||||
return (Player) getS();
|
||||
}
|
||||
|
||||
@ -93,117 +84,102 @@ public class MortarSender implements CommandSender
|
||||
*
|
||||
* @return the command sender
|
||||
*/
|
||||
public CommandSender getS()
|
||||
{
|
||||
public CommandSender getS() {
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(String name)
|
||||
{
|
||||
public boolean isPermissionSet(String name) {
|
||||
return s.isPermissionSet(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(Permission perm)
|
||||
{
|
||||
public boolean isPermissionSet(Permission perm) {
|
||||
return s.isPermissionSet(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String name)
|
||||
{
|
||||
public boolean hasPermission(String name) {
|
||||
return s.hasPermission(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Permission perm)
|
||||
{
|
||||
public boolean hasPermission(Permission perm) {
|
||||
return s.hasPermission(perm);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin)
|
||||
{
|
||||
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||
return s.addAttachment(plugin);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks)
|
||||
{
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||
return s.addAttachment(plugin, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(PermissionAttachment attachment)
|
||||
{
|
||||
public void removeAttachment(PermissionAttachment attachment) {
|
||||
s.removeAttachment(attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions()
|
||||
{
|
||||
public void recalculatePermissions() {
|
||||
s.recalculatePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions()
|
||||
{
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
return s.getEffectivePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp()
|
||||
{
|
||||
public boolean isOp() {
|
||||
return s.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value)
|
||||
{
|
||||
public void setOp(boolean value) {
|
||||
s.setOp(value);
|
||||
}
|
||||
|
||||
public void hr() {
|
||||
s.sendMessage("========================================================");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
public void sendMessage(String message) {
|
||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag()) + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String[] messages)
|
||||
{
|
||||
for(String str : messages)
|
||||
public void sendMessage(String[] messages) {
|
||||
for (String str : messages)
|
||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag() + str));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer()
|
||||
{
|
||||
public Server getServer() {
|
||||
return s.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
public String getName() {
|
||||
return s.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spigot spigot()
|
||||
{
|
||||
public Spigot spigot() {
|
||||
return s.spigot();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user