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'
|
group 'com.volmit.iris'
|
||||||
version '1.7'
|
version '1.7.1'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = getRootProject().getName() // See settings.gradle
|
def name = getRootProject().getName() // See settings.gradle
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
@ -153,6 +153,10 @@ repositories {
|
|||||||
// maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'}
|
// maven { allowInsecureProtocol true, url 'http://archive.arcane.art/repository/arcane'}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
compileJava {
|
||||||
|
options.compilerArgs << '-parameters'
|
||||||
|
}
|
||||||
|
|
||||||
shadowJar
|
shadowJar
|
||||||
{
|
{
|
||||||
minimize()
|
minimize()
|
||||||
|
@ -129,6 +129,7 @@ public class IrisSettings {
|
|||||||
public boolean systemEntitySpawnOverrides = true;
|
public boolean systemEntitySpawnOverrides = true;
|
||||||
public boolean systemEntityInitialSpawns = true;
|
public boolean systemEntityInitialSpawns = true;
|
||||||
public int maxBiomeChildDepth = 4;
|
public int maxBiomeChildDepth = 4;
|
||||||
|
public boolean preventLeafDecay = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.util.data;
|
package com.volmit.iris.util.data;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
@ -156,10 +157,15 @@ public class B {
|
|||||||
bx = Bukkit.createBlockData(ix);
|
bx = Bukkit.createBlockData(ix);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bx instanceof Leaves) {
|
if (bx instanceof Leaves && IrisSettings.get().getGenerator().preventLeafDecay) {
|
||||||
((Leaves) bx).setPersistent(true);
|
((Leaves) bx).setPersistent(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(bx instanceof Leaves)
|
||||||
|
{
|
||||||
|
((Leaves) bx).setPersistent(false);
|
||||||
|
}
|
||||||
|
|
||||||
blockDataCache.put(ix, bx);
|
blockDataCache.put(ix, bx);
|
||||||
return bx;
|
return bx;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -23,6 +23,8 @@ import com.volmit.iris.util.decree.exceptions.DecreeParsingException;
|
|||||||
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
import com.volmit.iris.util.decree.exceptions.DecreeWhichException;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public interface DecreeParameterHandler<T> {
|
public interface DecreeParameterHandler<T> {
|
||||||
/**
|
/**
|
||||||
* Should return the possible values for this type
|
* Should return the possible values for this type
|
||||||
@ -111,4 +113,55 @@ public interface DecreeParameterHandler<T> {
|
|||||||
{
|
{
|
||||||
return "NOEXAMPLE";
|
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.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class DoubleHandler implements DecreeParameterHandler<Double> {
|
public class DoubleHandler implements DecreeParameterHandler<Double> {
|
||||||
@Override
|
@Override
|
||||||
public KList<Double> getPossibilities() {
|
public KList<Double> getPossibilities() {
|
||||||
@ -34,7 +36,9 @@ public class DoubleHandler implements DecreeParameterHandler<Double> {
|
|||||||
public Double parse(String in) throws DecreeParsingException {
|
public Double parse(String in) throws DecreeParsingException {
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return Double.parseDouble(in);
|
AtomicReference<String> r = new AtomicReference<>(in);
|
||||||
|
double m = getMultiplier(r);
|
||||||
|
return Double.parseDouble(r.get()) * m;
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
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.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class FloatHandler implements DecreeParameterHandler<Float> {
|
public class FloatHandler implements DecreeParameterHandler<Float> {
|
||||||
@Override
|
@Override
|
||||||
public KList<Float> getPossibilities() {
|
public KList<Float> getPossibilities() {
|
||||||
@ -34,7 +36,9 @@ public class FloatHandler implements DecreeParameterHandler<Float> {
|
|||||||
public Float parse(String in) throws DecreeParsingException {
|
public Float parse(String in) throws DecreeParsingException {
|
||||||
try
|
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)
|
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.format.Form;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
||||||
@Override
|
@Override
|
||||||
public KList<Integer> getPossibilities() {
|
public KList<Integer> getPossibilities() {
|
||||||
@ -34,7 +37,9 @@ public class IntegerHandler implements DecreeParameterHandler<Integer> {
|
|||||||
public Integer parse(String in) throws DecreeParsingException {
|
public Integer parse(String in) throws DecreeParsingException {
|
||||||
try
|
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)
|
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.decree.exceptions.DecreeParsingException;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class LongHandler implements DecreeParameterHandler<Long> {
|
public class LongHandler implements DecreeParameterHandler<Long> {
|
||||||
@Override
|
@Override
|
||||||
public KList<Long> getPossibilities() {
|
public KList<Long> getPossibilities() {
|
||||||
@ -33,7 +35,9 @@ public class LongHandler implements DecreeParameterHandler<Long> {
|
|||||||
public Long parse(String in) throws DecreeParsingException {
|
public Long parse(String in) throws DecreeParsingException {
|
||||||
try
|
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)
|
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.decree.exceptions.DecreeParsingException;
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class ShortHandler implements DecreeParameterHandler<Short> {
|
public class ShortHandler implements DecreeParameterHandler<Short> {
|
||||||
@Override
|
@Override
|
||||||
public KList<Short> getPossibilities() {
|
public KList<Short> getPossibilities() {
|
||||||
@ -33,7 +35,9 @@ public class ShortHandler implements DecreeParameterHandler<Short> {
|
|||||||
public Short parse(String in) throws DecreeParsingException {
|
public Short parse(String in) throws DecreeParsingException {
|
||||||
try
|
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)
|
catch(Throwable e)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user