mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Merge remote-tracking branch 'upstream/master' into DecreeCommands
This commit is contained in:
commit
2ac2cc2ebf
@ -32,7 +32,7 @@ plugins {
|
||||
}
|
||||
|
||||
group 'com.volmit.iris'
|
||||
version '1.7'
|
||||
version '1.7.1'
|
||||
def apiVersion = '1.17'
|
||||
def name = getRootProject().getName() // See settings.gradle
|
||||
def main = 'com.volmit.iris.Iris'
|
||||
@ -153,6 +153,10 @@ repositories {
|
||||
// maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'}
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs << '-parameters'
|
||||
}
|
||||
|
||||
shadowJar
|
||||
{
|
||||
minimize()
|
||||
|
@ -129,6 +129,7 @@ public class IrisSettings {
|
||||
public boolean systemEntitySpawnOverrides = true;
|
||||
public boolean systemEntityInitialSpawns = true;
|
||||
public int maxBiomeChildDepth = 4;
|
||||
public boolean preventLeafDecay = true;
|
||||
}
|
||||
|
||||
@Data
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.util.data;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
@ -156,10 +157,15 @@ public class B {
|
||||
bx = Bukkit.createBlockData(ix);
|
||||
}
|
||||
|
||||
if (bx instanceof Leaves) {
|
||||
if (bx instanceof Leaves && IrisSettings.get().getGenerator().preventLeafDecay) {
|
||||
((Leaves) bx).setPersistent(true);
|
||||
}
|
||||
|
||||
else if(bx instanceof Leaves)
|
||||
{
|
||||
((Leaves) bx).setPersistent(false);
|
||||
}
|
||||
|
||||
blockDataCache.put(ix, bx);
|
||||
return bx;
|
||||
} catch (Exception e) {
|
||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public interface DecreeParameterHandler<T> {
|
||||
/**
|
||||
* Should return the possible values for this type
|
||||
@ -111,4 +113,55 @@ public interface DecreeParameterHandler<T> {
|
||||
{
|
||||
return "NOEXAMPLE";
|
||||
}
|
||||
|
||||
default double getMultiplier(AtomicReference<String> g)
|
||||
{
|
||||
double multiplier = 1;
|
||||
String in = g.get();
|
||||
boolean valid = true;
|
||||
while(valid) {
|
||||
boolean trim = false;
|
||||
if (in.toLowerCase().endsWith("k"))
|
||||
{
|
||||
multiplier *= 1000;
|
||||
trim = true;
|
||||
}
|
||||
|
||||
else if(in.toLowerCase().endsWith("m"))
|
||||
{
|
||||
multiplier *= 1000000;
|
||||
trim = true;
|
||||
}
|
||||
|
||||
else if(in.toLowerCase().endsWith("h"))
|
||||
{
|
||||
multiplier *= 100;
|
||||
trim = true;
|
||||
}
|
||||
|
||||
else if(in.toLowerCase().endsWith("c"))
|
||||
{
|
||||
multiplier *= 16;
|
||||
trim = true;
|
||||
}
|
||||
|
||||
else if(in.toLowerCase().endsWith("r"))
|
||||
{
|
||||
multiplier *= (16 * 32);
|
||||
trim = true;
|
||||
}
|
||||
|
||||
else {
|
||||
valid = false;
|
||||
}
|
||||
|
||||
if(trim)
|
||||
{
|
||||
in = in.substring(0, in.length() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
g.set(in);
|
||||
return multiplier;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class DoubleHandler implements DecreeParameterHandler<Double> {
|
||||
@Override
|
||||
public KList<Double> getPossibilities() {
|
||||
@ -34,7 +36,9 @@ public class DoubleHandler implements DecreeParameterHandler<Double> {
|
||||
public Double parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Double.parseDouble(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return Double.parseDouble(r.get()) * m;
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -24,6 +24,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class FloatHandler implements DecreeParameterHandler<Float> {
|
||||
@Override
|
||||
public KList<Float> getPossibilities() {
|
||||
@ -34,7 +36,9 @@ public class FloatHandler implements DecreeParameterHandler<Float> {
|
||||
public Float parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Float.parseFloat(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (float)(Float.parseFloat(r.get()) * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -24,6 +24,9 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.format.Form;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
||||
@Override
|
||||
public KList<Integer> getPossibilities() {
|
||||
@ -34,7 +37,9 @@ public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
||||
public Integer parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Integer.parseInt(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (int)(Integer.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class LongHandler implements DecreeParameterHandler<Long> {
|
||||
@Override
|
||||
public KList<Long> getPossibilities() {
|
||||
@ -33,7 +35,9 @@ public class LongHandler implements DecreeParameterHandler<Long> {
|
||||
public Long parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Long.parseLong(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (long)(Long.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.DecreeParameterHandler;
|
||||
import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class ShortHandler implements DecreeParameterHandler<Short> {
|
||||
@Override
|
||||
public KList<Short> getPossibilities() {
|
||||
@ -33,7 +35,9 @@ public class ShortHandler implements DecreeParameterHandler<Short> {
|
||||
public Short parse(String in) throws DecreeParsingException {
|
||||
try
|
||||
{
|
||||
return Short.parseShort(in);
|
||||
AtomicReference<String> r = new AtomicReference<>(in);
|
||||
double m = getMultiplier(r);
|
||||
return (short)(Short.valueOf(r.get()).doubleValue() * m);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
Loading…
x
Reference in New Issue
Block a user