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

Cleanup SRC

This commit is contained in:
Daniel Mills
2021-07-14 02:34:13 -04:00
parent f29015426f
commit 6ca6fc6989
605 changed files with 53283 additions and 64305 deletions

View File

@@ -4,27 +4,24 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("Defines if an object is allowed to place in carvings, surfaces or both.")
public enum CarvingMode
{
@Desc("Only place this object on surfaces (NOT under carvings)")
@DontObfuscate
SURFACE_ONLY,
public enum CarvingMode {
@Desc("Only place this object on surfaces (NOT under carvings)")
@DontObfuscate
SURFACE_ONLY,
@Desc("Only place this object under carvings (NOT on the surface)")
@DontObfuscate
CARVING_ONLY,
@Desc("Only place this object under carvings (NOT on the surface)")
@DontObfuscate
CARVING_ONLY,
@Desc("This object can place anywhere")
@DontObfuscate
ANYWHERE;
@Desc("This object can place anywhere")
@DontObfuscate
ANYWHERE;
public boolean supportsCarving()
{
return this.equals(ANYWHERE) || this.equals(CARVING_ONLY);
}
public boolean supportsCarving() {
return this.equals(ANYWHERE) || this.equals(CARVING_ONLY);
}
public boolean supportsSurface()
{
return this.equals(ANYWHERE) || this.equals(SURFACE_ONLY);
}
public boolean supportsSurface() {
return this.equals(ANYWHERE) || this.equals(SURFACE_ONLY);
}
}

View File

@@ -4,25 +4,24 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("Represents a location where decorations should go")
public enum DecorationPart
{
@Desc("The default, decorate anywhere")
@DontObfuscate
NONE,
public enum DecorationPart {
@Desc("The default, decorate anywhere")
@DontObfuscate
NONE,
@Desc("Targets shore lines (typically for sugar cane)")
@DontObfuscate
SHORE_LINE,
@Desc("Targets shore lines (typically for sugar cane)")
@DontObfuscate
SHORE_LINE,
@Desc("Target sea surfaces (typically for lilypads)")
@DontObfuscate
SEA_SURFACE,
@Desc("Target sea surfaces (typically for lilypads)")
@DontObfuscate
SEA_SURFACE,
@Desc("Targets the sea floor (entire placement must be bellow sea level)")
@DontObfuscate
SEA_FLOOR,
@Desc("Targets the sea floor (entire placement must be bellow sea level)")
@DontObfuscate
SEA_FLOOR,
@Desc("Decorates on cave & carving ceilings or underside of overhangs")
@DontObfuscate
CEILING,
@Desc("Decorates on cave & carving ceilings or underside of overhangs")
@DontObfuscate
CEILING,
}

View File

@@ -4,17 +4,16 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("Represents a basic font style to apply to a font family")
public enum FontStyle
{
@Desc("Plain old text")
@DontObfuscate
PLAIN,
public enum FontStyle {
@Desc("Plain old text")
@DontObfuscate
PLAIN,
@Desc("Italicized Text")
@DontObfuscate
ITALIC,
@Desc("Italicized Text")
@DontObfuscate
ITALIC,
@Desc("Bold Text")
@DontObfuscate
BOLD,
@Desc("Bold Text")
@DontObfuscate
BOLD,
}

View File

@@ -4,33 +4,32 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("Represents a biome type")
public enum InferredType
{
@Desc("Represents any shore biome type")
@DontObfuscate
SHORE,
public enum InferredType {
@Desc("Represents any shore biome type")
@DontObfuscate
SHORE,
@Desc("Represents any land biome type")
@DontObfuscate
LAND,
@Desc("Represents any land biome type")
@DontObfuscate
LAND,
@Desc("Represents any sea biome type")
@DontObfuscate
SEA,
@Desc("Represents any sea biome type")
@DontObfuscate
SEA,
@Desc("Represents any cave biome type")
@DontObfuscate
CAVE,
@Desc("Represents any cave biome type")
@DontObfuscate
CAVE,
@Desc("Represents any river biome type")
@DontObfuscate
RIVER,
@Desc("Represents any river biome type")
@DontObfuscate
RIVER,
@Desc("Represents any lake biome type")
@DontObfuscate
LAKE,
@Desc("Represents any lake biome type")
@DontObfuscate
LAKE,
@Desc("Defers the type to whatever another biome type that already exists is.")
@DontObfuscate
DEFER;
@Desc("Defers the type to whatever another biome type that already exists is.")
@DontObfuscate
DEFER
}

View File

@@ -4,115 +4,113 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("An interpolation method (or function) is simply a method of smoothing a position based on surrounding points on a grid. Bicubic for example is smoother, but has 4 times the checks than Bilinear for example. Try using BILINEAR_STARCAST_9 for beautiful results.")
public enum InterpolationMethod
{
@Desc("No interpolation. Nearest Neighbor (bad for terrain, great for performance).")
@DontObfuscate
NONE,
public enum InterpolationMethod {
@Desc("No interpolation. Nearest Neighbor (bad for terrain, great for performance).")
@DontObfuscate
NONE,
@Desc("Uses 4 nearby points in a square to calculate a 2d slope. Very fast but creates square artifacts. See: https://en.wikipedia.org/wiki/Bilinear_interpolation")
@DontObfuscate
BILINEAR,
@Desc("Uses 4 nearby points in a square to calculate a 2d slope. Very fast but creates square artifacts. See: https://en.wikipedia.org/wiki/Bilinear_interpolation")
@DontObfuscate
BILINEAR,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 3 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_3,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 3 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_3,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 6 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_6,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 6 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_6,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 9 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_9,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 9 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_9,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 12 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_12,
@Desc("Starcast is Iris's own creation. It uses raytrace checks to find a horizontal boundary nearby. 12 Checks in a circle. Typically starcast is used with another interpolation method. See BILINEAR_STARCAST_9 For example. Starcast is meant to 'break up' large, abrupt cliffs to make cheap interpolation smoother.")
@DontObfuscate
STARCAST_12,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_3,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_3,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_6,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_6,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_9,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_9,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_12,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with bilinear.")
@DontObfuscate
BILINEAR_STARCAST_12,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_3,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_3,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_6,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_6,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_9,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_9,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_12,
@Desc("Uses starcast to break up the abrupt sharp cliffs, then smooths the rest out with hermite.")
@DontObfuscate
HERMITE_STARCAST_12,
@Desc("Uses bilinear but on a bezier curve. See: https://en.wikipedia.org/wiki/Bezier_curve")
@DontObfuscate
BILINEAR_BEZIER,
@Desc("Uses bilinear but on a bezier curve. See: https://en.wikipedia.org/wiki/Bezier_curve")
@DontObfuscate
BILINEAR_BEZIER,
@Desc("Uses Bilinear but with parametric curves alpha 2.")
@DontObfuscate
BILINEAR_PARAMETRIC_2,
@Desc("Uses Bilinear but with parametric curves alpha 2.")
@DontObfuscate
BILINEAR_PARAMETRIC_2,
@Desc("Uses Bilinear but with parametric curves alpha 4.")
@DontObfuscate
BILINEAR_PARAMETRIC_4,
@Desc("Uses Bilinear but with parametric curves alpha 4.")
@DontObfuscate
BILINEAR_PARAMETRIC_4,
@Desc("Uses Bilinear but with parametric curves alpha 1.5.")
@DontObfuscate
BILINEAR_PARAMETRIC_1_5,
@Desc("Uses Bilinear but with parametric curves alpha 1.5.")
@DontObfuscate
BILINEAR_PARAMETRIC_1_5,
@Desc("Bicubic noise creates 4, 4-point splines for a total of 16 checks. Bcubic can go higher than expected and lower than expected right before a large change in slope.")
@DontObfuscate
BICUBIC,
@Desc("Bicubic noise creates 4, 4-point splines for a total of 16 checks. Bcubic can go higher than expected and lower than expected right before a large change in slope.")
@DontObfuscate
BICUBIC,
@Desc("Hermite is similar to bicubic, but faster and it can be tuned a little bit")
@DontObfuscate
HERMITE,
@Desc("Hermite is similar to bicubic, but faster and it can be tuned a little bit")
@DontObfuscate
HERMITE,
@Desc("Essentially bicubic with zero tension")
@DontObfuscate
CATMULL_ROM_SPLINE,
@Desc("Essentially bicubic with zero tension")
@DontObfuscate
CATMULL_ROM_SPLINE,
@Desc("Essentially bicubic with max tension")
@DontObfuscate
HERMITE_TENSE,
@Desc("Essentially bicubic with max tension")
@DontObfuscate
HERMITE_TENSE,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_HALF_POSITIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_HALF_POSITIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_HALF_NEGATIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_HALF_NEGATIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_FULL_POSITIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_FULL_POSITIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_FULL_NEGATIVE_BIAS,
@Desc("Hermite is similar to bicubic, this variant reduces the dimple artifacts of bicubic")
@DontObfuscate
HERMITE_LOOSE_FULL_NEGATIVE_BIAS,
;
}

View File

@@ -4,25 +4,24 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("An inventory slot type is used to represent a type of slot for items to fit into in any given inventory.")
public enum InventorySlotType
{
@Desc("Typically the one you want to go with. Storage represnents most slots in inventories.")
@DontObfuscate
STORAGE,
public enum InventorySlotType {
@Desc("Typically the one you want to go with. Storage represnents most slots in inventories.")
@DontObfuscate
STORAGE,
@Desc("Used for the fuel slot in Furnaces, Blast furnaces, smokers etc.")
@DontObfuscate
FUEL,
@Desc("Used for the fuel slot in Furnaces, Blast furnaces, smokers etc.")
@DontObfuscate
FUEL,
@Desc("Used for the cook slot in furnaces")
@DontObfuscate
FURNACE,
@Desc("Used for the cook slot in furnaces")
@DontObfuscate
FURNACE,
@Desc("Used for the cook slot in blast furnaces")
@DontObfuscate
BLAST_FURNACE,
@Desc("Used for the cook slot in blast furnaces")
@DontObfuscate
BLAST_FURNACE,
@Desc("Used for the cook slot in smokers")
@DontObfuscate
SMOKER,
@Desc("Used for the cook slot in smokers")
@DontObfuscate
SMOKER,
}

View File

@@ -1,83 +1,70 @@
package com.volmit.iris.object;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.attribute.Attributable;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.attribute.AttributeModifier.Operation;
import org.bukkit.inventory.meta.ItemMeta;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Desc("Represents an attribute modifier for an item or an entity. This allows you to create modifications to basic game attributes such as MAX_HEALTH or ARMOR_VALUE.")
@Data
public class IrisAttributeModifier
{
@Required
@DontObfuscate
@Desc("The Attribute type. This type is pulled from the game attributes. Zombie & Horse attributes will not work on non-zombie/horse entities.\nUsing an attribute on an item will have affects when held, or worn. There is no way to specify further granularity as the game picks this depending on the item type.")
private Attribute attribute = null;
public class IrisAttributeModifier {
@Required
@MinNumber(2)
@Required
@DontObfuscate
@Desc("The Attribute Name is used internally only for the game. This value should be unique to all other attributes applied to this item/entity. It is not shown in game.")
private String name = "";
@DontObfuscate
@Desc("The Attribute type. This type is pulled from the game attributes. Zombie & Horse attributes will not work on non-zombie/horse entities.\nUsing an attribute on an item will have affects when held, or worn. There is no way to specify further granularity as the game picks this depending on the item type.")
private Attribute attribute = null;
@DontObfuscate
@Desc("The application operation (add number is default). Add Number adds to the default value. \nAdd scalar_1 will multiply by 1 for example if the health is 20 and you multiply_scalar_1 by 0.5, the health will result in 30, not 10. Use negative values to achieve that.")
private Operation operation = Operation.ADD_NUMBER;
@MinNumber(2)
@Required
@DontObfuscate
@Desc("Minimum amount for this modifier. Iris randomly chooses an amount, this is the minimum it can choose randomly for this attribute.")
private double minAmount = 1;
@DontObfuscate
@Desc("The Attribute Name is used internally only for the game. This value should be unique to all other attributes applied to this item/entity. It is not shown in game.")
private String name = "";
@DontObfuscate
@Desc("Maximum amount for this modifier Iris randomly chooses an amount, this is the maximum it can choose randomly for this attribute.")
private double maxAmount = 1;
@DontObfuscate
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance that this attribute is applied (0 to 1). If the chance is 0.5 (50%), then Iris will only apply this attribute 50% of the time.")
private double chance = 1;
@Desc("The application operation (add number is default). Add Number adds to the default value. \nAdd scalar_1 will multiply by 1 for example if the health is 20 and you multiply_scalar_1 by 0.5, the health will result in 30, not 10. Use negative values to achieve that.")
private Operation operation = Operation.ADD_NUMBER;
public void apply(RNG rng, ItemMeta meta)
{
if(rng.nextDouble() < getChance())
{
meta.addAttributeModifier(getAttribute(), new AttributeModifier(getName(), getAmount(rng), getOperation()));
}
}
@DontObfuscate
public void apply(RNG rng, Attributable meta)
{
if(rng.nextDouble() < getChance())
{
meta.getAttribute(getAttribute()).addModifier(new AttributeModifier(getName(), getAmount(rng), getOperation()));
}
}
@Desc("Minimum amount for this modifier. Iris randomly chooses an amount, this is the minimum it can choose randomly for this attribute.")
private double minAmount = 1;
public double getAmount(RNG rng)
{
return rng.d(getMinAmount(), getMaxAmount());
}
@DontObfuscate
@Desc("Maximum amount for this modifier Iris randomly chooses an amount, this is the maximum it can choose randomly for this attribute.")
private double maxAmount = 1;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance that this attribute is applied (0 to 1). If the chance is 0.5 (50%), then Iris will only apply this attribute 50% of the time.")
private double chance = 1;
public void apply(RNG rng, ItemMeta meta) {
if (rng.nextDouble() < getChance()) {
meta.addAttributeModifier(getAttribute(), new AttributeModifier(getName(), getAmount(rng), getOperation()));
}
}
public void apply(RNG rng, Attributable meta) {
if (rng.nextDouble() < getChance()) {
meta.getAttribute(getAttribute()).addModifier(new AttributeModifier(getName(), getAmount(rng), getOperation()));
}
}
public double getAmount(RNG rng) {
return rng.d(getMinAmount(), getMaxAmount());
}
}

View File

@@ -1,13 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.M;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -18,77 +11,68 @@ import lombok.experimental.Accessors;
@NoArgsConstructor
@Desc("Represents a rotation axis with intervals and maxes. The x and z axis values are defaulted to disabled. The Y axis defaults to on, rotating by 90 degree increments.")
@Data
public class IrisAxisRotationClamp
{
@DontObfuscate
@Desc("Should this axis be rotated at all?")
private boolean enabled = false;
public class IrisAxisRotationClamp {
@DontObfuscate
@Desc("Should this axis be rotated at all?")
private boolean enabled = false;
private transient boolean forceLock = false;
private transient boolean forceLock = false;
@Required
@DependsOn({"max"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double min = 0;
@Required
@DependsOn({"max"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@Desc("The minimum angle (from) or set this and max to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double min = 0;
@Required
@DependsOn({"min"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double max = 0;
@Required
@DependsOn({"min"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@Desc("The maximum angle (to) or set this and min to zero for any angle degrees. Set both to the same non-zero value to force it to that angle only")
private double max = 0;
@Required
@DependsOn({"min", "max"})
@MinNumber(0)
@MaxNumber(360)
@DontObfuscate
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
private double interval = 0;
@Required
@DependsOn({"min", "max"})
@MinNumber(0)
@MaxNumber(360)
@DontObfuscate
@Desc("Iris spins the axis but not freely. For example an interval of 90 would mean 4 possible angles (right angles) degrees. \nSetting this to 0 means totally free rotation.\n\nNote that a lot of structures can have issues with non 90 degree intervals because the minecraft block resolution is so low.")
private double interval = 0;
public void minMax(double fd)
{
min = fd;
max = fd;
forceLock = true;
}
public void minMax(double fd) {
min = fd;
max = fd;
forceLock = true;
}
public boolean isUnlimited()
{
return min == max && min == 0;
}
public boolean isUnlimited() {
return min == max && min == 0;
}
public boolean isLocked()
{
return min == max && !isUnlimited();
}
public boolean isLocked() {
return min == max && !isUnlimited();
}
public double getRadians(int rng)
{
if(forceLock)
{
return Math.toRadians(max);
}
public double getRadians(int rng) {
if (forceLock) {
return Math.toRadians(max);
}
if(isUnlimited())
{
if(interval < 1)
{
interval = 1;
}
if (isUnlimited()) {
if (interval < 1) {
interval = 1;
}
return Math.toRadians(((double) interval * (Math.ceil(Math.abs((rng % 360D) / (double) interval)))) % 360D);
}
return Math.toRadians((interval * (Math.ceil(Math.abs((rng % 360D) / interval)))) % 360D);
}
if(min == max && min != 0)
{
return Math.toRadians(max);
}
if (min == max && min != 0) {
return Math.toRadians(max);
}
return Math.toRadians(M.clip(((double) interval * (Math.ceil(Math.abs((rng % 360D) / (double) interval)))) % 360D, Math.min(min, max), Math.max(min, max)));
}
return Math.toRadians(M.clip((interval * (Math.ceil(Math.abs((rng % 360D) / interval)))) % 360D, Math.min(min, max), Math.max(min, max)));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -13,53 +13,49 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("This represents a link to a generator for a biome")
@Data
public class IrisBiomeGeneratorLink
{
public class IrisBiomeGeneratorLink {
@RegistryListGenerator
@DontObfuscate
@Desc("The generator id")
private String generator = "default";
@RegistryListGenerator
@DontObfuscate
@Desc("The generator id")
private String generator = "default";
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The min block value (value + fluidHeight)")
private int min = 0;
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The min block value (value + fluidHeight)")
private int min = 0;
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max block value (value + fluidHeight)")
private int max = 0;
@DependsOn({"min", "max"})
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max block value (value + fluidHeight)")
private int max = 0;
private final transient AtomicCache<IrisGenerator> gen = new AtomicCache<>();
private final transient AtomicCache<IrisGenerator> gen = new AtomicCache<>();
public IrisGenerator getCachedGenerator(DataProvider g)
{
return gen.aquire(() ->
{
IrisGenerator gen = g.getData().getGeneratorLoader().load(getGenerator());
public IrisGenerator getCachedGenerator(DataProvider g) {
return gen.aquire(() ->
{
IrisGenerator gen = g.getData().getGeneratorLoader().load(getGenerator());
if(gen == null)
{
gen = new IrisGenerator();
}
if (gen == null) {
gen = new IrisGenerator();
}
return gen;
});
}
return gen;
});
}
public double getHeight(DataProvider xg, double x, double z, long seed)
{
double g = getCachedGenerator(xg).getHeight(x, z, seed);
g = g < 0 ? 0 : g;
g = g > 1 ? 1 : g;
public double getHeight(DataProvider xg, double x, double z, long seed) {
double g = getCachedGenerator(xg).getHeight(x, z, seed);
g = g < 0 ? 0 : g;
g = g > 1 ? 1 : g;
return IrisInterpolation.lerp(min, max, g);
}
return IrisInterpolation.lerp(min, max, g);
}
}

View File

@@ -1,18 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KSet;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RegistryListBiome;
import com.volmit.iris.util.RegistryListObject;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.data.DataProvider;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -23,93 +13,75 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("A biome mutation if a condition is met")
@Data
public class IrisBiomeMutation
{
public class IrisBiomeMutation {
@RegistryListBiome
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("One of The following biomes or regions must show up")
private KList<String> sideA = new KList<>();
@RegistryListBiome
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("One of The following biomes or regions must show up")
private KList<String> sideA = new KList<>();
@RegistryListBiome
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("One of The following biomes or regions must show up")
private KList<String> sideB = new KList<>();
@RegistryListBiome
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("One of The following biomes or regions must show up")
private KList<String> sideB = new KList<>();
@Required
@MinNumber(1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The scan radius for placing this mutator")
private int radius = 16;
@Required
@MinNumber(1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The scan radius for placing this mutator")
private int radius = 16;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("How many tries per chunk to check for this mutation")
private int checks = 2;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("How many tries per chunk to check for this mutation")
private int checks = 2;
@RegistryListObject
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@DontObfuscate
@Desc("Objects define what schematics (iob files) iris will place in this biome mutation")
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
@RegistryListObject
@ArrayType(min = 1, type = IrisObjectPlacement.class)
@DontObfuscate
@Desc("Objects define what schematics (iob files) iris will place in this biome mutation")
private KList<IrisObjectPlacement> objects = new KList<IrisObjectPlacement>();
private final transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
private final transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
private final transient AtomicCache<KList<String>> sideACache = new AtomicCache<>();
private final transient AtomicCache<KList<String>> sideBCache = new AtomicCache<>();
public KList<String> getRealSideA(DataProvider xg)
{
return sideACache.aquire(() -> processList(xg, getSideA()));
}
public KList<String> getRealSideA(DataProvider xg) {
return sideACache.aquire(() -> processList(xg, getSideA()));
}
public KList<String> getRealSideB(DataProvider xg)
{
return sideBCache.aquire(() -> processList(xg, getSideB()));
}
public KList<String> getRealSideB(DataProvider xg) {
return sideBCache.aquire(() -> processList(xg, getSideB()));
}
public KList<String> processList(DataProvider xg, KList<String> s)
{
KSet<String> r = new KSet<>();
public KList<String> processList(DataProvider xg, KList<String> s) {
KSet<String> r = new KSet<>();
for(String i : s)
{
String q = i;
for (String i : s) {
String q = i;
if(q.startsWith("^"))
{
r.addAll(xg.getData().getRegionLoader().load(q.substring(1)).getLandBiomes());
continue;
}
if (q.startsWith("^")) {
r.addAll(xg.getData().getRegionLoader().load(q.substring(1)).getLandBiomes());
continue;
} else if (q.startsWith("*")) {
String name = q.substring(1);
r.addAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
} else if (q.startsWith("!")) {
r.remove(q.substring(1));
} else if (q.startsWith("!*")) {
String name = q.substring(2);
r.removeAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
} else {
r.add(q);
}
}
else if(q.startsWith("*"))
{
String name = q.substring(1);
r.addAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
}
else if(q.startsWith("!"))
{
r.remove(q.substring(1));
}
else if(q.startsWith("!*"))
{
String name = q.substring(2);
r.removeAll(xg.getData().getBiomeLoader().load(name).getAllChildren(xg, 7));
}
else
{
r.add(q);
}
}
return new KList<String>(r);
}
return new KList<String>(r);
}
}

View File

@@ -1,18 +1,9 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -24,105 +15,93 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("A layer of surface / subsurface material in biomes")
@Data
public class IrisBiomePaletteLayer
{
@DontObfuscate
@Desc("The style of noise")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
public class IrisBiomePaletteLayer {
@DontObfuscate
@Desc("The style of noise")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The min thickness of this layer")
private int minHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The min thickness of this layer")
private int minHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max thickness of this layer")
private int maxHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max thickness of this layer")
private int maxHeight = 1;
@DontObfuscate
@Desc("If set, this layer will change size depending on the slope. If in bounds, the layer will get larger (taller) the closer to the center of this slope clip it is. If outside of the slipe's bounds, this layer will not show.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
@DontObfuscate
@Desc("If set, this layer will change size depending on the slope. If in bounds, the layer will get larger (taller) the closer to the center of this slope clip it is. If outside of the slipe's bounds, this layer will not show.")
private IrisSlopeClip slopeCondition = new IrisSlopeClip();
@MinNumber(0.0001)
@DontObfuscate
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
private double zoom = 5;
@MinNumber(0.0001)
@DontObfuscate
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
private double zoom = 5;
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this layer")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("GRASS_BLOCK"));
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this layer")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("GRASS_BLOCK"));
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
public CNG getHeightGenerator(RNG rng, IrisDataManager data)
{
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
}
public CNG getHeightGenerator(RNG rng, IrisDataManager data) {
return heightGenerator.aquire(() -> CNG.signature(rng.nextParallelRNG(minHeight * maxHeight + getBlockData(data).size())));
}
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager data)
{
if(getBlockData(data).isEmpty())
{
return null;
}
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager data) {
if (getBlockData(data).isEmpty()) {
return null;
}
if(getBlockData(data).size() == 1)
{
return getBlockData(data).get(0);
}
if (getBlockData(data).size() == 1) {
return getBlockData(data).get(0);
}
return getLayerGenerator(rng, data).fit(getBlockData(data), x / zoom, y / zoom, z / zoom);
}
return getLayerGenerator(rng, data).fit(getBlockData(data), x / zoom, y / zoom, z / zoom);
}
public CNG getLayerGenerator(RNG rng, IrisDataManager data)
{
return layerGenerator.aquire(() ->
{
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData(data).size());
return style.create(rngx);
});
}
public CNG getLayerGenerator(RNG rng, IrisDataManager data) {
return layerGenerator.aquire(() ->
{
RNG rngx = rng.nextParallelRNG(minHeight + maxHeight + getBlockData(data).size());
return style.create(rngx);
});
}
public KList<IrisBlockData> add(String b)
{
palette.add(new IrisBlockData(b));
public KList<IrisBlockData> add(String b) {
palette.add(new IrisBlockData(b));
return palette;
}
return palette;
}
public KList<BlockData> getBlockData(IrisDataManager data)
{
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for(IrisBlockData ix : palette)
{
BlockData bx = ix.getBlockData(data);
if(bx != null)
{
for(int i = 0; i < ix.getWeight(); i++)
{
blockData.add(bx);
}
}
}
public KList<BlockData> getBlockData(IrisDataManager data) {
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for (IrisBlockData ix : palette) {
BlockData bx = ix.getBlockData(data);
if (bx != null) {
for (int i = 0; i < ix.getWeight(); i++) {
blockData.add(bx);
}
}
}
return blockData;
});
}
return blockData;
});
}
public IrisBiomePaletteLayer zero()
{
palette.clear();
return this;
}
public IrisBiomePaletteLayer zero() {
palette.clear();
return this;
}
}

View File

@@ -1,18 +1,9 @@
package com.volmit.iris.object;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.util.B;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RegistryListBlockType;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -26,218 +17,176 @@ import org.bukkit.block.data.BlockData;
@Desc("Represents Block Data")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisBlockData extends IrisRegistrant
{
@RegistryListBlockType
@Required
@DontObfuscate
@Desc("The block to use")
private String block = "air";
public class IrisBlockData extends IrisRegistrant {
@RegistryListBlockType
@Required
@DontObfuscate
@Desc("The block to use")
private String block = "air";
@Desc("Debug this block by printing it to the console when it's used")
@DontObfuscate
private boolean debug = false;
@Desc("Debug this block by printing it to the console when it's used")
@DontObfuscate
private boolean debug = false;
@DontObfuscate
@Desc("The resource key. Typically Minecraft")
private String key = "minecraft";
@DontObfuscate
@Desc("The resource key. Typically Minecraft")
private String key = "minecraft";
@MinNumber(1)
@MaxNumber(1000)
@DontObfuscate
@Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.")
private int weight = 1;
@MinNumber(1)
@MaxNumber(1000)
@DontObfuscate
@Desc("The weight is used when this block data is inside of a list of blockdata. A weight of two is just as if you placed two of the same block data values in the same list making it more common when randomly picked.")
private int weight = 1;
@DontObfuscate
@Desc("If the block cannot be created on this version, Iris will attempt to use this backup block data instead.")
private IrisBlockData backup = null;
@DontObfuscate
@Desc("If the block cannot be created on this version, Iris will attempt to use this backup block data instead.")
private IrisBlockData backup = null;
@DontObfuscate
@Desc("Optional properties for this block data such as 'waterlogged': true")
private KMap<String, Object> data = new KMap<>();
@DontObfuscate
@Desc("Optional properties for this block data such as 'waterlogged': true")
private KMap<String, Object> data = new KMap<>();
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
private final transient AtomicCache<BlockData> blockdata = new AtomicCache<>();
private final transient AtomicCache<String> realProperties = new AtomicCache<>();
public IrisBlockData(String b)
{
this.block = b;
}
public IrisBlockData(String b) {
this.block = b;
}
public String computeProperties(KMap<String, Object> data)
{
if(data.isEmpty())
{
return "";
}
public String computeProperties(KMap<String, Object> data) {
if (data.isEmpty()) {
return "";
}
KList<String> r = new KList<>();
KList<String> r = new KList<>();
for(String i : data.keySet())
{
r.add(i + "=" + filter(data.get(i).toString()));
}
for (String i : data.keySet()) {
r.add(i + "=" + filter(data.get(i).toString()));
}
return "[" + r.toString(",") + "]";
}
return "[" + r.toString(",") + "]";
}
public String computeProperties()
{
return computeProperties(getData());
}
public String computeProperties() {
return computeProperties(getData());
}
public BlockData getBlockData(IrisDataManager data)
{
return blockdata.aquire(() ->
{
BlockData b = null;
public BlockData getBlockData(IrisDataManager data) {
return blockdata.aquire(() ->
{
BlockData b = null;
IrisBlockData customData = data.getBlockLoader().load(getBlock(), false);
IrisBlockData customData = data.getBlockLoader().load(getBlock(), false);
if(customData != null)
{
b = customData.getBlockData(data);
if (customData != null) {
b = customData.getBlockData(data);
if(b != null)
{
b = b.clone();
if (b != null) {
b = b.clone();
String st = b.getAsString(true);
String st = b.getAsString(true);
if(st.contains("["))
{
st = st.split("\\Q[\\E")[0];
}
if (st.contains("[")) {
st = st.split("\\Q[\\E")[0];
}
KMap<String, Object> cdata = customData.getData().copy();
KMap<String, Object> cdata = customData.getData().copy();
for(String i : getData().keySet())
{
cdata.put(i, getData().get(i));
}
for (String i : getData().keySet()) {
cdata.put(i, getData().get(i));
}
String sx = getKey() + ":" + st.split("\\Q:\\E")[1] + computeProperties(cdata);
String sx = getKey() + ":" + st.split("\\Q:\\E")[1] + computeProperties(cdata);
if(debug)
{
Iris.warn("Debug block data " + sx + " (CUSTOM)");
}
if (debug) {
Iris.warn("Debug block data " + sx + " (CUSTOM)");
}
BlockData bx = B.get(sx);
BlockData bx = B.get(sx);
if(bx != null)
{
return bx;
}
if (bx != null) {
return bx;
}
if(b != null)
{
return b;
}
}
}
if (b != null) {
return b;
}
}
}
String ss = getKey() + ":" + getBlock() + computeProperties();
b = B.get(ss);
String ss = getKey() + ":" + getBlock() + computeProperties();
b = B.get(ss);
if(debug)
{
Iris.warn("Debug block data " + ss);
}
if (debug) {
Iris.warn("Debug block data " + ss);
}
if(b != null)
{
return b;
}
if (b != null) {
return b;
}
if(backup != null)
{
return backup.getBlockData(data);
}
if (backup != null) {
return backup.getBlockData(data);
}
return B.get("AIR");
});
}
return B.get("AIR");
});
}
public static IrisBlockData from(String j)
{
IrisBlockData b = new IrisBlockData();
String m = j.toLowerCase().trim();
public static IrisBlockData from(String j) {
IrisBlockData b = new IrisBlockData();
String m = j.toLowerCase().trim();
if(m.contains(":"))
{
b.setKey(m.split("\\Q:\\E")[0]);
String v = m.split("\\Q:\\E")[1];
if (m.contains(":")) {
b.setKey(m.split("\\Q:\\E")[0]);
String v = m.split("\\Q:\\E")[1];
if(v.contains("["))
{
KList<String> props = new KList<>();
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
b.setBlock(v.split("\\Q[\\E")[0]);
if (v.contains("[")) {
KList<String> props = new KList<>();
String rp = v.split("\\Q[\\E")[1].replaceAll("\\Q]\\E", "");
b.setBlock(v.split("\\Q[\\E")[0]);
if(rp.contains(","))
{
props.add(rp.split("\\Q,\\E"));
}
if (rp.contains(",")) {
props.add(rp.split("\\Q,\\E"));
} else {
props.add(rp);
}
else
{
props.add(rp);
}
for (String i : props) {
Object kg = filter(i.split("\\Q=\\E")[1]);
b.data.put(i.split("\\Q=\\E")[0], kg);
}
} else {
b.setBlock(v);
}
} else {
b.setBlock(m);
}
for(String i : props)
{
Object kg = filter(i.split("\\Q=\\E")[1]);
b.data.put(i.split("\\Q=\\E")[0], kg);
}
}
return b;
}
else
{
b.setBlock(v);
}
}
private static Object filter(String string) {
if (string.equals("true")) {
return true;
}
else
{
b.setBlock(m);
}
if (string.equals("false")) {
return false;
}
return b;
}
try {
return Integer.valueOf(string);
} catch (Throwable e) {
private static Object filter(String string)
{
if(string.equals("true"))
{
return true;
}
}
if(string.equals("false"))
{
return false;
}
try {
return Double.valueOf(string).intValue();
} catch (Throwable e) {
try
{
return Integer.valueOf(string);
}
}
catch(Throwable e)
{
}
try
{
return Double.valueOf(string).intValue();
}
catch(Throwable e)
{
}
return string;
}
return string;
}
}

View File

@@ -1,91 +1,75 @@
package com.volmit.iris.object;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.block.data.BlockData;
import org.bukkit.inventory.ItemStack;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents a block drop list")
@Data
public class IrisBlockDrops
{
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@Desc("The blocks that drop loot")
private KList<IrisBlockData> blocks = new KList<IrisBlockData>();
public class IrisBlockDrops {
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@Desc("The blocks that drop loot")
private KList<IrisBlockData> blocks = new KList<IrisBlockData>();
@DontObfuscate
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
private boolean exactBlocks = false;
@DontObfuscate
@Desc("If exact blocks is set to true, minecraft:barrel[axis=x] will only drop for that axis. When exact is false (default) any barrel will drop the defined drops.")
private boolean exactBlocks = false;
@DontObfuscate
@Desc("Add in specific items to drop")
@ArrayType(min = 1, type = IrisLoot.class)
private KList<IrisLoot> drops = new KList<>();
@DontObfuscate
@Desc("Add in specific items to drop")
@ArrayType(min = 1, type = IrisLoot.class)
private KList<IrisLoot> drops = new KList<>();
@DontObfuscate
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
private boolean skipParents = false;
@DontObfuscate
@Desc("If this is in a biome, setting skipParents to true will ignore the drops in the region and dimension for this block type. The default (false) will allow all three nodes to fire and add to a list of drops.")
private boolean skipParents = false;
@DontObfuscate
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
private boolean replaceVanillaDrops = false;
@DontObfuscate
@Desc("Removes the default vanilla block drops and only drops the given items & any parent loot tables specified for this block type.")
private boolean replaceVanillaDrops = false;
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> data = new AtomicCache<>();
public boolean shouldDropFor(BlockData data, IrisDataManager rdata)
{
KList<BlockData> list = this.data.aquire(() ->
{
KList<BlockData> b = new KList<>();
public boolean shouldDropFor(BlockData data, IrisDataManager rdata) {
KList<BlockData> list = this.data.aquire(() ->
{
KList<BlockData> b = new KList<>();
for(IrisBlockData i : getBlocks())
{
BlockData dd = i.getBlockData(rdata);
for (IrisBlockData i : getBlocks()) {
BlockData dd = i.getBlockData(rdata);
if(dd != null)
{
b.add(dd);
}
}
if (dd != null) {
b.add(dd);
}
}
return b.removeDuplicates();
});
return b.removeDuplicates();
});
for(BlockData i : list)
{
if(exactBlocks ? i.equals(data) : i.getMaterial().equals(data.getMaterial()))
{
return true;
}
}
for (BlockData i : list) {
if (exactBlocks ? i.equals(data) : i.getMaterial().equals(data.getMaterial())) {
return true;
}
}
return false;
}
return false;
}
public void fillDrops(boolean debug, KList<ItemStack> d)
{
for(IrisLoot i : getDrops())
{
if(RNG.r.i(1, i.getRarity()) == i.getRarity())
{
d.add(i.get(debug, RNG.r));
}
}
}
public void fillDrops(boolean debug, KList<ItemStack> d) {
for (IrisLoot i : getDrops()) {
if (RNG.r.i(1, i.getRarity()) == i.getRarity()) {
d.add(i.get(debug, RNG.r));
}
}
}
}

View File

@@ -1,16 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IrisInterpolation;
import com.volmit.iris.util.M;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -21,70 +13,61 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisCarveLayer
{
@Required
@DontObfuscate
@Desc("The 4d slope this carve layer follows")
private IrisGeneratorStyle style = new IrisGeneratorStyle();
public class IrisCarveLayer {
@Required
@DontObfuscate
@Desc("The 4d slope this carve layer follows")
private IrisGeneratorStyle style = new IrisGeneratorStyle();
@MaxNumber(512)
@MinNumber(-128)
@DontObfuscate
@Desc("The max height")
private int maxHeight = 220;
@MaxNumber(512)
@MinNumber(-128)
@DontObfuscate
@Desc("The max height")
private int maxHeight = 220;
@MinNumber(0.0)
@MaxNumber(1.0)
@DontObfuscate
@Desc("The full percentage means the 4D opacity of this carver will decay from 100% to 0% at the min & max vertical ranges. Setting the percent to 1.0 will make a very drastic & charp change at the edge of the vertical min & max. Where as 0.15 means only 15% of the vertical range will actually be 100% opacity.")
private double fullPercent = 0.5;
@MinNumber(0.0)
@MaxNumber(1.0)
@DontObfuscate
@Desc("The full percentage means the 4D opacity of this carver will decay from 100% to 0% at the min & max vertical ranges. Setting the percent to 1.0 will make a very drastic & charp change at the edge of the vertical min & max. Where as 0.15 means only 15% of the vertical range will actually be 100% opacity.")
private double fullPercent = 0.5;
@MaxNumber(512)
@MinNumber(-128)
@DontObfuscate
@Desc("The min height")
private int minHeight = 147;
@MaxNumber(512)
@MinNumber(-128)
@DontObfuscate
@Desc("The min height")
private int minHeight = 147;
@MaxNumber(1)
@MinNumber(0)
@DontObfuscate
@Desc("The threshold used as: \n\ncarved = noise(x,y,z) > threshold")
private double threshold = 0.5;
@MaxNumber(1)
@MinNumber(0)
@DontObfuscate
@Desc("The threshold used as: \n\ncarved = noise(x,y,z) > threshold")
private double threshold = 0.5;
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
private final transient AtomicCache<CNG> cng = new AtomicCache<>();
public boolean isCarved(RNG rng, double x, double y, double z)
{
if(y > getMaxHeight() || y < getMinHeight())
{
return false;
}
public boolean isCarved(RNG rng, double x, double y, double z) {
if (y > getMaxHeight() || y < getMinHeight()) {
return false;
}
double opacity = Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
}
double opacity = Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
}
public boolean isCarved2(RNG rng, double x, double y, double z)
{
if(y > getMaxHeight() || y < getMinHeight())
{
return false;
}
public boolean isCarved2(RNG rng, double x, double y, double z) {
if (y > getMaxHeight() || y < getMinHeight()) {
return false;
}
double innerRange = fullPercent * (maxHeight - minHeight);
double opacity = 1D;
double innerRange = fullPercent * (maxHeight - minHeight);
double opacity = 1D;
if(y <= minHeight+innerRange)
{
opacity = IrisInterpolation.bezier(M.lerpInverse(getMinHeight(), minHeight+innerRange, y));
}
if (y <= minHeight + innerRange) {
opacity = IrisInterpolation.bezier(M.lerpInverse(getMinHeight(), minHeight + innerRange, y));
} else if (y >= maxHeight - innerRange) {
opacity = IrisInterpolation.bezier(1D - M.lerpInverse(maxHeight - innerRange, getMaxHeight(), y));
}
else if(y >=maxHeight - innerRange)
{
opacity = IrisInterpolation.bezier(1D - M.lerpInverse(maxHeight-innerRange, getMaxHeight(), y));
}
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
}
return cng.aquire(() -> getStyle().create(rng.nextParallelRNG(-2340 * getMaxHeight() * getMinHeight()))).fitDouble(0D, 1D, x, y, z) * opacity > getThreshold();
}
}

View File

@@ -1,14 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.util.B;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -20,43 +14,39 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisCaveFluid
{
@Required
@MaxNumber(255)
@MinNumber(0)
@DontObfuscate
@Desc("The fluid height of the cave")
private int fluidHeight = 35;
public class IrisCaveFluid {
@Required
@MaxNumber(255)
@MinNumber(0)
@DontObfuscate
@Desc("The fluid height of the cave")
private int fluidHeight = 35;
@DontObfuscate
@Desc("Insead of fluidHeight & below being fluid, turning inverse height on will simply spawn fluid in this cave layer from min(max_height, cave_height) to the fluid height. Basically, fluid will spawn above the fluidHeight value instead of below the fluidHeight.")
private boolean inverseHeight = false;
@DontObfuscate
@Desc("Insead of fluidHeight & below being fluid, turning inverse height on will simply spawn fluid in this cave layer from min(max_height, cave_height) to the fluid height. Basically, fluid will spawn above the fluidHeight value instead of below the fluidHeight.")
private boolean inverseHeight = false;
@Required
@DontObfuscate
@Desc("The fluid type that should spawn here")
private IrisBlockData fluidType = new IrisBlockData("CAVE_AIR");
@Required
@DontObfuscate
@Desc("The fluid type that should spawn here")
private IrisBlockData fluidType = new IrisBlockData("CAVE_AIR");
private final transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
private final transient AtomicCache<BlockData> fluidData = new AtomicCache<>();
public boolean hasFluid(IrisDataManager rdata)
{
return !B.isAir(getFluid(rdata));
}
public boolean hasFluid(IrisDataManager rdata) {
return !B.isAir(getFluid(rdata));
}
public BlockData getFluid(IrisDataManager rdata)
{
return fluidData.aquire(() ->
{
BlockData b = getFluidType().getBlockData(rdata);
public BlockData getFluid(IrisDataManager rdata) {
return fluidData.aquire(() ->
{
BlockData b = getFluidType().getBlockData(rdata);
if(b != null)
{
return b;
}
if (b != null) {
return b;
}
return B.get("CAVE_AIR");
});
}
return B.get("CAVE_AIR");
});
}
}

View File

@@ -4,7 +4,6 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -15,34 +14,33 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisCaveLayer
{
@Required
@DontObfuscate
@Desc("The vertical slope this cave layer follows")
private IrisShapedGeneratorStyle verticalSlope = new IrisShapedGeneratorStyle();
public class IrisCaveLayer {
@Required
@DontObfuscate
@Desc("The vertical slope this cave layer follows")
private IrisShapedGeneratorStyle verticalSlope = new IrisShapedGeneratorStyle();
@Required
@DontObfuscate
@Desc("The horizontal slope this cave layer follows")
private IrisShapedGeneratorStyle horizontalSlope = new IrisShapedGeneratorStyle();
@Required
@DontObfuscate
@Desc("The horizontal slope this cave layer follows")
private IrisShapedGeneratorStyle horizontalSlope = new IrisShapedGeneratorStyle();
@DontObfuscate
@Desc("If defined, a cave fluid will fill this cave below (or above) the specified fluidHeight in this object.")
private IrisCaveFluid fluid = new IrisCaveFluid();
@DontObfuscate
@Desc("If defined, a cave fluid will fill this cave below (or above) the specified fluidHeight in this object.")
private IrisCaveFluid fluid = new IrisCaveFluid();
@MinNumber(0.001)
@DontObfuscate
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")
private double caveZoom = 1D;
@MinNumber(0.001)
@DontObfuscate
@Desc("The cave zoom. Higher values makes caves spread out further and branch less often, but are thicker.")
private double caveZoom = 1D;
@MinNumber(0.001)
@DontObfuscate
@Desc("The cave thickness.")
private double caveThickness = 1D;
@MinNumber(0.001)
@DontObfuscate
@Desc("The cave thickness.")
private double caveThickness = 1D;
@DontObfuscate
@Desc("If set to true, this cave layer can break the surface")
private boolean canBreakSurface = false;
@DontObfuscate
@Desc("If set to true, this cave layer can break the surface")
private boolean canBreakSurface = false;
}

View File

@@ -15,83 +15,75 @@ import java.awt.*;
@NoArgsConstructor
@Desc("Represents a color")
@Data
public class IrisColor
{
@DontObfuscate
@MaxNumber(7)
@MinNumber(6)
@Desc("Pass in a 6 digit hexadecimal color to fill R G and B values. You can also include the # symbol, but it's not required.")
private String hex = null;
public class IrisColor {
@DontObfuscate
@MaxNumber(7)
@MinNumber(6)
@Desc("Pass in a 6 digit hexadecimal color to fill R G and B values. You can also include the # symbol, but it's not required.")
private String hex = null;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the red channel. Only define this if you are not defining the hex value.")
private int red = 0;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the red channel. Only define this if you are not defining the hex value.")
private int red = 0;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the green channel. Only define this if you are not defining the hex value.")
private int green = 0;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the green channel. Only define this if you are not defining the hex value.")
private int green = 0;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the blue channel. Only define this if you are not defining the hex value.")
private int blue = 0;
@DontObfuscate
@MaxNumber(255)
@MinNumber(0)
@Desc("Represents the blue channel. Only define this if you are not defining the hex value.")
private int blue = 0;
private final transient AtomicCache<Color> color = new AtomicCache<>();
private final transient AtomicCache<Color> color = new AtomicCache<>();
public Color getColor()
{
return color.aquire(() -> {
if(hex != null)
{
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
try
{
return Color.decode(v);
}
public Color getColor() {
return color.aquire(() -> {
if (hex != null) {
String v = (hex.startsWith("#") ? hex : "#" + hex).trim();
try {
return Color.decode(v);
} catch (Throwable e) {
catch(Throwable e)
{
}
}
}
}
return new Color(red, green, blue);
});
}
return new Color(red, green, blue);
});
}
public org.bukkit.Color getBukkitColor() {
return org.bukkit.Color.fromRGB(getColor().getRGB());
}
public org.bukkit.Color getBukkitColor()
{
return org.bukkit.Color.fromRGB(getColor().getRGB());
}
public static Color blend(Color... c) {
if (c == null || c.length <= 0) {
return null;
}
float ratio = 1f / ((float) c.length);
public static Color blend(Color... c) {
if (c == null || c.length <= 0) {
return null;
}
float ratio = 1f / ((float) c.length);
int a = 0;
int r = 0;
int g = 0;
int b = 0;
int a = 0;
int r = 0;
int g = 0;
int b = 0;
for (int i = 0; i < c.length; i++) {
int rgb = c[i].getRGB();
int a1 = (rgb >> 24 & 0xff);
int r1 = ((rgb & 0xff0000) >> 16);
int g1 = ((rgb & 0xff00) >> 8);
int b1 = (rgb & 0xff);
a += (a1 * ratio);
r += (r1 * ratio);
g += (g1 * ratio);
b += (b1 * ratio);
}
for (int i = 0; i < c.length; i++) {
int rgb = c[i].getRGB();
int a1 = (rgb >> 24 & 0xff);
int r1 = ((rgb & 0xff0000) >> 16);
int g1 = ((rgb & 0xff00) >> 8);
int b1 = (rgb & 0xff);
a += ((int) a1 * ratio);
r += ((int) r1 * ratio);
g += ((int) g1 * ratio);
b += ((int) b1 * ratio);
}
return new Color(a << 24 | r << 16 | g << 8 | b);
}
return new Color(a << 24 | r << 16 | g << 8 | b);
}
}

View File

@@ -11,358 +11,327 @@ import java.io.File;
import java.io.IOException;
@Data
public class IrisCompat
{
private KList<IrisCompatabilityBlockFilter> blockFilters;
private KList<IrisCompatabilityItemFilter> itemFilters;
public class IrisCompat {
private KList<IrisCompatabilityBlockFilter> blockFilters;
private KList<IrisCompatabilityItemFilter> itemFilters;
public IrisCompat()
{
blockFilters = getDefaultBlockCompatabilityFilters();
itemFilters = getDefaultItemCompatabilityFilters();
}
public IrisCompat() {
blockFilters = getDefaultBlockCompatabilityFilters();
itemFilters = getDefaultItemCompatabilityFilters();
}
public BlockData getBlock(String n)
{
String buf = n;
int err = 16;
public BlockData getBlock(String n) {
String buf = n;
int err = 16;
BlockData tx = B.getOrNull(buf);
BlockData tx = B.getOrNull(buf);
if(tx != null)
{
return tx;
}
if (tx != null) {
return tx;
}
searching: while(true)
{
if(err-- <= 0)
{
return B.get("STONE");
}
searching:
while (true) {
if (err-- <= 0) {
return B.get("STONE");
}
for(IrisCompatabilityBlockFilter i : blockFilters)
{
if(i.getWhen().equalsIgnoreCase(buf))
{
BlockData b = i.getReplace();
for (IrisCompatabilityBlockFilter i : blockFilters) {
if (i.getWhen().equalsIgnoreCase(buf)) {
BlockData b = i.getReplace();
if(b != null)
{
return b;
}
if (b != null) {
return b;
}
buf = i.getSupplement();
continue searching;
}
}
buf = i.getSupplement();
continue searching;
}
}
return B.get("STONE");
}
}
return B.get("STONE");
}
}
public Material getItem(String n)
{
String buf = n;
int err = 16;
Material txf = B.getMaterialOrNull(buf);
public Material getItem(String n) {
String buf = n;
int err = 16;
Material txf = B.getMaterialOrNull(buf);
if(txf != null)
{
return txf;
}
if (txf != null) {
return txf;
}
int nomore = 64;
int nomore = 64;
searching: while(true)
{
if(nomore < 0)
{
return B.getMaterial("STONE");
}
searching:
while (true) {
if (nomore < 0) {
return B.getMaterial("STONE");
}
nomore--;
if(err-- <= 0)
{
break;
}
nomore--;
if (err-- <= 0) {
break;
}
for(IrisCompatabilityItemFilter i : itemFilters)
{
if(i.getWhen().equalsIgnoreCase(buf))
{
Material b = i.getReplace();
for (IrisCompatabilityItemFilter i : itemFilters) {
if (i.getWhen().equalsIgnoreCase(buf)) {
Material b = i.getReplace();
if(b != null)
{
return b;
}
if (b != null) {
return b;
}
buf = i.getSupplement();
continue searching;
}
}
buf = i.getSupplement();
continue searching;
}
}
break;
}
break;
}
buf = n;
BlockData tx = B.getOrNull(buf);
buf = n;
BlockData tx = B.getOrNull(buf);
if(tx != null)
{
return tx.getMaterial();
}
nomore = 64;
if (tx != null) {
return tx.getMaterial();
}
nomore = 64;
searching: while(true)
{
if(nomore < 0)
{
return B.getMaterial("STONE");
}
searching:
while (true) {
if (nomore < 0) {
return B.getMaterial("STONE");
}
nomore--;
nomore--;
if(err-- <= 0)
{
return B.getMaterial("STONE");
}
if (err-- <= 0) {
return B.getMaterial("STONE");
}
for(IrisCompatabilityBlockFilter i : blockFilters)
{
if(i.getWhen().equalsIgnoreCase(buf))
{
BlockData b = i.getReplace();
for (IrisCompatabilityBlockFilter i : blockFilters) {
if (i.getWhen().equalsIgnoreCase(buf)) {
BlockData b = i.getReplace();
if(b != null)
{
return b.getMaterial();
}
if (b != null) {
return b.getMaterial();
}
buf = i.getSupplement();
continue searching;
}
}
buf = i.getSupplement();
continue searching;
}
}
return B.getMaterial("STONE");
}
}
return B.getMaterial("STONE");
}
}
public static IrisCompat configured(File f) throws IOException
{
IrisCompat def = new IrisCompat();
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
public static IrisCompat configured(File f) throws IOException {
IrisCompat def = new IrisCompat();
String defa = new JSONObject(new Gson().toJson(def)).toString(4);
J.attemptAsync(() -> IO.writeAll(new File(f.getParentFile(), "compat.default.json"), defa));
if(!f.exists())
{
J.attemptAsync(() -> IO.writeAll(f, defa));
}
if (!f.exists()) {
J.attemptAsync(() -> IO.writeAll(f, defa));
}
try
{
IrisCompat rea = new Gson().fromJson(IO.readAll(f), IrisCompat.class);
try {
IrisCompat rea = new Gson().fromJson(IO.readAll(f), IrisCompat.class);
for(IrisCompatabilityBlockFilter i : rea.getBlockFilters())
{
def.getBlockFilters().add(i);
}
for (IrisCompatabilityBlockFilter i : rea.getBlockFilters()) {
def.getBlockFilters().add(i);
}
for(IrisCompatabilityItemFilter i : rea.getItemFilters())
{
def.getItemFilters().add(i);
}
}
catch(JsonSyntaxException e)
{
e.printStackTrace();
}
catch(IOException e){
throw e;
}
for (IrisCompatabilityItemFilter i : rea.getItemFilters()) {
def.getItemFilters().add(i);
}
} catch (JsonSyntaxException e) {
e.printStackTrace();
} catch (IOException e) {
throw e;
}
return def;
}
return def;
}
private static KList<IrisCompatabilityItemFilter> getDefaultItemCompatabilityFilters()
{
KList<IrisCompatabilityItemFilter> filters = new KList<>();
private static KList<IrisCompatabilityItemFilter> getDefaultItemCompatabilityFilters() {
KList<IrisCompatabilityItemFilter> filters = new KList<>();
// Below 1.16
filters.add(new IrisCompatabilityItemFilter("NETHERITE_HELMET", "DIAMOND_HELMET"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_CHESTPLATE", "DIAMOND_CHESTPLATE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_BOOTS", "DIAMOND_BOOTS"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_LEGGINGS", "DIAMOND_LEGGINGS"));
filters.add(new IrisCompatabilityItemFilter("MUSIC_DISC_PIGSTEP", "MUSIC_DISC_FAR"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SWORD", "DIAMOND_SWORD"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_AXE", "DIAMOND_AXE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_PICKAXE", "DIAMOND_PICKAXE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_HOE", "DIAMOND_HOE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SHOVEL", "DIAMOND_SHOVEL"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_INGOT", "DIAMOND"));
filters.add(new IrisCompatabilityItemFilter("PIGLIN_BANNER_PATTERN", "PORKCHOP"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SCRAP", "GOLD_INGOT"));
filters.add(new IrisCompatabilityItemFilter("WARPED_FUNGUS_ON_A_STICK", "CARROT_ON_A_STICK"));
// Below 1.16
filters.add(new IrisCompatabilityItemFilter("NETHERITE_HELMET", "DIAMOND_HELMET"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_CHESTPLATE", "DIAMOND_CHESTPLATE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_BOOTS", "DIAMOND_BOOTS"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_LEGGINGS", "DIAMOND_LEGGINGS"));
filters.add(new IrisCompatabilityItemFilter("MUSIC_DISC_PIGSTEP", "MUSIC_DISC_FAR"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SWORD", "DIAMOND_SWORD"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_AXE", "DIAMOND_AXE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_PICKAXE", "DIAMOND_PICKAXE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_HOE", "DIAMOND_HOE"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SHOVEL", "DIAMOND_SHOVEL"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_INGOT", "DIAMOND"));
filters.add(new IrisCompatabilityItemFilter("PIGLIN_BANNER_PATTERN", "PORKCHOP"));
filters.add(new IrisCompatabilityItemFilter("NETHERITE_SCRAP", "GOLD_INGOT"));
filters.add(new IrisCompatabilityItemFilter("WARPED_FUNGUS_ON_A_STICK", "CARROT_ON_A_STICK"));
// Below 1.15
filters.add(new IrisCompatabilityItemFilter("HONEY_BOTTLE", "GLASS_BOTTLE"));
filters.add(new IrisCompatabilityItemFilter("HONEYCOMB", "GLASS"));
// Below 1.15
filters.add(new IrisCompatabilityItemFilter("HONEY_BOTTLE", "GLASS_BOTTLE"));
filters.add(new IrisCompatabilityItemFilter("HONEYCOMB", "GLASS"));
// Below 1.14
filters.add(new IrisCompatabilityItemFilter("SWEET_BERRIES", "APPLE"));
filters.add(new IrisCompatabilityItemFilter("SUSPICIOUS_STEW", "MUSHROOM_STEW"));
filters.add(new IrisCompatabilityItemFilter("BLACK_DYE", "INK_SAC"));
filters.add(new IrisCompatabilityItemFilter("WHITE_DYE", "BONE_MEAL"));
filters.add(new IrisCompatabilityItemFilter("BROWN_DYE", "COCOA_BEANS"));
filters.add(new IrisCompatabilityItemFilter("BLUE_DYE", "LAPIS_LAZULI"));
filters.add(new IrisCompatabilityItemFilter("CROSSBOW", "BOW"));
filters.add(new IrisCompatabilityItemFilter("FLOWER_BANNER_PATTERN", "CORNFLOWER"));
filters.add(new IrisCompatabilityItemFilter("SKULL_BANNER_PATTERN", "BONE"));
filters.add(new IrisCompatabilityItemFilter("GLOBE_BANNER_PATTERN", "WHEAT_SEEDS"));
filters.add(new IrisCompatabilityItemFilter("MOJANG_BANNER_PATTERN", "DIRT"));
filters.add(new IrisCompatabilityItemFilter("CREEPER_BANNER_PATTERN", "CREEPER_HEAD"));
// Below 1.14
filters.add(new IrisCompatabilityItemFilter("SWEET_BERRIES", "APPLE"));
filters.add(new IrisCompatabilityItemFilter("SUSPICIOUS_STEW", "MUSHROOM_STEW"));
filters.add(new IrisCompatabilityItemFilter("BLACK_DYE", "INK_SAC"));
filters.add(new IrisCompatabilityItemFilter("WHITE_DYE", "BONE_MEAL"));
filters.add(new IrisCompatabilityItemFilter("BROWN_DYE", "COCOA_BEANS"));
filters.add(new IrisCompatabilityItemFilter("BLUE_DYE", "LAPIS_LAZULI"));
filters.add(new IrisCompatabilityItemFilter("CROSSBOW", "BOW"));
filters.add(new IrisCompatabilityItemFilter("FLOWER_BANNER_PATTERN", "CORNFLOWER"));
filters.add(new IrisCompatabilityItemFilter("SKULL_BANNER_PATTERN", "BONE"));
filters.add(new IrisCompatabilityItemFilter("GLOBE_BANNER_PATTERN", "WHEAT_SEEDS"));
filters.add(new IrisCompatabilityItemFilter("MOJANG_BANNER_PATTERN", "DIRT"));
filters.add(new IrisCompatabilityItemFilter("CREEPER_BANNER_PATTERN", "CREEPER_HEAD"));
return filters;
}
return filters;
}
private static KList<IrisCompatabilityBlockFilter> getDefaultBlockCompatabilityFilters()
{
KList<IrisCompatabilityBlockFilter> filters = new KList<>();
private static KList<IrisCompatabilityBlockFilter> getDefaultBlockCompatabilityFilters() {
KList<IrisCompatabilityBlockFilter> filters = new KList<>();
// Below 1.16
filters.add(new IrisCompatabilityBlockFilter("WEEPING_VINES", "NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("WEEPING_VINES_PLANT", "NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_WART_BLOCK", "NETHER_WART_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("TWISTING_VINES", "BAMBOO"));
filters.add(new IrisCompatabilityBlockFilter("TWISTING_VINES_PLANT", "BAMBOO"));
filters.add(new IrisCompatabilityBlockFilter("TARGET", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_SOIL", "SOULSAND"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_TORCH", "TORCH"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_LANTERN", "LANTERN"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_FIRE", "FIRE"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_CAMPFIRE", "CAMPFIRE"));
filters.add(new IrisCompatabilityBlockFilter("SHROOMLIGHT", "GLOWSTONE"));
filters.add(new IrisCompatabilityBlockFilter("RESPAWN_ANCHOR", "OBSIDIAN"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_SPROUTS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_GOLD_ORE", "GOLD_ORE"));
filters.add(new IrisCompatabilityBlockFilter("LODESTONE", "STONE"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_WARPED_HYPHAE", "BROWN_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_CRIMSON_HYPHAE", "RED_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_HYPHAE", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_HYPHAE", "RED_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("GILDED_BLACKSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("CRYING_OBSIDIAN", "OBSIDIAN"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_WARPED_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_CRIMSON_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_ROOTS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_ROOTS", "BROWN_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_PLANKS", "OAK_PLANKS"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_PLANKS", "OAK_PLANKS"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_NYLIUM", "MYCELIUM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_NYLIUM", "MYCELIUM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_FUNGUS", "BROWN_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_FUNGUS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRACKED_NETHER_BRICKS", "NETHER_BRICKS"));
filters.add(new IrisCompatabilityBlockFilter("CHISELED_NETHER_BRICKS", "NETHER_BRICKS"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_FENCE", "LEGACY_NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("CHAIN", "IRON_BARS"));
filters.add(new IrisCompatabilityBlockFilter("NETHERITE_BLOCK", "QUARTZ_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("BLACKSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("BASALT", "STONE"));
filters.add(new IrisCompatabilityBlockFilter("ANCIENT_DEBRIS", "NETHERRACK"));
filters.add(new IrisCompatabilityBlockFilter("NETHERRACK", "LEGACY_NETHERRACK"));
// Below 1.16
filters.add(new IrisCompatabilityBlockFilter("WEEPING_VINES", "NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("WEEPING_VINES_PLANT", "NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_WART_BLOCK", "NETHER_WART_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("TWISTING_VINES", "BAMBOO"));
filters.add(new IrisCompatabilityBlockFilter("TWISTING_VINES_PLANT", "BAMBOO"));
filters.add(new IrisCompatabilityBlockFilter("TARGET", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_SOIL", "SOULSAND"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_TORCH", "TORCH"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_LANTERN", "LANTERN"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_FIRE", "FIRE"));
filters.add(new IrisCompatabilityBlockFilter("SOUL_CAMPFIRE", "CAMPFIRE"));
filters.add(new IrisCompatabilityBlockFilter("SHROOMLIGHT", "GLOWSTONE"));
filters.add(new IrisCompatabilityBlockFilter("RESPAWN_ANCHOR", "OBSIDIAN"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_SPROUTS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_GOLD_ORE", "GOLD_ORE"));
filters.add(new IrisCompatabilityBlockFilter("LODESTONE", "STONE"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_WARPED_HYPHAE", "BROWN_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_CRIMSON_HYPHAE", "RED_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_HYPHAE", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_HYPHAE", "RED_MUSHROOM_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("GILDED_BLACKSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("CRYING_OBSIDIAN", "OBSIDIAN"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_WARPED_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("STRIPPED_CRIMSON_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_STEM", "MUSHROOM_STEM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_ROOTS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_ROOTS", "BROWN_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_PLANKS", "OAK_PLANKS"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_PLANKS", "OAK_PLANKS"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_NYLIUM", "MYCELIUM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_NYLIUM", "MYCELIUM"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_FUNGUS", "BROWN_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_FUNGUS", "RED_MUSHROOM"));
filters.add(new IrisCompatabilityBlockFilter("CRACKED_NETHER_BRICKS", "NETHER_BRICKS"));
filters.add(new IrisCompatabilityBlockFilter("CHISELED_NETHER_BRICKS", "NETHER_BRICKS"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_FENCE", "LEGACY_NETHER_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("CHAIN", "IRON_BARS"));
filters.add(new IrisCompatabilityBlockFilter("NETHERITE_BLOCK", "QUARTZ_BLOCK"));
filters.add(new IrisCompatabilityBlockFilter("BLACKSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("BASALT", "STONE"));
filters.add(new IrisCompatabilityBlockFilter("ANCIENT_DEBRIS", "NETHERRACK"));
filters.add(new IrisCompatabilityBlockFilter("NETHERRACK", "LEGACY_NETHERRACK"));
// Below 1.15
filters.add(new IrisCompatabilityBlockFilter("HONEY_BLOCK", "OAK_LEAVES"));
filters.add(new IrisCompatabilityBlockFilter("BEEHIVE", "OAK_LEAVES"));
filters.add(new IrisCompatabilityBlockFilter("BEE_NEST", "OAK_LEAVES"));
// Below 1.15
filters.add(new IrisCompatabilityBlockFilter("HONEY_BLOCK", "OAK_LEAVES"));
filters.add(new IrisCompatabilityBlockFilter("BEEHIVE", "OAK_LEAVES"));
filters.add(new IrisCompatabilityBlockFilter("BEE_NEST", "OAK_LEAVES"));
// Below 1.14
filters.add(new IrisCompatabilityBlockFilter("GRANITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("BLUE_ICE", "PACKED_ICE"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("SWEET_BERRY_BUSH", "GRASS"));
filters.add(new IrisCompatabilityBlockFilter("STONECUTTER", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("SANDSTONE_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_SANDSTONE_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_COBBLESTONE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_STONE_BRICK_STAIRS", "STONE_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_GRANITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("GRANITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_DIORITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_ANDESITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("STONE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("END_STONE_BRICK_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_BRICK_STAIRS", "LEGACY_NETHER_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("RED_NETHER_BRICK_STAIRS", "NETHER_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_QUARTZ_STAIRS", "LEGACY_QUARTZ_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("QUARTZ_STAIRS", "LEGACY_QUARTZ_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("RED_SANDSTONE_STAIRS", "LEGACY_RED_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_RED_SANDSTONE_STAIRS", "LEGACY_RED_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("STONE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOKER", "FURNACE"));
filters.add(new IrisCompatabilityBlockFilter("SMITHING_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("END_STONE_BRICK_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("RED_NETHER_BRICK_SLAB", "NETHER_BRICK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_QUARTZ_SLAB", "QUARTZ_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("CUT_SANDSTONE_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("CUT_RED_SANDSTONE_SLAB", "RED_SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_RED_SANDSTONE_SLAB", "RED_SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_SANDSTONE_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_COBBLESTONE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_STONE_BRICK_SLAB", "STONE_BRICK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("STONE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("GRANITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_ANDESITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_DIORITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_GRANITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("SPRUCE_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("SPRUCE_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("OAK_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("OAK_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("JUNGLE_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("JUNGLE_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("DARK_OAK_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("DARK_OAK_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("BIRCH_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("BIRCH_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("ACACIA_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("ACACIA_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("SCAFFOLDING", "BIRCH_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("LOOM", "LOOM"));
filters.add(new IrisCompatabilityBlockFilter("LECTERN", "BOOKSHELF"));
filters.add(new IrisCompatabilityBlockFilter("LANTERN", "REDSTONE_LAMP"));
filters.add(new IrisCompatabilityBlockFilter("JIGSAW", "AIR"));
filters.add(new IrisCompatabilityBlockFilter("GRINDSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("FLETCHING_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("COMPOSTER", "CHEST"));
filters.add(new IrisCompatabilityBlockFilter("CARTOGRAPHY_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("CAMPFIRE", "DARK_OAK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("BLAST_FURNACE", "FURNACE"));
filters.add(new IrisCompatabilityBlockFilter("BELL", "REDSTONE_LAMP"));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=south]", "minecraft:hay_bale[axis=z]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=north]", "minecraft:hay_bale[axis=z]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=east]", "minecraft:hay_bale[axis=x]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=west]", "minecraft:hay_bale[axis=x]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=up]", "minecraft:hay_bale[axis=y]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=down]", "minecraft:hay_bale[axis=y]", true));
filters.add(new IrisCompatabilityBlockFilter("BAMBOO", "BIRCH_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("BAMBOO_SAPLING", "BIRCH_SAPLING"));
filters.add(new IrisCompatabilityBlockFilter("POTTED_BAMBOO", "POTTED_BIRCH_SAPLING"));
// Below 1.14
filters.add(new IrisCompatabilityBlockFilter("GRANITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("BLUE_ICE", "PACKED_ICE"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_WALL", "COBBLESTONE_WALL"));
filters.add(new IrisCompatabilityBlockFilter("SWEET_BERRY_BUSH", "GRASS"));
filters.add(new IrisCompatabilityBlockFilter("STONECUTTER", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("SANDSTONE_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_SANDSTONE_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_COBBLESTONE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_STONE_BRICK_STAIRS", "STONE_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_GRANITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("GRANITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_DIORITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_ANDESITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("STONE_STAIRS", "COBBLESTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("END_STONE_BRICK_STAIRS", "LEGACY_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("NETHER_BRICK_STAIRS", "LEGACY_NETHER_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("RED_NETHER_BRICK_STAIRS", "NETHER_BRICK_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_QUARTZ_STAIRS", "LEGACY_QUARTZ_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("QUARTZ_STAIRS", "LEGACY_QUARTZ_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("RED_SANDSTONE_STAIRS", "LEGACY_RED_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_RED_SANDSTONE_STAIRS", "LEGACY_RED_SANDSTONE_STAIRS"));
filters.add(new IrisCompatabilityBlockFilter("STONE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOKER", "FURNACE"));
filters.add(new IrisCompatabilityBlockFilter("SMITHING_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("END_STONE_BRICK_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("RED_NETHER_BRICK_SLAB", "NETHER_BRICK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_QUARTZ_SLAB", "QUARTZ_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("CUT_SANDSTONE_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("CUT_RED_SANDSTONE_SLAB", "RED_SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_RED_SANDSTONE_SLAB", "RED_SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("SMOOTH_SANDSTONE_SLAB", "SANDSTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_COBBLESTONE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("MOSSY_STONE_BRICK_SLAB", "STONE_BRICK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("STONE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("ANDESITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("DIORITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("GRANITE_SLAB", "COBBLESTONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_ANDESITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_DIORITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("POLISHED_GRANITE_SLAB", "SMOOTH_STONE_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("WARPED_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("SPRUCE_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("SPRUCE_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("OAK_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("OAK_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("JUNGLE_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("JUNGLE_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("DARK_OAK_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("DARK_OAK_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("CRIMSON_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("BIRCH_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("BIRCH_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("ACACIA_WALL_SIGN", "LEGACY_WALL_SIGN"));
filters.add(new IrisCompatabilityBlockFilter("ACACIA_SIGN", "LEGACY_SIGN_POST"));
filters.add(new IrisCompatabilityBlockFilter("SCAFFOLDING", "BIRCH_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("LOOM", "LOOM"));
filters.add(new IrisCompatabilityBlockFilter("LECTERN", "BOOKSHELF"));
filters.add(new IrisCompatabilityBlockFilter("LANTERN", "REDSTONE_LAMP"));
filters.add(new IrisCompatabilityBlockFilter("JIGSAW", "AIR"));
filters.add(new IrisCompatabilityBlockFilter("GRINDSTONE", "COBBLESTONE"));
filters.add(new IrisCompatabilityBlockFilter("FLETCHING_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("COMPOSTER", "CHEST"));
filters.add(new IrisCompatabilityBlockFilter("CARTOGRAPHY_TABLE", "CRAFTING_TABLE"));
filters.add(new IrisCompatabilityBlockFilter("CAMPFIRE", "DARK_OAK_SLAB"));
filters.add(new IrisCompatabilityBlockFilter("BLAST_FURNACE", "FURNACE"));
filters.add(new IrisCompatabilityBlockFilter("BELL", "REDSTONE_LAMP"));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=south]", "minecraft:hay_bale[axis=z]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=north]", "minecraft:hay_bale[axis=z]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=east]", "minecraft:hay_bale[axis=x]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=west]", "minecraft:hay_bale[axis=x]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=up]", "minecraft:hay_bale[axis=y]", true));
filters.add(new IrisCompatabilityBlockFilter("minecraft:barrel[facing=down]", "minecraft:hay_bale[axis=y]", true));
filters.add(new IrisCompatabilityBlockFilter("BAMBOO", "BIRCH_FENCE"));
filters.add(new IrisCompatabilityBlockFilter("BAMBOO_SAPLING", "BIRCH_SAPLING"));
filters.add(new IrisCompatabilityBlockFilter("POTTED_BAMBOO", "POTTED_BIRCH_SAPLING"));
return filters;
}
return filters;
}
}

View File

@@ -6,7 +6,6 @@ import com.volmit.iris.util.B;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -18,49 +17,44 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("Find and replace object materials for compatability")
@Data
public class IrisCompatabilityBlockFilter
{
@Required
@DontObfuscate
@Desc("When iris sees this block, and it's not reconized")
private String when = "";
public class IrisCompatabilityBlockFilter {
@Required
@DontObfuscate
@Desc("When iris sees this block, and it's not reconized")
private String when = "";
@Required
@DontObfuscate
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
private String supplement = "";
@Required
@DontObfuscate
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
private String supplement = "";
@DontObfuscate
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
private boolean exact = false;
@DontObfuscate
@Desc("If exact is true, it compares block data for example minecraft:some_log[axis=x]")
private boolean exact = false;
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
private final transient AtomicCache<BlockData> findData = new AtomicCache<>(true);
private final transient AtomicCache<BlockData> replaceData = new AtomicCache<>(true);
public IrisCompatabilityBlockFilter(String when, String supplement)
{
this(when, supplement, false);
}
public IrisCompatabilityBlockFilter(String when, String supplement) {
this(when, supplement, false);
}
public BlockData getFind()
{
return findData.aquire(() -> B.get(when));
}
public BlockData getFind() {
return findData.aquire(() -> B.get(when));
}
public BlockData getReplace()
{
return replaceData.aquire(() ->
{
BlockData b = B.getOrNull(supplement);
public BlockData getReplace() {
return replaceData.aquire(() ->
{
BlockData b = B.getOrNull(supplement);
if(b == null)
{
return null;
}
if (b == null) {
return null;
}
Iris.warn("Compat: Using " + supplement + " in place of " + when + " since this server doesnt support '" + supplement + "'");
Iris.warn("Compat: Using " + supplement + " in place of " + when + " since this server doesnt support '" + supplement + "'");
return b;
});
}
return b;
});
}
}

View File

@@ -1,62 +1,55 @@
package com.volmit.iris.object;
import org.bukkit.Material;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.B;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.Required;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.Material;
@Accessors(chain = true)
@NoArgsConstructor
@Desc("Find and replace object items for compatability")
@Data
public class IrisCompatabilityItemFilter
{
@Required
@DontObfuscate
@Desc("When iris sees this block, and it's not reconized")
private String when = "";
public class IrisCompatabilityItemFilter {
@Required
@DontObfuscate
@Desc("When iris sees this block, and it's not reconized")
private String when = "";
@Required
@DontObfuscate
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
private String supplement = "";
@Required
@DontObfuscate
@Desc("Replace it with this block. Dont worry if this block is also not reconized, iris repeat this compat check.")
private String supplement = "";
private final transient AtomicCache<Material> findData = new AtomicCache<>(true);
private final transient AtomicCache<Material> replaceData = new AtomicCache<>(true);
private final transient AtomicCache<Material> findData = new AtomicCache<>(true);
private final transient AtomicCache<Material> replaceData = new AtomicCache<>(true);
public IrisCompatabilityItemFilter(String when, String supplement)
{
this.when = when;
this.supplement = supplement;
}
public IrisCompatabilityItemFilter(String when, String supplement) {
this.when = when;
this.supplement = supplement;
}
public Material getFind()
{
return findData.aquire(() -> B.getMaterial(when));
}
public Material getFind() {
return findData.aquire(() -> B.getMaterial(when));
}
public Material getReplace()
{
return replaceData.aquire(() ->
{
Material b = B.getMaterialOrNull(supplement);
public Material getReplace() {
return replaceData.aquire(() ->
{
Material b = B.getMaterialOrNull(supplement);
if(b == null)
{
return null;
}
Iris.verbose("Compat: Using " + supplement + " in place of " + when + " since this server doesnt support '" + supplement + "'");
if (b == null) {
return null;
}
return b;
});
}
Iris.verbose("Compat: Using " + supplement + " in place of " + when + " since this server doesnt support '" + supplement + "'");
return b;
});
}
}

View File

@@ -1,11 +1,10 @@
package com.volmit.iris.object;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -17,226 +16,201 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("A biome decorator is used for placing flowers, grass, cacti and so on")
@Data
public class IrisDecorator
{
@DontObfuscate
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
public class IrisDecorator {
@DontObfuscate
@Desc("The varience dispersion is used when multiple blocks are put in the palette. Scatter scrambles them, Wispy shows streak-looking varience")
private IrisGeneratorStyle variance = NoiseStyle.STATIC.style();
@DontObfuscate
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
private boolean forcePlace = false;
@DontObfuscate
@Desc("Forcefully place this decorant anywhere it is supposed to go even if it should not go on a specific surface block. For example, you could force tallgrass to place on top of stone by using this.")
private boolean forcePlace = false;
@DontObfuscate
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@DontObfuscate
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@DependsOn({"stackMin", "stackMax"})
@DontObfuscate
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
private IrisGeneratorStyle heightVariance = NoiseStyle.STATIC.style();
@DependsOn({"stackMin", "stackMax"})
@DontObfuscate
@Desc("If this decorator has a height more than 1 this changes how it picks the height between your maxes. Scatter = random, Wispy = wavy heights")
private IrisGeneratorStyle heightVariance = NoiseStyle.STATIC.style();
@DontObfuscate
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
private DecorationPart partOf = DecorationPart.NONE;
@DontObfuscate
@Desc("Tells iris where this decoration is a part of. I.e. SHORE_LINE or SEA_SURFACE")
private DecorationPart partOf = DecorationPart.NONE;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
private int stackMin = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The minimum repeat stack height (setting to 3 would stack 3 of <block> on top of each other")
private int stackMin = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The maximum repeat stack height")
private int stackMax = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(1)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The maximum repeat stack height")
private int stackMax = 1;
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)") // TODO: WARNING HEIGHT
private double chance = 0.1;
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance for this decorator to decorate at a given X,Y coordinate. This is hit 256 times per chunk (per surface block)")
// TODO: WARNING HEIGHT
private double chance = 0.1;
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to pick from when this decorator needs to place.")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("grass"));
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to pick from when this decorator needs to place.")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("grass"));
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
private KList<IrisBlockData> topPalette = new KList<IrisBlockData>();
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks used at the very top of a 'stackMax' of higher than 1. For example, bamboo tops.")
private KList<IrisBlockData> topPalette = new KList<IrisBlockData>();
@DependsOn("topPalette")
@MinNumber(0.01)
@MaxNumber(1.0)
@DontObfuscate
@Desc("When the stack passes the top threshold, the top palette will start being used instead of the normal palette.")
private double topThreshold = 1.0;
@DependsOn("topPalette")
@MinNumber(0.01)
@MaxNumber(1.0)
@DontObfuscate
@Desc("When the stack passes the top threshold, the top palette will start being used instead of the normal palette.")
private double topThreshold = 1.0;
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockDataTops = new AtomicCache<>();
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> varianceGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockDataTops = new AtomicCache<>();
public int getHeight(RNG rng, double x, double z, IrisDataManager data)
{
if(stackMin == stackMax)
{
return stackMin;
}
public int getHeight(RNG rng, double x, double z, IrisDataManager data) {
if (stackMin == stackMax) {
return stackMin;
}
return getHeightGenerator(rng, data).fit(stackMin, stackMax, x / heightVariance.getZoom(), z / heightVariance.getZoom()) + 1;
}
return getHeightGenerator(rng, data).fit(stackMin, stackMax, x / heightVariance.getZoom(), z / heightVariance.getZoom()) + 1;
}
public CNG getHeightGenerator(RNG rng, IrisDataManager data)
{
return heightGenerator.aquire(() ->
{
return heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin));
});
}
public CNG getHeightGenerator(RNG rng, IrisDataManager data) {
return heightGenerator.aquire(() ->
{
return heightVariance.create(rng.nextParallelRNG(getBlockData(data).size() + stackMax + stackMin));
});
}
public CNG getGenerator(RNG rng, IrisDataManager data)
{
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG((int) (getBlockData(data).size()))));
}
public CNG getGenerator(RNG rng, IrisDataManager data) {
return layerGenerator.aquire(() -> style.create(rng.nextParallelRNG(getBlockData(data).size())));
}
public CNG getVarianceGenerator(RNG rng, IrisDataManager data)
{
return varianceGenerator.aquire(() ->
variance.create(
rng.nextParallelRNG((int) (getBlockData(data).size())))
public CNG getVarianceGenerator(RNG rng, IrisDataManager data) {
return varianceGenerator.aquire(() ->
variance.create(
rng.nextParallelRNG(getBlockData(data).size()))
.scale(1D / variance.getZoom()));
}
.scale(1D / variance.getZoom()));
}
public KList<IrisBlockData> add(String b)
{
palette.add(new IrisBlockData(b));
return palette;
}
public KList<IrisBlockData> add(String b) {
palette.add(new IrisBlockData(b));
return palette;
}
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
{
if(getBlockData(data).isEmpty())
{
Iris.warn("Empty Block Data for " + b.getName());
return null;
}
public BlockData getBlockData(IrisBiome b, RNG rng, double x, double z, IrisDataManager data) {
if (getBlockData(data).isEmpty()) {
Iris.warn("Empty Block Data for " + b.getName());
return null;
}
double xx = x / style.getZoom();
double zz = z / style.getZoom();
double xx = x / style.getZoom();
double zz = z / style.getZoom();
if(getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance)
{
if(getBlockData(data).size() == 1)
{
return getBlockData(data).get(0);
}
if (getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance) {
if (getBlockData(data).size() == 1) {
return getBlockData(data).get(0);
}
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, x); //X and Z must be switched
}
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, x); //X and Z must be switched
}
return null;
}
return null;
}
public BlockData getBlockData100(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
{
if(getBlockData(data).isEmpty())
{
Iris.warn("Empty Block Data for " + b.getName());
return null;
}
public BlockData getBlockData100(IrisBiome b, RNG rng, double x, double z, IrisDataManager data) {
if (getBlockData(data).isEmpty()) {
Iris.warn("Empty Block Data for " + b.getName());
return null;
}
double xx = x;
double zz = z;
double xx = x;
double zz = z;
if(!getVarianceGenerator(rng, data).isStatic())
{
xx = x / style.getZoom();
zz = z / style.getZoom();
}
if (!getVarianceGenerator(rng, data).isStatic()) {
xx = x / style.getZoom();
zz = z / style.getZoom();
}
if(getBlockData(data).size() == 1)
{
return getBlockData(data).get(0);
}
if (getBlockData(data).size() == 1) {
return getBlockData(data).get(0);
}
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, x).clone(); //X and Z must be switched
}
return getVarianceGenerator(rng, data).fit(getBlockData(data), z, x).clone(); //X and Z must be switched
}
public BlockData getBlockDataForTop(IrisBiome b, RNG rng, double x, double z, IrisDataManager data)
{
if(getBlockDataTops(data).isEmpty())
{
return null;
}
public BlockData getBlockDataForTop(IrisBiome b, RNG rng, double x, double z, IrisDataManager data) {
if (getBlockDataTops(data).isEmpty()) {
return null;
}
double xx = x / style.getZoom();
double zz = z / style.getZoom();
double xx = x / style.getZoom();
double zz = z / style.getZoom();
if(getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance)
{
if(getBlockData(data).size() == 1)
{
return getBlockDataTops(data).get(0);
}
if (getGenerator(rng, data).fitDouble(0D, 1D, xx, zz) <= chance) {
if (getBlockData(data).size() == 1) {
return getBlockDataTops(data).get(0);
}
return getVarianceGenerator(rng, data).fit(getBlockDataTops(data), z, x); //X and Z must be switched
}
return getVarianceGenerator(rng, data).fit(getBlockDataTops(data), z, x); //X and Z must be switched
}
return null;
}
return null;
}
public KList<BlockData> getBlockData(IrisDataManager data)
{
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for(IrisBlockData i : palette)
{
BlockData bx = i.getBlockData(data);
if(bx != null)
{
for (int n = 0; n < i.getWeight(); n++) {
blockData.add(bx);
}
}
}
public KList<BlockData> getBlockData(IrisDataManager data) {
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for (IrisBlockData i : palette) {
BlockData bx = i.getBlockData(data);
if (bx != null) {
for (int n = 0; n < i.getWeight(); n++) {
blockData.add(bx);
}
}
}
return blockData;
});
}
return blockData;
});
}
public KList<BlockData> getBlockDataTops(IrisDataManager data)
{
return blockDataTops.aquire(() ->
{
KList<BlockData> blockDataTops = new KList<>();
for(IrisBlockData i : topPalette)
{
BlockData bx = i.getBlockData(data);
if(bx != null)
{
for (int n = 0; n < i.getWeight(); n++) {
blockDataTops.add(bx);
}
}
}
public KList<BlockData> getBlockDataTops(IrisDataManager data) {
return blockDataTops.aquire(() ->
{
KList<BlockData> blockDataTops = new KList<>();
for (IrisBlockData i : topPalette) {
BlockData bx = i.getBlockData(data);
if (bx != null) {
for (int n = 0; n < i.getWeight(); n++) {
blockDataTops.add(bx);
}
}
}
return blockDataTops;
});
}
return blockDataTops;
});
}
public boolean isStacking()
{
return getStackMax() > 1;
}
public boolean isStacking() {
return getStackMax() > 1;
}
}

View File

@@ -1,7 +1,7 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
@@ -15,135 +15,121 @@ import org.bukkit.util.BlockVector;
@AllArgsConstructor
@Desc("Creates ore & other block deposits underground")
@Data
public class IrisDepositGenerator
{
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The minimum height this deposit can generate at")
private int minHeight = 7;
public class IrisDepositGenerator {
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The minimum height this deposit can generate at")
private int minHeight = 7;
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The maximum height this deposit can generate at")
private int maxHeight = 55;
@Required
@MinNumber(0)
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The maximum height this deposit can generate at")
private int maxHeight = 55;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("The minimum amount of deposit blocks per clump")
private int minSize = 3;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("The minimum amount of deposit blocks per clump")
private int minSize = 3;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("The maximum amount of deposit blocks per clump")
private int maxSize = 5;
@Required
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("The maximum amount of deposit blocks per clump")
private int maxSize = 5;
@Required
@MinNumber(1)
@MaxNumber(128)
@DontObfuscate
@Desc("The maximum amount of clumps per chunk")
private int maxPerChunk = 3;
@Required
@MinNumber(1)
@MaxNumber(128)
@DontObfuscate
@Desc("The maximum amount of clumps per chunk")
private int maxPerChunk = 3;
@Required
@MinNumber(0)
@MaxNumber(128)
@DontObfuscate
@Desc("The minimum amount of clumps per chunk")
private int minPerChunk = 1;
@Required
@MinNumber(0)
@MaxNumber(128)
@DontObfuscate
@Desc("The minimum amount of clumps per chunk")
private int minPerChunk = 1;
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this deposit generator")
private KList<IrisBlockData> palette = new KList<IrisBlockData>();
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this deposit generator")
private KList<IrisBlockData> palette = new KList<IrisBlockData>();
@MinNumber(1)
@MaxNumber(64)
@DontObfuscate
@Desc("Ore varience is how many different objects clumps iris will create")
private int varience = 3;
@MinNumber(1)
@MaxNumber(64)
@DontObfuscate
@Desc("Ore varience is how many different objects clumps iris will create")
private int varience = 3;
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<KList<IrisObject>> objects = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
public IrisObject getClump(RNG rng, IrisDataManager rdata)
{
KList<IrisObject> objects = this.objects.aquire(() ->
{
RNG rngv = rng.nextParallelRNG(3957778);
KList<IrisObject> objectsf = new KList<>();
public IrisObject getClump(RNG rng, IrisDataManager rdata) {
KList<IrisObject> objects = this.objects.aquire(() ->
{
RNG rngv = rng.nextParallelRNG(3957778);
KList<IrisObject> objectsf = new KList<>();
for(int i = 0; i < varience; i++)
{
objectsf.add(generateClumpObject(rngv.nextParallelRNG(2349 * i + 3598), rdata));
}
for (int i = 0; i < varience; i++) {
objectsf.add(generateClumpObject(rngv.nextParallelRNG(2349 * i + 3598), rdata));
}
return objectsf;
});
return objects.get(rng.i(0, objects.size() - 1));
}
return objectsf;
});
return objects.get(rng.i(0, objects.size() - 1));
}
public int getMaxDimension()
{
return Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
}
public int getMaxDimension() {
return Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
}
private IrisObject generateClumpObject(RNG rngv, IrisDataManager rdata)
{
int s = rngv.i(minSize, maxSize);
int dim = Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
int w = dim / 2;
IrisObject o = new IrisObject(dim, dim, dim);
private IrisObject generateClumpObject(RNG rngv, IrisDataManager rdata) {
int s = rngv.i(minSize, maxSize);
int dim = Math.min(11, (int) Math.round(Math.pow(maxSize, 1D / 3D)));
int w = dim / 2;
IrisObject o = new IrisObject(dim, dim, dim);
if(s == 1)
{
o.getBlocks().put(o.getCenter(), nextBlock(rngv, rdata));
}
if (s == 1) {
o.getBlocks().put(o.getCenter(), nextBlock(rngv, rdata));
} else {
while (s > 0) {
s--;
BlockVector ang = new BlockVector(rngv.i(-w, w), rngv.i(-w, w), rngv.i(-w, w));
BlockVector pos = o.getCenter().clone().add(ang).toBlockVector();
o.getBlocks().put(pos, nextBlock(rngv, rdata));
}
}
else
{
while(s > 0)
{
s--;
BlockVector ang = new BlockVector(rngv.i(-w, w), rngv.i(-w, w), rngv.i(-w, w));
BlockVector pos = o.getCenter().clone().add(ang).toBlockVector();
o.getBlocks().put(pos, nextBlock(rngv, rdata));
}
}
return o;
}
return o;
}
private BlockData nextBlock(RNG rngv, IrisDataManager rdata) {
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size() - 1));
}
private BlockData nextBlock(RNG rngv, IrisDataManager rdata)
{
return getBlockData(rdata).get(rngv.i(0, getBlockData(rdata).size() - 1));
}
public KList<BlockData> getBlockData(IrisDataManager rdata) {
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
public KList<BlockData> getBlockData(IrisDataManager rdata)
{
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for (IrisBlockData ix : palette) {
BlockData bx = ix.getBlockData(rdata);
for(IrisBlockData ix : palette)
{
BlockData bx = ix.getBlockData(rdata);
if (bx != null) {
blockData.add(bx);
}
}
if(bx != null)
{
blockData.add(bx);
}
}
return blockData;
});
}
return blockData;
});
}
}

View File

@@ -20,458 +20,436 @@ import org.bukkit.block.data.BlockData;
@Desc("Represents a dimension")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisDimension extends IrisRegistrant
{
public static final BlockData STONE = Material.STONE.createBlockData();
public static final BlockData WATER = Material.WATER.createBlockData();
@MinNumber(2)
@Required
@DontObfuscate
@Desc("The human readable name of this dimension")
private String name = "A Dimension";
@Desc("You can create mutliple dimensions on top of each other taking up less height of the same world. Such as the nether with a floor + ceiling.")
@ArrayType(min = 1,type = IrisDimensionIndex.class)
private KList<IrisDimensionIndex> dimensionalComposite = new KList<>();
@DontObfuscate
@Desc("Create an inverted dimension in the sky (like the nether)")
private IrisDimension sky = null;
@RegistryListJigsaw
@DontObfuscate
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold;
@DontObfuscate
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
private boolean aggressiveBiomeReshuffle = false;
@DontObfuscate
@Desc("Instead of a flat bottom, applies a clamp (using this noise style) to the bottom instead of a flat bottom. Useful for carving out center-dimensions in a dimension composite world.")
private IrisShapedGeneratorStyle undercarriage = null;
@DontObfuscate
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
private String resourcePack = "";
@DontObfuscate
@Desc("Entity spawns to override or add to this dimension")
@ArrayType(min = 1, type = IrisEntitySpawnOverride.class)
private KList<IrisEntitySpawnOverride> entitySpawnOverrides = new KList<>();
@DontObfuscate
@Desc("Add specific features in exact positions")
@ArrayType(min = 1, type = IrisFeaturePositional.class)
private KList<IrisFeaturePositional> specificFeatures = new KList<>();
@DontObfuscate
@Desc("Entity spawns during generation")
@ArrayType(min = 1, type = IrisEntityInitialSpawn.class)
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@DontObfuscate
@Desc("Add random chances for terrain features")
@ArrayType(min = 1, type = IrisFeaturePotential.class)
private KList<IrisFeaturePotential> features = new KList<>();
@DontObfuscate
@Desc("Reference loot tables in this area")
private IrisLootReference loot = new IrisLootReference();
@MinNumber(0)
@DontObfuscate
@Desc("The version of this dimension. Changing this will stop users from accidentally upgrading (and breaking their worlds).")
private int version = 1;
@ArrayType(min = 1, type = IrisBlockDrops.class)
@DontObfuscate
@Desc("Define custom block drops for this dimension")
private KList<IrisBlockDrops> blockDrops = new KList<>();
@DontObfuscate
@Desc("Should bedrock be generated or not.")
private boolean bedrock = true;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The land chance. Up to 1.0 for total land or 0.0 for total sea")
private double landChance = 0.625;
@DontObfuscate
@Desc("The placement style of regions")
private IrisGeneratorStyle regionStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of land/sea")
private IrisGeneratorStyle continentalStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle landBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle shoreBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle seaBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle caveBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle riverBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle lakeBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle islandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle islandBiomeChanceStyle = NoiseStyle.CELLULAR_HEIGHT_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle skylandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("Generate caves or not.")
private boolean caves = true;
@DontObfuscate
@Desc("Instead of filling objects with air, fills them with cobweb so you can see them")
private boolean debugSmartBore = false;
@DontObfuscate
@Desc("Carve terrain or not")
private boolean carving = true;
@DontObfuscate
@Desc("If defined, If air is defined below the area, this fluid will always place")
private IrisCaveFluid forceFluid = new IrisCaveFluid();
@DontObfuscate
@Desc("Generate decorations or not")
private boolean decorate = true;
@DontObfuscate
@Desc("Generate ravines or not")
private boolean ravines = false;
@MinNumber(1)
@DontObfuscate
@Desc("The rarity of a ravine layer having a lib (or rib) that sticks in or out by one block. Minecraft's default is 3.")
private int ravineRibRarity = 2;
@MinNumber(1)
@DontObfuscate
@Desc("The rarity of ravines. Each chunk has a 1 in X chance")
private int ravineRarity = 50;
@DontObfuscate
@Desc("Use post processing or not")
private boolean postProcessing = true;
@DontObfuscate
@Desc("Add slabs in post processing")
private boolean postProcessingSlabs = true;
@DontObfuscate
@Desc("Add painted walls in post processing")
private boolean postProcessingWalls = true;
@DontObfuscate
@Desc("Use post processing for caves or not")
private boolean postProcessCaves = true;
@DontObfuscate
@Desc("The world environment")
private Environment environment = Environment.NORMAL;
@RegistryListRegion
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
private KList<String> regions = new KList<>();
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
@DontObfuscate
@Desc("Jigsaw structures")
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
@Required
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The fluid height for this dimension")
private int fluidHeight = 63;
@RegistryListBiome
@DontObfuscate
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
private String focus = "";
@RegistryListBiome
@DontObfuscate
@Desc("Keep this either undefined or empty. Setting any region name into this will force iris to only generate the specified region. Great for testing.")
private String focusRegion = "";
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
private double biomeZoom = 5D;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in or out the terrain. This stretches the terrain. Due to performance improvements, Higher than 2.0 may cause weird rounding artifacts. Lower = more terrain changes per block. Its a true zoom-out.")
private double terrainZoom = 1D;
@MinNumber(0)
@MaxNumber(360)
@DontObfuscate
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
private double dimensionAngleDeg = 0;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Coordinate fracturing applies noise to the input coordinates. This creates the 'iris swirls' and wavy features. The distance pushes these waves further into places they shouldnt be. This is a block value multiplier.")
private double coordFractureDistance = 20;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
private double coordFractureZoom = 8;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("This zooms in the land space")
private double landZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("This zooms oceanic biomes")
private double seaZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in continents")
private double continentZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Change the size of regions")
private double regionZoom = 1;
@DontObfuscate
@Desc("Disable this to stop placing schematics in biomes")
private boolean placeObjects = true;
@DontObfuscate
@Desc("Prevent Leaf decay as if placed in creative mode")
private boolean preventLeafDecay = false;
@ArrayType(min = 1, type = IrisDepositGenerator.class)
@DontObfuscate
@Desc("Define global deposit generators")
private KList<IrisDepositGenerator> deposits = new KList<>();
@ArrayType(min = 1, type = IrisShapedGeneratorStyle.class)
@DontObfuscate
@Desc("Overlay additional noise on top of the interoplated terrain.")
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
@ArrayType(min = 1, type = IrisCaveLayer.class)
@DontObfuscate
@Desc("Define cave layers")
private KList<IrisCaveLayer> caveLayers = new KList<>();
@ArrayType(min = 1, type = IrisCarveLayer.class)
@DontObfuscate
@Desc("Define carve layers")
private KList<IrisCarveLayer> carveLayers = new KList<>();
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("The rock zoom mostly for zooming in on a wispy palette")
private double rockZoom = 5;
@DontObfuscate
@Desc("The palette of blocks for 'stone'")
private IrisMaterialPalette rockPalette = new IrisMaterialPalette().qclear().qadd("stone");
@DontObfuscate
@Desc("The palette of blocks for 'water'")
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
@ArrayType(min = 1, type = IrisBiomeMutation.class)
@DontObfuscate
@Desc("Define biome mutations for this dimension")
private KList<IrisBiomeMutation> mutations = new KList<>();
private final transient AtomicCache<ChunkPosition> parallaxSize = new AtomicCache<>();
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> coordFracture = new AtomicCache<>();
private final transient AtomicCache<Double> sinr = new AtomicCache<>();
private final transient AtomicCache<Double> cosr = new AtomicCache<>();
private final transient AtomicCache<Double> rad = new AtomicCache<>();
public boolean hasSky()
{
return getSky() != null;
}
public CNG getCoordFracture(RNG rng, int signature)
{
return coordFracture.aquire(() ->
{
CNG coordFracture = CNG.signature(rng.nextParallelRNG(signature));
coordFracture.scale(0.012 / coordFractureZoom);
return coordFracture;
});
}
public double getDimensionAngle()
{
return rad.aquire(() -> Math.toRadians(dimensionAngleDeg));
}
public boolean isCarved(int x, int y, int z, RNG rng, int terrainHeight)
{
if(isCarving() && terrainHeight > getFluidHeight() || y < terrainHeight)
{
for(IrisCarveLayer j : getCarveLayers())
{
if(j.isCarved(rng, x, y, z))
{
return true;
}
}
}
return false;
}
public Environment getEnvironment(){
return environment;
}
public boolean hasFocusRegion(){
return !focusRegion.equals("");
}
public String getFocusRegion(){
return focusRegion;
}
public double sinRotate()
{
return sinr.aquire(() -> Math.sin(getDimensionAngle()));
}
public double cosRotate()
{
return cosr.aquire(() -> Math.cos(getDimensionAngle()));
}
public KList<IrisRegion> getAllRegions(DataProvider g)
{
KList<IrisRegion> r = new KList<>();
for(String i : getRegions())
{
r.add(g.getData().getRegionLoader().load(i));
}
return r;
}
public KList<IrisRegion> getAllAnyRegions()
{
KList<IrisRegion> r = new KList<>();
for(String i : getRegions())
{
r.add(IrisDataManager.loadAnyRegion(i));
}
return r;
}
public KList<IrisBiome> getAllBiomes(DataProvider g)
{
KList<IrisBiome> r = new KList<>();
for(IrisRegion i : getAllRegions(g))
{
if(i == null)
{
continue;
}
r.addAll(i.getAllBiomes(g));
}
return r;
}
public KList<IrisBiome> getAllAnyBiomes()
{
KList<IrisBiome> r = new KList<>();
for(IrisRegion i : getAllAnyRegions())
{
if(i == null)
{
continue;
}
r.addAll(i.getAllAnyBiomes());
}
return r;
}
public IrisGeneratorStyle getBiomeStyle(InferredType type)
{
switch(type)
{
case CAVE:
return caveBiomeStyle;
case LAKE:
return lakeBiomeStyle;
case RIVER:
return riverBiomeStyle;
case LAND:
return landBiomeStyle;
case SEA:
return seaBiomeStyle;
case SHORE:
return shoreBiomeStyle;
default:
break;
}
return landBiomeStyle;
}
public class IrisDimension extends IrisRegistrant {
public static final BlockData STONE = Material.STONE.createBlockData();
public static final BlockData WATER = Material.WATER.createBlockData();
@MinNumber(2)
@Required
@DontObfuscate
@Desc("The human readable name of this dimension")
private String name = "A Dimension";
@Desc("You can create mutliple dimensions on top of each other taking up less height of the same world. Such as the nether with a floor + ceiling.")
@ArrayType(min = 1, type = IrisDimensionIndex.class)
private KList<IrisDimensionIndex> dimensionalComposite = new KList<>();
@DontObfuscate
@Desc("Create an inverted dimension in the sky (like the nether)")
private IrisDimension sky = null;
@RegistryListJigsaw
@DontObfuscate
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold;
@DontObfuscate
@Desc("Improves the biome grid variation by shuffling the cell grid more depending on the seed. This makes biomes across multiple seeds look far different than before.")
private boolean aggressiveBiomeReshuffle = false;
@DontObfuscate
@Desc("Instead of a flat bottom, applies a clamp (using this noise style) to the bottom instead of a flat bottom. Useful for carving out center-dimensions in a dimension composite world.")
private IrisShapedGeneratorStyle undercarriage = null;
@DontObfuscate
@Desc("Upon joining this world, Iris will send a resource pack request to the client. If they have previously selected yes, it will auto-switch depending on which dimension they go to.")
private String resourcePack = "";
@DontObfuscate
@Desc("Entity spawns to override or add to this dimension")
@ArrayType(min = 1, type = IrisEntitySpawnOverride.class)
private KList<IrisEntitySpawnOverride> entitySpawnOverrides = new KList<>();
@DontObfuscate
@Desc("Add specific features in exact positions")
@ArrayType(min = 1, type = IrisFeaturePositional.class)
private KList<IrisFeaturePositional> specificFeatures = new KList<>();
@DontObfuscate
@Desc("Entity spawns during generation")
@ArrayType(min = 1, type = IrisEntityInitialSpawn.class)
private KList<IrisEntityInitialSpawn> entityInitialSpawns = new KList<>();
@DontObfuscate
@Desc("Add random chances for terrain features")
@ArrayType(min = 1, type = IrisFeaturePotential.class)
private KList<IrisFeaturePotential> features = new KList<>();
@DontObfuscate
@Desc("Reference loot tables in this area")
private IrisLootReference loot = new IrisLootReference();
@MinNumber(0)
@DontObfuscate
@Desc("The version of this dimension. Changing this will stop users from accidentally upgrading (and breaking their worlds).")
private int version = 1;
@ArrayType(min = 1, type = IrisBlockDrops.class)
@DontObfuscate
@Desc("Define custom block drops for this dimension")
private KList<IrisBlockDrops> blockDrops = new KList<>();
@DontObfuscate
@Desc("Should bedrock be generated or not.")
private boolean bedrock = true;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The land chance. Up to 1.0 for total land or 0.0 for total sea")
private double landChance = 0.625;
@DontObfuscate
@Desc("The placement style of regions")
private IrisGeneratorStyle regionStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of land/sea")
private IrisGeneratorStyle continentalStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle landBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle shoreBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle seaBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle caveBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle riverBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle lakeBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle islandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle islandBiomeChanceStyle = NoiseStyle.CELLULAR_HEIGHT_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("The placement style of biomes")
private IrisGeneratorStyle skylandBiomeStyle = NoiseStyle.CELLULAR_IRIS_DOUBLE.style();
@DontObfuscate
@Desc("Generate caves or not.")
private boolean caves = true;
@DontObfuscate
@Desc("Instead of filling objects with air, fills them with cobweb so you can see them")
private boolean debugSmartBore = false;
@DontObfuscate
@Desc("Carve terrain or not")
private boolean carving = true;
@DontObfuscate
@Desc("If defined, If air is defined below the area, this fluid will always place")
private IrisCaveFluid forceFluid = new IrisCaveFluid();
@DontObfuscate
@Desc("Generate decorations or not")
private boolean decorate = true;
@DontObfuscate
@Desc("Generate ravines or not")
private boolean ravines = false;
@MinNumber(1)
@DontObfuscate
@Desc("The rarity of a ravine layer having a lib (or rib) that sticks in or out by one block. Minecraft's default is 3.")
private int ravineRibRarity = 2;
@MinNumber(1)
@DontObfuscate
@Desc("The rarity of ravines. Each chunk has a 1 in X chance")
private int ravineRarity = 50;
@DontObfuscate
@Desc("Use post processing or not")
private boolean postProcessing = true;
@DontObfuscate
@Desc("Add slabs in post processing")
private boolean postProcessingSlabs = true;
@DontObfuscate
@Desc("Add painted walls in post processing")
private boolean postProcessingWalls = true;
@DontObfuscate
@Desc("Use post processing for caves or not")
private boolean postProcessCaves = true;
@DontObfuscate
@Desc("The world environment")
private Environment environment = Environment.NORMAL;
@RegistryListRegion
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("Define all of the regions to include in this dimension. Dimensions -> Regions -> Biomes -> Objects etc")
private KList<String> regions = new KList<>();
@ArrayType(min = 1, type = IrisJigsawStructurePlacement.class)
@DontObfuscate
@Desc("Jigsaw structures")
private KList<IrisJigsawStructurePlacement> jigsawStructures = new KList<>();
@Required
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The fluid height for this dimension")
private int fluidHeight = 63;
@RegistryListBiome
@DontObfuscate
@Desc("Keep this either undefined or empty. Setting any biome name into this will force iris to only generate the specified biome. Great for testing.")
private String focus = "";
@RegistryListBiome
@DontObfuscate
@Desc("Keep this either undefined or empty. Setting any region name into this will force iris to only generate the specified region. Great for testing.")
private String focusRegion = "";
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in or out the biome size. Higher = bigger biomes")
private double biomeZoom = 5D;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in or out the terrain. This stretches the terrain. Due to performance improvements, Higher than 2.0 may cause weird rounding artifacts. Lower = more terrain changes per block. Its a true zoom-out.")
private double terrainZoom = 1D;
@MinNumber(0)
@MaxNumber(360)
@DontObfuscate
@Desc("You can rotate the input coordinates by an angle. This can make terrain appear more natural (less sharp corners and lines). This literally rotates the entire dimension by an angle. Hint: Try 12 degrees or something not on a 90 or 45 degree angle.")
private double dimensionAngleDeg = 0;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Coordinate fracturing applies noise to the input coordinates. This creates the 'iris swirls' and wavy features. The distance pushes these waves further into places they shouldnt be. This is a block value multiplier.")
private double coordFractureDistance = 20;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Coordinate fracturing zoom. Higher = less frequent warping, Lower = more frequent and rapid warping / swirls.")
private double coordFractureZoom = 8;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("This zooms in the land space")
private double landZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("This zooms oceanic biomes")
private double seaZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Zoom in continents")
private double continentZoom = 1;
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("Change the size of regions")
private double regionZoom = 1;
@DontObfuscate
@Desc("Disable this to stop placing schematics in biomes")
private boolean placeObjects = true;
@DontObfuscate
@Desc("Prevent Leaf decay as if placed in creative mode")
private boolean preventLeafDecay = false;
@ArrayType(min = 1, type = IrisDepositGenerator.class)
@DontObfuscate
@Desc("Define global deposit generators")
private KList<IrisDepositGenerator> deposits = new KList<>();
@ArrayType(min = 1, type = IrisShapedGeneratorStyle.class)
@DontObfuscate
@Desc("Overlay additional noise on top of the interoplated terrain.")
private KList<IrisShapedGeneratorStyle> overlayNoise = new KList<>();
@ArrayType(min = 1, type = IrisCaveLayer.class)
@DontObfuscate
@Desc("Define cave layers")
private KList<IrisCaveLayer> caveLayers = new KList<>();
@ArrayType(min = 1, type = IrisCarveLayer.class)
@DontObfuscate
@Desc("Define carve layers")
private KList<IrisCarveLayer> carveLayers = new KList<>();
@MinNumber(0.0001)
@MaxNumber(512)
@DontObfuscate
@Desc("The rock zoom mostly for zooming in on a wispy palette")
private double rockZoom = 5;
@DontObfuscate
@Desc("The palette of blocks for 'stone'")
private IrisMaterialPalette rockPalette = new IrisMaterialPalette().qclear().qadd("stone");
@DontObfuscate
@Desc("The palette of blocks for 'water'")
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("water");
@ArrayType(min = 1, type = IrisBiomeMutation.class)
@DontObfuscate
@Desc("Define biome mutations for this dimension")
private KList<IrisBiomeMutation> mutations = new KList<>();
private final transient AtomicCache<ChunkPosition> parallaxSize = new AtomicCache<>();
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> coordFracture = new AtomicCache<>();
private final transient AtomicCache<Double> sinr = new AtomicCache<>();
private final transient AtomicCache<Double> cosr = new AtomicCache<>();
private final transient AtomicCache<Double> rad = new AtomicCache<>();
public boolean hasSky() {
return getSky() != null;
}
public CNG getCoordFracture(RNG rng, int signature) {
return coordFracture.aquire(() ->
{
CNG coordFracture = CNG.signature(rng.nextParallelRNG(signature));
coordFracture.scale(0.012 / coordFractureZoom);
return coordFracture;
});
}
public double getDimensionAngle() {
return rad.aquire(() -> Math.toRadians(dimensionAngleDeg));
}
public boolean isCarved(int x, int y, int z, RNG rng, int terrainHeight) {
if (isCarving() && terrainHeight > getFluidHeight() || y < terrainHeight) {
for (IrisCarveLayer j : getCarveLayers()) {
if (j.isCarved(rng, x, y, z)) {
return true;
}
}
}
return false;
}
public Environment getEnvironment() {
return environment;
}
public boolean hasFocusRegion() {
return !focusRegion.equals("");
}
public String getFocusRegion() {
return focusRegion;
}
public double sinRotate() {
return sinr.aquire(() -> Math.sin(getDimensionAngle()));
}
public double cosRotate() {
return cosr.aquire(() -> Math.cos(getDimensionAngle()));
}
public KList<IrisRegion> getAllRegions(DataProvider g) {
KList<IrisRegion> r = new KList<>();
for (String i : getRegions()) {
r.add(g.getData().getRegionLoader().load(i));
}
return r;
}
public KList<IrisRegion> getAllAnyRegions() {
KList<IrisRegion> r = new KList<>();
for (String i : getRegions()) {
r.add(IrisDataManager.loadAnyRegion(i));
}
return r;
}
public KList<IrisBiome> getAllBiomes(DataProvider g) {
KList<IrisBiome> r = new KList<>();
for (IrisRegion i : getAllRegions(g)) {
if (i == null) {
continue;
}
r.addAll(i.getAllBiomes(g));
}
return r;
}
public KList<IrisBiome> getAllAnyBiomes() {
KList<IrisBiome> r = new KList<>();
for (IrisRegion i : getAllAnyRegions()) {
if (i == null) {
continue;
}
r.addAll(i.getAllAnyBiomes());
}
return r;
}
public IrisGeneratorStyle getBiomeStyle(InferredType type) {
switch (type) {
case CAVE:
return caveBiomeStyle;
case LAKE:
return lakeBiomeStyle;
case RIVER:
return riverBiomeStyle;
case LAND:
return landBiomeStyle;
case SEA:
return seaBiomeStyle;
case SHORE:
return shoreBiomeStyle;
default:
break;
}
return landBiomeStyle;
}
}

View File

@@ -1,11 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RegistryListDimension;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -18,25 +13,24 @@ import lombok.experimental.Accessors;
@Desc("Represents an index for dimensions to take up vertical slots in the same world")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisDimensionIndex
{
@Required
@DontObfuscate
@Desc("The weight of this dimension. If there are 2 dimensions, if the weight is the same on both, both dimensions will take up 128 blocks of height.")
private double weight = 1D;
public class IrisDimensionIndex {
@Required
@DontObfuscate
@Desc("The weight of this dimension. If there are 2 dimensions, if the weight is the same on both, both dimensions will take up 128 blocks of height.")
private double weight = 1D;
@DontObfuscate
@Desc("If inverted is set to true, the dimension will be updide down in the world")
private boolean inverted = false;
@DontObfuscate
@Desc("If inverted is set to true, the dimension will be updide down in the world")
private boolean inverted = false;
@DontObfuscate
@Desc("Only one dimension layer should be set to primary. The primary dimension layer is where players spawn, and the biomes that the vanilla structure system uses to figure out what structures to place.")
private boolean primary = false;
@DontObfuscate
@Desc("Only one dimension layer should be set to primary. The primary dimension layer is where players spawn, and the biomes that the vanilla structure system uses to figure out what structures to place.")
private boolean primary = false;
@DontObfuscate
@Required
@RegistryListDimension
@MinNumber(1)
@Desc("Name of dimension")
private String dimension = "";
@DontObfuscate
@Required
@RegistryListDimension
@MinNumber(1)
@Desc("Name of dimension")
private String dimension = "";
}

View File

@@ -13,538 +13,424 @@ import org.bukkit.util.Vector;
* @author cyberpwn
*/
@Desc("A direction object")
public enum IrisDirection
{
UP_POSITIVE_Y(0, 1, 0, CuboidDirection.Up),
DOWN_NEGATIVE_Y(0, -1, 0, CuboidDirection.Down),
NORTH_NEGATIVE_Z(0, 0, -1, CuboidDirection.North),
SOUTH_POSITIVE_Z(0, 0, 1, CuboidDirection.South),
EAST_POSITIVE_X(1, 0, 0, CuboidDirection.East),
WEST_NEGATIVE_X(-1, 0, 0, CuboidDirection.West);
public enum IrisDirection {
UP_POSITIVE_Y(0, 1, 0, CuboidDirection.Up),
DOWN_NEGATIVE_Y(0, -1, 0, CuboidDirection.Down),
NORTH_NEGATIVE_Z(0, 0, -1, CuboidDirection.North),
SOUTH_POSITIVE_Z(0, 0, 1, CuboidDirection.South),
EAST_POSITIVE_X(1, 0, 0, CuboidDirection.East),
WEST_NEGATIVE_X(-1, 0, 0, CuboidDirection.West);
private static KMap<GBiset<IrisDirection, IrisDirection>, DOP> permute = null;
private static KMap<GBiset<IrisDirection, IrisDirection>, DOP> permute = null;
private int x;
private int y;
private int z;
private CuboidDirection f;
private final int x;
private final int y;
private final int z;
private final CuboidDirection f;
public static IrisDirection getDirection(BlockFace f)
{
switch(f)
{
case DOWN:
return DOWN_NEGATIVE_Y;
case EAST:
case EAST_NORTH_EAST:
case EAST_SOUTH_EAST:
return EAST_POSITIVE_X;
case NORTH:
case NORTH_NORTH_WEST:
case NORTH_EAST:
case NORTH_NORTH_EAST:
case NORTH_WEST:
return NORTH_NEGATIVE_Z;
case SELF:
case UP:
return UP_POSITIVE_Y;
case SOUTH:
case SOUTH_EAST:
case SOUTH_SOUTH_EAST:
case SOUTH_SOUTH_WEST:
case SOUTH_WEST:
return SOUTH_POSITIVE_Z;
case WEST:
case WEST_NORTH_WEST:
case WEST_SOUTH_WEST:
return WEST_NEGATIVE_X;
}
public static IrisDirection getDirection(BlockFace f) {
switch (f) {
case DOWN:
return DOWN_NEGATIVE_Y;
case EAST:
case EAST_NORTH_EAST:
case EAST_SOUTH_EAST:
return EAST_POSITIVE_X;
case NORTH:
case NORTH_NORTH_WEST:
case NORTH_EAST:
case NORTH_NORTH_EAST:
case NORTH_WEST:
return NORTH_NEGATIVE_Z;
case SELF:
case UP:
return UP_POSITIVE_Y;
case SOUTH:
case SOUTH_EAST:
case SOUTH_SOUTH_EAST:
case SOUTH_SOUTH_WEST:
case SOUTH_WEST:
return SOUTH_POSITIVE_Z;
case WEST:
case WEST_NORTH_WEST:
case WEST_SOUTH_WEST:
return WEST_NEGATIVE_X;
}
return DOWN_NEGATIVE_Y;
}
public static IrisDirection fromJigsawBlock(String direction) {
for(IrisDirection i : IrisDirection.values())
{
if(i.name().toLowerCase().split("\\Q_\\E")[0]
.equals(direction.split("\\Q_\\E")[0]))
{
return i;
}
}
return null;
return DOWN_NEGATIVE_Y;
}
public static IrisDirection getDirection(Jigsaw.Orientation orientation) {
switch(orientation)
{
case DOWN_EAST:
case UP_EAST:
case EAST_UP:
return EAST_POSITIVE_X;
case DOWN_NORTH:
case UP_NORTH:
case NORTH_UP:
return NORTH_NEGATIVE_Z;
case DOWN_SOUTH:
case UP_SOUTH:
case SOUTH_UP:
return SOUTH_POSITIVE_Z;
case DOWN_WEST:
case UP_WEST:
case WEST_UP:
return WEST_NEGATIVE_X;
}
public static IrisDirection fromJigsawBlock(String direction) {
for (IrisDirection i : IrisDirection.values()) {
if (i.name().toLowerCase().split("\\Q_\\E")[0]
.equals(direction.split("\\Q_\\E")[0])) {
return i;
}
}
return null;
}
return null;
}
@Override
public String toString()
{
switch(this)
{
case DOWN_NEGATIVE_Y:
return "Down";
case EAST_POSITIVE_X:
return "East";
case NORTH_NEGATIVE_Z:
return "North";
case SOUTH_POSITIVE_Z:
return "South";
case UP_POSITIVE_Y:
return "Up";
case WEST_NEGATIVE_X:
return "West";
}
public static IrisDirection getDirection(Jigsaw.Orientation orientation) {
switch (orientation) {
case DOWN_EAST:
case UP_EAST:
case EAST_UP:
return EAST_POSITIVE_X;
case DOWN_NORTH:
case UP_NORTH:
case NORTH_UP:
return NORTH_NEGATIVE_Z;
case DOWN_SOUTH:
case UP_SOUTH:
case SOUTH_UP:
return SOUTH_POSITIVE_Z;
case DOWN_WEST:
case UP_WEST:
case WEST_UP:
return WEST_NEGATIVE_X;
}
return "?";
}
return null;
}
public boolean isVertical()
{
return equals(DOWN_NEGATIVE_Y) || equals(UP_POSITIVE_Y);
}
@Override
public String toString() {
switch (this) {
case DOWN_NEGATIVE_Y:
return "Down";
case EAST_POSITIVE_X:
return "East";
case NORTH_NEGATIVE_Z:
return "North";
case SOUTH_POSITIVE_Z:
return "South";
case UP_POSITIVE_Y:
return "Up";
case WEST_NEGATIVE_X:
return "West";
}
public static IrisDirection closest(Vector v)
{
double m = Double.MAX_VALUE;
IrisDirection s = null;
return "?";
}
for(IrisDirection i : values())
{
Vector x = i.toVector();
double g = x.distance(v);
public boolean isVertical() {
return equals(DOWN_NEGATIVE_Y) || equals(UP_POSITIVE_Y);
}
if(g < m)
{
m = g;
s = i;
}
}
public static IrisDirection closest(Vector v) {
double m = Double.MAX_VALUE;
IrisDirection s = null;
return s;
}
for (IrisDirection i : values()) {
Vector x = i.toVector();
double g = x.distance(v);
public static IrisDirection closest(Vector v, IrisDirection... d)
{
double m = Double.MAX_VALUE;
IrisDirection s = null;
if (g < m) {
m = g;
s = i;
}
}
for(IrisDirection i : d)
{
Vector x = i.toVector();
double g = x.distance(v);
return s;
}
if(g < m)
{
m = g;
s = i;
}
}
public static IrisDirection closest(Vector v, IrisDirection... d) {
double m = Double.MAX_VALUE;
IrisDirection s = null;
return s;
}
for (IrisDirection i : d) {
Vector x = i.toVector();
double g = x.distance(v);
public static IrisDirection closest(Vector v, KList<IrisDirection> d)
{
double m = Double.MAX_VALUE;
IrisDirection s = null;
if (g < m) {
m = g;
s = i;
}
}
for(IrisDirection i : d)
{
Vector x = i.toVector();
double g = x.distance(v);
return s;
}
if(g < m)
{
m = g;
s = i;
}
}
public static IrisDirection closest(Vector v, KList<IrisDirection> d) {
double m = Double.MAX_VALUE;
IrisDirection s = null;
return s;
}
for (IrisDirection i : d) {
Vector x = i.toVector();
double g = x.distance(v);
public Vector toVector()
{
return new Vector(x, y, z);
}
if (g < m) {
m = g;
s = i;
}
}
public boolean isCrooked(IrisDirection to)
{
if(equals(to.reverse()))
{
return false;
}
return s;
}
return !equals(to);
}
public Vector toVector() {
return new Vector(x, y, z);
}
private IrisDirection(int x, int y, int z, CuboidDirection f)
{
this.x = x;
this.y = y;
this.z = z;
this.f = f;
}
public boolean isCrooked(IrisDirection to) {
if (equals(to.reverse())) {
return false;
}
public Vector angle(Vector initial, IrisDirection d)
{
calculatePermutations();
return !equals(to);
}
for(GBiset<IrisDirection, IrisDirection> i : permute.keySet())
{
if(i.getA().equals(this) && i.getB().equals(d))
{
return permute.get(i).op(initial);
}
}
IrisDirection(int x, int y, int z, CuboidDirection f) {
this.x = x;
this.y = y;
this.z = z;
this.f = f;
}
return initial;
}
public Vector angle(Vector initial, IrisDirection d) {
calculatePermutations();
public IrisDirection reverse()
{
switch(this)
{
case DOWN_NEGATIVE_Y:
return UP_POSITIVE_Y;
case EAST_POSITIVE_X:
return WEST_NEGATIVE_X;
case NORTH_NEGATIVE_Z:
return SOUTH_POSITIVE_Z;
case SOUTH_POSITIVE_Z:
return NORTH_NEGATIVE_Z;
case UP_POSITIVE_Y:
return DOWN_NEGATIVE_Y;
case WEST_NEGATIVE_X:
return EAST_POSITIVE_X;
default:
break;
}
for (GBiset<IrisDirection, IrisDirection> i : permute.keySet()) {
if (i.getA().equals(this) && i.getB().equals(d)) {
return permute.get(i).op(initial);
}
}
return EAST_POSITIVE_X;
}
return initial;
}
public int x()
{
return x;
}
public IrisDirection reverse() {
switch (this) {
case DOWN_NEGATIVE_Y:
return UP_POSITIVE_Y;
case EAST_POSITIVE_X:
return WEST_NEGATIVE_X;
case NORTH_NEGATIVE_Z:
return SOUTH_POSITIVE_Z;
case SOUTH_POSITIVE_Z:
return NORTH_NEGATIVE_Z;
case UP_POSITIVE_Y:
return DOWN_NEGATIVE_Y;
case WEST_NEGATIVE_X:
return EAST_POSITIVE_X;
default:
break;
}
public int y()
{
return y;
}
return EAST_POSITIVE_X;
}
public int z()
{
return z;
}
public int x() {
return x;
}
public CuboidDirection f()
{
return f;
}
public int y() {
return y;
}
public static KList<IrisDirection> news()
{
return new KList<IrisDirection>().add(NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
}
public int z() {
return z;
}
public static IrisDirection getDirection(Vector v)
{
Vector k = VectorMath.triNormalize(v.clone().normalize());
public CuboidDirection f() {
return f;
}
for(IrisDirection i : udnews())
{
if(i.x == k.getBlockX() && i.y == k.getBlockY() && i.z == k.getBlockZ())
{
return i;
}
}
public static KList<IrisDirection> news() {
return new KList<IrisDirection>().add(NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
}
return IrisDirection.NORTH_NEGATIVE_Z;
}
public static IrisDirection getDirection(Vector v) {
Vector k = VectorMath.triNormalize(v.clone().normalize());
public static KList<IrisDirection> udnews()
{
return new KList<IrisDirection>().add(UP_POSITIVE_Y, DOWN_NEGATIVE_Y, NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
}
for (IrisDirection i : udnews()) {
if (i.x == k.getBlockX() && i.y == k.getBlockY() && i.z == k.getBlockZ()) {
return i;
}
}
/**
* Get the directional value from the given byte from common directional blocks
* (MUST BE BETWEEN 0 and 5 INCLUSIVE)
*
* @param b
* the byte
* @return the direction or null if the byte is outside of the inclusive range
* 0-5
*/
public static IrisDirection fromByte(byte b)
{
if(b > 5 || b < 0)
{
return null;
}
return IrisDirection.NORTH_NEGATIVE_Z;
}
if(b == 0)
{
return DOWN_NEGATIVE_Y;
}
public static KList<IrisDirection> udnews() {
return new KList<IrisDirection>().add(UP_POSITIVE_Y, DOWN_NEGATIVE_Y, NORTH_NEGATIVE_Z, EAST_POSITIVE_X, WEST_NEGATIVE_X, SOUTH_POSITIVE_Z);
}
else if(b == 1)
{
return UP_POSITIVE_Y;
}
/**
* Get the directional value from the given byte from common directional blocks
* (MUST BE BETWEEN 0 and 5 INCLUSIVE)
*
* @param b the byte
* @return the direction or null if the byte is outside of the inclusive range
* 0-5
*/
public static IrisDirection fromByte(byte b) {
if (b > 5 || b < 0) {
return null;
}
else if(b == 2)
{
return NORTH_NEGATIVE_Z;
}
if (b == 0) {
return DOWN_NEGATIVE_Y;
} else if (b == 1) {
return UP_POSITIVE_Y;
} else if (b == 2) {
return NORTH_NEGATIVE_Z;
} else if (b == 3) {
return SOUTH_POSITIVE_Z;
} else if (b == 4) {
return WEST_NEGATIVE_X;
} else {
return EAST_POSITIVE_X;
}
}
else if(b == 3)
{
return SOUTH_POSITIVE_Z;
}
/**
* Get the byte value represented in some directional blocks
*
* @return the byte value
*/
public byte byteValue() {
switch (this) {
case DOWN_NEGATIVE_Y:
return 0;
case EAST_POSITIVE_X:
return 5;
case NORTH_NEGATIVE_Z:
return 2;
case SOUTH_POSITIVE_Z:
return 3;
case UP_POSITIVE_Y:
return 1;
case WEST_NEGATIVE_X:
return 4;
default:
break;
}
else if(b == 4)
{
return WEST_NEGATIVE_X;
}
return -1;
}
else
{
return EAST_POSITIVE_X;
}
}
public static void calculatePermutations() {
if (permute != null) {
return;
}
/**
* Get the byte value represented in some directional blocks
*
* @return the byte value
*/
public byte byteValue()
{
switch(this)
{
case DOWN_NEGATIVE_Y:
return 0;
case EAST_POSITIVE_X:
return 5;
case NORTH_NEGATIVE_Z:
return 2;
case SOUTH_POSITIVE_Z:
return 3;
case UP_POSITIVE_Y:
return 1;
case WEST_NEGATIVE_X:
return 4;
default:
break;
}
permute = new KMap<GBiset<IrisDirection, IrisDirection>, DOP>();
return -1;
}
for (IrisDirection i : udnews()) {
for (IrisDirection j : udnews()) {
GBiset<IrisDirection, IrisDirection> b = new GBiset<IrisDirection, IrisDirection>(i, j);
public static void calculatePermutations()
{
if(permute != null)
{
return;
}
if (i.equals(j)) {
permute.put(b, new DOP("DIRECT") {
@Override
public Vector op(Vector v) {
return v;
}
});
} else if (i.reverse().equals(j)) {
if (i.isVertical()) {
permute.put(b, new DOP("R180CCZ") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CCZ(VectorMath.rotate90CCZ(v));
}
});
} else {
permute.put(b, new DOP("R180CCY") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CCY(VectorMath.rotate90CCY(v));
}
});
}
} else if (getDirection(VectorMath.rotate90CX(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CX") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CX(v);
}
});
} else if (getDirection(VectorMath.rotate90CCX(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CCX") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CCX(v);
}
});
} else if (getDirection(VectorMath.rotate90CY(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CY") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CY(v);
}
});
} else if (getDirection(VectorMath.rotate90CCY(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CCY") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CCY(v);
}
});
} else if (getDirection(VectorMath.rotate90CZ(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CZ") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CZ(v);
}
});
} else if (getDirection(VectorMath.rotate90CCZ(i.toVector())).equals(j)) {
permute.put(b, new DOP("R90CCZ") {
@Override
public Vector op(Vector v) {
return VectorMath.rotate90CCZ(v);
}
});
} else {
permute.put(b, new DOP("FAIL") {
@Override
public Vector op(Vector v) {
return v;
}
});
}
}
}
}
permute = new KMap<GBiset<IrisDirection, IrisDirection>, DOP>();
public BlockFace getFace() {
switch (this) {
case DOWN_NEGATIVE_Y:
return BlockFace.DOWN;
case EAST_POSITIVE_X:
return BlockFace.EAST;
case NORTH_NEGATIVE_Z:
return BlockFace.NORTH;
case SOUTH_POSITIVE_Z:
return BlockFace.SOUTH;
case UP_POSITIVE_Y:
return BlockFace.UP;
case WEST_NEGATIVE_X:
return BlockFace.WEST;
}
for(IrisDirection i : udnews())
{
for(IrisDirection j : udnews())
{
GBiset<IrisDirection, IrisDirection> b = new GBiset<IrisDirection, IrisDirection>(i, j);
return null;
}
if(i.equals(j))
{
permute.put(b, new DOP("DIRECT")
{
@Override
public Vector op(Vector v)
{
return v;
}
});
}
public Axis getAxis() {
switch (this) {
case DOWN_NEGATIVE_Y:
case UP_POSITIVE_Y:
return Axis.Y;
case EAST_POSITIVE_X:
case WEST_NEGATIVE_X:
return Axis.X;
case NORTH_NEGATIVE_Z:
case SOUTH_POSITIVE_Z:
return Axis.Z;
}
else if(i.reverse().equals(j))
{
if(i.isVertical())
{
permute.put(b, new DOP("R180CCZ")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CCZ(VectorMath.rotate90CCZ(v));
}
});
}
else
{
permute.put(b, new DOP("R180CCY")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CCY(VectorMath.rotate90CCY(v));
}
});
}
}
else if(getDirection(VectorMath.rotate90CX(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CX")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CX(v);
}
});
}
else if(getDirection(VectorMath.rotate90CCX(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CCX")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CCX(v);
}
});
}
else if(getDirection(VectorMath.rotate90CY(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CY")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CY(v);
}
});
}
else if(getDirection(VectorMath.rotate90CCY(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CCY")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CCY(v);
}
});
}
else if(getDirection(VectorMath.rotate90CZ(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CZ")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CZ(v);
}
});
}
else if(getDirection(VectorMath.rotate90CCZ(i.toVector())).equals(j))
{
permute.put(b, new DOP("R90CCZ")
{
@Override
public Vector op(Vector v)
{
return VectorMath.rotate90CCZ(v);
}
});
}
else
{
permute.put(b, new DOP("FAIL")
{
@Override
public Vector op(Vector v)
{
return v;
}
});
}
}
}
}
public BlockFace getFace()
{
switch(this)
{
case DOWN_NEGATIVE_Y:
return BlockFace.DOWN;
case EAST_POSITIVE_X:
return BlockFace.EAST;
case NORTH_NEGATIVE_Z:
return BlockFace.NORTH;
case SOUTH_POSITIVE_Z:
return BlockFace.SOUTH;
case UP_POSITIVE_Y:
return BlockFace.UP;
case WEST_NEGATIVE_X:
return BlockFace.WEST;
}
return null;
}
public Axis getAxis()
{
switch(this)
{
case DOWN_NEGATIVE_Y:
case UP_POSITIVE_Y:
return Axis.Y;
case EAST_POSITIVE_X:
case WEST_NEGATIVE_X:
return Axis.X;
case NORTH_NEGATIVE_Z:
case SOUTH_POSITIVE_Z:
return Axis.Z;
}
return null;
}
return null;
}
}

View File

@@ -20,273 +20,251 @@ import org.bukkit.potion.PotionEffectType;
@AllArgsConstructor
@Desc("An iris effect")
@Data
public class IrisEffect
{
public class IrisEffect {
@DontObfuscate
@Desc("The potion effect to apply in this area")
private String potionEffect = "";
@DontObfuscate
@Desc("The potion effect to apply in this area")
private String potionEffect = "";
@DontObfuscate
@Desc("The particle effect to apply in the area")
private Particle particleEffect = null;
@DontObfuscate
@Desc("The particle effect to apply in the area")
private Particle particleEffect = null;
@DependsOn({"particleEffect"})
@MinNumber(-32)
@MaxNumber(32)
@DontObfuscate
@Desc("Randomly offset from the surface to this surface+value")
private int particleOffset = 0;
@DependsOn({"particleEffect"})
@MinNumber(-32)
@MaxNumber(32)
@DontObfuscate
@Desc("Randomly offset from the surface to this surface+value")
private int particleOffset = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltX = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt x, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltX = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltY = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt y, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltY = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltZ = 0;
@DependsOn({"particleEffect"})
@MinNumber(-8)
@MaxNumber(8)
@DontObfuscate
@Desc("The alt z, usually represents motion if the particle count is zero. Otherwise an offset.")
private double particleAltZ = 0;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altX by -altX to altX")
private boolean randomAltX = true;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altX by -altX to altX")
private boolean randomAltX = true;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altY by -altY to altY")
private boolean randomAltY = false;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altY by -altY to altY")
private boolean randomAltY = false;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altZ by -altZ to altZ")
private boolean randomAltZ = true;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("Randomize the altZ by -altZ to altZ")
private boolean randomAltZ = true;
@DontObfuscate
@Desc("The sound to play")
private Sound sound = null;
@DontObfuscate
@Desc("The sound to play")
private Sound sound = null;
@DependsOn({"sound"})
@MinNumber(0)
@MaxNumber(512)
@DontObfuscate
@Desc("The max distance from the player the sound will play")
private int soundDistance = 12;
@DependsOn({"sound"})
@MinNumber(0)
@MaxNumber(512)
@DontObfuscate
@Desc("The max distance from the player the sound will play")
private int soundDistance = 12;
@DependsOn({"sound", "maxPitch"})
@MinNumber(0.01)
@MaxNumber(1.99)
@DontObfuscate
@Desc("The minimum sound pitch")
private double minPitch = 0.5D;
@DependsOn({"sound", "maxPitch"})
@MinNumber(0.01)
@MaxNumber(1.99)
@DontObfuscate
@Desc("The minimum sound pitch")
private double minPitch = 0.5D;
@DependsOn({"sound", "minVolume"})
@MinNumber(0.01)
@MaxNumber(1.99)
@DontObfuscate
@Desc("The max sound pitch")
private double maxPitch = 1.5D;
@DependsOn({"sound", "minVolume"})
@MinNumber(0.01)
@MaxNumber(1.99)
@DontObfuscate
@Desc("The max sound pitch")
private double maxPitch = 1.5D;
@DependsOn({"sound"})
@MinNumber(0.001)
@MaxNumber(512)
@DontObfuscate
@Desc("The sound volume.")
private double volume = 1.5D;
@DependsOn({"sound"})
@MinNumber(0.001)
@MaxNumber(512)
@DontObfuscate
@Desc("The sound volume.")
private double volume = 1.5D;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(512)
@DontObfuscate
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
private int particleCount = 0;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(512)
@DontObfuscate
@Desc("The particle count. Try setting to zero for using the alt xyz to a motion value instead of an offset")
private int particleCount = 0;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(64)
@DontObfuscate
@Desc("How far away from the player particles can play")
private int particleDistance = 20;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(64)
@DontObfuscate
@Desc("How far away from the player particles can play")
private int particleDistance = 20;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(128)
@DontObfuscate
@Desc("How wide the particles can play (player's view left and right) RADIUS")
private int particleDistanceWidth = 24;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(128)
@DontObfuscate
@Desc("How wide the particles can play (player's view left and right) RADIUS")
private int particleDistanceWidth = 24;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
private double extra = 0;
@DependsOn({"particleEffect"})
@DontObfuscate
@Desc("An extra value for some particles... Which bukkit doesn't even document.")
private double extra = 0;
@DependsOn({"potionEffect"})
@MinNumber(-1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The Potion Strength or -1 to disable")
private int potionStrength = -1;
@DependsOn({"potionEffect"})
@MinNumber(-1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The Potion Strength or -1 to disable")
private int potionStrength = -1;
@DependsOn({"potionEffect", "potionTicksMin"})
@MinNumber(1)
@DontObfuscate
@Desc("The max time the potion will last for")
private int potionTicksMax = 155;
@DependsOn({"potionEffect", "potionTicksMin"})
@MinNumber(1)
@DontObfuscate
@Desc("The max time the potion will last for")
private int potionTicksMax = 155;
@DependsOn({"potionEffect", "potionTicksMax"})
@MinNumber(1)
@DontObfuscate
@Desc("The min time the potion will last for")
private int potionTicksMin = 75;
@DependsOn({"potionEffect", "potionTicksMax"})
@MinNumber(1)
@DontObfuscate
@Desc("The min time the potion will last for")
private int potionTicksMin = 75;
@Required
@MinNumber(0)
@DontObfuscate
@Desc("The effect interval in milliseconds")
private int interval = 150;
@Required
@MinNumber(0)
@DontObfuscate
@Desc("The effect interval in milliseconds")
private int interval = 150;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(16)
@DontObfuscate
@Desc("The effect distance start away")
private int particleAway = 5;
@DependsOn({"particleEffect"})
@MinNumber(0)
@MaxNumber(16)
@DontObfuscate
@Desc("The effect distance start away")
private int particleAway = 5;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The chance is 1 in CHANCE per interval")
private int chance = 50;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The chance is 1 in CHANCE per interval")
private int chance = 50;
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
private final transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
private final transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
public boolean canTick()
{
return latch.aquire(() -> new ChronoLatch(interval)).flip();
}
public boolean canTick() {
return latch.aquire(() -> new ChronoLatch(interval)).flip();
}
public PotionEffectType getRealType()
{
return pt.aquire(() ->
{
PotionEffectType t = PotionEffectType.LUCK;
public PotionEffectType getRealType() {
return pt.aquire(() ->
{
PotionEffectType t = PotionEffectType.LUCK;
if(getPotionEffect().isEmpty())
{
return t;
}
if (getPotionEffect().isEmpty()) {
return t;
}
try
{
for(PotionEffectType i : PotionEffectType.values())
{
if(i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect()))
{
t = i;
try {
for (PotionEffectType i : PotionEffectType.values()) {
if (i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect())) {
t = i;
return t;
}
}
}
return t;
}
}
} catch (Throwable e) {
catch(Throwable e)
{
}
}
Iris.warn("Unknown Potion Effect Type: " + getPotionEffect());
Iris.warn("Unknown Potion Effect Type: " + getPotionEffect());
return t;
});
}
return t;
});
}
public void apply(Player p, GeneratorAccess g) {
if (!canTick()) {
return;
}
public void apply(Player p, GeneratorAccess g)
{
if(!canTick())
{
return;
}
if (RNG.r.nextInt(chance) != 0) {
return;
}
if(RNG.r.nextInt(chance) != 0)
{
return;
}
if (sound != null) {
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
if(sound != null)
{
Location part = p.getLocation().clone().add(RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance), RNG.r.i(-soundDistance, soundDistance));
J.s(() -> {
p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch));
});
}
J.s(() -> {
p.playSound(part, getSound(), (float) volume, (float) RNG.r.d(minPitch, maxPitch));
});
}
if (particleEffect != null) {
Location part = p.getLocation().clone().add(p.getLocation().getDirection().clone().multiply(RNG.r.i(particleDistance) + particleAway)).clone().add(p.getLocation().getDirection().clone().rotateAroundY(Math.toRadians(90)).multiply(RNG.r.d(-particleDistanceWidth, particleDistanceWidth)));
if(particleEffect != null)
{
Location part = p.getLocation().clone().add(p.getLocation().getDirection().clone().multiply(RNG.r.i(particleDistance) + particleAway)).clone().add(p.getLocation().getDirection().clone().rotateAroundY(Math.toRadians(90)).multiply(RNG.r.d(-particleDistanceWidth, particleDistanceWidth)));
part.setY(Math.round(g.getHeight(part.getBlockX(), part.getBlockZ())) + 1);
part.add(RNG.r.d(), 0, RNG.r.d());
if (extra != 0) {
J.s(() -> {
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset),
part.getZ(),
particleCount,
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ,
extra);
});
} else {
J.s(() -> {
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(),
particleCount,
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ);
});
}
}
part.setY(Math.round(g.getHeight(part.getBlockX(), part.getBlockZ())) + 1);
part.add(RNG.r.d(), 0, RNG.r.d());
if(extra != 0)
{
J.s(() -> {
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset),
part.getZ(),
particleCount,
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ,
extra);
});
}
if (potionStrength > -1) {
if (p.hasPotionEffect(getRealType())) {
PotionEffect e = p.getPotionEffect(getRealType());
if (e.getAmplifier() > getPotionStrength()) {
return;
}
else
{
J.s(() -> {
p.spawnParticle(particleEffect, part.getX(), part.getY() + RNG.r.i(particleOffset), part.getZ(),
particleCount,
randomAltX ? RNG.r.d(-particleAltX, particleAltX) : particleAltX,
randomAltY ? RNG.r.d(-particleAltY, particleAltY) : particleAltY,
randomAltZ ? RNG.r.d(-particleAltZ, particleAltZ) : particleAltZ);
});
}
}
J.s(() -> {
p.removePotionEffect(getRealType());
});
}
if(potionStrength > -1)
{
if(p.hasPotionEffect(getRealType()))
{
PotionEffect e = p.getPotionEffect(getRealType());
if(e.getAmplifier() > getPotionStrength())
{
return;
}
J.s(() -> {
p.removePotionEffect(getRealType());
});
}
J.s(() -> {
p.addPotionEffect(new PotionEffect(getRealType(),
RNG.r.i(Math.min(potionTicksMax, potionTicksMin),
Math.max(potionTicksMax, potionTicksMin)),
getPotionStrength(),
true, false, false));
});
}
}
J.s(() -> {
p.addPotionEffect(new PotionEffect(getRealType(),
RNG.r.i(Math.min(potionTicksMax, potionTicksMin),
Math.max(potionTicksMax, potionTicksMin)),
getPotionStrength(),
true, false, false));
});
}
}
}

View File

@@ -1,95 +1,73 @@
package com.volmit.iris.object;
import java.lang.reflect.Field;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.EnchantmentStorageMeta;
import org.bukkit.inventory.meta.ItemMeta;
import java.lang.reflect.Field;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents an enchantment & level")
@Data
public class IrisEnchantment
{
public class IrisEnchantment {
@Required
@DontObfuscate
@Desc("The enchantment")
private String enchantment = "";
@Required
@DontObfuscate
@Desc("The enchantment")
private String enchantment = "";
@MinNumber(1)
@DontObfuscate
@Desc("Minimum amount of this loot")
private int minLevel = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Minimum amount of this loot")
private int minLevel = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Maximum amount of this loot")
private int maxLevel = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Maximum amount of this loot")
private int maxLevel = 1;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance that this enchantment is applied (0 to 1)")
private double chance = 1;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance that this enchantment is applied (0 to 1)")
private double chance = 1;
public void apply(RNG rng, ItemMeta meta)
{
try
{
if(rng.nextDouble() < chance)
{
if (meta instanceof EnchantmentStorageMeta) {
((EnchantmentStorageMeta) meta).addStoredEnchant(getEnchant(), getLevel(rng), true);
return;
}
meta.addEnchant(getEnchant(), getLevel(rng), true);
}
}
public void apply(RNG rng, ItemMeta meta) {
try {
if (rng.nextDouble() < chance) {
if (meta instanceof EnchantmentStorageMeta) {
((EnchantmentStorageMeta) meta).addStoredEnchant(getEnchant(), getLevel(rng), true);
return;
}
meta.addEnchant(getEnchant(), getLevel(rng), true);
}
} catch (Throwable e) {
catch(Throwable e)
{
}
}
}
}
public Enchantment getEnchant() {
for (Field i : Enchantment.class.getDeclaredFields()) {
if (i.getType().equals(Enchantment.class) && i.getName().equals(getEnchantment())) {
try {
return (Enchantment) i.get(null);
} catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
public Enchantment getEnchant()
{
for(Field i : Enchantment.class.getDeclaredFields())
{
if(i.getType().equals(Enchantment.class) && i.getName().equals(getEnchantment()))
{
try
{
return (Enchantment) i.get(null);
}
return null;
}
catch(IllegalArgumentException | IllegalAccessException e)
{
e.printStackTrace();
}
}
}
return null;
}
public int getLevel(RNG rng)
{
return rng.i(getMinLevel(), getMaxLevel());
}
public int getLevel(RNG rng) {
return rng.i(getMinLevel(), getMaxLevel());
}
}

View File

@@ -31,295 +31,264 @@ import java.util.concurrent.atomic.AtomicReference;
@Desc("Represents an iris entity.")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisEntity extends IrisRegistrant
{
@Required
@DontObfuscate
@Desc("The type of entity to spawn. To spawn a mythic mob, set this type to unknown and define mythic type.")
private EntityType type = EntityType.UNKNOWN;
public class IrisEntity extends IrisRegistrant {
@Required
@DontObfuscate
@Desc("The type of entity to spawn. To spawn a mythic mob, set this type to unknown and define mythic type.")
private EntityType type = EntityType.UNKNOWN;
@RegistryListMythical
@Desc("The type of mythic mob (if mythic mobs is installed). If this is set, make sure to set 'type' to UNKNOWN")
@DontObfuscate
private String mythicalType = "";
@RegistryListMythical
@Desc("The type of mythic mob (if mythic mobs is installed). If this is set, make sure to set 'type' to UNKNOWN")
@DontObfuscate
private String mythicalType = "";
@DontObfuscate
@Desc("The custom name of this entity")
private String customName = "";
@DontObfuscate
@Desc("The custom name of this entity")
private String customName = "";
@DontObfuscate
@Desc("Should the name on this entity be visible even if you arent looking at it.")
private boolean customNameVisible = false;
@DontObfuscate
@Desc("Should the name on this entity be visible even if you arent looking at it.")
private boolean customNameVisible = false;
@DontObfuscate
@Desc("If this entity type is a mob, should it be aware of it's surroundings & interact with the world.")
private boolean aware = true;
@DontObfuscate
@Desc("If this entity type is a mob, should it be aware of it's surroundings & interact with the world.")
private boolean aware = true;
@DontObfuscate
@Desc("If this entity type is a creature, should it have ai goals.")
private boolean ai = true;
@DontObfuscate
@Desc("If this entity type is a creature, should it have ai goals.")
private boolean ai = true;
@DontObfuscate
@Desc("Should this entity be glowing")
private boolean glowing = false;
@DontObfuscate
@Desc("Should this entity be glowing")
private boolean glowing = false;
@DontObfuscate
@Desc("Should gravity apply to this entity")
private boolean gravity = true;
@DontObfuscate
@Desc("Should gravity apply to this entity")
private boolean gravity = true;
@DontObfuscate
@Desc("When an entity is invulnerable it can only be damaged by players increative mode.")
private boolean invulnerable = false;
@DontObfuscate
@Desc("When an entity is invulnerable it can only be damaged by players increative mode.")
private boolean invulnerable = false;
@DontObfuscate
@Desc("When an entity is silent it will not produce any sound.")
private boolean silent = false;
@DontObfuscate
@Desc("When an entity is silent it will not produce any sound.")
private boolean silent = false;
@DontObfuscate
@Desc("Should this entity be allowed to pickup items")
private boolean pickupItems = false;
@DontObfuscate
@Desc("Should this entity be allowed to pickup items")
private boolean pickupItems = false;
@DontObfuscate
@Desc("Should this entity be removed when far away")
private boolean removable = true;
@DontObfuscate
@Desc("Should this entity be removed when far away")
private boolean removable = true;
@DontObfuscate
@Desc("Entity helmet equipment")
private IrisLoot helmet = null;
@DontObfuscate
@Desc("Entity helmet equipment")
private IrisLoot helmet = null;
@DontObfuscate
@Desc("Entity chestplate equipment")
private IrisLoot chestplate = null;
@DontObfuscate
@Desc("Entity chestplate equipment")
private IrisLoot chestplate = null;
@DontObfuscate
@Desc("Entity boots equipment")
private IrisLoot boots = null;
@DontObfuscate
@Desc("Entity boots equipment")
private IrisLoot boots = null;
@DontObfuscate
@Desc("Entity leggings equipment")
private IrisLoot leggings = null;
@DontObfuscate
@Desc("Entity leggings equipment")
private IrisLoot leggings = null;
@DontObfuscate
@Desc("Entity main hand equipment")
private IrisLoot mainHand = null;
@DontObfuscate
@Desc("Entity main hand equipment")
private IrisLoot mainHand = null;
@DontObfuscate
@Desc("Entity off hand equipment")
private IrisLoot offHand = null;
@DontObfuscate
@Desc("Entity off hand equipment")
private IrisLoot offHand = null;
@DontObfuscate
@Desc("Make other entities ride this entity")
@ArrayType(min = 1, type = IrisEntity.class)
private KList<IrisEntity> passengers = new KList<>();
@DontObfuscate
@Desc("Make other entities ride this entity")
@ArrayType(min = 1, type = IrisEntity.class)
private KList<IrisEntity> passengers = new KList<>();
@DontObfuscate
@Desc("Attribute modifiers for this entity")
@ArrayType(min = 1, type = IrisAttributeModifier.class)
private KList<IrisAttributeModifier> attributes = new KList<>();
@DontObfuscate
@Desc("Attribute modifiers for this entity")
@ArrayType(min = 1, type = IrisAttributeModifier.class)
private KList<IrisAttributeModifier> attributes = new KList<>();
@DontObfuscate
@Desc("Loot tables for drops")
private IrisLootReference loot = new IrisLootReference();
@DontObfuscate
@Desc("Loot tables for drops")
private IrisLootReference loot = new IrisLootReference();
@DontObfuscate
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
private IrisEntity leashHolder = null;
@DontObfuscate
@Desc("If specified, this entity will be leashed by this entity. I.e. THIS ENTITY Leashed by SPECIFIED. This has no effect on EnderDragons, Withers, Players, or Bats.Non-living entities excluding leashes will not persist as leashholders.")
private IrisEntity leashHolder = null;
@DontObfuscate
@Desc("The main gene for a panda if the entity type is a panda")
private Gene pandaMainGene = Gene.NORMAL;
@DontObfuscate
@Desc("The main gene for a panda if the entity type is a panda")
private Gene pandaMainGene = Gene.NORMAL;
@DontObfuscate
@Desc("The hidden gene for a panda if the entity type is a panda")
private Gene pandaHiddenGene = Gene.NORMAL;
@DontObfuscate
@Desc("The hidden gene for a panda if the entity type is a panda")
private Gene pandaHiddenGene = Gene.NORMAL;
@DontObfuscate
@Desc("The this entity is ageable, set it's baby status")
private boolean baby = false;
@DontObfuscate
@Desc("The this entity is ageable, set it's baby status")
private boolean baby = false;
public Entity spawn(Engine gen, Location at)
{
return spawn(gen, at, new RNG(at.hashCode()));
}
public Entity spawn(Engine gen, Location at) {
return spawn(gen, at, new RNG(at.hashCode()));
}
public Entity spawn(Engine gen, Location at, RNG rng)
{
Entity e = doSpawn(at);
e.setCustomName(getCustomName() != null ? C.translateAlternateColorCodes('&', getCustomName()) : null);
e.setCustomNameVisible(isCustomNameVisible());
e.setGlowing(isGlowing());
e.setGravity(isGravity());
e.setInvulnerable(isInvulnerable());
e.setSilent(isSilent());
e.setPersistent(true);
public Entity spawn(Engine gen, Location at, RNG rng) {
Entity e = doSpawn(at);
e.setCustomName(getCustomName() != null ? C.translateAlternateColorCodes('&', getCustomName()) : null);
e.setCustomNameVisible(isCustomNameVisible());
e.setGlowing(isGlowing());
e.setGravity(isGravity());
e.setInvulnerable(isInvulnerable());
e.setSilent(isSilent());
e.setPersistent(true);
int gg = 0;
for(IrisEntity i : passengers)
{
e.addPassenger(i.spawn(gen, at, rng.nextParallelRNG(234858 + gg++)));
}
int gg = 0;
for (IrisEntity i : passengers) {
e.addPassenger(i.spawn(gen, at, rng.nextParallelRNG(234858 + gg++)));
}
if(e instanceof Attributable)
{
Attributable a = (Attributable) e;
if (e instanceof Attributable) {
Attributable a = (Attributable) e;
for(IrisAttributeModifier i : getAttributes())
{
i.apply(rng, a);
}
}
for (IrisAttributeModifier i : getAttributes()) {
i.apply(rng, a);
}
}
if(e instanceof Lootable)
{
Lootable l = (Lootable) e;
if (e instanceof Lootable) {
Lootable l = (Lootable) e;
if(getLoot().getTables().isNotEmpty())
{
l.setLootTable(new LootTable()
{
@Override
public NamespacedKey getKey()
{
return new NamespacedKey(Iris.instance, "loot-" + IrisEntity.this.hashCode());
}
if (getLoot().getTables().isNotEmpty()) {
l.setLootTable(new LootTable() {
@Override
public NamespacedKey getKey() {
return new NamespacedKey(Iris.instance, "loot-" + IrisEntity.this.hashCode());
}
@Override
public Collection<ItemStack> populateLoot(Random random, LootContext context)
{
KList<ItemStack> items = new KList<>();
@Override
public Collection<ItemStack> populateLoot(Random random, LootContext context) {
KList<ItemStack> items = new KList<>();
for(String fi : getLoot().getTables())
{
IrisLootTable i = gen.getData().getLootLoader().load(fi);
items.addAll(i.getLoot(gen.isStudio(), false, rng.nextParallelRNG(345911), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), 8, 4));
}
for (String fi : getLoot().getTables()) {
IrisLootTable i = gen.getData().getLootLoader().load(fi);
items.addAll(i.getLoot(gen.isStudio(), false, rng.nextParallelRNG(345911), InventorySlotType.STORAGE, at.getBlockX(), at.getBlockY(), at.getBlockZ(), 8, 4));
}
return items;
}
return items;
}
@Override
public void fillInventory(Inventory inventory, Random random, LootContext context)
{
for(ItemStack i : populateLoot(random, context))
{
inventory.addItem(i);
}
@Override
public void fillInventory(Inventory inventory, Random random, LootContext context) {
for (ItemStack i : populateLoot(random, context)) {
inventory.addItem(i);
}
gen.getCompound().getEngine(at.getBlockY()).scramble(inventory, rng);
}
});
}
}
gen.getCompound().getEngine(at.getBlockY()).scramble(inventory, rng);
}
});
}
}
if(e instanceof LivingEntity)
{
LivingEntity l = (LivingEntity) e;
l.setAI(isAi());
l.setCanPickupItems(isPickupItems());
if (e instanceof LivingEntity) {
LivingEntity l = (LivingEntity) e;
l.setAI(isAi());
l.setCanPickupItems(isPickupItems());
if(getLeashHolder() != null)
{
l.setLeashHolder(getLeashHolder().spawn(gen, at, rng.nextParallelRNG(234548)));
}
if (getLeashHolder() != null) {
l.setLeashHolder(getLeashHolder().spawn(gen, at, rng.nextParallelRNG(234548)));
}
l.setRemoveWhenFarAway(isRemovable());
l.setRemoveWhenFarAway(isRemovable());
if(getHelmet() != null && rng.i(1, getHelmet().getRarity()) == 1)
{
l.getEquipment().setHelmet(getHelmet().get(gen.isStudio(), rng));
}
if (getHelmet() != null && rng.i(1, getHelmet().getRarity()) == 1) {
l.getEquipment().setHelmet(getHelmet().get(gen.isStudio(), rng));
}
if(getChestplate() != null && rng.i(1, getChestplate().getRarity()) == 1)
{
l.getEquipment().setChestplate(getChestplate().get(gen.isStudio(), rng));
}
if (getChestplate() != null && rng.i(1, getChestplate().getRarity()) == 1) {
l.getEquipment().setChestplate(getChestplate().get(gen.isStudio(), rng));
}
if(getLeggings() != null && rng.i(1, getLeggings().getRarity()) == 1)
{
l.getEquipment().setLeggings(getLeggings().get(gen.isStudio(), rng));
}
if (getLeggings() != null && rng.i(1, getLeggings().getRarity()) == 1) {
l.getEquipment().setLeggings(getLeggings().get(gen.isStudio(), rng));
}
if(getBoots() != null && rng.i(1, getBoots().getRarity()) == 1)
{
l.getEquipment().setBoots(getBoots().get(gen.isStudio(), rng));
}
if (getBoots() != null && rng.i(1, getBoots().getRarity()) == 1) {
l.getEquipment().setBoots(getBoots().get(gen.isStudio(), rng));
}
if(getMainHand() != null && rng.i(1, getMainHand().getRarity()) == 1)
{
l.getEquipment().setItemInMainHand(getMainHand().get(gen.isStudio(), rng));
}
if (getMainHand() != null && rng.i(1, getMainHand().getRarity()) == 1) {
l.getEquipment().setItemInMainHand(getMainHand().get(gen.isStudio(), rng));
}
if(getOffHand() != null && rng.i(1, getOffHand().getRarity()) == 1)
{
l.getEquipment().setItemInOffHand(getOffHand().get(gen.isStudio(), rng));
}
}
if (getOffHand() != null && rng.i(1, getOffHand().getRarity()) == 1) {
l.getEquipment().setItemInOffHand(getOffHand().get(gen.isStudio(), rng));
}
}
if(e instanceof Ageable && isBaby())
{
((Ageable) e).setBaby();
}
if (e instanceof Ageable && isBaby()) {
((Ageable) e).setBaby();
}
if(e instanceof Panda)
{
((Panda) e).setMainGene(getPandaMainGene());
((Panda) e).setMainGene(getPandaHiddenGene());
}
if (e instanceof Panda) {
((Panda) e).setMainGene(getPandaMainGene());
((Panda) e).setMainGene(getPandaHiddenGene());
}
if (e instanceof Villager) {
Villager villager = (Villager) e;
villager.setRemoveWhenFarAway(false);
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> {
villager.setPersistent(true);
villager.setCustomName(" ");
villager.setCustomNameVisible(false);
},1);
}
if (e instanceof Villager) {
Villager villager = (Villager) e;
villager.setRemoveWhenFarAway(false);
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> {
villager.setPersistent(true);
villager.setCustomName(" ");
villager.setCustomNameVisible(false);
}, 1);
}
if(Iris.awareEntities && e instanceof Mob)
{
Mob m = (Mob) e;
m.setAware(isAware());
}
if (Iris.awareEntities && e instanceof Mob) {
Mob m = (Mob) e;
m.setAware(isAware());
}
return e;
}
return e;
}
private Entity doSpawn(Location at)
{
if(!Bukkit.isPrimaryThread())
{
// Someone called spawn (worldedit maybe?) on a non server thread
// Due to the structure of iris, we will call it sync and busy wait until it's done.
AtomicReference<Entity> ae = new AtomicReference<>();
J.s(() -> ae.set(doSpawn(at)));
PrecisionStopwatch p = PrecisionStopwatch.start();
private Entity doSpawn(Location at) {
if (!Bukkit.isPrimaryThread()) {
// Someone called spawn (worldedit maybe?) on a non server thread
// Due to the structure of iris, we will call it sync and busy wait until it's done.
AtomicReference<Entity> ae = new AtomicReference<>();
J.s(() -> ae.set(doSpawn(at)));
PrecisionStopwatch p = PrecisionStopwatch.start();
while(ae == null)
{
J.sleep(3);
}
while (ae == null) {
J.sleep(3);
}
return ae.get();
}
return ae.get();
}
if(isMythical())
{
return Iris.linkMythicMobs.spawn(getMythicalType(), at);
}
if (isMythical()) {
return Iris.linkMythicMobs.spawn(getMythicalType(), at);
}
return at.getWorld().spawnEntity(at, getType());
}
return at.getWorld().spawnEntity(at, getType());
}
public boolean isMythical()
{
return Iris.linkMythicMobs.supported() && !getMythicalType().trim().isEmpty();
}
public boolean isMythical() {
return Iris.linkMythicMobs.supported() && !getMythicalType().trim().isEmpty();
}
public boolean isCitizens()
{
return false;
public boolean isCitizens() {
return false;
// TODO: return Iris.linkCitizens.supported() && someType is not empty;
}
// TODO: return Iris.linkCitizens.supported() && someType is not empty;
}
}

View File

@@ -16,70 +16,61 @@ import org.bukkit.entity.Entity;
@AllArgsConstructor
@Desc("Represents an entity spawn during initial chunk generation")
@Data
public class IrisEntityInitialSpawn
{
@RegistryListEntity
@Required
@DontObfuscate
@Desc("The entity")
private String entity = "";
public class IrisEntityInitialSpawn {
@RegistryListEntity
@Required
@DontObfuscate
@Desc("The entity")
private String entity = "";
@MinNumber(1)
@DontObfuscate
@Desc("The 1 in RARITY chance for this entity to spawn")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The 1 in RARITY chance for this entity to spawn")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The minumum of this entity to spawn")
private int minSpawns = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The minumum of this entity to spawn")
private int minSpawns = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The max of this entity to spawn")
private int maxSpawns = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The max of this entity to spawn")
private int maxSpawns = 1;
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
public void spawn(Engine gen, Chunk c, RNG rng)
{
int spawns = rng.i(1, rarity) == 1 ? rng.i(minSpawns, maxSpawns) : 0;
public void spawn(Engine gen, Chunk c, RNG rng) {
int spawns = rng.i(1, rarity) == 1 ? rng.i(minSpawns, maxSpawns) : 0;
if(spawns > 0)
{
for(int i = 0; i < spawns; i++)
{
int x = (c.getX() * 16) + rng.i(15);
int z = (c.getZ() * 16) + rng.i(15);
int h = gen.getHeight(x, z) + gen.getMinHeight();
spawn100(gen, new Location(c.getWorld(), x, h, z));
}
}
}
if (spawns > 0) {
for (int i = 0; i < spawns; i++) {
int x = (c.getX() * 16) + rng.i(15);
int z = (c.getZ() * 16) + rng.i(15);
int h = gen.getHeight(x, z) + gen.getMinHeight();
spawn100(gen, new Location(c.getWorld(), x, h, z));
}
}
}
public IrisEntity getRealEntity(Engine g)
{
return ent.aquire(() -> g.getData().getEntityLoader().load(getEntity()));
}
public IrisEntity getRealEntity(Engine g) {
return ent.aquire(() -> g.getData().getEntityLoader().load(getEntity()));
}
public Entity spawn(Engine g, Location at)
{
if(getRealEntity(g) == null)
{
return null;
}
public Entity spawn(Engine g, Location at) {
if (getRealEntity(g) == null) {
return null;
}
if(rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1)
{
return spawn100(g, at);
}
if (rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1) {
return spawn100(g, at);
}
return null;
}
return null;
}
private Entity spawn100(Engine g, Location at)
{
return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
}
private Entity spawn100(Engine g, Location at) {
return getRealEntity(g).spawn(g, at.clone().add(0.5, 1, 0.5), rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
}
}

View File

@@ -17,74 +17,65 @@ import org.bukkit.event.entity.EntitySpawnEvent;
@AllArgsConstructor
@Desc("Represents an entity spawn")
@Data
public class IrisEntitySpawnOverride
{
@RegistryListEntity
@Required
@DontObfuscate
@Desc("The entity")
private String entity = "";
public class IrisEntitySpawnOverride {
@Required
@DontObfuscate
@Desc("If the following entity type spawns, spawn this entity. Set to unknown for any entity spawn")
private EntityType trigger = EntityType.UNKNOWN;
@DontObfuscate
@Desc("If the source is triggered, cancel spawning the original entity instead of ADDING a new entity.")
private boolean cancelSourceSpawn = false;
@MinNumber(1)
@DontObfuscate
@Desc("The 1 in RARITY chance for this entity to spawn")
private int rarity = 1;
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
@RegistryListEntity
@Required
@DontObfuscate
@Desc("The entity")
private String entity = "";
public Entity on(Engine g, Location at, EntityType t, EntitySpawnEvent ee)
{
if(!trigger.equals(EntityType.UNKNOWN))
{
if(!trigger.equals(t))
{
return null;
}
}
@Required
@DontObfuscate
@Desc("If the following entity type spawns, spawn this entity. Set to unknown for any entity spawn")
private EntityType trigger = EntityType.UNKNOWN;
Entity e = spawn(g, at);
if(e != null && isCancelSourceSpawn())
{
ee.setCancelled(true);
ee.getEntity().remove();
}
@DontObfuscate
@Desc("If the source is triggered, cancel spawning the original entity instead of ADDING a new entity.")
private boolean cancelSourceSpawn = false;
return e;
}
public Entity spawn(Engine g, Location at)
{
if(getRealEntity(g) == null)
{
return null;
}
@MinNumber(1)
@DontObfuscate
@Desc("The 1 in RARITY chance for this entity to spawn")
private int rarity = 1;
if(rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1)
{
return getRealEntity(g).spawn(g, at, rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
}
private final transient AtomicCache<RNG> rng = new AtomicCache<>();
private final transient AtomicCache<IrisEntity> ent = new AtomicCache<>();
return null;
}
public IrisEntity getRealEntity(Engine g)
{
return ent.aquire(() -> g.getData().getEntityLoader().load(getEntity()));
}
public Entity on(Engine g, Location at, EntityType t, EntitySpawnEvent ee) {
if (!trigger.equals(EntityType.UNKNOWN)) {
if (!trigger.equals(t)) {
return null;
}
}
Entity e = spawn(g, at);
if (e != null && isCancelSourceSpawn()) {
ee.setCancelled(true);
ee.getEntity().remove();
}
return e;
}
public Entity spawn(Engine g, Location at) {
if (getRealEntity(g) == null) {
return null;
}
if (rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)).i(1, getRarity()) == 1) {
return getRealEntity(g).spawn(g, at, rng.aquire(() -> new RNG(g.getTarget().getWorld().getSeed() + 4)));
}
return null;
}
public IrisEntity getRealEntity(Engine g) {
return ent.aquire(() -> g.getData().getEntityLoader().load(getEntity()));
}
}

View File

@@ -73,13 +73,12 @@ public class IrisFeature {
private transient AtomicCache<Double> actualRadius = new AtomicCache<>();
public double getActualRadius()
{
return actualRadius.aquire(() -> IrisInterpolation.getRealRadius(getInterpolator(),getInterpolationRadius()));
public double getActualRadius() {
return actualRadius.aquire(() -> IrisInterpolation.getRealRadius(getInterpolator(), getInterpolationRadius()));
}
public static IrisFeature read(DataInputStream s) throws IOException
{
public static IrisFeature read(DataInputStream s) throws IOException {
return new Gson().fromJson(s.readUTF(), IrisFeature.class);
}

View File

@@ -15,8 +15,7 @@ import java.io.IOException;
@NoArgsConstructor
@Desc("Represents an Iris zone")
public class IrisFeaturePositional {
public IrisFeaturePositional(int x, int z, IrisFeature feature)
{
public IrisFeaturePositional(int x, int z, IrisFeature feature) {
this.x = x;
this.z = z;
this.feature = feature;
@@ -40,8 +39,7 @@ public class IrisFeaturePositional {
private transient AtomicCache<NoiseProvider> provider = new AtomicCache<>();
private static double BLOCK = 1D / 256D; // TODO: WARNING HEIGHT
public static IrisFeaturePositional read(DataInputStream s) throws IOException
{
public static IrisFeaturePositional read(DataInputStream s) throws IOException {
return new Gson().fromJson(s.readUTF(), IrisFeaturePositional.class);
}
@@ -49,60 +47,45 @@ public class IrisFeaturePositional {
s.writeUTF(new Gson().toJson(this));
}
public boolean shouldFilter(double x, double z)
{
public boolean shouldFilter(double x, double z) {
double actualRadius = getFeature().getActualRadius();
double dist2 = distance2(x, z);
if(getFeature().isInvertZone()) {
if (getFeature().isInvertZone()) {
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
return false;
}
}
if(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2))
{
return false;
}
return true;
return !(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2));
}
public double getStrength(double x, double z)
{
public double getStrength(double x, double z) {
double actualRadius = getFeature().getActualRadius();
double dist2 = distance2(x, z);
if(getFeature().isInvertZone())
{
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2))
{
if (getFeature().isInvertZone()) {
if (dist2 < Math.pow(getFeature().getBlockRadius() - actualRadius, 2)) {
return 0;
}
NoiseProvider d = provider.aquire(this::getNoiseProvider);
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int)x, (int)z, getFeature().getInterpolationRadius(), d);
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int) x, (int) z, getFeature().getInterpolationRadius(), d);
if(s <= 0)
{
if (s <= 0) {
return 0;
}
return getFeature().getStrength() * s;
}
else
{
if(dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2))
{
} else {
if (dist2 > Math.pow(getFeature().getBlockRadius() + actualRadius, 2)) {
return 0;
}
NoiseProvider d = provider.aquire(this::getNoiseProvider);
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int)x, (int)z, getFeature().getInterpolationRadius(), d);
double s = IrisInterpolation.getNoise(getFeature().getInterpolator(), (int) x, (int) z, getFeature().getInterpolationRadius(), d);
if(s <= 0)
{
if (s <= 0) {
return 0;
}
@@ -110,10 +93,8 @@ public class IrisFeaturePositional {
}
}
public double getObjectChanceModifier(double x, double z)
{
if(getFeature().getObjectChance()>=1)
{
public double getObjectChanceModifier(double x, double z) {
if (getFeature().getObjectChance() >= 1) {
return getFeature().getObjectChance();
}
@@ -123,15 +104,13 @@ public class IrisFeaturePositional {
public double filter(double x, double z, double noise) {
double s = getStrength(x, z);
if(s <= 0)
{
if (s <= 0) {
return noise;
}
double fx = noise;
if(getFeature().getConvergeToHeight() >= 0)
{
if (getFeature().getConvergeToHeight() >= 0) {
fx = getFeature().getConvergeToHeight();
}
@@ -150,13 +129,9 @@ public class IrisFeaturePositional {
}
private NoiseProvider getNoiseProvider() {
if(getFeature().isInvertZone())
{
if (getFeature().isInvertZone()) {
return (x, z) -> distance(x, z) > getFeature().getBlockRadius() ? 1D : 0D;
}
else
{
} else {
return (x, z) -> distance(x, z) < getFeature().getBlockRadius() ? 1D : 0D;
}
}

View File

@@ -19,8 +19,7 @@ public class IrisFeaturePotential {
@Desc("")
private IrisFeature zone = new IrisFeature();
public boolean hasZone(RNG rng, int cx, int cz)
{
public boolean hasZone(RNG rng, int cx, int cz) {
return rng.nextInt(rarity) == 0;
}
}

View File

@@ -1,328 +1,274 @@
package com.volmit.iris.object;
import java.util.List;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CellGenerator;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IRare;
import com.volmit.iris.util.IrisInterpolation;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.List;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents a composite generator of noise gens")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisGenerator extends IrisRegistrant
{
@MinNumber(0.001)
@DontObfuscate
@Desc("The zoom or frequency.")
private double zoom = 1;
public class IrisGenerator extends IrisRegistrant {
@MinNumber(0.001)
@DontObfuscate
@Desc("The zoom or frequency.")
private double zoom = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The opacity, essentially a multiplier on the output.")
private double opacity = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The opacity, essentially a multiplier on the output.")
private double opacity = 1;
@DontObfuscate
@Desc("Multiply the compsites instead of adding them")
private boolean multiplicitive = false;
@DontObfuscate
@Desc("Multiply the compsites instead of adding them")
private boolean multiplicitive = false;
@MinNumber(0.001)
@DontObfuscate
@Desc("The size of the cell fractures")
private double cellFractureZoom = 1D;
@MinNumber(0.001)
@DontObfuscate
@Desc("The size of the cell fractures")
private double cellFractureZoom = 1D;
@MinNumber(0)
@DontObfuscate
@Desc("Cell Fracture Coordinate Shuffling")
private double cellFractureShuffle = 12D;
@MinNumber(0)
@DontObfuscate
@Desc("Cell Fracture Coordinate Shuffling")
private double cellFractureShuffle = 12D;
@DontObfuscate
@Desc("The height of fracture cells. Set to 0 to disable")
private double cellFractureHeight = 0D;
@DontObfuscate
@Desc("The height of fracture cells. Set to 0 to disable")
private double cellFractureHeight = 0D;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("How big are the cells (X,Z) relative to the veins that touch them. Between 0 and 1. 0.1 means thick veins, small cells.")
private double cellPercentSize = 0.75D;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("How big are the cells (X,Z) relative to the veins that touch them. Between 0 and 1. 0.1 means thick veins, small cells.")
private double cellPercentSize = 0.75D;
@DontObfuscate
@Desc("The offset to shift this noise x")
private double offsetX = 0;
@DontObfuscate
@Desc("The offset to shift this noise x")
private double offsetX = 0;
@DontObfuscate
@Desc("The offset to shift this noise z")
private double offsetZ = 0;
@DontObfuscate
@Desc("The offset to shift this noise z")
private double offsetZ = 0;
@Required
@DontObfuscate
@Desc("The seed for this generator")
private long seed = 1;
@Required
@DontObfuscate
@Desc("The seed for this generator")
private long seed = 1;
@Required
@DontObfuscate
@Desc("The interpolator to use when smoothing this generator into other regions & generators")
private IrisInterpolator interpolator = new IrisInterpolator();
@Required
@DontObfuscate
@Desc("The interpolator to use when smoothing this generator into other regions & generators")
private IrisInterpolator interpolator = new IrisInterpolator();
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Cliff Height Max. Disable with 0 for min and max")
private double cliffHeightMax = 0;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Cliff Height Max. Disable with 0 for min and max")
private double cliffHeightMax = 0;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Cliff Height Min. Disable with 0 for min and max")
private double cliffHeightMin = 0;
@MinNumber(0)
@MaxNumber(8192)
@DontObfuscate
@Desc("Cliff Height Min. Disable with 0 for min and max")
private double cliffHeightMin = 0;
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
@DontObfuscate
@Desc("The list of noise gens this gen contains.")
private KList<IrisNoiseGenerator> composite = new KList<IrisNoiseGenerator>();
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
@DontObfuscate
@Desc("The list of noise gens this gen contains.")
private KList<IrisNoiseGenerator> composite = new KList<IrisNoiseGenerator>();
@DontObfuscate
@Desc("The noise gen for cliff height.")
private IrisNoiseGenerator cliffHeightGenerator = new IrisNoiseGenerator();
@DontObfuscate
@Desc("The noise gen for cliff height.")
private IrisNoiseGenerator cliffHeightGenerator = new IrisNoiseGenerator();
private final transient AtomicCache<CellGenerator> cellGen = new AtomicCache<>();
private final transient AtomicCache<CellGenerator> cellGen = new AtomicCache<>();
public double getMax()
{
return opacity;
}
public double getMax() {
return opacity;
}
public boolean hasCliffs()
{
return cliffHeightMax > 0;
}
public boolean hasCliffs() {
return cliffHeightMax > 0;
}
public CellGenerator getCellGenerator(long seed)
{
return cellGen.aquire(() -> new CellGenerator(new RNG(seed + 239466)));
}
public CellGenerator getCellGenerator(long seed) {
return cellGen.aquire(() -> new CellGenerator(new RNG(seed + 239466)));
}
public <T extends IRare> T fitRarity(KList<T> b, long superSeed, double rx, double rz)
{
if(b.size() == 0)
{
return null;
}
public <T extends IRare> T fitRarity(KList<T> b, long superSeed, double rx, double rz) {
if (b.size() == 0) {
return null;
}
if(b.size() == 1)
{
return b.get(0);
}
if (b.size() == 1) {
return b.get(0);
}
KList<T> rarityMapped = new KList<>();
boolean o = false;
int max = 1;
for(T i : b)
{
if(i.getRarity() > max)
{
max = i.getRarity();
}
}
KList<T> rarityMapped = new KList<>();
boolean o = false;
int max = 1;
for (T i : b) {
if (i.getRarity() > max) {
max = i.getRarity();
}
}
max++;
max++;
for(T i : b)
{
for(int j = 0; j < max - i.getRarity(); j++)
{
if(o = !o)
{
rarityMapped.add(i);
}
for (T i : b) {
for (int j = 0; j < max - i.getRarity(); j++) {
if (o = !o) {
rarityMapped.add(i);
} else {
rarityMapped.add(0, i);
}
}
}
else
{
rarityMapped.add(0, i);
}
}
}
if (rarityMapped.size() == 1) {
return rarityMapped.get(0);
}
if(rarityMapped.size() == 1)
{
return rarityMapped.get(0);
}
if (rarityMapped.isEmpty()) {
throw new RuntimeException("BAD RARITY MAP! RELATED TO: " + b.toString(", or possibly "));
}
if(rarityMapped.isEmpty())
{
throw new RuntimeException("BAD RARITY MAP! RELATED TO: " + b.toString(", or possibly "));
}
return fit(rarityMapped, superSeed, rx, rz);
}
return fit(rarityMapped, superSeed, rx, rz);
}
public <T> T fit(T[] v, long superSeed, double rx, double rz) {
if (v.length == 0) {
return null;
}
public <T> T fit(T[] v, long superSeed, double rx, double rz)
{
if(v.length == 0)
{
return null;
}
if (v.length == 1) {
return v[0];
}
if(v.length == 1)
{
return v[0];
}
return v[fit(0, v.length - 1, superSeed, rx, rz)];
}
return v[fit(0, v.length - 1, superSeed, rx, rz)];
}
public <T> T fit(List<T> v, long superSeed, double rx, double rz) {
if (v.size() == 0) {
return null;
}
public <T> T fit(List<T> v, long superSeed, double rx, double rz)
{
if(v.size() == 0)
{
return null;
}
if (v.size() == 1) {
return v.get(0);
}
if(v.size() == 1)
{
return v.get(0);
}
return v.get(fit(0, v.size() - 1, superSeed, rx, rz));
}
return v.get(fit(0, v.size() - 1, superSeed, rx, rz));
}
public int fit(int min, int max, long superSeed, double rx, double rz) {
if (min == max) {
return min;
}
public int fit(int min, int max, long superSeed, double rx, double rz)
{
if(min == max)
{
return min;
}
double noise = getHeight(rx, rz, superSeed);
double noise = getHeight(rx, rz, superSeed);
return (int) Math.round(IrisInterpolation.lerp(min, max, noise));
}
return (int) Math.round(IrisInterpolation.lerp(min, max, noise));
}
public int fit(double min, double max, long superSeed, double rx, double rz) {
if (min == max) {
return (int) Math.round(min);
}
public int fit(double min, double max, long superSeed, double rx, double rz)
{
if(min == max)
{
return (int) Math.round(min);
}
double noise = getHeight(rx, rz, superSeed);
double noise = getHeight(rx, rz, superSeed);
return (int) Math.round(IrisInterpolation.lerp(min, max, noise));
}
return (int) Math.round(IrisInterpolation.lerp(min, max, noise));
}
public double fitDouble(double min, double max, long superSeed, double rx, double rz) {
if (min == max) {
return min;
}
public double fitDouble(double min, double max, long superSeed, double rx, double rz)
{
if(min == max)
{
return min;
}
double noise = getHeight(rx, rz, superSeed);
double noise = getHeight(rx, rz, superSeed);
return IrisInterpolation.lerp(min, max, noise);
}
return IrisInterpolation.lerp(min, max, noise);
}
public double getHeight(double rx, double rz, long superSeed) {
return getHeight(rx, 0, rz, superSeed);
}
public double getHeight(double rx, double rz, long superSeed)
{
return getHeight(rx, 0, rz, superSeed);
}
public double getHeight(double rx, double ry, double rz, long superSeed) {
if (composite.isEmpty()) {
Iris.warn("Useless Generator: Composite is empty in " + getLoadKey());
return 0;
}
public double getHeight(double rx, double ry, double rz, long superSeed)
{
if(composite.isEmpty())
{
Iris.warn("Useless Generator: Composite is empty in " + getLoadKey());
return 0;
}
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
double h = 0;
double tp = multiplicitive ? 1 : 0;
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
double h = 0;
double tp = multiplicitive ? 1 : 0;
for (IrisNoiseGenerator i : composite) {
if (multiplicitive) {
tp *= i.getOpacity();
h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
} else {
tp += i.getOpacity();
h += i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
}
}
for(IrisNoiseGenerator i : composite)
{
if(multiplicitive)
{
tp *= i.getOpacity();
h *= i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
}
double v = multiplicitive ? h * opacity : (h / tp) * opacity;
else
{
tp += i.getOpacity();
h += i.getNoise(seed + superSeed + hc, (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
}
}
if (Double.isNaN(v)) {
Iris.warn("Nan value on gen: " + getLoadKey() + ": H = " + h + " TP = " + tp + " OPACITY = " + opacity + " ZOOM = " + zoom);
}
double v = multiplicitive ? h * opacity : (h / tp) * opacity;
v = hasCliffs() ? cliff(rx, rz, v, superSeed + 294596 + hc) : v;
v = hasCellCracks() ? cell(rx, rz, v, superSeed + 48622 + hc) : v;
if(Double.isNaN(v))
{
Iris.warn("Nan value on gen: " + getLoadKey() + ": H = " + h + " TP = " + tp + " OPACITY = " + opacity + " ZOOM = " + zoom);
}
return v;
}
v = hasCliffs() ? cliff(rx, rz, v, superSeed + 294596 + hc) : v;
v = hasCellCracks() ? cell(rx, rz, v, superSeed + 48622 + hc) : v;
public double cell(double rx, double rz, double v, double superSeed) {
getCellGenerator(seed + 46222).setShuffle(getCellFractureShuffle());
return getCellGenerator(seed + 46222).getDistance(rx / getCellFractureZoom(), rz / getCellFractureZoom()) > getCellPercentSize() ? (v * getCellFractureHeight()) : v;
}
return v;
}
private boolean hasCellCracks() {
return getCellFractureHeight() != 0;
}
public double cell(double rx, double rz, double v, double superSeed)
{
getCellGenerator(seed + 46222).setShuffle(getCellFractureShuffle());
return getCellGenerator(seed + 46222).getDistance(rx / getCellFractureZoom(), rz / getCellFractureZoom()) > getCellPercentSize() ? (v * getCellFractureHeight()) : v;
}
public double getCliffHeight(double rx, double rz, double superSeed) {
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
double h = cliffHeightGenerator.getNoise((long) (seed + superSeed + hc), (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
return IrisInterpolation.lerp(cliffHeightMin, cliffHeightMax, h);
}
private boolean hasCellCracks()
{
return getCellFractureHeight() != 0;
}
public double cliff(double rx, double rz, double v, double superSeed) {
double cliffHeight = getCliffHeight(rx, rz, superSeed - 34857);
return (Math.round((v * 255D) / cliffHeight) * cliffHeight) / 255D;
}
public double getCliffHeight(double rx, double rz, double superSeed)
{
int hc = (int) ((cliffHeightMin * 10) + 10 + cliffHeightMax * seed + offsetX + offsetZ);
double h = cliffHeightGenerator.getNoise((long) (seed + superSeed + hc), (rx + offsetX) / zoom, (rz + offsetZ) / zoom);
return IrisInterpolation.lerp(cliffHeightMin, cliffHeightMax, h);
}
public IrisGenerator rescale(double scale) {
zoom /= scale;
return this;
}
public double cliff(double rx, double rz, double v, double superSeed)
{
double cliffHeight = getCliffHeight(rx, rz, superSeed - 34857);
return (Math.round((v * 255D) / cliffHeight) * cliffHeight) / 255D;
}
public KList<IrisNoiseGenerator> getAllComposites() {
KList<IrisNoiseGenerator> g = new KList<>();
public IrisGenerator rescale(double scale)
{
zoom /= scale;
return this;
}
for (IrisNoiseGenerator i : composite) {
g.addAll(i.getAllComposites());
}
public KList<IrisNoiseGenerator> getAllComposites() {
KList<IrisNoiseGenerator> g = new KList<>();
for(IrisNoiseGenerator i : composite)
{
g.addAll(i.getAllComposites());
}
return g;
}
return g;
}
}

View File

@@ -1,14 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -19,69 +13,63 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("A gen style")
@Data
public class IrisGeneratorStyle
{
public class IrisGeneratorStyle {
@Required
@DontObfuscate
@Desc("The chance is 1 in CHANCE per interval")
private NoiseStyle style = NoiseStyle.IRIS;
@Required
@DontObfuscate
@Desc("The chance is 1 in CHANCE per interval")
private NoiseStyle style = NoiseStyle.IRIS;
@DontObfuscate
@MinNumber(0.00001)
@Desc("The zoom of this style")
private double zoom = 1;
@DontObfuscate
@MinNumber(0.00001)
@Desc("The zoom of this style")
private double zoom = 1;
@DontObfuscate
@MinNumber(0.00001)
@Desc("The Output multiplier. Only used if parent is fracture.")
private double multiplier = 1;
@DontObfuscate
@MinNumber(0.00001)
@Desc("The Output multiplier. Only used if parent is fracture.")
private double multiplier = 1;
@DontObfuscate
@Desc("If set to true, each dimension will be fractured with a different order of input coordinates. This is usually 2 or 3 times slower than normal.")
private boolean maxFractureAccuracy = false;
@DontObfuscate
@Desc("If set to true, each dimension will be fractured with a different order of input coordinates. This is usually 2 or 3 times slower than normal.")
private boolean maxFractureAccuracy = false;
@DontObfuscate
@Desc("Apply a generator to the coordinate field fed into this parent generator. I.e. Distort your generator with another generator.")
private IrisGeneratorStyle fracture = null;
@DontObfuscate
@Desc("Apply a generator to the coordinate field fed into this parent generator. I.e. Distort your generator with another generator.")
private IrisGeneratorStyle fracture = null;
@DontObfuscate
@MinNumber(0.01562)
@MaxNumber(64)
@Desc("The exponent")
private double exponent = 1;
@DontObfuscate
@MinNumber(0.01562)
@MaxNumber(64)
@Desc("The exponent")
private double exponent = 1;
private final transient AtomicCache<CNG> cng = new AtomicCache<CNG>();
private final transient AtomicCache<CNG> cng = new AtomicCache<CNG>();
public IrisGeneratorStyle(NoiseStyle s)
{
this.style = s;
}
public IrisGeneratorStyle(NoiseStyle s) {
this.style = s;
}
public IrisGeneratorStyle zoomed(double z)
{
this.zoom = z;
return this;
}
public IrisGeneratorStyle zoomed(double z) {
this.zoom = z;
return this;
}
public CNG create(RNG rng)
{
return cng.aquire(() ->
{
CNG cng = style.create(rng).bake().scale(1D / zoom).pow(exponent).bake();
cng.setTrueFracturing(maxFractureAccuracy);
public CNG create(RNG rng) {
return cng.aquire(() ->
{
CNG cng = style.create(rng).bake().scale(1D / zoom).pow(exponent).bake();
cng.setTrueFracturing(maxFractureAccuracy);
if(fracture != null)
{
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934)), fracture.getMultiplier());
}
if (fracture != null) {
cng.fractureWith(fracture.create(rng.nextParallelRNG(2934)), fracture.getMultiplier());
}
return cng;
});
}
return cng;
});
}
public boolean isFlat()
{
return style.equals(NoiseStyle.FLAT);
}
public boolean isFlat() {
return style.equals(NoiseStyle.FLAT);
}
}

View File

@@ -1,13 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IrisInterpolation;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.NoiseProvider;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -18,28 +11,25 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Configures rotation for iris")
@Data
public class IrisInterpolator
{
public class IrisInterpolator {
@Required
@DontObfuscate
@Desc("The interpolation method when two biomes use different heights but this same generator")
private InterpolationMethod function = InterpolationMethod.BICUBIC;
@Required
@DontObfuscate
@Desc("The interpolation method when two biomes use different heights but this same generator")
private InterpolationMethod function = InterpolationMethod.BICUBIC;
@Required
@MinNumber(1)
@MaxNumber(8192)
@DontObfuscate
@Desc("The range checked horizontally. Smaller ranges yeild more detail but are not as smooth.")
private double horizontalScale = 3;
@Required
@MinNumber(1)
@MaxNumber(8192)
@DontObfuscate
@Desc("The range checked horizontally. Smaller ranges yeild more detail but are not as smooth.")
private double horizontalScale = 3;
public double interpolate(double x, double z, NoiseProvider provider)
{
return interpolate((int) Math.round(x), (int) Math.round(z), provider);
}
public double interpolate(double x, double z, NoiseProvider provider) {
return interpolate((int) Math.round(x), (int) Math.round(z), provider);
}
public double interpolate(int x, int z, NoiseProvider provider)
{
return IrisInterpolation.getNoise(getFunction(), x, z, getHorizontalScale(), provider);
}
public double interpolate(int x, int z, NoiseProvider provider) {
return IrisInterpolation.getNoise(getFunction(), x, z, getHorizontalScale(), provider);
}
}

View File

@@ -18,89 +18,84 @@ import java.io.IOException;
@Desc("Represents a structure tile")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisJigsawPiece extends IrisRegistrant
{
@RegistryListObject
@Required
@DontObfuscate
@Desc("The object this piece represents")
private String object = "";
public class IrisJigsawPiece extends IrisRegistrant {
@RegistryListObject
@Required
@DontObfuscate
@Desc("The object this piece represents")
private String object = "";
@Required
@DontObfuscate
@ArrayType(type = IrisJigsawPieceConnector.class, min = 1)
@Desc("The connectors this object contains")
private KList<IrisJigsawPieceConnector> connectors = new KList<>();
@Required
@DontObfuscate
@ArrayType(type = IrisJigsawPieceConnector.class, min = 1)
@Desc("The connectors this object contains")
private KList<IrisJigsawPieceConnector> connectors = new KList<>();
@Desc("Configure everything about the object placement. Please don't define this unless you actually need it as using this option will slow down the jigsaw deign stage. Use this where you need it, just avoid using it everywhere to keep things fast.")
@DontObfuscate
private IrisObjectPlacement placementOptions = new IrisObjectPlacement().setMode(ObjectPlaceMode.FAST_MAX_HEIGHT);
@Desc("Configure everything about the object placement. Please don't define this unless you actually need it as using this option will slow down the jigsaw deign stage. Use this where you need it, just avoid using it everywhere to keep things fast.")
@DontObfuscate
private IrisObjectPlacement placementOptions = new IrisObjectPlacement().setMode(ObjectPlaceMode.FAST_MAX_HEIGHT);
private transient AtomicCache<Integer> max2dDim = new AtomicCache<>();
private transient AtomicCache<Integer> max3dDim = new AtomicCache<>();
private transient AtomicCache<Integer> max2dDim = new AtomicCache<>();
private transient AtomicCache<Integer> max3dDim = new AtomicCache<>();
public int getMax2dDimension() {
return max2dDim.aquire(() -> {
try {
BlockVector v = IrisObject.sampleSize(getLoader().getObjectLoader().findFile(getObject()));
return Math.max(v.getBlockX(), v.getBlockZ());
} catch (IOException e) {
e.printStackTrace();
}
public int getMax2dDimension() {
return max2dDim.aquire(() -> {
try {
BlockVector v = IrisObject.sampleSize(getLoader().getObjectLoader().findFile(getObject()));
return Math.max(v.getBlockX(), v.getBlockZ());
} catch (IOException e) {
e.printStackTrace();
}
return 0;
});
}
return 0;
});
}
public int getMax3dDimension() {
return max3dDim.aquire(() -> {
try {
BlockVector v = IrisObject.sampleSize(getLoader().getObjectLoader().findFile(getObject()));
return Math.max(Math.max(v.getBlockX(), v.getBlockZ()), v.getBlockY());
} catch (IOException e) {
e.printStackTrace();
}
public int getMax3dDimension() {
return max3dDim.aquire(() -> {
try {
BlockVector v = IrisObject.sampleSize(getLoader().getObjectLoader().findFile(getObject()));
return Math.max(Math.max(v.getBlockX(), v.getBlockZ()), v.getBlockY());
} catch (IOException e) {
e.printStackTrace();
}
return -1;
});
}
return -1;
});
}
public IrisJigsawPieceConnector getConnector(IrisPosition relativePosition) {
for (IrisJigsawPieceConnector i : connectors) {
if (i.getPosition().equals(relativePosition)) {
return i;
}
}
public IrisJigsawPieceConnector getConnector(IrisPosition relativePosition) {
for(IrisJigsawPieceConnector i : connectors)
{
if(i.getPosition().equals(relativePosition))
{
return i;
}
}
return null;
}
return null;
}
public IrisJigsawPiece copy() {
IrisJigsawPiece p = new IrisJigsawPiece();
p.setObject(getObject());
p.setLoader(getLoader());
p.setLoadKey(getLoadKey());
p.setLoadFile(getLoadFile());
p.setConnectors(new KList<>());
p.setPlacementOptions(getPlacementOptions());
public IrisJigsawPiece copy() {
IrisJigsawPiece p = new IrisJigsawPiece();
p.setObject(getObject());
p.setLoader(getLoader());
p.setLoadKey(getLoadKey());
p.setLoadFile(getLoadFile());
p.setConnectors(new KList<>());
p.setPlacementOptions(getPlacementOptions());
for (IrisJigsawPieceConnector i : getConnectors()) {
p.getConnectors().add(i.copy());
}
for(IrisJigsawPieceConnector i : getConnectors())
{
p.getConnectors().add(i.copy());
}
return p;
}
return p;
}
public boolean isTerminal() {
return connectors.size() == 1;
}
public boolean isTerminal() {
return connectors.size() == 1;
}
public ObjectPlaceMode getPlaceMode() {
return getPlacementOptions().getMode();
}
public ObjectPlaceMode getPlaceMode() {
return getPlacementOptions().getMode();
}
}

View File

@@ -14,77 +14,75 @@ import lombok.experimental.Accessors;
@Desc("Represents a structure tile")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisJigsawPieceConnector
{
@Required
@DontObfuscate
@Desc("The name of this connector, such as entry, or table node. This is a name for organization. Other connectors can specifically use targetName to target a specific connector type. Multiple connectors can use the same name.")
private String name = "";
public class IrisJigsawPieceConnector {
@Required
@DontObfuscate
@Desc("The name of this connector, such as entry, or table node. This is a name for organization. Other connectors can specifically use targetName to target a specific connector type. Multiple connectors can use the same name.")
private String name = "";
@Required
@DontObfuscate
@Desc("Target a piece's connector with the specified name. For any piece's connector, define * or don't define it.")
private String targetName = "*";
@Required
@DontObfuscate
@Desc("Target a piece's connector with the specified name. For any piece's connector, define * or don't define it.")
private String targetName = "*";
@DontObfuscate
@Desc("Rotates the placed piece on this connector. If rotation is enabled, this connector will effectivley rotate, if this connector is facing the Z direction, then the connected piece would rotate in the X,Y direction in 90 degree segments.")
private boolean rotateConnector = false;
@DontObfuscate
@Desc("Rotates the placed piece on this connector. If rotation is enabled, this connector will effectivley rotate, if this connector is facing the Z direction, then the connected piece would rotate in the X,Y direction in 90 degree segments.")
private boolean rotateConnector = false;
@DontObfuscate
@Desc("If set to true, this connector is allowed to place pieces inside of it's own piece. For example if you are adding a light post, or house on top of a path piece, you would set this to true to allow the piece to collide with the path bounding box.")
private boolean innerConnector = false;
@DontObfuscate
@Desc("If set to true, this connector is allowed to place pieces inside of it's own piece. For example if you are adding a light post, or house on top of a path piece, you would set this to true to allow the piece to collide with the path bounding box.")
private boolean innerConnector = false;
@RegistryListJigsawPool
@Desc("Pick piece pools to place onto this connector")
@ArrayType(type = String.class, min = 1)
@Required
private KList<String> pools = new KList<>();
@RegistryListJigsawPool
@Desc("Pick piece pools to place onto this connector")
@ArrayType(type = String.class, min = 1)
@Required
private KList<String> pools = new KList<>();
@RegistryListEntity
@DontObfuscate
@Desc("Pick an entity to spawn on this connector")
private String spawnEntity;
@RegistryListEntity
@DontObfuscate
@Desc("Pick an entity to spawn on this connector")
private String spawnEntity;
@DontObfuscate
@Desc("Stop the entity from despawning")
private boolean keepEntity;
@DontObfuscate
@Desc("Stop the entity from despawning")
private boolean keepEntity;
@DontObfuscate
@MaxNumber(50)
@MinNumber(1)
@Desc("The amount of entities to spawn (must be a whole number)")
private int entityCount = 1;
@DontObfuscate
@MaxNumber(50)
@MinNumber(1)
@Desc("The amount of entities to spawn (must be a whole number)")
private int entityCount = 1;
@DontObfuscate
@Desc("The relative position this connector is located at for connecting to other pieces")
@Required
private IrisPosition position = new IrisPosition(0,0,0);
@DontObfuscate
@Desc("The relative position this connector is located at for connecting to other pieces")
@Required
private IrisPosition position = new IrisPosition(0, 0, 0);
@DontObfuscate
@Desc("The relative position to this connector to place entities at")
@DependsOn({"spawnEntity"})
private IrisPosition entityPosition = null;
@DontObfuscate
@Desc("The relative position to this connector to place entities at")
@DependsOn({"spawnEntity"})
private IrisPosition entityPosition = null;
@DontObfuscate
@Desc("The direction this connector is facing. If the direction is set to UP, then pieces will place ABOVE the connector.")
@Required
private IrisDirection direction = IrisDirection.UP_POSITIVE_Y;
@DontObfuscate
@Desc("The direction this connector is facing. If the direction is set to UP, then pieces will place ABOVE the connector.")
@Required
private IrisDirection direction = IrisDirection.UP_POSITIVE_Y;
public String toString()
{
return direction.getFace().name() + "@(" + position.getX() + "," + position.getY() + "," + position.getZ() + ")";
}
public String toString() {
return direction.getFace().name() + "@(" + position.getX() + "," + position.getY() + "," + position.getZ() + ")";
}
public IrisJigsawPieceConnector copy() {
IrisJigsawPieceConnector c = new IrisJigsawPieceConnector();
c.setInnerConnector(isInnerConnector());
c.setTargetName(getTargetName());
c.setPosition(getPosition().copy());
c.setDirection(getDirection());
c.setRotateConnector(isRotateConnector());
c.setName(getName());
c.setSpawnEntity(getSpawnEntity());
c.setPools(getPools().copy());
return c;
}
public IrisJigsawPieceConnector copy() {
IrisJigsawPieceConnector c = new IrisJigsawPieceConnector();
c.setInnerConnector(isInnerConnector());
c.setTargetName(getTargetName());
c.setPosition(getPosition().copy());
c.setDirection(getDirection());
c.setRotateConnector(isRotateConnector());
c.setName(getName());
c.setSpawnEntity(getSpawnEntity());
c.setPools(getPools().copy());
return c;
}
}

View File

@@ -11,17 +11,16 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Represents a jigsaw placement")
@Data
public class IrisJigsawPlacement
{
@RegistryListJigsaw
@Required
@DontObfuscate
@Desc("The jigsaw structure to use")
private String structure = "";
public class IrisJigsawPlacement {
@RegistryListJigsaw
@Required
@DontObfuscate
@Desc("The jigsaw structure to use")
private String structure = "";
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The rarity for this jigsaw structure to place on a per chunk basis")
private int rarity = 29;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The rarity for this jigsaw structure to place on a per chunk basis")
private int rarity = 29;
}

View File

@@ -14,12 +14,11 @@ import lombok.experimental.Accessors;
@Desc("Represents a structure piece pool")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisJigsawPool extends IrisRegistrant
{
@RegistryListJigsawPiece
@Required
@DontObfuscate
@ArrayType(min = 1,type = String.class)
@Desc("A list of structure piece pools")
private KList<String> pieces = new KList<>();
public class IrisJigsawPool extends IrisRegistrant {
@RegistryListJigsawPiece
@Required
@DontObfuscate
@ArrayType(min = 1, type = String.class)
@Desc("A list of structure piece pools")
private KList<String> pieces = new KList<>();
}

View File

@@ -16,122 +16,102 @@ import lombok.experimental.Accessors;
@Desc("Represents a jigsaw structure")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisJigsawStructure extends IrisRegistrant
{
@RegistryListJigsawPiece
@Required
@DontObfuscate
@ArrayType(min = 1,type = String.class)
@Desc("The starting pieces. Randomly chooses a starting piece, then connects pieces using the pools define in the starting piece.")
private KList<String> pieces = new KList<>();
public class IrisJigsawStructure extends IrisRegistrant {
@RegistryListJigsawPiece
@Required
@DontObfuscate
@ArrayType(min = 1, type = String.class)
@Desc("The starting pieces. Randomly chooses a starting piece, then connects pieces using the pools define in the starting piece.")
private KList<String> pieces = new KList<>();
@MaxNumber(32)
@MinNumber(1)
@DontObfuscate
@Desc("The maximum pieces that can step out from the center piece")
private int maxDepth = 9;
@MaxNumber(32)
@MinNumber(1)
@DontObfuscate
@Desc("The maximum pieces that can step out from the center piece")
private int maxDepth = 9;
@DontObfuscate
@Desc("Jigsaw grows the parallax layer which slows iris down a bit. Since there are so many pieces, Iris takes the avg piece size and calculates the parallax radius from that. Unless your structures are using only the biggest pieces, your structure should fit in the chosen size fine. If you are seeing cut-off parts of your structures or broken terrain, turn this option on. This option will pick the biggest piece dimensions and multiply it by your (maxDepth+1) * 2 as the size to grow the parallax layer by. But typically keep this off.")
private boolean useMaxPieceSizeForParallaxRadius = false;
@DontObfuscate
@Desc("Jigsaw grows the parallax layer which slows iris down a bit. Since there are so many pieces, Iris takes the avg piece size and calculates the parallax radius from that. Unless your structures are using only the biggest pieces, your structure should fit in the chosen size fine. If you are seeing cut-off parts of your structures or broken terrain, turn this option on. This option will pick the biggest piece dimensions and multiply it by your (maxDepth+1) * 2 as the size to grow the parallax layer by. But typically keep this off.")
private boolean useMaxPieceSizeForParallaxRadius = false;
@Desc("Add a noise feature to this village")
@DontObfuscate
private IrisFeature feature = null;
@Desc("Add a noise feature to this village")
@DontObfuscate
private IrisFeature feature = null;
@DontObfuscate
@Desc("If set to true, iris will look for any pieces with only one connector in valid pools for edge connectors and attach them to 'terminate' the paths/piece connectors. Essentially it caps off ends. For example in a village, Iris would add houses to the ends of roads where possible. For terminators to be selected, they can only have one connector or they wont be chosen.")
private boolean terminate = true;
@DontObfuscate
@Desc("If set to true, iris will look for any pieces with only one connector in valid pools for edge connectors and attach them to 'terminate' the paths/piece connectors. Essentially it caps off ends. For example in a village, Iris would add houses to the ends of roads where possible. For terminators to be selected, they can only have one connector or they wont be chosen.")
private boolean terminate = true;
private transient AtomicCache<Integer> maxDimension = new AtomicCache<>();
private transient AtomicCache<Integer> maxDimension = new AtomicCache<>();
private void loadPool(String p, KList<String> pools, KList<String> pieces)
{
if(p.isEmpty())
{
return;
}
private void loadPool(String p, KList<String> pools, KList<String> pieces) {
if (p.isEmpty()) {
return;
}
IrisJigsawPool pool = getLoader().getJigsawPoolLoader().load(p);
IrisJigsawPool pool = getLoader().getJigsawPoolLoader().load(p);
if(pool == null)
{
Iris.warn("Can't find jigsaw pool: " + p);
return;
}
if (pool == null) {
Iris.warn("Can't find jigsaw pool: " + p);
return;
}
for(String i : pool.getPieces())
{
if(pieces.addIfMissing(i))
{
loadPiece(i, pools, pieces);
}
}
}
for (String i : pool.getPieces()) {
if (pieces.addIfMissing(i)) {
loadPiece(i, pools, pieces);
}
}
}
private void loadPiece(String p, KList<String> pools, KList<String> pieces)
{
IrisJigsawPiece piece = getLoader().getJigsawPieceLoader().load(p);
private void loadPiece(String p, KList<String> pools, KList<String> pieces) {
IrisJigsawPiece piece = getLoader().getJigsawPieceLoader().load(p);
if(piece == null)
{
Iris.warn("Can't find jigsaw piece: " + p);
return;
}
if (piece == null) {
Iris.warn("Can't find jigsaw piece: " + p);
return;
}
for(IrisJigsawPieceConnector i : piece.getConnectors())
{
for(String j : i.getPools())
{
if(pools.addIfMissing(j))
{
loadPool(j, pools, pieces);
}
}
}
}
for (IrisJigsawPieceConnector i : piece.getConnectors()) {
for (String j : i.getPools()) {
if (pools.addIfMissing(j)) {
loadPool(j, pools, pieces);
}
}
}
}
public int getMaxDimension()
{
return maxDimension.aquire(() -> {
if(useMaxPieceSizeForParallaxRadius)
{
int max = 0;
KList<String> pools = new KList<>();
KList<String> pieces = new KList<>();
public int getMaxDimension() {
return maxDimension.aquire(() -> {
if (useMaxPieceSizeForParallaxRadius) {
int max = 0;
KList<String> pools = new KList<>();
KList<String> pieces = new KList<>();
for(String i : getPieces())
{
loadPiece(i, pools, pieces);
}
for (String i : getPieces()) {
loadPiece(i, pools, pieces);
}
for(String i : pieces)
{
max = Math.max(max, getLoader().getJigsawPieceLoader().load(i).getMax3dDimension());
}
for (String i : pieces) {
max = Math.max(max, getLoader().getJigsawPieceLoader().load(i).getMax3dDimension());
}
return max * (((getMaxDepth() + 1) * 2) + 1);
}
return max * (((getMaxDepth() + 1) * 2) + 1);
} else {
KList<String> pools = new KList<>();
KList<String> pieces = new KList<>();
else
{
KList<String> pools = new KList<>();
KList<String> pieces = new KList<>();
for (String i : getPieces()) {
loadPiece(i, pools, pieces);
}
for(String i : getPieces())
{
loadPiece(i, pools, pieces);
}
int avg = 0;
int avg = 0;
for (String i : pieces) {
avg += getLoader().getJigsawPieceLoader().load(i).getMax2dDimension();
}
for(String i : pieces)
{
avg += getLoader().getJigsawPieceLoader().load(i).getMax2dDimension();
}
return (avg/(pieces.size() > 0 ? pieces.size() : 1)) * (((getMaxDepth() + 1) * 2) + 1);
}
});
}
return (avg / (pieces.size() > 0 ? pieces.size() : 1)) * (((getMaxDepth() + 1) * 2) + 1);
}
});
}
}

View File

@@ -17,16 +17,15 @@ import lombok.experimental.Accessors;
@Desc("Represents a jigsaw structure placer")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisJigsawStructurePlacement extends IrisRegistrant
{
@RegistryListJigsaw
@Required
@DontObfuscate
@Desc("The structure to place")
private String structure;
public class IrisJigsawStructurePlacement extends IrisRegistrant {
@RegistryListJigsaw
@Required
@DontObfuscate
@Desc("The structure to place")
private String structure;
@DontObfuscate
@Required
@Desc("The 1 in X chance rarity")
private int rarity = 100;
@DontObfuscate
@Required
@Desc("The 1 in X chance rarity")
private int rarity = 100;
}

View File

@@ -1,7 +1,13 @@
package com.volmit.iris.object;
import java.awt.Color;
import com.volmit.iris.Iris;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemFlag;
@@ -11,305 +17,245 @@ import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.material.Colorable;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.B;
import com.volmit.iris.util.C;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.Form;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.RegistryListItemType;
import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.awt.*;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Represents a loot entry")
@Data
public class IrisLoot
{
@DontObfuscate
@Desc("The target inventory slot types to fill this loot with")
private InventorySlotType slotTypes = InventorySlotType.STORAGE;
public class IrisLoot {
@DontObfuscate
@Desc("The target inventory slot types to fill this loot with")
private InventorySlotType slotTypes = InventorySlotType.STORAGE;
@MinNumber(1)
@DontObfuscate
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The sub rarity of this loot. Calculated after this loot table has been picked.")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Minimum amount of this loot")
private int minAmount = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Minimum amount of this loot")
private int minAmount = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Maximum amount of this loot")
private int maxAmount = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Maximum amount of this loot")
private int maxAmount = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The display name of this item")
private String displayName = null;
@MinNumber(1)
@DontObfuscate
@Desc("The display name of this item")
private String displayName = null;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("Minimum durability percent")
private double minDurability = 0;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("Minimum durability percent")
private double minDurability = 0;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("Maximum durability percent")
private double maxDurability = 1;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("Maximum durability percent")
private double maxDurability = 1;
@DontObfuscate
@Desc("Define a custom model identifier 1.14+ only")
private Integer customModel = null;
@DontObfuscate
@Desc("Define a custom model identifier 1.14+ only")
private Integer customModel = null;
@DontObfuscate
@Desc("Set this to true to prevent it from being broken")
private boolean unbreakable = false;
@DontObfuscate
@Desc("Set this to true to prevent it from being broken")
private boolean unbreakable = false;
@ArrayType(min = 1, type = ItemFlag.class)
@DontObfuscate
@Desc("The item flags to add")
private KList<ItemFlag> itemFlags = new KList<>();
@ArrayType(min = 1, type = ItemFlag.class)
@DontObfuscate
@Desc("The item flags to add")
private KList<ItemFlag> itemFlags = new KList<>();
@DontObfuscate
@Desc("Apply enchantments to this item")
@ArrayType(min = 1, type = IrisEnchantment.class)
private KList<IrisEnchantment> enchantments = new KList<>();
@DontObfuscate
@Desc("Apply enchantments to this item")
@ArrayType(min = 1, type = IrisEnchantment.class)
private KList<IrisEnchantment> enchantments = new KList<>();
@DontObfuscate
@Desc("Apply attribute modifiers to this item")
@ArrayType(min = 1, type = IrisAttributeModifier.class)
private KList<IrisAttributeModifier> attributes = new KList<>();
@DontObfuscate
@Desc("Apply attribute modifiers to this item")
@ArrayType(min = 1, type = IrisAttributeModifier.class)
private KList<IrisAttributeModifier> attributes = new KList<>();
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("Add lore to this item")
private KList<String> lore = new KList<>();
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("Add lore to this item")
private KList<String> lore = new KList<>();
@RegistryListItemType
@Required
@DontObfuscate
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
private String type = "";
@RegistryListItemType
@Required
@DontObfuscate
@Desc("This is the item or block type. Does not accept minecraft:*. Only materials such as DIAMOND_SWORD or DIRT.")
private String type = "";
@DontObfuscate
@Desc("The dye color")
private DyeColor dyeColor = null;
@DontObfuscate
@Desc("The dye color")
private DyeColor dyeColor = null;
@DontObfuscate
@Desc("The leather armor color")
private String leatherColor = null;
@DontObfuscate
@Desc("The leather armor color")
private String leatherColor = null;
private final transient AtomicCache<CNG> chance = new AtomicCache<>();
private final transient AtomicCache<CNG> chance = new AtomicCache<>();
public Material getType()
{
return B.getMaterial(type);
}
public Material getType() {
return B.getMaterial(type);
}
public ItemStack get(boolean debug, RNG rng)
{
try
{
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
public ItemStack get(boolean debug, RNG rng) {
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
if(getType().getMaxDurability() > 0 && m instanceof Damageable)
{
Damageable d = (Damageable) m;
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
if (getType().getMaxDurability() > 0 && m instanceof Damageable) {
Damageable d = (Damageable) m;
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
for(IrisEnchantment i : getEnchantments())
{
i.apply(rng, m);
}
for (IrisEnchantment i : getEnchantments()) {
i.apply(rng, m);
}
for(IrisAttributeModifier i : getAttributes())
{
i.apply(rng, m);
}
for (IrisAttributeModifier i : getAttributes()) {
i.apply(rng, m);
}
if(Iris.customModels)
{
m.setCustomModelData(getCustomModel());
}
if (Iris.customModels) {
m.setCustomModelData(getCustomModel());
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
for(ItemFlag i : getItemFlags())
{
m.addItemFlags(i);
}
for (ItemFlag i : getItemFlags()) {
m.addItemFlags(i);
}
KList<String> lore = new KList<>();
KList<String> lore = new KList<>();
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
if(mf.length() > 24)
{
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E"))
{
lore.add(g.trim());
}
}
if (mf.length() > 24) {
for (String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
lore.add(g.trim());
}
} else {
lore.add(mf);
}
});
else
{
lore.add(mf);
}
});
if (debug) {
if (lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
if(debug)
{
if(lore.isNotEmpty())
{
lore.add(C.GRAY + "--------------------");
}
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
}
lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
}
m.setLore(lore);
m.setLore(lore);
if (getLeatherColor() != null && m instanceof LeatherArmorMeta) {
Color c = Color.decode(getLeatherColor());
((LeatherArmorMeta) m).setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
}
if(getLeatherColor() != null && m instanceof LeatherArmorMeta)
{
Color c = Color.decode(getLeatherColor());
((LeatherArmorMeta) m).setColor(org.bukkit.Color.fromRGB(c.getRed(), c.getGreen(), c.getBlue()));
}
if (getDyeColor() != null && m instanceof Colorable) {
((Colorable) m).setColor(getDyeColor());
}
if(getDyeColor() != null && m instanceof Colorable)
{
((Colorable) m).setColor(getDyeColor());
}
is.setItemMeta(m);
return is;
} catch (Throwable e) {
is.setItemMeta(m);
return is;
}
}
catch(Throwable e)
{
return new ItemStack(Material.AIR);
}
}
public ItemStack get(boolean debug, boolean giveSomething, IrisLootTable table, RNG rng, int x, int y, int z) {
if (debug) {
chance.reset();
}
return new ItemStack(Material.AIR);
}
if (giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1) {
if (getType() == null) {
Iris.warn("Cant find item type " + type);
return null;
}
public ItemStack get(boolean debug, boolean giveSomething, IrisLootTable table, RNG rng, int x, int y, int z)
{
if(debug)
{
chance.reset();
}
try {
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
if(giveSomething || chance.aquire(() -> NoiseStyle.STATIC.create(rng)).fit(1, rarity * table.getRarity(), x, y, z) == 1)
{
if(getType() == null)
{
Iris.warn("Cant find item type " + type);
return null;
}
if (getType().getMaxDurability() > 0 && m instanceof Damageable) {
Damageable d = (Damageable) m;
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
try
{
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
for (IrisEnchantment i : getEnchantments()) {
i.apply(rng, m);
}
if(getType().getMaxDurability() > 0 && m instanceof Damageable)
{
Damageable d = (Damageable) m;
int max = getType().getMaxDurability();
d.setDamage((int) Math.round(Math.max(0, Math.min(max, (1D - rng.d(getMinDurability(), getMaxDurability())) * max))));
}
for (IrisAttributeModifier i : getAttributes()) {
i.apply(rng, m);
}
for(IrisEnchantment i : getEnchantments())
{
i.apply(rng, m);
}
if (Iris.customModels) {
m.setCustomModelData(getCustomModel());
}
for(IrisAttributeModifier i : getAttributes())
{
i.apply(rng, m);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
if(Iris.customModels)
{
m.setCustomModelData(getCustomModel());
}
for (ItemFlag i : getItemFlags()) {
m.addItemFlags(i);
}
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
KList<String> lore = new KList<>();
for(ItemFlag i : getItemFlags())
{
m.addItemFlags(i);
}
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
KList<String> lore = new KList<>();
if (mf.length() > 24) {
for (String g : Form.wrapWords(mf, 24).split("\\Q\n\\E")) {
lore.add(g.trim());
}
} else {
lore.add(mf);
}
});
getLore().forEach((i) ->
{
String mf = C.translateAlternateColorCodes('&', i);
if (debug) {
if (lore.isNotEmpty()) {
lore.add(C.GRAY + "--------------------");
}
if(mf.length() > 24)
{
for(String g : Form.wrapWords(mf, 24).split("\\Q\n\\E"))
{
lore.add(g.trim());
}
}
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
}
else
{
lore.add(mf);
}
});
m.setLore(lore);
is.setItemMeta(m);
return is;
} catch (Throwable e) {
if(debug)
{
if(lore.isNotEmpty())
{
lore.add(C.GRAY + "--------------------");
}
}
}
lore.add(C.GRAY + "From: " + table.getName() + " (" + Form.pc(1D / table.getRarity(), 5) + ")");
lore.add(C.GRAY + "1 in " + (table.getRarity() * getRarity()) + " Chance (" + Form.pc(1D / (table.getRarity() * getRarity()), 5) + ")");
}
m.setLore(lore);
is.setItemMeta(m);
return is;
}
catch(Throwable e)
{
}
}
return null;
}
return null;
}
}

View File

@@ -1,14 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RegistryListLoot;
import com.volmit.iris.scaffold.data.DataProvider;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -19,38 +13,35 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Represents a loot entry")
@Data
public class IrisLootReference
{
public class IrisLootReference {
@DontObfuscate
@Desc("Add = add on top of parent tables, Replace = clear first then add these. Clear = Remove all and dont add loot from this or parent.")
private LootMode mode = LootMode.ADD;
@DontObfuscate
@Desc("Add = add on top of parent tables, Replace = clear first then add these. Clear = Remove all and dont add loot from this or parent.")
private LootMode mode = LootMode.ADD;
@DontObfuscate
@RegistryListLoot
@ArrayType(min = 1, type = String.class)
@Desc("Add loot table registries here")
private KList<String> tables = new KList<>();
@DontObfuscate
@RegistryListLoot
@ArrayType(min = 1, type = String.class)
@Desc("Add loot table registries here")
private KList<String> tables = new KList<>();
@MinNumber(0)
@DontObfuscate
@Desc("Increase the chance of loot in this area")
private double multiplier = 1D;
@MinNumber(0)
@DontObfuscate
@Desc("Increase the chance of loot in this area")
private double multiplier = 1D;
private final transient AtomicCache<KList<IrisLootTable>> tt = new AtomicCache<>();
private final transient AtomicCache<KList<IrisLootTable>> tt = new AtomicCache<>();
public KList<IrisLootTable> getLootTables(DataProvider g)
{
return tt.aquire(() ->
{
KList<IrisLootTable> t = new KList<>();
public KList<IrisLootTable> getLootTables(DataProvider g) {
return tt.aquire(() ->
{
KList<IrisLootTable> t = new KList<>();
for(String i : tables)
{
t.add(g.getData().getLootLoader().load(i));
}
for (String i : tables) {
t.add(g.getData().getLootLoader().load(i));
}
return t;
});
}
return t;
});
}
}

View File

@@ -1,21 +1,13 @@
package com.volmit.iris.object;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@Accessors(chain = true)
@NoArgsConstructor
@@ -23,59 +15,55 @@ import lombok.experimental.Accessors;
@Desc("Represents a loot table. Biomes, Regions & Objects can add or replace the virtual table with these loot tables")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisLootTable extends IrisRegistrant
{
@Required
public class IrisLootTable extends IrisRegistrant {
@Required
@Desc("The name of this loot table")
@DontObfuscate
@MinNumber(2)
private String name = "";
@Desc("The name of this loot table")
@DontObfuscate
@MinNumber(2)
private String name = "";
@MinNumber(1)
@DontObfuscate
@Desc("The rarity as in 1 in X chance")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The rarity as in 1 in X chance")
private int rarity = 1;
@MinNumber(1)
@DontObfuscate
@Desc("The maximum amount of loot that can be picked in this table at a time.")
private int maxPicked = 5;
@MinNumber(1)
@DontObfuscate
@Desc("The maximum amount of loot that can be picked in this table at a time.")
private int maxPicked = 5;
@MinNumber(0)
@DontObfuscate
@Desc("The minimum amount of loot that can be picked in this table at a time.")
private int minPicked = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The minimum amount of loot that can be picked in this table at a time.")
private int minPicked = 1;
@DontObfuscate
@Desc("The loot in this table")
@ArrayType(min = 1, type = IrisLoot.class)
private KList<IrisLoot> loot = new KList<>();
@DontObfuscate
@Desc("The loot in this table")
@ArrayType(min = 1, type = IrisLoot.class)
private KList<IrisLoot> loot = new KList<>();
public KList<ItemStack> getLoot(boolean debug, boolean doSomething, RNG rng, InventorySlotType slot, int x, int y, int z, int gg, int ffs)
{
KList<ItemStack> lootf = new KList<>();
public KList<ItemStack> getLoot(boolean debug, boolean doSomething, RNG rng, InventorySlotType slot, int x, int y, int z, int gg, int ffs) {
KList<ItemStack> lootf = new KList<>();
int m = 0;
int mx = rng.i(getMinPicked(), getMaxPicked());
int m = 0;
int mx = rng.i(getMinPicked(), getMaxPicked());
while (m < mx) {
int num = rng.i(loot.size());
while (m < mx) {
int num = rng.i(loot.size());
IrisLoot l = loot.get(num);
IrisLoot l = loot.get(num);
if(l.getSlotTypes() == slot)
{
ItemStack item = l.get(debug, false, this, rng, x, y, z);
if (l.getSlotTypes() == slot) {
ItemStack item = l.get(debug, false, this, rng, x, y, z);
if(item != null && item.getType() != Material.AIR)
{
lootf.add(item);
m++;
}
}
}
if (item != null && item.getType() != Material.AIR) {
lootf.add(item);
m++;
}
}
}
return lootf;
}
return lootf;
}
}

View File

@@ -1,16 +1,9 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -22,95 +15,82 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("A palette of materials")
@Data
public class IrisMaterialPalette
{
@DontObfuscate
@Desc("The style of noise")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
public class IrisMaterialPalette {
@DontObfuscate
@Desc("The style of noise")
private IrisGeneratorStyle style = NoiseStyle.STATIC.style();
@MinNumber(0.0001)
@DontObfuscate
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
private double zoom = 5;
@MinNumber(0.0001)
@DontObfuscate
@Desc("The terrain zoom mostly for zooming in on a wispy palette")
private double zoom = 5;
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this layer")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("STONE"));
@Required
@ArrayType(min = 1, type = IrisBlockData.class)
@DontObfuscate
@Desc("The palette of blocks to be used in this layer")
private KList<IrisBlockData> palette = new KList<IrisBlockData>().qadd(new IrisBlockData("STONE"));
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> blockData = new AtomicCache<>();
private final transient AtomicCache<CNG> layerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> heightGenerator = new AtomicCache<>();
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata)
{
if(getBlockData(rdata).isEmpty())
{
return null;
}
public BlockData get(RNG rng, double x, double y, double z, IrisDataManager rdata) {
if (getBlockData(rdata).isEmpty()) {
return null;
}
if(getBlockData(rdata).size() == 1)
{
return getBlockData(rdata).get(0);
}
if (getBlockData(rdata).size() == 1) {
return getBlockData(rdata).get(0);
}
return getLayerGenerator(rng, rdata).fit(getBlockData(rdata), x / zoom, y / zoom, z / zoom);
}
return getLayerGenerator(rng, rdata).fit(getBlockData(rdata), x / zoom, y / zoom, z / zoom);
}
public CNG getLayerGenerator(RNG rng, IrisDataManager rdata)
{
return layerGenerator.aquire(() ->
{
RNG rngx = rng.nextParallelRNG(-23498896 + getBlockData(rdata).size());
return style.create(rngx);
});
}
public CNG getLayerGenerator(RNG rng, IrisDataManager rdata) {
return layerGenerator.aquire(() ->
{
RNG rngx = rng.nextParallelRNG(-23498896 + getBlockData(rdata).size());
return style.create(rngx);
});
}
public IrisMaterialPalette qclear()
{
palette.clear();
return this;
}
public IrisMaterialPalette qclear() {
palette.clear();
return this;
}
public KList<IrisBlockData> add(String b)
{
palette.add(new IrisBlockData(b));
public KList<IrisBlockData> add(String b) {
palette.add(new IrisBlockData(b));
return palette;
}
return palette;
}
public IrisMaterialPalette qadd(String b)
{
palette.add(new IrisBlockData(b));
public IrisMaterialPalette qadd(String b) {
palette.add(new IrisBlockData(b));
return this;
}
return this;
}
public KList<BlockData> getBlockData(IrisDataManager rdata)
{
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for(IrisBlockData ix : palette)
{
BlockData bx = ix.getBlockData(rdata);
if(bx != null)
{
for(int i = 0; i < ix.getWeight(); i++)
{
blockData.add(bx);
}
}
}
public KList<BlockData> getBlockData(IrisDataManager rdata) {
return blockData.aquire(() ->
{
KList<BlockData> blockData = new KList<>();
for (IrisBlockData ix : palette) {
BlockData bx = ix.getBlockData(rdata);
if (bx != null) {
for (int i = 0; i < ix.getWeight(); i++) {
blockData.add(bx);
}
}
}
return blockData;
});
}
return blockData;
});
}
public IrisMaterialPalette zero()
{
palette.clear();
return this;
}
public IrisMaterialPalette zero() {
palette.clear();
return this;
}
}

View File

@@ -1,156 +1,137 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IrisInterpolation;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.util.Collection;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A noise generator")
@Data
public class IrisNoiseGenerator
{
public class IrisNoiseGenerator {
@MinNumber(0.0001)
@DontObfuscate
@Desc("The coordinate input zoom")
private double zoom = 1;
@MinNumber(0.0001)
@DontObfuscate
@Desc("The coordinate input zoom")
private double zoom = 1;
@DontObfuscate
@Desc("Reverse the output. So that noise = -noise + opacity")
private boolean negative = false;
@DontObfuscate
@Desc("Reverse the output. So that noise = -noise + opacity")
private boolean negative = false;
@MinNumber(0)
@DontObfuscate
@Desc("The output multiplier")
private double opacity = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The output multiplier")
private double opacity = 1;
@DontObfuscate
@Desc("Coordinate offset x")
private double offsetX = 0;
@DontObfuscate
@Desc("Coordinate offset x")
private double offsetX = 0;
@DontObfuscate
@Desc("Height output offset y")
private double offsetY = 0;
@DontObfuscate
@Desc("Height output offset y")
private double offsetY = 0;
@DontObfuscate
@Desc("Coordinate offset z")
private double offsetZ = 0;
@DontObfuscate
@Desc("Coordinate offset z")
private double offsetZ = 0;
@Required
@DontObfuscate
@Desc("The seed")
private long seed = 0;
@Required
@DontObfuscate
@Desc("The seed")
private long seed = 0;
@DontObfuscate
@Desc("Apply a parametric curve on the output")
private boolean parametric = false;
@DontObfuscate
@Desc("Apply a parametric curve on the output")
private boolean parametric = false;
@DontObfuscate
@Desc("Apply a bezier curve on the output")
private boolean bezier = false;
@DontObfuscate
@Desc("Apply a bezier curve on the output")
private boolean bezier = false;
@DontObfuscate
@Desc("Apply a sin-center curve on the output (0, and 1 = 0 and 0.5 = 1.0 using a sinoid shape.)")
private boolean sinCentered = false;
@DontObfuscate
@Desc("Apply a sin-center curve on the output (0, and 1 = 0 and 0.5 = 1.0 using a sinoid shape.)")
private boolean sinCentered = false;
@DontObfuscate
@Desc("The exponent noise^EXPONENT")
private double exponent = 1;
@DontObfuscate
@Desc("The exponent noise^EXPONENT")
private double exponent = 1;
@DontObfuscate
@Desc("Enable / disable. Outputs offsetY if disabled")
private boolean enabled = true;
@DontObfuscate
@Desc("Enable / disable. Outputs offsetY if disabled")
private boolean enabled = true;
@Required
@DontObfuscate
@Desc("The Noise Style")
private IrisGeneratorStyle style = NoiseStyle.IRIS.style();
@Required
@DontObfuscate
@Desc("The Noise Style")
private IrisGeneratorStyle style = NoiseStyle.IRIS.style();
@MinNumber(1)
@DontObfuscate
@Desc("Multiple octaves for multple generators of changing zooms added together")
private int octaves = 1;
@MinNumber(1)
@DontObfuscate
@Desc("Multiple octaves for multple generators of changing zooms added together")
private int octaves = 1;
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
@DontObfuscate
@Desc("Apply a child noise generator to fracture the input coordinates of this generator")
private KList<IrisNoiseGenerator> fracture = new KList<>();
@ArrayType(min = 1, type = IrisNoiseGenerator.class)
@DontObfuscate
@Desc("Apply a child noise generator to fracture the input coordinates of this generator")
private KList<IrisNoiseGenerator> fracture = new KList<>();
private final transient AtomicCache<CNG> generator = new AtomicCache<>();
private final transient AtomicCache<CNG> generator = new AtomicCache<>();
public IrisNoiseGenerator(boolean enabled)
{
this();
this.enabled = enabled;
}
public IrisNoiseGenerator(boolean enabled) {
this();
this.enabled = enabled;
}
protected CNG getGenerator(long superSeed)
{
return generator.aquire(() -> style.create(new RNG(superSeed + 33955677 - seed)).oct(octaves));
}
protected CNG getGenerator(long superSeed) {
return generator.aquire(() -> style.create(new RNG(superSeed + 33955677 - seed)).oct(octaves));
}
public double getMax()
{
return getOffsetY() + opacity;
}
public double getMax() {
return getOffsetY() + opacity;
}
public double getNoise(long superSeed, double xv, double zv)
{
if(!enabled)
{
return offsetY;
}
public double getNoise(long superSeed, double xv, double zv) {
if (!enabled) {
return offsetY;
}
double x = xv;
double z = zv;
int g = 33;
double x = xv;
double z = zv;
int g = 33;
for(IrisNoiseGenerator i : fracture)
{
if(i.isEnabled())
{
x += i.getNoise(superSeed + seed + g, xv, zv) - (opacity / 2D);
z -= i.getNoise(superSeed + seed + g, zv, xv) - (opacity / 2D);
}
g += 819;
}
for (IrisNoiseGenerator i : fracture) {
if (i.isEnabled()) {
x += i.getNoise(superSeed + seed + g, xv, zv) - (opacity / 2D);
z -= i.getNoise(superSeed + seed + g, zv, xv) - (opacity / 2D);
}
g += 819;
}
double n = getGenerator(superSeed).fitDouble(0, opacity, (x / zoom) + offsetX, (z / zoom) + offsetZ);
n = negative ? (-n + opacity) : n;
n = (exponent != 1 ? n < 0 ? -Math.pow(-n, exponent) : Math.pow(n, exponent) : n) + offsetY;
n = parametric ? IrisInterpolation.parametric(n, 1) : n;
n = bezier ? IrisInterpolation.bezier(n) : n;
n = sinCentered ? IrisInterpolation.sinCenter(n) : n;
double n = getGenerator(superSeed).fitDouble(0, opacity, (x / zoom) + offsetX, (z / zoom) + offsetZ);
n = negative ? (-n + opacity) : n;
n = (exponent != 1 ? n < 0 ? -Math.pow(-n, exponent) : Math.pow(n, exponent) : n) + offsetY;
n = parametric ? IrisInterpolation.parametric(n, 1) : n;
n = bezier ? IrisInterpolation.bezier(n) : n;
n = sinCentered ? IrisInterpolation.sinCenter(n) : n;
return n;
}
return n;
}
public KList<IrisNoiseGenerator> getAllComposites() {
KList<IrisNoiseGenerator> g = new KList<IrisNoiseGenerator>();
KList<IrisNoiseGenerator> g = new KList<IrisNoiseGenerator>();
g.add(this);
g.add(this);
for(IrisNoiseGenerator i : getFracture())
{
g.addAll(i.getAllComposites());
}
for (IrisNoiseGenerator i : getFracture()) {
g.addAll(i.getAllComposites());
}
return g;
return g;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,7 +4,6 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -15,28 +14,21 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisObjectLimit
{
public class IrisObjectLimit {
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The minimum height for placement (bottom of object)")
private int minimumHeight = 0;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The minimum height for placement (bottom of object)")
private int minimumHeight = 0;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The maximum height for placement (top of object)")
private int maximumHeight = 255;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The maximum height for placement (top of object)")
private int maximumHeight = 255;
public boolean canPlace(int h, int l)
{
if(h > maximumHeight || l < minimumHeight)
{
return false;
}
return true;
}
public boolean canPlace(int h, int l) {
return h <= maximumHeight && l >= minimumHeight;
}
}

View File

@@ -1,14 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.Iris;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.RegistryListLoot;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -43,18 +37,15 @@ public class IrisObjectLoot {
private final transient AtomicCache<KList<BlockData>> filterCache = new AtomicCache<>();
public KList<BlockData> getFilter(IrisDataManager rdata)
{
public KList<BlockData> getFilter(IrisDataManager rdata) {
return filterCache.aquire(() ->
{
KList<BlockData> b = new KList<>();
for(IrisBlockData i : filter)
{
for (IrisBlockData i : filter) {
BlockData bx = i.getBlockData(rdata);
if(bx != null)
{
if (bx != null) {
b.add(bx);
}
}

View File

@@ -20,269 +20,260 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("Represents an iris object placer. It places objects.")
@Data
public class IrisObjectPlacement
{
@RegistryListObject
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("List of objects to place")
private KList<String> place = new KList<>();
public class IrisObjectPlacement {
@RegistryListObject
@Required
@ArrayType(min = 1, type = String.class)
@DontObfuscate
@Desc("List of objects to place")
private KList<String> place = new KList<>();
@Desc("Rotate this objects placement")
private IrisObjectRotation rotation = new IrisObjectRotation();
@Desc("Rotate this objects placement")
private IrisObjectRotation rotation = new IrisObjectRotation();
@DontObfuscate
@Desc("Limit the max height or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
@DontObfuscate
@Desc("Limit the max height or min height of placement.")
private IrisObjectLimit clamp = new IrisObjectLimit();
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
private double snow = 0;
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The maximum layer level of a snow filter overtop of this placement. Set to 0 to disable. Max of 1.")
private double snow = 0;
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
private double chance = 1;
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance for this to place in a chunk. If you need multiple per chunk, set this to 1 and use density.")
private double chance = 1;
@MinNumber(1)
@DontObfuscate
@Desc("If the chance check passes, place this many in a single chunk")
private int density = 1;
@MinNumber(1)
@DontObfuscate
@Desc("If the chance check passes, place this many in a single chunk")
private int density = 1;
@MaxNumber(64)
@MinNumber(0)
@DontObfuscate
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt = 0;
@MaxNumber(64)
@MinNumber(0)
@DontObfuscate
@Desc("If the place mode is set to stilt, you can over-stilt it even further into the ground. Especially useful when using fast stilt due to inaccuracies.")
private int overStilt = 0;
@MaxNumber(64)
@MinNumber(0)
@DontObfuscate
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
private int boreExtendMaxY = 0;
@MaxNumber(64)
@MinNumber(0)
@DontObfuscate
@Desc("When bore is enabled, expand max-y of the cuboid it removes")
private int boreExtendMaxY = 0;
@MaxNumber(64)
@MinNumber(-1)
@DontObfuscate
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
private int boreExtendMinY = 0;
@MaxNumber(64)
@MinNumber(-1)
@DontObfuscate
@Desc("When bore is enabled, lower min-y of the cuboid it removes")
private int boreExtendMinY = 0;
@DontObfuscate
@Desc("If set to true, objects will place on the terrain height, ignoring the water surface.")
private boolean underwater = false;
@DontObfuscate
@Desc("If set to true, objects will place on the terrain height, ignoring the water surface.")
private boolean underwater = false;
@DontObfuscate
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@DontObfuscate
@Desc("If set to true, objects will place in carvings (such as underground) or under an overhang.")
private CarvingMode carvingSupport = CarvingMode.SURFACE_ONLY;
@DontObfuscate
@Desc("If this is defined, this object wont place on the terrain heightmap, but instead on this virtual heightmap")
private IrisNoiseGenerator heightmap;
@DontObfuscate
@Desc("If this is defined, this object wont place on the terrain heightmap, but instead on this virtual heightmap")
private IrisNoiseGenerator heightmap;
@DontObfuscate
@Desc("If set to true, Iris will try to fill the insides of 'rooms' and 'pockets' where air should fit based off of raytrace checks. This prevents a village house placing in an area where a tree already exists, and instead replaces the parts of the tree where the interior of the structure is. \n\nThis operation does not affect warmed-up generation speed however it does slow down loading objects.")
private boolean smartBore = false;
@DontObfuscate
@Desc("If set to true, Iris will try to fill the insides of 'rooms' and 'pockets' where air should fit based off of raytrace checks. This prevents a village house placing in an area where a tree already exists, and instead replaces the parts of the tree where the interior of the structure is. \n\nThis operation does not affect warmed-up generation speed however it does slow down loading objects.")
private boolean smartBore = false;
@DontObfuscate
@Desc("If set to true, Blocks placed underwater that could be waterlogged are waterlogged.")
private boolean waterloggable = false;
@DontObfuscate
@Desc("If set to true, Blocks placed underwater that could be waterlogged are waterlogged.")
private boolean waterloggable = false;
@DontObfuscate
@Desc("If set to true, objects will place on the fluid height level Such as boats.")
private boolean onwater = false;
@DontObfuscate
@Desc("If set to true, objects will place on the fluid height level Such as boats.")
private boolean onwater = false;
@DontObfuscate
@Desc("If set to true, this object will only place parts of itself where blocks already exist. Warning: Melding is very performance intensive!")
private boolean meld = false;
@DontObfuscate
@Desc("If set to true, this object will only place parts of itself where blocks already exist. Warning: Melding is very performance intensive!")
private boolean meld = false;
@DontObfuscate
@Desc("If set to true, this object will place from the ground up instead of height checks when not y locked to the surface. This is not compatable with X and Z axis rotations (it may look off)")
private boolean bottom = false;
@DontObfuscate
@Desc("If set to true, this object will place from the ground up instead of height checks when not y locked to the surface. This is not compatable with X and Z axis rotations (it may look off)")
private boolean bottom = false;
@DontObfuscate
@Desc("If set to true, air will be placed before the schematic places.")
private boolean bore = false;
@DontObfuscate
@Desc("If set to true, air will be placed before the schematic places.")
private boolean bore = false;
@DontObfuscate
@Desc("Use a generator to warp the field of coordinates. Using simplex for example would make a square placement warp like a flag")
private IrisGeneratorStyle warp = new IrisGeneratorStyle(NoiseStyle.FLAT);
@DontObfuscate
@Desc("Use a generator to warp the field of coordinates. Using simplex for example would make a square placement warp like a flag")
private IrisGeneratorStyle warp = new IrisGeneratorStyle(NoiseStyle.FLAT);
@DontObfuscate
@Desc("If the place mode is set to CENTER_HEIGHT_RIGID and you have an X/Z translation, Turning on translate center will also translate the center height check.")
private boolean translateCenter = false;
@DontObfuscate
@Desc("If the place mode is set to CENTER_HEIGHT_RIGID and you have an X/Z translation, Turning on translate center will also translate the center height check.")
private boolean translateCenter = false;
@DontObfuscate
@Desc("The placement mode")
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@DontObfuscate
@Desc("The placement mode")
private ObjectPlaceMode mode = ObjectPlaceMode.CENTER_HEIGHT;
@ArrayType(min = 1, type = IrisObjectReplace.class)
@DontObfuscate
@Desc("Find and replace blocks")
private KList<IrisObjectReplace> edit = new KList<>();
@ArrayType(min = 1, type = IrisObjectReplace.class)
@DontObfuscate
@Desc("Find and replace blocks")
private KList<IrisObjectReplace> edit = new KList<>();
@DontObfuscate
@Desc("Translate this object's placement")
private IrisObjectTranslate translate = new IrisObjectTranslate();
@DontObfuscate
@Desc("Translate this object's placement")
private IrisObjectTranslate translate = new IrisObjectTranslate();
@DontObfuscate
@Desc("Scale Objects")
private IrisObjectScale scale = new IrisObjectScale();
@DontObfuscate
@Desc("Scale Objects")
private IrisObjectScale scale = new IrisObjectScale();
@ArrayType(min = 1, type = IrisObjectLoot.class)
@DontObfuscate
@Desc("The loot tables to apply to these objects")
private KList<IrisObjectLoot> loot = new KList<>();
@ArrayType(min = 1, type = IrisObjectLoot.class)
@DontObfuscate
@Desc("The loot tables to apply to these objects")
private KList<IrisObjectLoot> loot = new KList<>();
public IrisObjectPlacement toPlacement(String... place)
{
IrisObjectPlacement p = new IrisObjectPlacement();
p.setPlace(new KList<>(place));
p.setTranslateCenter(translateCenter);
p.setMode(mode);
p.setEdit(edit);
p.setTranslate(translate);
p.setWarp(warp);
p.setBore(bore);
p.setMeld(meld);
p.setWaterloggable(waterloggable);
p.setOnwater(onwater);
p.setSmartBore(smartBore);
p.setCarvingSupport(carvingSupport);
p.setUnderwater(underwater);
p.setBoreExtendMaxY(boreExtendMaxY);
p.setBoreExtendMinY(boreExtendMinY);
p.setOverStilt(overStilt);
p.setDensity(density);
p.setChance(chance);
p.setSnow(snow);
p.setClamp(clamp);
p.setRotation(rotation);
p.setLoot(loot);
return p;
}
public IrisObjectPlacement toPlacement(String... place) {
IrisObjectPlacement p = new IrisObjectPlacement();
p.setPlace(new KList<>(place));
p.setTranslateCenter(translateCenter);
p.setMode(mode);
p.setEdit(edit);
p.setTranslate(translate);
p.setWarp(warp);
p.setBore(bore);
p.setMeld(meld);
p.setWaterloggable(waterloggable);
p.setOnwater(onwater);
p.setSmartBore(smartBore);
p.setCarvingSupport(carvingSupport);
p.setUnderwater(underwater);
p.setBoreExtendMaxY(boreExtendMaxY);
p.setBoreExtendMinY(boreExtendMinY);
p.setOverStilt(overStilt);
p.setDensity(density);
p.setChance(chance);
p.setSnow(snow);
p.setClamp(clamp);
p.setRotation(rotation);
p.setLoot(loot);
return p;
}
private final transient AtomicCache<CNG> surfaceWarp = new AtomicCache<>();
private final transient AtomicCache<CNG> surfaceWarp = new AtomicCache<>();
public CNG getSurfaceWarp(RNG rng)
{
return surfaceWarp.aquire(() ->
{
return getWarp().create(rng);
});
}
public CNG getSurfaceWarp(RNG rng) {
return surfaceWarp.aquire(() ->
{
return getWarp().create(rng);
});
}
public double warp(RNG rng, double x, double y, double z)
{
return getSurfaceWarp(rng).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
}
public double warp(RNG rng, double x, double y, double z) {
return getSurfaceWarp(rng).fitDouble(-(getWarp().getMultiplier() / 2D), (getWarp().getMultiplier() / 2D), x, y, z);
}
public int getTriesForChunk(RNG random)
{
if(chance <= 0)
{
return 0;
}
public int getTriesForChunk(RNG random) {
if (chance <= 0) {
return 0;
}
if(chance >= 1 || random.nextDouble() < chance)
{
return density;
}
if (chance >= 1 || random.nextDouble() < chance) {
return density;
}
return 0;
}
return 0;
}
public IrisObject getObject(DataProvider g, RNG random)
{
if(place.isEmpty())
{
return null;
}
public IrisObject getObject(DataProvider g, RNG random) {
if (place.isEmpty()) {
return null;
}
return g.getData().getObjectLoader().load(place.get(random.nextInt(place.size())));
}
return g.getData().getObjectLoader().load(place.get(random.nextInt(place.size())));
}
public boolean isVacuum() {
return getMode().equals(ObjectPlaceMode.VACUUM);
}
public boolean isVacuum() {
return getMode().equals(ObjectPlaceMode.VACUUM);
}
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
private transient AtomicCache<TableCache> cache = new AtomicCache<>();
private class TableCache {
transient WeightedRandom<IrisLootTable> global = new WeightedRandom<>();
transient KMap<Material, WeightedRandom<IrisLootTable>> basic = new KMap<>();
transient KMap<Material, KMap<BlockData, WeightedRandom<IrisLootTable>>> exact = new KMap<>();
}
private class TableCache {
transient WeightedRandom<IrisLootTable> global = new WeightedRandom<>();
transient KMap<Material, WeightedRandom<IrisLootTable>> basic = new KMap<>();
transient KMap<Material, KMap<BlockData, WeightedRandom<IrisLootTable>>> exact = new KMap<>();
}
private TableCache getCache(IrisDataManager manager) {
return cache.aquire(() -> {
TableCache tc = new TableCache();
private TableCache getCache(IrisDataManager manager) {
return cache.aquire(() -> {
TableCache tc = new TableCache();
for (IrisObjectLoot loot : getLoot()) {
IrisLootTable table = manager.getLootLoader().load(loot.getName());
if (table == null) {
Iris.warn("Couldn't find loot table " + loot.getName());
continue;
}
for (IrisObjectLoot loot : getLoot()) {
IrisLootTable table = manager.getLootLoader().load(loot.getName());
if (table == null) {
Iris.warn("Couldn't find loot table " + loot.getName());
continue;
}
if (loot.getFilter().isEmpty()) //Table applies to all containers
{
tc.global.put(table, loot.getWeight());
} else if (!loot.isExact()) //Table is meant to be by type
{
for (BlockData filterData : loot.getFilter(manager)) {
if (!tc.basic.containsKey(filterData.getMaterial())) {
tc.basic.put(filterData.getMaterial(), new WeightedRandom<>());
}
if (loot.getFilter().isEmpty()) //Table applies to all containers
{
tc.global.put(table, loot.getWeight());
} else if (!loot.isExact()) //Table is meant to be by type
{
for (BlockData filterData : loot.getFilter(manager)) {
if (!tc.basic.containsKey(filterData.getMaterial())) {
tc.basic.put(filterData.getMaterial(), new WeightedRandom<>());
}
tc.basic.get(filterData.getMaterial()).put(table, loot.getWeight());
}
} else //Filter is exact
{
for (BlockData filterData : loot.getFilter(manager)) {
if (!tc.exact.containsKey(filterData.getMaterial())) {
tc.exact.put(filterData.getMaterial(), new KMap<>());
}
tc.basic.get(filterData.getMaterial()).put(table, loot.getWeight());
}
} else //Filter is exact
{
for (BlockData filterData : loot.getFilter(manager)) {
if (!tc.exact.containsKey(filterData.getMaterial())) {
tc.exact.put(filterData.getMaterial(), new KMap<>());
}
if (!tc.exact.get(filterData.getMaterial()).containsKey(filterData)) {
tc.exact.get(filterData.getMaterial()).put(filterData, new WeightedRandom<>());
}
if (!tc.exact.get(filterData.getMaterial()).containsKey(filterData)) {
tc.exact.get(filterData.getMaterial()).put(filterData, new WeightedRandom<>());
}
tc.exact.get(filterData.getMaterial()).get(filterData).put(table, loot.getWeight());
}
}
}
return tc;
});
}
tc.exact.get(filterData.getMaterial()).get(filterData).put(table, loot.getWeight());
}
}
}
return tc;
});
}
/**
* Gets the loot table that should be used for the block
* @param data The block data of the block
* @param dataManager Iris Data Manager
* @return The loot table it should use.
*/
public IrisLootTable getTable(BlockData data, IrisDataManager dataManager) {
TableCache cache = getCache(dataManager);
/**
* Gets the loot table that should be used for the block
*
* @param data The block data of the block
* @param dataManager Iris Data Manager
* @return The loot table it should use.
*/
public IrisLootTable getTable(BlockData data, IrisDataManager dataManager) {
TableCache cache = getCache(dataManager);
if(B.isStorageChest(data))
{
IrisLootTable picked = null;
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.containsKey(data)) {
picked = cache.exact.get(data.getMaterial()).get(data).pullRandom();
} else if (cache.basic.containsKey(data.getMaterial())) {
picked = cache.basic.get(data.getMaterial()).pullRandom();
} else if (cache.global.getSize() > 0){
picked = cache.global.pullRandom();
}
if (B.isStorageChest(data)) {
IrisLootTable picked = null;
if (cache.exact.containsKey(data.getMaterial()) && cache.exact.containsKey(data)) {
picked = cache.exact.get(data.getMaterial()).get(data).pullRandom();
} else if (cache.basic.containsKey(data.getMaterial())) {
picked = cache.basic.get(data.getMaterial()).pullRandom();
} else if (cache.global.getSize() > 0) {
picked = cache.global.pullRandom();
}
return picked;
}
return picked;
}
return null;
}
return null;
}
}

View File

@@ -1,10 +1,9 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.manager.IrisDataManager;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -16,55 +15,50 @@ import org.bukkit.block.data.BlockData;
@AllArgsConstructor
@Desc("Find and replace object materials")
@Data
public class IrisObjectReplace
{
@ArrayType(min = 1, type = IrisBlockData.class)
@Required
@Desc("Find this block")
@DontObfuscate
private KList<IrisBlockData> find = new KList<>();
public class IrisObjectReplace {
@ArrayType(min = 1, type = IrisBlockData.class)
@Required
@Desc("Find this block")
@DontObfuscate
private KList<IrisBlockData> find = new KList<>();
@Required
@Desc("Replace it with this block palette")
@DontObfuscate
private IrisMaterialPalette replace = new IrisMaterialPalette();
@Required
@Desc("Replace it with this block palette")
@DontObfuscate
private IrisMaterialPalette replace = new IrisMaterialPalette();
@Desc("Exactly match the block data or not")
@DontObfuscate
private boolean exact = false;
@Desc("Exactly match the block data or not")
@DontObfuscate
private boolean exact = false;
@MinNumber(0)
@MaxNumber(1)
@Desc("Modifies the chance the block is replaced")
@DontObfuscate
private float chance = 1;
@MinNumber(0)
@MaxNumber(1)
@Desc("Modifies the chance the block is replaced")
@DontObfuscate
private float chance = 1;
private final transient AtomicCache<CNG> replaceGen = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> replaceData = new AtomicCache<>();
private final transient AtomicCache<CNG> replaceGen = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
private final transient AtomicCache<KList<BlockData>> replaceData = new AtomicCache<>();
public KList<BlockData> getFind(IrisDataManager rdata)
{
return findData.aquire(() ->
{
KList<BlockData> b = new KList<>();
public KList<BlockData> getFind(IrisDataManager rdata) {
return findData.aquire(() ->
{
KList<BlockData> b = new KList<>();
for(IrisBlockData i : find)
{
BlockData bx = i.getBlockData(rdata);
for (IrisBlockData i : find) {
BlockData bx = i.getBlockData(rdata);
if(bx != null)
{
b.add(bx);
}
}
if (bx != null) {
b.add(bx);
}
}
return b;
});
}
return b;
});
}
public BlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata)
{
return getReplace().get(seed, x, y, z, rdata);
}
public BlockData getReplace(RNG seed, double x, double y, double z, IrisDataManager rdata) {
return getReplace().get(seed, x, y, z, rdata);
}
}

View File

@@ -1,6 +1,5 @@
package com.volmit.iris.object;
import com.volmit.iris.Iris;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
@@ -12,8 +11,6 @@ import org.bukkit.Axis;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.*;
import org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_17_R1.block.impl.CraftRotatable;
import org.bukkit.util.BlockVector;
import java.util.List;
@@ -23,511 +20,401 @@ import java.util.List;
@AllArgsConstructor
@Desc("Configures rotation for iris")
@Data
public class IrisObjectRotation
{
@DontObfuscate
@Desc("If this rotator is enabled or not")
private boolean enabled = true;
@DontObfuscate
@Desc("The x axis rotation")
private IrisAxisRotationClamp xAxis = new IrisAxisRotationClamp();
@DontObfuscate
@Desc("The y axis rotation")
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, false, 0, 0, 90);
@DontObfuscate
@Desc("The z axis rotation")
private IrisAxisRotationClamp zAxis = new IrisAxisRotationClamp();
public double getYRotation(int spin)
{
return getRotation(spin, yAxis);
}
public double getXRotation(int spin)
{
return getRotation(spin, xAxis);
}
public double getZRotation(int spin)
{
return getRotation(spin, zAxis);
}
public IrisObject rotateCopy(IrisObject e)
{
return e.rotateCopy(this);
}
public IrisJigsawPiece rotateCopy(IrisJigsawPiece v) {
IrisJigsawPiece piece = v.copy();
for(IrisJigsawPieceConnector i : piece.getConnectors())
{
i.setPosition(rotate(i.getPosition()));
i.setDirection(rotate(i.getDirection()));
}
return piece;
}
public BlockVector rotate(BlockVector direction) {
return rotate(direction, 0,0,0);
}
public IrisDirection rotate(IrisDirection direction) {
BlockVector v = rotate(direction.toVector().toBlockVector());
return IrisDirection.closest(v);
}
public static IrisObjectRotation of(double x, double y, double z) {
IrisObjectRotation rt = new IrisObjectRotation();
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
rt.setEnabled(x != 0 || y != 0 || z != 0);
rt.setXAxis(rtx);
rt.setYAxis(rty);
rt.setZAxis(rtz);
rtx.setEnabled(x != 0);
rty.setEnabled(y != 0);
rtz.setEnabled(z != 0);
rtx.setInterval(90);
rty.setInterval(90);
rtz.setInterval(90);
rtx.minMax(x);
rty.minMax(y);
rtz.minMax(z);
return rt;
}
public double getRotation(int spin, IrisAxisRotationClamp clamp)
{
if(!enabled)
{
return 0;
}
if(!clamp.isEnabled())
{
return 0;
}
return clamp.getRadians(spin);
}
public BlockFace getFace(BlockVector v)
{
int x = (int) Math.round(v.getX());
int y = (int) Math.round(v.getY());
int z = (int) Math.round(v.getZ());
if(x == 0 && z == -1)
{
return BlockFace.NORTH;
}
if(x == 0 && z == 1)
{
return BlockFace.SOUTH;
}
if(x == 1 && z == 0)
{
return BlockFace.EAST;
}
if(x == -1 && z == 0)
{
return BlockFace.WEST;
}
if(y > 0)
{
return BlockFace.UP;
}
if(y < 0)
{
return BlockFace.DOWN;
}
return BlockFace.SOUTH;
}
public BlockFace getHexFace(BlockVector v)
{
int x = v.getBlockX();
int y = v.getBlockY();
int z = v.getBlockZ();
if(x == 0 && z == -1) return BlockFace.NORTH;
if(x == 1 && z == -2) return BlockFace.NORTH_NORTH_EAST;
if(x == 1 && z == -1) return BlockFace.NORTH_EAST;
if(x == 2 && z == -1) return BlockFace.EAST_NORTH_EAST;
if(x == 1 && z == 0) return BlockFace.EAST;
if(x == 2 && z == 1) return BlockFace.EAST_SOUTH_EAST;
if(x == 1 && z == 1) return BlockFace.SOUTH_EAST;
if(x == 1 && z == 2) return BlockFace.SOUTH_SOUTH_EAST;
if(x == 0 && z == 1) return BlockFace.SOUTH;
if(x == -1 && z == 2) return BlockFace.SOUTH_SOUTH_WEST;
if(x == -1 && z == 1) return BlockFace.SOUTH_WEST;
if(x == -2 && z == 1) return BlockFace.WEST_SOUTH_WEST;
if(x == -1 && z == 0) return BlockFace.WEST;
if(x == -2 && z == -1) return BlockFace.WEST_NORTH_WEST;
if(x == -1 && z == -1) return BlockFace.NORTH_WEST;
if(x == -1 && z == -2) return BlockFace.NORTH_NORTH_WEST;
if(y > 0)
{
return BlockFace.UP;
}
if(y < 0)
{
return BlockFace.DOWN;
}
return BlockFace.SOUTH;
}
public BlockFace faceForAxis(Axis axis)
{
switch(axis)
{
case X:
return BlockFace.EAST;
case Y:
return BlockFace.UP;
case Z:
return BlockFace.NORTH;
}
return BlockFace.NORTH;
}
public Axis axisFor(BlockFace f)
{
switch(f)
{
case NORTH:
case SOUTH:
return Axis.Z;
case EAST:
case WEST:
return Axis.X;
case UP:
case DOWN:
return Axis.Y;
}
return Axis.Y;
}
public Axis axisFor2D(BlockFace f)
{
switch(f)
{
case NORTH:
case SOUTH:
return Axis.Z;
case EAST:
case WEST:
case UP:
case DOWN:
return Axis.X;
}
return Axis.Z;
}
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz)
{
BlockData d = dd;
try
{
int spinx = (int) (90D * (Math.ceil(Math.abs((spinxx % 360D) / 90D))));
int spiny = (int) (90D * (Math.ceil(Math.abs((spinyy % 360D) / 90D))));
int spinz = (int) (90D * (Math.ceil(Math.abs((spinzz % 360D) / 90D))));
if(!canRotate())
{
return d;
}
if(d instanceof Directional)
{
Directional g = ((Directional) d);
BlockFace f = g.getFacing();
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace t = getFace(bv);
if(g.getFaces().contains(t))
{
g.setFacing(t);
}
else if(!g.getMaterial().isSolid())
{
d = null;
}
}
else if(d instanceof Rotatable)
{
Rotatable g = ((Rotatable) d);
BlockFace f = g.getRotation();
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace face = getHexFace(bv);
g.setRotation(face);
}
else if(d instanceof Orientable)
{
BlockFace f = getFace(((Orientable) d).getAxis());
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
Axis a = getAxis(bv);
if(!a.equals(((Orientable) d).getAxis()) && ((Orientable) d).getAxes().contains(a))
{
((Orientable) d).setAxis(a);
}
}
else if(d instanceof MultipleFacing)
{
List<BlockFace> faces = new KList<>();
MultipleFacing g = (MultipleFacing) d;
for(BlockFace i : g.getFaces())
{
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace r = getFace(bv);
if(g.getAllowedFaces().contains(r))
{
faces.add(r);
}
}
for(BlockFace i : g.getFaces())
{
g.setFace(i, false);
}
for(BlockFace i : faces)
{
g.setFace(i, true);
}
}
else if(d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable)
{
//TODO: Fucks up logs
Orientable g = ((Orientable) d);
BlockFace f = faceForAxis(g.getAxis());
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace t = getFace(bv);
Axis a = !g.getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
((Orientable) d).setAxis(a);
}
}
catch(Throwable throwable)
{
}
return d;
}
public Axis getAxis(BlockVector v)
{
if(Math.abs(v.getBlockX()) > Math.max(Math.abs(v.getBlockY()), Math.abs(v.getBlockZ())))
{
return Axis.X;
}
if(Math.abs(v.getBlockY()) > Math.max(Math.abs(v.getBlockX()), Math.abs(v.getBlockZ())))
{
return Axis.Y;
}
if(Math.abs(v.getBlockZ()) > Math.max(Math.abs(v.getBlockX()), Math.abs(v.getBlockY())))
{
return Axis.Z;
}
return Axis.Y;
}
private BlockFace getFace(Axis axis) {
return switch (axis) {
case X -> BlockFace.EAST;
case Y -> BlockFace.UP;
case Z -> BlockFace.SOUTH;
};
}
public IrisPosition rotate(IrisPosition b)
{
return rotate(b, 0,0,0);
}
public IrisPosition rotate(IrisPosition b, int spinx, int spiny, int spinz)
{
return new IrisPosition(rotate(new BlockVector(b.getX(), b.getY(), b.getZ()), spinx, spiny, spinz));
}
public BlockVector rotate(BlockVector b, int spinx, int spiny, int spinz)
{
if(!canRotate())
{
return b;
}
BlockVector v = b.clone();
if(canRotateX())
{
if(getXAxis().isLocked())
{
if(Math.abs(getXAxis().getMax())%360D == 180D)
{
v.setZ(-v.getZ());
v.setY(-v.getY());
}
else if(getXAxis().getMax()%360D == 90D || getXAxis().getMax()%360D == -270D)
{
double z = v.getZ();
v.setZ(v.getY());
v.setY(-z);
}
else if(getXAxis().getMax() == -90D || getXAxis().getMax()%360D == 270D)
{
double z = v.getZ();
v.setZ(-v.getY());
v.setY(z);
}
else
{
v.rotateAroundX(getXRotation(spinx));
}
}
else
{
v.rotateAroundX(getXRotation(spinx));
}
}
if(canRotateZ())
{
if(getZAxis().isLocked())
{
if(Math.abs(getZAxis().getMax())%360D == 180D)
{
v.setY(-v.getY());
v.setX(-v.getX());
}
else if(getZAxis().getMax()%360D == 90D || getZAxis().getMax()%360D == -270D)
{
double y = v.getY();
v.setY(v.getX());
v.setX(-y);
}
else if(getZAxis().getMax() == -90D || getZAxis().getMax()%360D == 270D)
{
double y = v.getY();
v.setY(-v.getX());
v.setX(y);
}
else
{
v.rotateAroundZ(getZRotation(spinz));
}
}
else
{
v.rotateAroundY(getZRotation(spinz));
}
}
if(canRotateY())
{
if(getYAxis().isLocked())
{
if(Math.abs(getYAxis().getMax())%360D == 180D)
{
v.setX(-v.getX());
v.setZ(-v.getZ());
}
else if(getYAxis().getMax()%360D == 90D || getYAxis().getMax()%360D == -270D)
{
double x = v.getX();
v.setX(v.getZ());
v.setZ(-x);
}
else if(getYAxis().getMax() == -90D || getYAxis().getMax()%360D == 270D)
{
double x = v.getX();
v.setX(-v.getZ());
v.setZ(x);
}
else
{
v.rotateAroundY(getYRotation(spiny));
}
}
else
{
v.rotateAroundY(getYRotation(spiny));
}
}
return v;
}
public boolean canRotateX()
{
return enabled && xAxis.isEnabled();
}
public boolean canRotateY()
{
return enabled && yAxis.isEnabled();
}
public boolean canRotateZ()
{
return enabled && zAxis.isEnabled();
}
public boolean canRotate()
{
return canRotateX() || canRotateY() || canRotateZ();
}
public class IrisObjectRotation {
@DontObfuscate
@Desc("If this rotator is enabled or not")
private boolean enabled = true;
@DontObfuscate
@Desc("The x axis rotation")
private IrisAxisRotationClamp xAxis = new IrisAxisRotationClamp();
@DontObfuscate
@Desc("The y axis rotation")
private IrisAxisRotationClamp yAxis = new IrisAxisRotationClamp(true, false, 0, 0, 90);
@DontObfuscate
@Desc("The z axis rotation")
private IrisAxisRotationClamp zAxis = new IrisAxisRotationClamp();
public double getYRotation(int spin) {
return getRotation(spin, yAxis);
}
public double getXRotation(int spin) {
return getRotation(spin, xAxis);
}
public double getZRotation(int spin) {
return getRotation(spin, zAxis);
}
public IrisObject rotateCopy(IrisObject e) {
return e.rotateCopy(this);
}
public IrisJigsawPiece rotateCopy(IrisJigsawPiece v) {
IrisJigsawPiece piece = v.copy();
for (IrisJigsawPieceConnector i : piece.getConnectors()) {
i.setPosition(rotate(i.getPosition()));
i.setDirection(rotate(i.getDirection()));
}
return piece;
}
public BlockVector rotate(BlockVector direction) {
return rotate(direction, 0, 0, 0);
}
public IrisDirection rotate(IrisDirection direction) {
BlockVector v = rotate(direction.toVector().toBlockVector());
return IrisDirection.closest(v);
}
public static IrisObjectRotation of(double x, double y, double z) {
IrisObjectRotation rt = new IrisObjectRotation();
IrisAxisRotationClamp rtx = new IrisAxisRotationClamp();
IrisAxisRotationClamp rty = new IrisAxisRotationClamp();
IrisAxisRotationClamp rtz = new IrisAxisRotationClamp();
rt.setEnabled(x != 0 || y != 0 || z != 0);
rt.setXAxis(rtx);
rt.setYAxis(rty);
rt.setZAxis(rtz);
rtx.setEnabled(x != 0);
rty.setEnabled(y != 0);
rtz.setEnabled(z != 0);
rtx.setInterval(90);
rty.setInterval(90);
rtz.setInterval(90);
rtx.minMax(x);
rty.minMax(y);
rtz.minMax(z);
return rt;
}
public double getRotation(int spin, IrisAxisRotationClamp clamp) {
if (!enabled) {
return 0;
}
if (!clamp.isEnabled()) {
return 0;
}
return clamp.getRadians(spin);
}
public BlockFace getFace(BlockVector v) {
int x = (int) Math.round(v.getX());
int y = (int) Math.round(v.getY());
int z = (int) Math.round(v.getZ());
if (x == 0 && z == -1) {
return BlockFace.NORTH;
}
if (x == 0 && z == 1) {
return BlockFace.SOUTH;
}
if (x == 1 && z == 0) {
return BlockFace.EAST;
}
if (x == -1 && z == 0) {
return BlockFace.WEST;
}
if (y > 0) {
return BlockFace.UP;
}
if (y < 0) {
return BlockFace.DOWN;
}
return BlockFace.SOUTH;
}
public BlockFace getHexFace(BlockVector v) {
int x = v.getBlockX();
int y = v.getBlockY();
int z = v.getBlockZ();
if (x == 0 && z == -1) return BlockFace.NORTH;
if (x == 1 && z == -2) return BlockFace.NORTH_NORTH_EAST;
if (x == 1 && z == -1) return BlockFace.NORTH_EAST;
if (x == 2 && z == -1) return BlockFace.EAST_NORTH_EAST;
if (x == 1 && z == 0) return BlockFace.EAST;
if (x == 2 && z == 1) return BlockFace.EAST_SOUTH_EAST;
if (x == 1 && z == 1) return BlockFace.SOUTH_EAST;
if (x == 1 && z == 2) return BlockFace.SOUTH_SOUTH_EAST;
if (x == 0 && z == 1) return BlockFace.SOUTH;
if (x == -1 && z == 2) return BlockFace.SOUTH_SOUTH_WEST;
if (x == -1 && z == 1) return BlockFace.SOUTH_WEST;
if (x == -2 && z == 1) return BlockFace.WEST_SOUTH_WEST;
if (x == -1 && z == 0) return BlockFace.WEST;
if (x == -2 && z == -1) return BlockFace.WEST_NORTH_WEST;
if (x == -1 && z == -1) return BlockFace.NORTH_WEST;
if (x == -1 && z == -2) return BlockFace.NORTH_NORTH_WEST;
if (y > 0) {
return BlockFace.UP;
}
if (y < 0) {
return BlockFace.DOWN;
}
return BlockFace.SOUTH;
}
public BlockFace faceForAxis(Axis axis) {
switch (axis) {
case X:
return BlockFace.EAST;
case Y:
return BlockFace.UP;
case Z:
return BlockFace.NORTH;
}
return BlockFace.NORTH;
}
public Axis axisFor(BlockFace f) {
switch (f) {
case NORTH:
case SOUTH:
return Axis.Z;
case EAST:
case WEST:
return Axis.X;
case UP:
case DOWN:
return Axis.Y;
}
return Axis.Y;
}
public Axis axisFor2D(BlockFace f) {
switch (f) {
case NORTH:
case SOUTH:
return Axis.Z;
case EAST:
case WEST:
case UP:
case DOWN:
return Axis.X;
}
return Axis.Z;
}
public BlockData rotate(BlockData dd, int spinxx, int spinyy, int spinzz) {
BlockData d = dd;
try {
int spinx = (int) (90D * (Math.ceil(Math.abs((spinxx % 360D) / 90D))));
int spiny = (int) (90D * (Math.ceil(Math.abs((spinyy % 360D) / 90D))));
int spinz = (int) (90D * (Math.ceil(Math.abs((spinzz % 360D) / 90D))));
if (!canRotate()) {
return d;
}
if (d instanceof Directional) {
Directional g = ((Directional) d);
BlockFace f = g.getFacing();
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace t = getFace(bv);
if (g.getFaces().contains(t)) {
g.setFacing(t);
} else if (!g.getMaterial().isSolid()) {
d = null;
}
} else if (d instanceof Rotatable) {
Rotatable g = ((Rotatable) d);
BlockFace f = g.getRotation();
BlockVector bv = new BlockVector(f.getModX(), 0, f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace face = getHexFace(bv);
g.setRotation(face);
} else if (d instanceof Orientable) {
BlockFace f = getFace(((Orientable) d).getAxis());
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
Axis a = getAxis(bv);
if (!a.equals(((Orientable) d).getAxis()) && ((Orientable) d).getAxes().contains(a)) {
((Orientable) d).setAxis(a);
}
} else if (d instanceof MultipleFacing) {
List<BlockFace> faces = new KList<>();
MultipleFacing g = (MultipleFacing) d;
for (BlockFace i : g.getFaces()) {
BlockVector bv = new BlockVector(i.getModX(), i.getModY(), i.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace r = getFace(bv);
if (g.getAllowedFaces().contains(r)) {
faces.add(r);
}
}
for (BlockFace i : g.getFaces()) {
g.setFace(i, false);
}
for (BlockFace i : faces) {
g.setFace(i, true);
}
} else if (d.getMaterial().equals(Material.NETHER_PORTAL) && d instanceof Orientable) {
//TODO: Fucks up logs
Orientable g = ((Orientable) d);
BlockFace f = faceForAxis(g.getAxis());
BlockVector bv = new BlockVector(f.getModX(), f.getModY(), f.getModZ());
bv = rotate(bv.clone(), spinx, spiny, spinz);
BlockFace t = getFace(bv);
Axis a = !g.getAxes().contains(Axis.Y) ? axisFor(t) : axisFor2D(t);
((Orientable) d).setAxis(a);
}
} catch (Throwable throwable) {
}
return d;
}
public Axis getAxis(BlockVector v) {
if (Math.abs(v.getBlockX()) > Math.max(Math.abs(v.getBlockY()), Math.abs(v.getBlockZ()))) {
return Axis.X;
}
if (Math.abs(v.getBlockY()) > Math.max(Math.abs(v.getBlockX()), Math.abs(v.getBlockZ()))) {
return Axis.Y;
}
if (Math.abs(v.getBlockZ()) > Math.max(Math.abs(v.getBlockX()), Math.abs(v.getBlockY()))) {
return Axis.Z;
}
return Axis.Y;
}
private BlockFace getFace(Axis axis) {
return switch (axis) {
case X -> BlockFace.EAST;
case Y -> BlockFace.UP;
case Z -> BlockFace.SOUTH;
};
}
public IrisPosition rotate(IrisPosition b) {
return rotate(b, 0, 0, 0);
}
public IrisPosition rotate(IrisPosition b, int spinx, int spiny, int spinz) {
return new IrisPosition(rotate(new BlockVector(b.getX(), b.getY(), b.getZ()), spinx, spiny, spinz));
}
public BlockVector rotate(BlockVector b, int spinx, int spiny, int spinz) {
if (!canRotate()) {
return b;
}
BlockVector v = b.clone();
if (canRotateX()) {
if (getXAxis().isLocked()) {
if (Math.abs(getXAxis().getMax()) % 360D == 180D) {
v.setZ(-v.getZ());
v.setY(-v.getY());
} else if (getXAxis().getMax() % 360D == 90D || getXAxis().getMax() % 360D == -270D) {
double z = v.getZ();
v.setZ(v.getY());
v.setY(-z);
} else if (getXAxis().getMax() == -90D || getXAxis().getMax() % 360D == 270D) {
double z = v.getZ();
v.setZ(-v.getY());
v.setY(z);
} else {
v.rotateAroundX(getXRotation(spinx));
}
} else {
v.rotateAroundX(getXRotation(spinx));
}
}
if (canRotateZ()) {
if (getZAxis().isLocked()) {
if (Math.abs(getZAxis().getMax()) % 360D == 180D) {
v.setY(-v.getY());
v.setX(-v.getX());
} else if (getZAxis().getMax() % 360D == 90D || getZAxis().getMax() % 360D == -270D) {
double y = v.getY();
v.setY(v.getX());
v.setX(-y);
} else if (getZAxis().getMax() == -90D || getZAxis().getMax() % 360D == 270D) {
double y = v.getY();
v.setY(-v.getX());
v.setX(y);
} else {
v.rotateAroundZ(getZRotation(spinz));
}
} else {
v.rotateAroundY(getZRotation(spinz));
}
}
if (canRotateY()) {
if (getYAxis().isLocked()) {
if (Math.abs(getYAxis().getMax()) % 360D == 180D) {
v.setX(-v.getX());
v.setZ(-v.getZ());
} else if (getYAxis().getMax() % 360D == 90D || getYAxis().getMax() % 360D == -270D) {
double x = v.getX();
v.setX(v.getZ());
v.setZ(-x);
} else if (getYAxis().getMax() == -90D || getYAxis().getMax() % 360D == 270D) {
double x = v.getX();
v.setX(-v.getZ());
v.setZ(x);
} else {
v.rotateAroundY(getYRotation(spiny));
}
} else {
v.rotateAroundY(getYRotation(spiny));
}
}
return v;
}
public boolean canRotateX() {
return enabled && xAxis.isEnabled();
}
public boolean canRotateY() {
return enabled && yAxis.isEnabled();
}
public boolean canRotateZ() {
return enabled && zAxis.isEnabled();
}
public boolean canRotate() {
return canRotateX() || canRotateY() || canRotateZ();
}
}

View File

@@ -12,79 +12,70 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Scale objects")
@Data
public class IrisObjectScale
{
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("Iris Objects are scaled and cached to speed up placements. Because of this extra memory is used, so we evenly distribute variations across the defined scale range, then pick one randomly. If the differences is small, use a lower number. For more possibilities on the scale spectrum, increase this at the cost of memory.")
private int variations = 7;
public class IrisObjectScale {
@MinNumber(1)
@MaxNumber(32)
@DontObfuscate
@Desc("Iris Objects are scaled and cached to speed up placements. Because of this extra memory is used, so we evenly distribute variations across the defined scale range, then pick one randomly. If the differences is small, use a lower number. For more possibilities on the scale spectrum, increase this at the cost of memory.")
private int variations = 7;
@MinNumber(0.01)
@MaxNumber(50)
@DontObfuscate
@Desc("The minimum scale")
private double minimumScale = 1;
@MinNumber(0.01)
@MaxNumber(50)
@DontObfuscate
@Desc("The minimum scale")
private double minimumScale = 1;
@MinNumber(0.01)
@MaxNumber(50)
@DontObfuscate
@Desc("The maximum height for placement (top of object)")
private double maximumScale = 1;
@MinNumber(0.01)
@MaxNumber(50)
@DontObfuscate
@Desc("The maximum height for placement (top of object)")
private double maximumScale = 1;
private final transient ConcurrentLinkedHashMap<IrisObject, KList<IrisObject>> cache
= new ConcurrentLinkedHashMap.Builder<IrisObject, KList<IrisObject>>()
.initialCapacity(64)
.maximumWeightedCapacity(64)
.concurrencyLevel(32)
.build();
private final transient ConcurrentLinkedHashMap<IrisObject, KList<IrisObject>> cache
= new ConcurrentLinkedHashMap.Builder<IrisObject, KList<IrisObject>>()
.initialCapacity(64)
.maximumWeightedCapacity(64)
.concurrencyLevel(32)
.build();
public boolean shouldScale()
{
return ((minimumScale == maximumScale) && maximumScale == 1) || variations <= 0;
}
public boolean shouldScale() {
return ((minimumScale == maximumScale) && maximumScale == 1) || variations <= 0;
}
public int getMaxSizeFor(int indim)
{
return (int) (getMaxScale() * indim);
}
public int getMaxSizeFor(int indim) {
return (int) (getMaxScale() * indim);
}
public double getMaxScale()
{
double mx = 0;
public double getMaxScale() {
double mx = 0;
for(double i = minimumScale; i < maximumScale; i+= (maximumScale - minimumScale) / (double)(Math.min(variations, 32)))
{
mx = i;
}
for (double i = minimumScale; i < maximumScale; i += (maximumScale - minimumScale) / (double) (Math.min(variations, 32))) {
mx = i;
}
return mx;
}
return mx;
}
public IrisObject get(RNG rng, IrisObject origin)
{
if(shouldScale())
{
return origin;
}
public IrisObject get(RNG rng, IrisObject origin) {
if (shouldScale()) {
return origin;
}
return cache.compute(origin, (k, v) -> {
if(v != null)
{
return v;
}
return cache.compute(origin, (k, v) -> {
if (v != null) {
return v;
}
KList<IrisObject> c = new KList<>();
for(double i = minimumScale; i < maximumScale; i+= (maximumScale - minimumScale) / (double)(Math.min(variations, 32)))
{
c.add(origin.scaled(i));
}
KList<IrisObject> c = new KList<>();
for (double i = minimumScale; i < maximumScale; i += (maximumScale - minimumScale) / (double) (Math.min(variations, 32))) {
c.add(origin.scaled(i));
}
return c;
}).getRandom(rng);
}
return c;
}).getRandom(rng);
}
public boolean canScaleBeyond() {
return shouldScale() && maximumScale > 1;
}
public boolean canScaleBeyond() {
return shouldScale() && maximumScale > 1;
}
}

View File

@@ -1,73 +1,61 @@
package com.volmit.iris.object;
import org.bukkit.util.BlockVector;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.util.BlockVector;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisObjectTranslate
{
public class IrisObjectTranslate {
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int x = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int x = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int y = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int y = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("Adds an additional amount of height randomly (translateY + rand(0 - yRandom))")
private int yRandom = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("Adds an additional amount of height randomly (translateY + rand(0 - yRandom))")
private int yRandom = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int z = 0;
@MinNumber(-128) // TODO: WARNING HEIGHT
@MaxNumber(128) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The x shift in blocks")
private int z = 0;
public boolean canTranslate()
{
return x != 0 || y != 0 || z != 0;
}
public boolean canTranslate() {
return x != 0 || y != 0 || z != 0;
}
public BlockVector translate(BlockVector i)
{
if(canTranslate())
{
return (BlockVector) i.clone().add(new BlockVector(x, y, z));
}
public BlockVector translate(BlockVector i) {
if (canTranslate()) {
return (BlockVector) i.clone().add(new BlockVector(x, y, z));
}
return i;
}
return i;
}
public BlockVector translate(BlockVector clone, IrisObjectRotation rotation, int sx, int sy, int sz)
{
if(canTranslate())
{
return (BlockVector) clone.clone().add(rotation.rotate(new BlockVector(x, y, z), sx, sy, sz));
}
public BlockVector translate(BlockVector clone, IrisObjectRotation rotation, int sx, int sy, int sz) {
if (canTranslate()) {
return (BlockVector) clone.clone().add(rotation.rotate(new BlockVector(x, y, z), sx, sy, sz));
}
return clone;
}
return clone;
}
}

View File

@@ -16,50 +16,49 @@ import org.bukkit.util.Vector;
@AllArgsConstructor
@Desc("Represents a position")
@Data
public class IrisPosition
{
@DontObfuscate
@Desc("The x position")
private int x = 0;
public class IrisPosition {
@DontObfuscate
@Desc("The x position")
private int x = 0;
@DontObfuscate
@Desc("The y position")
private int y = 0;
@DontObfuscate
@Desc("The y position")
private int y = 0;
@DontObfuscate
@Desc("The z position")
private int z = 0;
@DontObfuscate
@Desc("The z position")
private int z = 0;
public IrisPosition(BlockVector bv) {
this(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
}
public IrisPosition(BlockVector bv) {
this(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
}
public IrisPosition(Location l) {
this(l.getBlockX(), l.getBlockY(), l.getBlockZ());
}
public IrisPosition(Location l) {
this(l.getBlockX(), l.getBlockY(), l.getBlockZ());
}
public IrisPosition(Vector v) {
this(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
public IrisPosition(Vector v) {
this(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
public IrisPosition add(IrisPosition relativePosition) {
return new IrisPosition(relativePosition.x+x, relativePosition.y+y, relativePosition.z + z);
}
public IrisPosition add(IrisPosition relativePosition) {
return new IrisPosition(relativePosition.x + x, relativePosition.y + y, relativePosition.z + z);
}
public IrisPosition sub(IrisPosition relativePosition) {
return new IrisPosition(x-relativePosition.x, y-relativePosition.y, z-relativePosition.z);
}
public IrisPosition sub(IrisPosition relativePosition) {
return new IrisPosition(x - relativePosition.x, y - relativePosition.y, z - relativePosition.z);
}
public Location toLocation(World world) {
return new Location(world, x,y,z);
}
public Location toLocation(World world) {
return new Location(world, x, y, z);
}
public IrisPosition copy() {
return new IrisPosition(x,y,z);
return new IrisPosition(x, y, z);
}
@Override
public String toString() {
return "[" + getX() + "," + getY() + "," + getZ() + "]";
}
return "[" + getX() + "," + getY() + "," + getZ() + "]";
}
}

View File

@@ -12,13 +12,12 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Represents a position")
@Data
public class IrisPosition2D
{
@DontObfuscate
@Desc("The x position")
private int x = 0;
public class IrisPosition2D {
@DontObfuscate
@Desc("The x position")
private int x = 0;
@DontObfuscate
@Desc("The z position")
private int z = 0;
@DontObfuscate
@Desc("The z position")
private int z = 0;
}

View File

@@ -1,21 +1,15 @@
package com.volmit.iris.object;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.volmit.iris.Iris;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.entity.LivingEntity;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
@Accessors(chain = true)
@NoArgsConstructor
@@ -23,88 +17,75 @@ import lombok.experimental.Accessors;
@DontObfuscate
@Desc("An iris potion effect")
@Data
public class IrisPotionEffect
{
public class IrisPotionEffect {
@Required
@DontObfuscate
@Desc("The potion effect to apply in this area")
private String potionEffect = "";
@Required
@DontObfuscate
@Desc("The potion effect to apply in this area")
private String potionEffect = "";
@Required
@MinNumber(-1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The Potion Strength or -1 to disable")
private int strength = -1;
@Required
@MinNumber(-1)
@MaxNumber(1024)
@DontObfuscate
@Desc("The Potion Strength or -1 to disable")
private int strength = -1;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The time the potion will last for")
private int ticks = 200;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("The time the potion will last for")
private int ticks = 200;
@DontObfuscate
@Desc("Is the effect ambient")
private boolean ambient = false;
@DontObfuscate
@Desc("Is the effect ambient")
private boolean ambient = false;
@DontObfuscate
@Desc("Is the effect showing particles")
private boolean particles = true;
@DontObfuscate
@Desc("Is the effect showing particles")
private boolean particles = true;
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
private final transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
public PotionEffectType getRealType()
{
return pt.aquire(() ->
{
PotionEffectType t = PotionEffectType.LUCK;
public PotionEffectType getRealType() {
return pt.aquire(() ->
{
PotionEffectType t = PotionEffectType.LUCK;
if(getPotionEffect().isEmpty())
{
return t;
}
if (getPotionEffect().isEmpty()) {
return t;
}
try
{
for(PotionEffectType i : PotionEffectType.values())
{
if(i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect()))
{
t = i;
try {
for (PotionEffectType i : PotionEffectType.values()) {
if (i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect())) {
t = i;
return t;
}
}
}
return t;
}
}
} catch (Throwable e) {
catch(Throwable e)
{
}
}
Iris.warn("Unknown Potion Effect Type: " + getPotionEffect());
Iris.warn("Unknown Potion Effect Type: " + getPotionEffect());
return t;
});
}
return t;
});
}
public void apply(LivingEntity p) {
if (strength > -1) {
if (p.hasPotionEffect(getRealType())) {
PotionEffect e = p.getPotionEffect(getRealType());
if (e.getAmplifier() > strength) {
return;
}
public void apply(LivingEntity p)
{
if(strength > -1)
{
if(p.hasPotionEffect(getRealType()))
{
PotionEffect e = p.getPotionEffect(getRealType());
if(e.getAmplifier() > strength)
{
return;
}
p.removePotionEffect(getRealType());
}
p.removePotionEffect(getRealType());
}
p.addPotionEffect(new PotionEffect(getRealType(), ticks, strength, ambient, particles, false));
}
}
p.addPotionEffect(new PotionEffect(getRealType(), ticks, strength, ambient, particles, false));
}
}
}

View File

@@ -13,23 +13,20 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Represents a range")
@Data
public class IrisRange
{
@DontObfuscate
@Desc("The minimum value")
private double min = 16;
public class IrisRange {
@DontObfuscate
@Desc("The minimum value")
private double min = 16;
@DontObfuscate
@Desc("The maximum value")
private double max = 32;
@DontObfuscate
@Desc("The maximum value")
private double max = 32;
public double get(RNG rng)
{
if(min == max)
{
return min;
}
public double get(RNG rng) {
if (min == max) {
return min;
}
return rng.d(min, max);
}
return rng.d(min, max);
}
}

View File

@@ -1,11 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RegistryListObject;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -19,18 +14,17 @@ import lombok.experimental.Accessors;
@Desc("Represents a structure tile")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisRareObject
{
public class IrisRareObject {
@Required
@MinNumber(1)
@Desc("The rarity is 1 in X")
@DontObfuscate
private int rarity = 1;
@Required
@MinNumber(1)
@Desc("The rarity is 1 in X")
@DontObfuscate
private int rarity = 1;
@RegistryListObject
@Required
@Desc("The object to place if rarity check passed")
@DontObfuscate
private String object = "";
@RegistryListObject
@Required
@Desc("The object to place if rarity check passed")
@DontObfuscate
private String object = "";
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,15 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CellGenerator;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.RegistryListBiome;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -20,124 +13,111 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("A ridge config")
@Data
public class IrisRegionRidge
{
@RegistryListBiome
@Required
@DontObfuscate
@Desc("The biome name")
private String biome = "";
public class IrisRegionRidge {
@Required
@DontObfuscate
@Desc("The type this biome should override (land sea or shore)")
private InferredType type = InferredType.LAND;
@DontObfuscate
@Desc("What type this spot is (i.e. target SEA but as LAND) like an island. Default matches the target type")
private InferredType as = InferredType.DEFER;
@DontObfuscate
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
private double noiseMultiplier = 0;
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance this biome will be placed in a given spot")
private double chance = 0.75;
@MinNumber(0)
@DontObfuscate
@Desc("The scale of the biome ridge. Higher values = wider veins & bigger connected cells")
private double scale = 5;
@DontObfuscate
@Desc("The chance scale (cell chances)")
private double chanceScale = 4;
@MinNumber(0)
@DontObfuscate
@Desc("The shuffle, how 'natural' this looks. Compared to pure polygons")
private double shuffle = 16;
@MinNumber(0)
@DontObfuscate
@Desc("The chance shuffle (polygon cell chances)")
private double chanceShuffle = 128;
@MinNumber(0)
@DontObfuscate
@Desc("The thickness of the vein")
private double thickness = 0.125;
@DontObfuscate
@Desc("If the noise multiplier is below zero, what should the air be filled with?")
private IrisBiomePaletteLayer air = new IrisBiomePaletteLayer().zero();
private final transient AtomicCache<CellGenerator> spot = new AtomicCache<>();
private final transient AtomicCache<CellGenerator> ridge = new AtomicCache<>();
@RegistryListBiome
@Required
@DontObfuscate
@Desc("The biome name")
private String biome = "";
public CellGenerator getSpotGenerator(RNG rng)
{
return spot.aquire(() ->
{
CellGenerator spot = new CellGenerator(rng.nextParallelRNG((int) (198523 * getChance())));
spot.setCellScale(chanceScale);
spot.setShuffle(shuffle);
return spot;
});
}
@Required
@DontObfuscate
@Desc("The type this biome should override (land sea or shore)")
private InferredType type = InferredType.LAND;
public CellGenerator getRidgeGenerator(RNG rng)
{
return spot.aquire(() ->
{
CellGenerator ridge = new CellGenerator(rng.nextParallelRNG((int) (465583 * getChance())));
ridge.setCellScale(scale);
ridge.setShuffle(shuffle);
return ridge;
});
}
public double getRidgeHeight(RNG rng, double x, double z)
{
if(getNoiseMultiplier() == 0)
{
return 0;
}
@DontObfuscate
@Desc("What type this spot is (i.e. target SEA but as LAND) like an island. Default matches the target type")
private InferredType as = InferredType.DEFER;
return getSpotGenerator(rng).getDistance(x, z) * getRidgeGenerator(rng).getDistance(x, z) * getNoiseMultiplier();
}
public boolean isRidge(RNG rng, double x, double z)
{
if(chance < 1)
{
if(getSpotGenerator(rng).getIndex(x, z, 1000) > chance * 1000)
{
return false;
}
}
@DontObfuscate
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
private double noiseMultiplier = 0;
if(getRidgeGenerator(rng).getDistance(x, z) <= thickness)
{
return true;
}
return false;
}
@Required
@MinNumber(0)
@MaxNumber(1)
@DontObfuscate
@Desc("The chance this biome will be placed in a given spot")
private double chance = 0.75;
@MinNumber(0)
@DontObfuscate
@Desc("The scale of the biome ridge. Higher values = wider veins & bigger connected cells")
private double scale = 5;
@DontObfuscate
@Desc("The chance scale (cell chances)")
private double chanceScale = 4;
@MinNumber(0)
@DontObfuscate
@Desc("The shuffle, how 'natural' this looks. Compared to pure polygons")
private double shuffle = 16;
@MinNumber(0)
@DontObfuscate
@Desc("The chance shuffle (polygon cell chances)")
private double chanceShuffle = 128;
@MinNumber(0)
@DontObfuscate
@Desc("The thickness of the vein")
private double thickness = 0.125;
@DontObfuscate
@Desc("If the noise multiplier is below zero, what should the air be filled with?")
private IrisBiomePaletteLayer air = new IrisBiomePaletteLayer().zero();
private final transient AtomicCache<CellGenerator> spot = new AtomicCache<>();
private final transient AtomicCache<CellGenerator> ridge = new AtomicCache<>();
public CellGenerator getSpotGenerator(RNG rng) {
return spot.aquire(() ->
{
CellGenerator spot = new CellGenerator(rng.nextParallelRNG((int) (198523 * getChance())));
spot.setCellScale(chanceScale);
spot.setShuffle(shuffle);
return spot;
});
}
public CellGenerator getRidgeGenerator(RNG rng) {
return spot.aquire(() ->
{
CellGenerator ridge = new CellGenerator(rng.nextParallelRNG((int) (465583 * getChance())));
ridge.setCellScale(scale);
ridge.setShuffle(shuffle);
return ridge;
});
}
public double getRidgeHeight(RNG rng, double x, double z) {
if (getNoiseMultiplier() == 0) {
return 0;
}
return getSpotGenerator(rng).getDistance(x, z) * getRidgeGenerator(rng).getDistance(x, z) * getNoiseMultiplier();
}
public boolean isRidge(RNG rng, double x, double z) {
if (chance < 1) {
if (getSpotGenerator(rng).getIndex(x, z, 1000) > chance * 1000) {
return false;
}
}
return getRidgeGenerator(rng).getDistance(x, z) <= thickness;
}
}

View File

@@ -1,14 +1,8 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.generator.noise.CellGenerator;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.RegistryListBiome;
import com.volmit.iris.util.Required;
import com.volmit.iris.scaffold.cache.AtomicCache;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -19,78 +13,68 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("A spot config")
@Data
public class IrisRegionSpot
{
public class IrisRegionSpot {
@RegistryListBiome
@Required
@DontObfuscate
@Desc("The biome to be placed")
private String biome = "";
@RegistryListBiome
@Required
@DontObfuscate
@Desc("The biome to be placed")
private String biome = "";
@Required
@DontObfuscate
@Desc("Where this spot overrides. Land sea or shore")
private InferredType type = InferredType.LAND;
@Required
@DontObfuscate
@Desc("Where this spot overrides. Land sea or shore")
private InferredType type = InferredType.LAND;
@DontObfuscate
@Desc("What type this spot is (i.e. target SEA but as LAND) like an island. Default matches the target type")
private InferredType as = InferredType.DEFER;
@DontObfuscate
@Desc("What type this spot is (i.e. target SEA but as LAND) like an island. Default matches the target type")
private InferredType as = InferredType.DEFER;
@DontObfuscate
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
private double noiseMultiplier = 0;
@DontObfuscate
@Desc("Use the distance from cell value to add or remove noise value. (Forces depth or height)")
private double noiseMultiplier = 0;
@MinNumber(0)
@DontObfuscate
@Desc("The scale of splotches")
private double scale = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The scale of splotches")
private double scale = 1;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("Rarity is how often this splotch appears. higher = less often")
private double rarity = 1;
@Required
@MinNumber(1)
@DontObfuscate
@Desc("Rarity is how often this splotch appears. higher = less often")
private double rarity = 1;
@MinNumber(0)
@DontObfuscate
@Desc("The shuffle or how natural the splotch looks like (anti-polygon)")
private double shuffle = 128;
@MinNumber(0)
@DontObfuscate
@Desc("The shuffle or how natural the splotch looks like (anti-polygon)")
private double shuffle = 128;
@DontObfuscate
@Desc("If the noise multiplier is below zero, what should the air be filled with?")
private IrisBiomePaletteLayer air = new IrisBiomePaletteLayer().zero();
@DontObfuscate
@Desc("If the noise multiplier is below zero, what should the air be filled with?")
private IrisBiomePaletteLayer air = new IrisBiomePaletteLayer().zero();
private final transient AtomicCache<CellGenerator> spot = new AtomicCache<>();
private final transient AtomicCache<CellGenerator> spot = new AtomicCache<>();
public CellGenerator getSpotGenerator(RNG rng)
{
return spot.aquire(() ->
{
CellGenerator spot = new CellGenerator(rng.nextParallelRNG((int) (168583 * (shuffle + 102) + rarity + (scale * 10465) + biome.length() + type.ordinal() + as.ordinal())));
spot.setCellScale(scale);
spot.setShuffle(shuffle);
return spot;
});
}
public CellGenerator getSpotGenerator(RNG rng) {
return spot.aquire(() ->
{
CellGenerator spot = new CellGenerator(rng.nextParallelRNG((int) (168583 * (shuffle + 102) + rarity + (scale * 10465) + biome.length() + type.ordinal() + as.ordinal())));
spot.setCellScale(scale);
spot.setShuffle(shuffle);
return spot;
});
}
public double getSpotHeight(RNG rng, double x, double z)
{
if(getNoiseMultiplier() == 0)
{
return 0;
}
public double getSpotHeight(RNG rng, double x, double z) {
if (getNoiseMultiplier() == 0) {
return 0;
}
return getSpotGenerator(rng).getDistance(x, z) * getNoiseMultiplier();
}
return getSpotGenerator(rng).getDistance(x, z) * getNoiseMultiplier();
}
public boolean isSpot(RNG rng, double x, double z)
{
if(getSpotGenerator(rng).getIndex(x, z, (int) (Math.round(rarity) + 8)) == (int) ((Math.round(rarity) + 8) / 2))
{
return true;
}
return false;
}
public boolean isSpot(RNG rng, double x, double z) {
return getSpotGenerator(rng).getIndex(x, z, (int) (Math.round(rarity) + 8)) == (int) ((Math.round(rarity) + 8) / 2);
}
}

View File

@@ -6,11 +6,10 @@ import lombok.Data;
import java.io.File;
@Data
public class IrisRegistrant
{
private transient IrisDataManager loader;
public class IrisRegistrant {
private transient IrisDataManager loader;
private transient String loadKey;
private transient String loadKey;
private transient File loadFile;
private transient File loadFile;
}

View File

@@ -1,12 +1,6 @@
package com.volmit.iris.object;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import com.volmit.iris.util.RNG;
import com.volmit.iris.util.Required;
import com.volmit.iris.util.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -17,43 +11,39 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("This represents a generator with a min and max height")
@Data
public class IrisShapedGeneratorStyle
{
@Required
@DontObfuscate
@Desc("The generator id")
public class IrisShapedGeneratorStyle {
@Required
@DontObfuscate
@Desc("The generator id")
private IrisGeneratorStyle generator = new IrisGeneratorStyle(NoiseStyle.IRIS);
private IrisGeneratorStyle generator = new IrisGeneratorStyle(NoiseStyle.IRIS);
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The min block value")
private int min = 0;
@DontObfuscate
@Desc("The min block value")
private int min = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max block value")
private int max = 0;
@Required
@MinNumber(-256) // TODO: WARNING HEIGHT
@MaxNumber(256) // TODO: WARNING HEIGHT
@DontObfuscate
@Desc("The max block value")
private int max = 0;
public double get(RNG rng, double... dim)
{
return generator.create(rng).fitDouble(min, max, dim);
}
public double get(RNG rng, double... dim) {
return generator.create(rng).fitDouble(min, max, dim);
}
public IrisShapedGeneratorStyle(NoiseStyle style, int min, int max)
{
this(style);
this.min = min;
this.max = max;
}
public IrisShapedGeneratorStyle(NoiseStyle style, int min, int max) {
this(style);
this.min = min;
this.max = max;
}
public IrisShapedGeneratorStyle(NoiseStyle style)
{
this.generator = new IrisGeneratorStyle(style);
}
public IrisShapedGeneratorStyle(NoiseStyle style) {
this.generator = new IrisGeneratorStyle(style);
}
}

View File

@@ -1,6 +1,9 @@
package com.volmit.iris.object;
import com.volmit.iris.util.*;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
import com.volmit.iris.util.MinNumber;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -11,36 +14,28 @@ import lombok.experimental.Accessors;
@AllArgsConstructor
@Desc("Translate objects")
@Data
public class IrisSlopeClip
{
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The minimum slope for placement")
private double minimumSlope = 0;
public class IrisSlopeClip {
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The minimum slope for placement")
private double minimumSlope = 0;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The maximum slope for placement")
private double maximumSlope = 10;
@MinNumber(0)
@MaxNumber(255)
@DontObfuscate
@Desc("The maximum slope for placement")
private double maximumSlope = 10;
public boolean isDefault() {
return minimumSlope <= 0 && maximumSlope >= 10;
}
public boolean isDefault() {
return minimumSlope <= 0 && maximumSlope >= 10;
}
public boolean isValid(double slope)
{
if(isDefault())
{
return true;
}
public boolean isValid(double slope) {
if (isDefault()) {
return true;
}
if(minimumSlope > slope || maximumSlope < slope)
{
return false;
}
return true;
}
return !(minimumSlope > slope) && !(maximumSlope < slope);
}
}

View File

@@ -4,17 +4,16 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("A loot mode is used to descrive what to do with the existing loot layers before adding this loot. Using ADD will simply add this table to the building list of tables (i.e. add dimension tables, region tables then biome tables). By using clear or replace, you remove the parent tables before and add just your tables.")
public enum LootMode
{
@Desc("Add to the existing parent loot tables")
@DontObfuscate
ADD,
public enum LootMode {
@Desc("Add to the existing parent loot tables")
@DontObfuscate
ADD,
@Desc("Clear all loot tables then add this table")
@DontObfuscate
CLEAR,
@Desc("Clear all loot tables then add this table")
@DontObfuscate
CLEAR,
@Desc("Replace all loot tables with this table (same as clear)")
@DontObfuscate
REPLACE;
@Desc("Replace all loot tables with this table (same as clear)")
@DontObfuscate
REPLACE
}

View File

@@ -1,463 +1,457 @@
package com.volmit.iris.object;
import com.volmit.iris.scaffold.stream.ProceduralStream;
import com.volmit.iris.generator.noise.CNG;
import com.volmit.iris.generator.noise.CNGFactory;
import com.volmit.iris.generator.noise.NoiseType;
import com.volmit.iris.scaffold.stream.ProceduralStream;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.RNG;
@Desc("Styles of noise")
@DontObfuscate
public enum NoiseStyle
{
@Desc("White Noise is like static. Useful for block scattering but not terrain.")
@DontObfuscate
STATIC(rng -> new CNG(rng, NoiseType.WHITE, 1D, 1)),
public enum NoiseStyle {
@Desc("White Noise is like static. Useful for block scattering but not terrain.")
@DontObfuscate
STATIC(rng -> new CNG(rng, NoiseType.WHITE, 1D, 1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS(rng -> CNG.signature(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS(rng -> CNG.signature(rng).scale(1)),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE(rng -> CNG.signaturePerlin(rng).scale(0.776).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE(rng -> CNG.signaturePerlin(rng).scale(0.776).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CELLULAR(rng -> CNG.signaturePerlin(rng, NoiseType.CELLULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CELLULAR(rng -> CNG.signaturePerlin(rng, NoiseType.CELLULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SIMPLEX(rng -> CNG.signaturePerlin(rng, NoiseType.SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SIMPLEX(rng -> CNG.signaturePerlin(rng, NoiseType.SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_GLOB(rng -> CNG.signaturePerlin(rng, NoiseType.GLOB).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_GLOB(rng -> CNG.signaturePerlin(rng, NoiseType.GLOB).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_VASCULAR(rng -> CNG.signaturePerlin(rng, NoiseType.VASCULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_VASCULAR(rng -> CNG.signaturePerlin(rng, NoiseType.VASCULAR).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CUBIC(rng -> CNG.signaturePerlin(rng, NoiseType.CUBIC).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_CUBIC(rng -> CNG.signaturePerlin(rng, NoiseType.CUBIC).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SUPERFRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_SUPERFRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_FRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_BILLOW_PERLIN).scale(1).bake()),
@Desc("Classic German Engineering")
@DontObfuscate
NOWHERE_FRACTAL(rng -> CNG.signaturePerlin(rng, NoiseType.FRACTAL_BILLOW_PERLIN).scale(1).bake()),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_DOUBLE(rng -> CNG.signatureDouble(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_DOUBLE(rng -> CNG.signatureDouble(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_THICK(rng -> CNG.signatureThick(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_THICK(rng -> CNG.signatureThick(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_HALF(rng -> CNG.signatureHalf(rng).scale(1)),
@Desc("Wispy Perlin-looking simplex noise. The 'iris' style noise.")
@DontObfuscate
IRIS_HALF(rng -> CNG.signatureHalf(rng).scale(1)),
@Desc("Basic, Smooth & Fast Simplex noise.")
@DontObfuscate
SIMPLEX(rng -> new CNG(rng, 1D, 1).scale(1)),
@Desc("Basic, Smooth & Fast Simplex noise.")
@DontObfuscate
SIMPLEX(rng -> new CNG(rng, 1D, 1).scale(1)),
@Desc("Very Detailed smoke using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_SMOKE(rng -> new CNG(rng, 1D, 1).fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8).scale(0.2), 1000).scale(0.34)),
@Desc("Very Detailed smoke using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_SMOKE(rng -> new CNG(rng, 1D, 1).fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8).scale(0.2), 1000).scale(0.34)),
@Desc("Thinner Veins.")
@DontObfuscate
VASCULAR_THIN(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.VASCULAR, 1D, 1).scale(1).pow(0.65)),
@Desc("Thinner Veins.")
@DontObfuscate
VASCULAR_THIN(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.VASCULAR, 1D, 1).scale(1).pow(0.65)),
@Desc("Cells of simplex noise")
@DontObfuscate
SIMPLEX_CELLS(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1).fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.CELLULAR, 1D, 1).scale(1), 200)),
@Desc("Cells of simplex noise")
@DontObfuscate
SIMPLEX_CELLS(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1).fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.CELLULAR, 1D, 1).scale(1), 200)),
@Desc("Veins of simplex noise")
@DontObfuscate
SIMPLEX_VASCULAR(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1).fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.VASCULAR, 1D, 1).scale(1), 200)),
@Desc("Veins of simplex noise")
@DontObfuscate
SIMPLEX_VASCULAR(rng -> new CNG(rng.nextParallelRNG(1), NoiseType.SIMPLEX, 1D, 1).scale(1).fractureWith(new CNG(rng.nextParallelRNG(8), NoiseType.VASCULAR, 1D, 1).scale(1), 200)),
@Desc("Very Detailed fluid using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_WATER(rng -> new CNG(rng, 1D, 1).fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9).scale(0.03), 9900).scale(1.14)),
@Desc("Very Detailed fluid using simplex fractured with fractal billow simplex at high octaves.")
@DontObfuscate
FRACTAL_WATER(rng -> new CNG(rng, 1D, 1).fractureWith(new CNG(rng.nextParallelRNG(1), NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9).scale(0.03), 9900).scale(1.14)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN(rng -> new CNG(rng, NoiseType.PERLIN, 1D, 1).scale(1.15)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN(rng -> new CNG(rng, NoiseType.PERLIN, 1D, 1).scale(1.15)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS(rng -> CNG.signature(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS(rng -> CNG.signature(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Perlin. Like simplex but more natural")
@DontObfuscate
PERLIN_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.PERLIN).scale(1.47)),
@Desc("Billow Fractal Perlin Noise.")
@DontObfuscate
FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 1).scale(1.47)),
@Desc("Billow Fractal Perlin Noise.")
@DontObfuscate
FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 1).scale(1.47)),
@Desc("Billow Fractal Perlin Noise. 2 Octaves")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 2).scale(1.17)),
@Desc("Billow Fractal Perlin Noise. 2 Octaves")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_PERLIN(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_PERLIN, 1D, 2).scale(1.17)),
@Desc("Billow Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 1)),
@Desc("Billow Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 1)),
@Desc("FBM Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 1)),
@Desc("FBM Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 1)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("Billow Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_BILLOW_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("FBM Fractal Iris Noise. Single octave.")
@DontObfuscate
FRACTAL_FBM_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_FBM_SIMPLEX)),
@Desc("Rigid Multi Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 1)),
@Desc("Rigid Multi Fractal Simplex Noise. Single octave.")
@DontObfuscate
FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 1)),
@Desc("Billow Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 2)),
@Desc("Billow Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 2)),
@Desc("FBM Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 2)),
@Desc("FBM Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 2)),
@Desc("Rigid Multi Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 2)),
@Desc("Rigid Multi Fractal Simplex Noise. 2 octaves.")
@DontObfuscate
BIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 2)),
@Desc("Rigid Multi Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 3)),
@Desc("Rigid Multi Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 3)),
@Desc("Billow Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 3)),
@Desc("Billow Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 3)),
@Desc("FBM Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 3)),
@Desc("FBM Fractal Simplex Noise. 3 octaves.")
@DontObfuscate
TRIOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 3)),
@Desc("Rigid Multi Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 4)),
@Desc("Rigid Multi Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 4)),
@Desc("Billow Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 4)),
@Desc("Billow Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 4)),
@Desc("FBM Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 4)),
@Desc("FBM Fractal Simplex Noise. 4 octaves.")
@DontObfuscate
QUADOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 4)),
@Desc("Rigid Multi Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 5)),
@Desc("Rigid Multi Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 5)),
@Desc("Billow Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 5)),
@Desc("Billow Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 5)),
@Desc("FBM Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 5)),
@Desc("FBM Fractal Simplex Noise. 5 octaves.")
@DontObfuscate
QUINTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 5)),
@Desc("Rigid Multi Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 6)),
@Desc("Rigid Multi Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 6)),
@Desc("Billow Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 6)),
@Desc("Billow Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 6)),
@Desc("FBM Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 6)),
@Desc("FBM Fractal Simplex Noise. 6 octaves.")
@DontObfuscate
SEXOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 6)),
@Desc("Rigid Multi Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 7)),
@Desc("Rigid Multi Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 7)),
@Desc("Billow Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 7)),
@Desc("Billow Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 7)),
@Desc("FBM Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 7)),
@Desc("FBM Fractal Simplex Noise. 7 octaves.")
@DontObfuscate
SEPTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 7)),
@Desc("Rigid Multi Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 8)),
@Desc("Rigid Multi Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 8)),
@Desc("Billow Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8)),
@Desc("Billow Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 8)),
@Desc("FBM Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 8)),
@Desc("FBM Fractal Simplex Noise. 8 octaves.")
@DontObfuscate
OCTOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 8)),
@Desc("Rigid Multi Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 9)),
@Desc("Rigid Multi Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 9)),
@Desc("Billow Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 9)),
@Desc("Billow Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 9)),
@Desc("FBM Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9)),
@Desc("FBM Fractal Simplex Noise. 9 octaves.")
@DontObfuscate
NONOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 9)),
@Desc("Rigid Multi Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 10)),
@Desc("Rigid Multi Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_RM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_RIGID_MULTI_SIMPLEX, 1D, 10)),
@Desc("Billow Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 10)),
@Desc("Billow Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_BILLOW_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_BILLOW_SIMPLEX, 1D, 10)),
@Desc("FBM Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 10)),
@Desc("FBM Fractal Simplex Noise. 10 octaves.")
@DontObfuscate
VIGOCTAVE_FRACTAL_FBM_SIMPLEX(rng -> new CNG(rng, NoiseType.FRACTAL_FBM_SIMPLEX, 1D, 10)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 2 octaves")
@DontObfuscate
BIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 2).scale(1D / 2D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 2 octaves")
@DontObfuscate
BIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 2).scale(1D / 2D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 3 octaves")
@DontObfuscate
TRIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 3).scale(1D / 3D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 3 octaves")
@DontObfuscate
TRIOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 3).scale(1D / 3D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 4 octaves")
@DontObfuscate
QUADOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 4).scale(1D / 4D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 4 octaves")
@DontObfuscate
QUADOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 4).scale(1D / 4D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 5 octaves")
@DontObfuscate
QUINTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 5).scale(1D / 5D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 5 octaves")
@DontObfuscate
QUINTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 5).scale(1D / 5D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 6 octaves")
@DontObfuscate
SEXOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 6).scale(1D / 6D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 6 octaves")
@DontObfuscate
SEXOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 6).scale(1D / 6D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 7 octaves")
@DontObfuscate
SEPTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 7).scale(1D / 12D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 7 octaves")
@DontObfuscate
SEPTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 7).scale(1D / 12D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 8 octaves")
@DontObfuscate
OCTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 8).scale(1D / 25D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 8 octaves")
@DontObfuscate
OCTOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 8).scale(1D / 25D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 9 octaves")
@DontObfuscate
NONOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 9).scale(1D / 50D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 9 octaves")
@DontObfuscate
NONOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 9).scale(1D / 50D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 10 octaves")
@DontObfuscate
VIGOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 10).scale(1D / 100D)),
@Desc("Basic, Smooth & Fast Simplex noise. Uses 10 octaves")
@DontObfuscate
VIGOCTAVE_SIMPLEX(rng -> new CNG(rng, 1D, 10).scale(1D / 100D)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB(rng -> new CNG(rng, NoiseType.GLOB, 1D, 1)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB(rng -> new CNG(rng, NoiseType.GLOB, 1D, 1)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS(rng -> CNG.signature(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS(rng -> CNG.signature(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.GLOB)),
@Desc("Glob noise is like cellular, but with globs...")
@DontObfuscate
GLOB_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.GLOB)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC(rng -> new CNG(rng, NoiseType.CUBIC, 1D, 1).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC(rng -> new CNG(rng, NoiseType.CUBIC, 1D, 1).scale(256)),
@Desc("Fractal Cubic Noise")
@DontObfuscate
FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 1).scale(2)),
@Desc("Fractal Cubic Noise")
@DontObfuscate
FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 1).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS(rng -> CNG.signature(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise With Iris Swirls")
@DontObfuscate
FRACTAL_CUBIC_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.FRACTAL_CUBIC).scale(2)),
@Desc("Fractal Cubic Noise, 2 Octaves")
@DontObfuscate
BIOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 2).scale(2)),
@Desc("Fractal Cubic Noise, 2 Octaves")
@DontObfuscate
BIOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 2).scale(2)),
@Desc("Fractal Cubic Noise, 3 Octaves")
@DontObfuscate
TRIOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 3).scale(1.5)),
@Desc("Fractal Cubic Noise, 3 Octaves")
@DontObfuscate
TRIOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 3).scale(1.5)),
@Desc("Fractal Cubic Noise, 4 Octaves")
@DontObfuscate
QUADOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 4).scale(1)),
@Desc("Fractal Cubic Noise, 4 Octaves")
@DontObfuscate
QUADOCTAVE_FRACTAL_CUBIC(rng -> new CNG(rng, NoiseType.FRACTAL_CUBIC, 1D, 4).scale(1)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS(rng -> CNG.signature(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS(rng -> CNG.signature(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cubic Noise")
@DontObfuscate
CUBIC_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CUBIC).scale(256)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders.")
@DontObfuscate
CELLULAR(rng -> new CNG(rng, NoiseType.CELLULAR, 1D, 1)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders.")
@DontObfuscate
CELLULAR(rng -> new CNG(rng, NoiseType.CELLULAR, 1D, 1)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR)),
@Desc("Cellular noise creates the same noise level for cells, changes noise level on cell borders. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
CELLULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell")
@DontObfuscate
CELLULAR_HEIGHT(rng -> new CNG(rng, NoiseType.CELLULAR_HEIGHT, 1D, 1)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell")
@DontObfuscate
CELLULAR_HEIGHT(rng -> new CNG(rng, NoiseType.CELLULAR_HEIGHT, 1D, 1)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS(rng -> CNG.signature(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Inverse of vascular, height gets to 1.0 as it approaches the center of a cell, using the iris style.")
@DontObfuscate
CELLULAR_HEIGHT_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.CELLULAR_HEIGHT)),
@Desc("Vascular noise gets higher as the position nears a cell border.")
@DontObfuscate
VASCULAR(rng -> new CNG(rng, NoiseType.VASCULAR, 1D, 1)),
@Desc("Vascular noise gets higher as the position nears a cell border.")
@DontObfuscate
VASCULAR(rng -> new CNG(rng, NoiseType.VASCULAR, 1D, 1)),
@Desc("It always returns 0.5")
@DontObfuscate
FLAT(rng -> new CNG(rng, NoiseType.FLAT, 1D, 1)),
@Desc("It always returns 0.5")
@DontObfuscate
FLAT(rng -> new CNG(rng, NoiseType.FLAT, 1D, 1)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS(rng -> CNG.signature(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS(rng -> CNG.signature(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_DOUBLE(rng -> CNG.signatureDouble(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_THICK(rng -> CNG.signatureThick(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.VASCULAR)),
@Desc("Vascular noise gets higher as the position nears a cell border. Cells are distorted using Iris styled wispy noise.")
@DontObfuscate
VASCULAR_IRIS_HALF(rng -> CNG.signatureHalf(rng, NoiseType.VASCULAR)),
;
;
private CNGFactory f;
private final CNGFactory f;
private NoiseStyle(CNGFactory f)
{
this.f = f;
}
public ProceduralStream<Double> stream(RNG seed)
{
return create(seed).stream();
}
NoiseStyle(CNGFactory f) {
this.f = f;
}
public ProceduralStream<Double> stream(long seed)
{
return create(new RNG(seed)).stream();
}
public ProceduralStream<Double> stream(RNG seed) {
return create(seed).stream();
}
public CNG create(RNG seed)
{
return f.create(seed).bake();
}
public ProceduralStream<Double> stream(long seed) {
return create(new RNG(seed)).stream();
}
public IrisGeneratorStyle style()
{
return new IrisGeneratorStyle(this);
}
public CNG create(RNG seed) {
return f.create(seed).bake();
}
public IrisGeneratorStyle style() {
return new IrisGeneratorStyle(this);
}
}

View File

@@ -4,41 +4,40 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
@Desc("Object Place modes are useful for positioning objects just right. The default value is CENTER_HEIGHT.")
public enum ObjectPlaceMode
{
@Desc("The default place mode. This mode picks a center point (where the center of the object will be) and takes the height. That height is used for the whole object.")
@DontObfuscate
CENTER_HEIGHT,
public enum ObjectPlaceMode {
@Desc("The default place mode. This mode picks a center point (where the center of the object will be) and takes the height. That height is used for the whole object.")
@DontObfuscate
CENTER_HEIGHT,
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.")
@DontObfuscate
MAX_HEIGHT,
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.")
@DontObfuscate
MAX_HEIGHT,
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.\"")
@DontObfuscate
FAST_MAX_HEIGHT,
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the highest height, that height is then used to place the object. This mode is useful for preventing any part of your object from being buried though it will float off of cliffs.\"")
@DontObfuscate
FAST_MAX_HEIGHT,
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
@DontObfuscate
MIN_HEIGHT,
@Desc("Samples a lot of points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
@DontObfuscate
MIN_HEIGHT,
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
@DontObfuscate
FAST_MIN_HEIGHT,
@Desc("Samples only 4 points where the object will cover (horizontally) and picks the lowest height, that height is then used to place the object. This mode is useful for preventing any part of your object from overhanging a cliff though it gets buried a lot")
@DontObfuscate
FAST_MIN_HEIGHT,
@Desc("Stilting is MAX_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
@DontObfuscate
STILT,
@Desc("Stilting is MAX_HEIGHT but it repeats the bottom most block of your object until it hits the surface. This is expensive because it has to first sample every height value for each x,z position of your object. Avoid using this unless its structures for performance reasons.")
@DontObfuscate
STILT,
@Desc("Just like stilting but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
@DontObfuscate
FAST_STILT,
@Desc("Just like stilting but very inaccurate. Useful for stilting a lot of objects without too much care on accuracy (you can use the over-stilt value to force stilts under ground further)")
@DontObfuscate
FAST_STILT,
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
@DontObfuscate
PAINT,
@Desc("Samples the height of the terrain at every x,z position of your object and pushes it down to the surface. It's pretty much like a melt function over the terrain.")
@DontObfuscate
PAINT,
@Desc("Applies multiple terrain features into the parallax layer before this object places to distort the height, essentially vacuuming the terrain's heightmap closer to the bottom of this object. Uses MAX_HEIGHT to place")
@DontObfuscate
VACUUM
@Desc("Applies multiple terrain features into the parallax layer before this object places to distort the height, essentially vacuuming the terrain's heightmap closer to the bottom of this object. Uses MAX_HEIGHT to place")
@DontObfuscate
VACUUM
}

View File

@@ -1,8 +1,8 @@
package com.volmit.iris.object.tile;
import lombok.Data;
import com.volmit.iris.scaffold.data.nbt.tag.CompoundTag;
import com.volmit.iris.scaffold.data.nbt.tag.ListTag;
import lombok.Data;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.block.Banner;
@@ -92,22 +92,38 @@ public class TileBanner implements TileData<Banner> {
public boolean isBanner(Material material) {
switch (material) {
case RED_BANNER: case RED_WALL_BANNER:
case ORANGE_BANNER: case ORANGE_WALL_BANNER:
case YELLOW_BANNER: case YELLOW_WALL_BANNER:
case LIME_BANNER: case LIME_WALL_BANNER:
case GREEN_BANNER: case GREEN_WALL_BANNER:
case CYAN_BANNER: case CYAN_WALL_BANNER:
case LIGHT_BLUE_BANNER: case LIGHT_BLUE_WALL_BANNER:
case BLUE_BANNER: case BLUE_WALL_BANNER:
case PURPLE_BANNER: case PURPLE_WALL_BANNER:
case MAGENTA_BANNER: case MAGENTA_WALL_BANNER:
case PINK_BANNER: case PINK_WALL_BANNER:
case WHITE_BANNER: case WHITE_WALL_BANNER:
case LIGHT_GRAY_BANNER: case LIGHT_GRAY_WALL_BANNER:
case GRAY_BANNER: case GRAY_WALL_BANNER:
case BLACK_BANNER: case BLACK_WALL_BANNER:
case BROWN_BANNER: case BROWN_WALL_BANNER:
case RED_BANNER:
case RED_WALL_BANNER:
case ORANGE_BANNER:
case ORANGE_WALL_BANNER:
case YELLOW_BANNER:
case YELLOW_WALL_BANNER:
case LIME_BANNER:
case LIME_WALL_BANNER:
case GREEN_BANNER:
case GREEN_WALL_BANNER:
case CYAN_BANNER:
case CYAN_WALL_BANNER:
case LIGHT_BLUE_BANNER:
case LIGHT_BLUE_WALL_BANNER:
case BLUE_BANNER:
case BLUE_WALL_BANNER:
case PURPLE_BANNER:
case PURPLE_WALL_BANNER:
case MAGENTA_BANNER:
case MAGENTA_WALL_BANNER:
case PINK_BANNER:
case PINK_WALL_BANNER:
case WHITE_BANNER:
case WHITE_WALL_BANNER:
case LIGHT_GRAY_BANNER:
case LIGHT_GRAY_WALL_BANNER:
case GRAY_BANNER:
case GRAY_WALL_BANNER:
case BLACK_BANNER:
case BLACK_WALL_BANNER:
case BROWN_BANNER:
case BROWN_WALL_BANNER:
return true;
default:
return false;

View File

@@ -1,7 +1,7 @@
package com.volmit.iris.object.tile;
import com.volmit.iris.util.KList;
import com.volmit.iris.scaffold.data.nbt.tag.CompoundTag;
import com.volmit.iris.util.KList;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.block.TileState;
@@ -13,7 +13,7 @@ import java.io.IOException;
public interface TileData<T extends TileState> extends Cloneable {
public static final KList<TileData<? extends TileState>> registry = setup();
KList<TileData<? extends TileState>> registry = setup();
static KList<TileData<? extends TileState>> setup() {
KList<TileData<? extends TileState>> registry = new KList<>();
@@ -25,29 +25,24 @@ public interface TileData<T extends TileState> extends Cloneable {
return registry;
}
public static TileData<? extends TileState> read(DataInputStream s) throws Throwable {
static TileData<? extends TileState> read(DataInputStream s) throws Throwable {
int id = s.readShort();
TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
d.fromBinary(s);
return d;
}
public static void setTileState(Block block, TileData<? extends TileState> data)
{
if(data.isApplicable(block.getBlockData()))
{
static void setTileState(Block block, TileData<? extends TileState> data) {
if (data.isApplicable(block.getBlockData())) {
data.toBukkitTry(block.getState());
}
}
public static TileData<? extends TileState> getTileState(Block block)
{
for(TileData<? extends TileState> i : registry)
{
static TileData<? extends TileState> getTileState(Block block) {
for (TileData<? extends TileState> i : registry) {
BlockData data = block.getBlockData();
if(i.isApplicable(data))
{
if (i.isApplicable(data)) {
try {
TileData<? extends TileState> s = i.getClass().getConstructor().newInstance();
s.fromBukkitTry(block.getState());
@@ -61,49 +56,41 @@ public interface TileData<T extends TileState> extends Cloneable {
return null;
}
public String getTileId();
String getTileId();
public boolean isApplicable(BlockData data);
boolean isApplicable(BlockData data);
public void toBukkit(T t);
void toBukkit(T t);
public void fromBukkit(T t);
void fromBukkit(T t);
public default boolean toBukkitTry(BlockState t)
{
default boolean toBukkitTry(BlockState t) {
try {
toBukkit((T) t);
return true;
}
catch(Throwable e)
{
} catch (Throwable e) {
}
return false;
}
public default boolean fromBukkitTry(BlockState t)
{
default boolean fromBukkitTry(BlockState t) {
try {
fromBukkit((T) t);
return true;
}
catch(Throwable e)
{
} catch (Throwable e) {
}
return false;
}
public TileData<T> clone();
TileData<T> clone();
public void toBinary(DataOutputStream out) throws IOException;
void toBinary(DataOutputStream out) throws IOException;
public void toNBT(CompoundTag tag);
void toNBT(CompoundTag tag);
public void fromBinary(DataInputStream in) throws IOException;
void fromBinary(DataInputStream in) throws IOException;
}

View File

@@ -1,7 +1,7 @@
package com.volmit.iris.object.tile;
import lombok.Data;
import com.volmit.iris.scaffold.data.nbt.tag.CompoundTag;
import lombok.Data;
import org.bukkit.DyeColor;
import org.bukkit.block.Sign;
import org.bukkit.block.data.BlockData;

View File

@@ -1,8 +1,8 @@
package com.volmit.iris.object.tile;
import lombok.Data;
import com.volmit.iris.scaffold.data.nbt.tag.CompoundTag;
import com.volmit.iris.scaffold.data.nbt.tag.ListTag;
import lombok.Data;
import org.bukkit.Material;
import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.data.BlockData;