9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-30 12:29:20 +00:00
This commit is contained in:
Dan Macbook
2020-08-13 10:45:59 -04:00
parent 991aaa8677
commit 8586ec67b6
13 changed files with 208 additions and 76 deletions

View File

@@ -1,5 +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;
@@ -18,6 +19,7 @@ public class IrisAxisRotationClamp
private boolean enabled = false;
@Required
@DependsOn({"max"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@@ -25,6 +27,7 @@ public class IrisAxisRotationClamp
private double min = 0;
@Required
@DependsOn({"min"})
@MinNumber(-360)
@MaxNumber(360)
@DontObfuscate
@@ -32,6 +35,7 @@ public class IrisAxisRotationClamp
private double max = 0;
@Required
@DependsOn({"min", "max"})
@MinNumber(0)
@MaxNumber(360)
@DontObfuscate

View File

@@ -9,6 +9,7 @@ import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.noise.RarityCellGenerator;
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.IRare;
@@ -39,11 +40,13 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private KList<IrisEffect> effects = new KList<>();
@DontObfuscate
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
@Desc("This changes the dispersion of the biome colors if multiple derivatives are chosen.")
private NoiseStyle biomeStyle = NoiseStyle.SIMPLEX;
@MinNumber(0.0001)
@DontObfuscate
@DependsOn({"biomeStyle", "biomeZoom", "biomeScatter"})
@Desc("This zooms in the biome colors if multiple derivatives are chosen")
private double biomeZoom = 1;
@@ -73,6 +76,7 @@ public class IrisBiome extends IrisRegistrant implements IRare {
private KList<Biome> biomeSkyScatter = new KList<>();
@DontObfuscate
@DependsOn({"children"})
@Desc("If this biome has children biomes, and the gen layer chooses one of this biomes children, how much smaller will it be (inside of this biome). Higher values means a smaller biome relative to this biome's size. Set higher than 1.0 and below 3.0 for best results.")
private double childShrinkFactor = 1.5;

View File

@@ -6,6 +6,7 @@ import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.B;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
@@ -28,6 +29,7 @@ public class IrisBiomeDecorator {
@Desc("Dispersion is used to pick places to spawn. Scatter randomly places them (vanilla) or Wispy for a streak like patch system.")
private NoiseStyle dispersion = NoiseStyle.STATIC;
@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 NoiseStyle heightVariance = NoiseStyle.STATIC;
@@ -36,12 +38,14 @@ public class IrisBiomeDecorator {
@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)
@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)
@DontObfuscate
@@ -58,6 +62,7 @@ public class IrisBiomeDecorator {
@Desc("The zoom is for zooming in or out variance. Makes patches have more or less of one type.")
private double varianceZoom = 1;
@DependsOn({"stackMin", "stackMax"})
@MinNumber(0.0001)
@DontObfuscate
@Desc("The vertical zoom is for wispy stack heights. Zooming this in makes stack heights more slowly change over a distance")

View File

@@ -3,6 +3,7 @@ package com.volmit.iris.object;
import com.volmit.iris.Iris;
import com.volmit.iris.gen.ContextualChunkGenerator;
import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.IrisInterpolation;
@@ -14,12 +15,12 @@ import lombok.Data;
@Desc("This represents a link to a generator for a biome")
@Data
public class IrisBiomeGeneratorLink
{
public class IrisBiomeGeneratorLink {
@DontObfuscate
@Desc("The generator id")
private String generator = "default";
@DependsOn({ "min", "max" })
@Required
@MinNumber(-256)
@MaxNumber(256)
@@ -27,6 +28,7 @@ public class IrisBiomeGeneratorLink
@Desc("The min block value (value + fluidHeight)")
private int min = 0;
@DependsOn({ "min", "max" })
@Required
@MinNumber(-256)
@MaxNumber(256)
@@ -36,19 +38,16 @@ public class IrisBiomeGeneratorLink
private transient AtomicCache<IrisGenerator> gen = new AtomicCache<>();
public IrisBiomeGeneratorLink()
{
public IrisBiomeGeneratorLink() {
}
public IrisGenerator getCachedGenerator(ContextualChunkGenerator g)
{
return gen.aquire(() ->
{
IrisGenerator gen = g != null ? g.loadGenerator(getGenerator()) : Iris.globaldata.getGeneratorLoader().load(getGenerator());
public IrisGenerator getCachedGenerator(ContextualChunkGenerator g) {
return gen.aquire(() -> {
IrisGenerator gen = g != null ? g.loadGenerator(getGenerator())
: Iris.globaldata.getGeneratorLoader().load(getGenerator());
if(gen == null)
{
if (gen == null) {
gen = new IrisGenerator();
}
@@ -56,8 +55,7 @@ public class IrisBiomeGeneratorLink
});
}
public double getHeight(ContextualChunkGenerator xg, double x, double z, long seed)
{
public double getHeight(ContextualChunkGenerator 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;

View File

@@ -6,6 +6,7 @@ import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.noise.CNG;
import com.volmit.iris.util.ArrayType;
import com.volmit.iris.util.B;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList;
@@ -23,12 +24,14 @@ public class IrisBiomePaletteLayer {
@Desc("The style of noise")
private NoiseStyle style = NoiseStyle.STATIC;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(0)
@MaxNumber(256)
@DontObfuscate
@Desc("The min thickness of this layer")
private int minHeight = 1;
@DependsOn({"minHeight", "maxHeight"})
@MinNumber(1)
@MaxNumber(256)
@DontObfuscate

View File

@@ -11,6 +11,7 @@ import com.volmit.iris.Iris;
import com.volmit.iris.gen.IrisChunkGenerator;
import com.volmit.iris.gen.atomics.AtomicCache;
import com.volmit.iris.util.ChronoLatch;
import com.volmit.iris.util.DependsOn;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
@@ -22,8 +23,7 @@ import lombok.Data;
@Desc("An iris effect")
@Data
public class IrisEffect
{
public class IrisEffect {
@DontObfuscate
@Desc("The potion effect to apply in this area")
private String potionEffect = "";
@@ -32,38 +32,45 @@ public class IrisEffect
@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(-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 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 altY by -altY to altY")
private boolean randomAltY = false;
@DependsOn({ "particleEffect" })
@DontObfuscate
@Desc("Randomize the altZ by -altZ to altZ")
private boolean randomAltZ = true;
@@ -72,63 +79,74 @@ public class IrisEffect
@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", "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" })
@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(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" })
@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", "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")
@@ -140,6 +158,7 @@ public class IrisEffect
@Desc("The effect interval in milliseconds")
private int interval = 150;
@DependsOn({ "particleEffect" })
@MinNumber(0)
@MaxNumber(16)
@DontObfuscate
@@ -155,33 +174,25 @@ public class IrisEffect
private transient AtomicCache<PotionEffectType> pt = new AtomicCache<>();
private transient AtomicCache<ChronoLatch> latch = new AtomicCache<>();
public IrisEffect()
{
public IrisEffect() {
}
public boolean canTick()
{
public boolean canTick() {
return latch.aquire(() -> new ChronoLatch(interval)).flip();
}
public PotionEffectType getRealType()
{
return pt.aquire(() ->
{
public PotionEffectType getRealType() {
return pt.aquire(() -> {
PotionEffectType t = PotionEffectType.LUCK;
if(getPotionEffect().isEmpty())
{
if (getPotionEffect().isEmpty()) {
return t;
}
try
{
for(PotionEffectType i : PotionEffectType.values())
{
if(i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect()))
{
try {
for (PotionEffectType i : PotionEffectType.values()) {
if (i.getName().toUpperCase().replaceAll("\\Q \\E", "_").equals(getPotionEffect())) {
t = i;
return t;
@@ -189,8 +200,7 @@ public class IrisEffect
}
}
catch(Throwable e)
{
catch (Throwable e) {
}
@@ -200,55 +210,57 @@ public class IrisEffect
});
}
public void apply(Player p, IrisChunkGenerator g)
{
if(!canTick())
{
public void apply(Player p, IrisChunkGenerator g) {
if (!canTick()) {
return;
}
if(RNG.r.nextInt(chance) != 0)
{
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));
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.getTerrainHeight(part.getBlockX(), part.getBlockZ())) + 1);
part.add(RNG.r.d(), 0, RNG.r.d());
if(extra != 0)
{
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 (extra != 0) {
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
{
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);
else {
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);
}
}
if(potionStrength > -1)
{
if(p.hasPotionEffect(getRealType()))
{
if (potionStrength > -1) {
if (p.hasPotionEffect(getRealType())) {
PotionEffect e = p.getPotionEffect(getRealType());
if(e.getAmplifier() > getPotionStrength())
{
if (e.getAmplifier() > getPotionStrength()) {
return;
}
p.removePotionEffect(getRealType());
}
p.addPotionEffect(new PotionEffect(getRealType(), RNG.r.i(Math.min(potionTicksMax, potionTicksMin), Math.max(potionTicksMax, potionTicksMin)), getPotionStrength(), true, false, false));
p.addPotionEffect(new PotionEffect(getRealType(),
RNG.r.i(Math.min(potionTicksMax, potionTicksMin), Math.max(potionTicksMax, potionTicksMin)),
getPotionStrength(), true, false, false));
}
}
}

View File

@@ -68,6 +68,7 @@ public class IrisNoiseGenerator
@Desc("Enable / disable. Outputs offsetY if disabled")
private boolean enabled = true;
@Required
@DontObfuscate
@Desc("The Noise Style")
private NoiseStyle style = NoiseStyle.IRIS;