9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-29 12:09:07 +00:00

BLOCK DATA CUSTOM SUPPORT & FIX DECAYS

This commit is contained in:
Daniel Mills
2020-09-14 08:27:14 -04:00
parent e0a60e3ef3
commit d2ea288009
32 changed files with 348 additions and 1151 deletions

View File

@@ -3,6 +3,7 @@ package com.volmit.iris.util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import org.bukkit.block.data.type.Leaves;
import com.volmit.iris.Iris;
import com.volmit.iris.object.IrisDimension;
@@ -143,6 +144,11 @@ public class B
return bdx;
}
if(resolver.isPreventLeafDecay() && bdx instanceof Leaves)
{
((Leaves) bdx).setPersistent(true);
}
bdc.put(bd, bdx);
return bdx;

View File

@@ -128,7 +128,7 @@ public class IrisInterpolation
public static double bihermite(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias)
{
//@NoArgsConstructor
//@builder
return hermite(
hermite(p00, p01, p02, p03, muy, tension, bias),
hermite(p10, p11, p12, p13, muy, tension, bias),
@@ -140,7 +140,7 @@ public class IrisInterpolation
public static double bihermiteBezier(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias)
{
//@NoArgsConstructor
//@builder
return hermiteBezier(
hermiteBezier(p00, p01, p02, p03, muy, tension, bias),
hermiteBezier(p10, p11, p12, p13, muy, tension, bias),
@@ -152,7 +152,7 @@ public class IrisInterpolation
public static double bihermiteParametric(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double tension, double bias, double a)
{
//@NoArgsConstructor
//@builder
return hermiteParametric(
hermiteParametric(p00, p01, p02, p03, muy, tension, bias, a),
hermiteParametric(p10, p11, p12, p13, muy, tension, bias, a),
@@ -187,7 +187,7 @@ public class IrisInterpolation
public static double bicubic(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy)
{
//@NoArgsConstructor
//@builder
return cubic(
cubic(p00, p01, p02, p03, muy),
cubic(p10, p11, p12, p13, muy),
@@ -199,7 +199,7 @@ public class IrisInterpolation
public static double bicubicBezier(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy)
{
//@NoArgsConstructor
//@builder
return cubicBezier(
cubicBezier(p00, p01, p02, p03, muy),
cubicBezier(p10, p11, p12, p13, muy),
@@ -211,7 +211,7 @@ public class IrisInterpolation
public static double bicubicParametric(double p00, double p01, double p02, double p03, double p10, double p11, double p12, double p13, double p20, double p21, double p22, double p23, double p30, double p31, double p32, double p33, double mux, double muy, double a)
{
//@NoArgsConstructor
//@builder
return cubicParametric(
cubicParametric(p00, p01, p02, p03, muy,a),
cubicParametric(p10, p11, p12, p13, muy,a),
@@ -239,7 +239,7 @@ public class IrisInterpolation
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return blerp(
n.noise(x1, z1),
n.noise(x2, z1),
@@ -276,7 +276,7 @@ public class IrisInterpolation
int z2 = (int) Math.round((fz + 1) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return blerpBezier(
n.noise(x1, z1),
n.noise(x2, z1),
@@ -296,7 +296,7 @@ public class IrisInterpolation
int z2 = (int) Math.round((fz + 1) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return blerpParametric(
n.noise(x1, z1),
n.noise(x2, z1),
@@ -316,7 +316,7 @@ public class IrisInterpolation
int z2 = (int) Math.round((fz + 1) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return blerpSinCenter(
n.noise(x1, z1),
n.noise(x2, z1),
@@ -340,7 +340,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bicubic(
n.noise(x0, z0),
n.noise(x0, z1),
@@ -376,7 +376,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bicubicBezier(
n.noise(x0, z0),
n.noise(x0, z1),
@@ -412,7 +412,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bicubicParametric(
n.noise(x0, z0),
n.noise(x0, z1),
@@ -463,7 +463,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bihermite(
n.noise(x0, z0),
n.noise(x0, z1),
@@ -499,7 +499,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bihermiteBezier(
n.noise(x0, z0),
n.noise(x0, z1),
@@ -535,7 +535,7 @@ public class IrisInterpolation
int z3 = (int) Math.round((fz + 2) * rad);
double px = rangeScale(0, 1, x1, x2, x);
double pz = rangeScale(0, 1, z1, z2, z);
//@NoArgsConstructor
//@builder
return bihermiteParametric(
n.noise(x0, z0),
n.noise(x0, z1),

View File

@@ -235,6 +235,11 @@ public class ObjectResourceLoader extends ResourceLoader<IrisObject>
}
public IrisObject load(String name)
{
return load(name, true);
}
public IrisObject load(String name, boolean warn)
{
String key = name + "-" + objectClass.getCanonicalName();

View File

@@ -59,7 +59,7 @@ public class ResourceLoader<T extends IrisRegistrant>
{
continue;
}
if(j.isFile() && j.getName().endsWith(".json"))
{
m.add(j.getName().replaceAll("\\Q.json\\E", ""));
@@ -147,6 +147,11 @@ public class ResourceLoader<T extends IrisRegistrant>
}
public T load(String name)
{
return load(name, true);
}
public T load(String name, boolean warn)
{
if(name.trim().isEmpty())
{
@@ -180,7 +185,10 @@ public class ResourceLoader<T extends IrisRegistrant>
}
}
J.a(() -> Iris.warn("Couldn't find " + resourceTypeName + ": " + name));
if(warn)
{
J.a(() -> Iris.warn("Couldn't find " + resourceTypeName + ": " + name));
}
lock.unlock();
return null;