diff --git a/pom.xml b/pom.xml
index 5ea0e84ee..d6abbdfa4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -157,6 +157,12 @@
1.16.1-R0.1-SNAPSHOT
provided
+
+ org.bukkit.craftbukkit
+ cb-1.16.2
+ 1.16.2
+ provided
+
org.projectlombok
diff --git a/scripts/release-heavy.bat b/scripts/release-heavy.bat
new file mode 100644
index 000000000..c916b4d89
--- /dev/null
+++ b/scripts/release-heavy.bat
@@ -0,0 +1,22 @@
+@Echo off
+echo Apply Script: COPY
+echo F|xcopy /y /s /f /q "%1" "%2"
+echo F|xcopy /y /s /f /q "lint/in.jar" "release/latest/Origin-%3.jar"
+echo Starting the Washing Machine
+cd lint
+
+echo ZKM Rinse Cycle
+java -Xmx4g -Xms1m -jar ZKM.jar script.zkm
+echo F|xcopy /y /f /q "out/in.jar" "in.jar"
+
+echo Powerwash Cycle
+java -Xmx4g -Xms1m -jar obfuscator.jar --jarIn in.jar --jarOut out.jar --config obf.json
+echo F|xcopy /y /f /q "out.jar" "in.jar"
+
+echo Rinse Cycle
+java -Xmx4g -Xms1m -jar proguard.jar @proguard.conf
+
+cd ..
+echo F|xcopy /y /s /f /q "lint/out.jar" "release/latest/Iris-%3.jar"
+cd release
+echo F|xcopy /y /s /f /q /E "latest" "%3/"
\ No newline at end of file
diff --git a/scripts/release.bat b/scripts/release.bat
index c916b4d89..f2b1fab1f 100644
--- a/scripts/release.bat
+++ b/scripts/release.bat
@@ -5,14 +5,6 @@ echo F|xcopy /y /s /f /q "lint/in.jar" "release/latest/Origin-%3.jar"
echo Starting the Washing Machine
cd lint
-echo ZKM Rinse Cycle
-java -Xmx4g -Xms1m -jar ZKM.jar script.zkm
-echo F|xcopy /y /f /q "out/in.jar" "in.jar"
-
-echo Powerwash Cycle
-java -Xmx4g -Xms1m -jar obfuscator.jar --jarIn in.jar --jarOut out.jar --config obf.json
-echo F|xcopy /y /f /q "out.jar" "in.jar"
-
echo Rinse Cycle
java -Xmx4g -Xms1m -jar proguard.jar @proguard.conf
diff --git a/src/main/java/com/volmit/iris/Iris.java b/src/main/java/com/volmit/iris/Iris.java
index 05b3a3d47..c81c55aa3 100644
--- a/src/main/java/com/volmit/iris/Iris.java
+++ b/src/main/java/com/volmit/iris/Iris.java
@@ -47,6 +47,9 @@ public class Iris extends MortarPlugin
public static IrisBoardManager board;
public static MultiverseCoreLink linkMultiverseCore;
private static IrisLock lock = new IrisLock("Iris");
+ public static boolean customModels = doesSupportCustomModels();
+ public static boolean awareEntities = doesSupportAwareness();
+ public static boolean biome3d = doesSupport3DBiomes();
public static boolean lowMemoryMode = false;
@Permission
@@ -61,6 +64,27 @@ public class Iris extends MortarPlugin
lowMemoryMode = Runtime.getRuntime().maxMemory() < 4 * 1000 * 1000 * 1000;
}
+ private static boolean doesSupport3DBiomes()
+ {
+ int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
+
+ return v >= 15;
+ }
+
+ private static boolean doesSupportCustomModels()
+ {
+ int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
+
+ return v >= 14;
+ }
+
+ private static boolean doesSupportAwareness()
+ {
+ int v = Integer.valueOf(Bukkit.getBukkitVersion().split("\\Q-\\E")[0].split("\\Q.\\E")[1]);
+
+ return v >= 15;
+ }
+
@Override
public void start()
{
@@ -108,7 +132,7 @@ public class Iris extends MortarPlugin
{
if(i.getGenerator() instanceof IrisChunkGenerator)
{
- ((IrisChunkGenerator) i).close();
+ ((IrisChunkGenerator) i.getGenerator()).close();
}
}
for(GroupedExecutor i : executors)
@@ -304,7 +328,8 @@ public class Iris extends MortarPlugin
padd + C.GRAY + " "+C.DARK_GRAY+"@@@"+C.GRAY+"@@@@@@@@@@@@@@"
};
//@done
-
+ Iris.info(Bukkit.getVersion());
+ Iris.info(Bukkit.getBukkitVersion() + " bk");
for(int i = 0; i < info.length; i++)
{
splash[i] += info[i];
@@ -314,7 +339,22 @@ public class Iris extends MortarPlugin
if(lowMemoryMode)
{
- Iris.warn("Low Memory mode Activated! For better performance, allocate 4gb or more to this server.");
+ Iris.verbose("* Low Memory mode Activated! For better performance, allocate 4gb or more to this server.");
+ }
+
+ if(!biome3d)
+ {
+ Iris.verbose("* This version of minecraft does not support 3D biomes (1.15 and up). Iris will generate as normal, but biome colors will not vary underground & in the sky.");
+ }
+
+ if(!customModels)
+ {
+ Iris.verbose("* This version of minecraft does not support custom model data in loot items (1.14 and up). Iris will generate as normal, but loot will not have custom models.");
+ }
+
+ if(!doesSupportAwareness())
+ {
+ Iris.verbose("* This version of minecraft does not support entity awareness.");
}
}
}
diff --git a/src/main/java/com/volmit/iris/ProjectManager.java b/src/main/java/com/volmit/iris/ProjectManager.java
index dad7ddcc7..90c0f11f0 100644
--- a/src/main/java/com/volmit/iris/ProjectManager.java
+++ b/src/main/java/com/volmit/iris/ProjectManager.java
@@ -359,7 +359,14 @@ public class ProjectManager
}
});
- World world = Bukkit.createWorld(new WorldCreator("iris/" + UUID.randomUUID()).seed(1337).generator(gx).generateStructures(false).type(WorldType.NORMAL).environment(d.getEnvironment()));
+ //@builder
+ World world = Bukkit.createWorld(new WorldCreator("iris/" + UUID.randomUUID())
+ .seed(1337)
+ .generator(gx)
+ .generateStructures(d.isVanillaStructures())
+ .type(WorldType.NORMAL)
+ .environment(d.getEnvironment()));
+ //@done
Iris.linkMultiverseCore.removeFromConfig(world);
done.set(true);
@@ -409,6 +416,7 @@ public class ProjectManager
Iris.info("Packaging Dimension " + dimension.getName() + " " + (obfuscate ? "(Obfuscated)" : ""));
KSet regions = new KSet<>();
KSet biomes = new KSet<>();
+ KSet entities = new KSet<>();
KSet structures = new KSet<>();
KSet generators = new KSet<>();
KSet loot = new KSet<>();
@@ -422,6 +430,11 @@ public class ProjectManager
biomes.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i))));
structures.forEach((b) -> b.getTiles().forEach((r) -> r.getLoot().getTables().forEach((i) -> loot.add(Iris.globaldata.getLootLoader().load(i)))));
+ structures.forEach((r) -> r.getEntitySpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
+ structures.forEach((s) -> s.getTiles().forEach((r) -> r.getEntitySpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())))));
+ biomes.forEach((r) -> r.getEntitySpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
+ regions.forEach((r) -> r.getEntitySpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity()))));
+ dimension.getEntitySpawns().forEach((sp) -> entities.add(Iris.globaldata.getEntityLoader().load(sp.getEntity())));
KMap renameObjects = new KMap<>();
String a = "";
@@ -621,6 +634,13 @@ public class ProjectManager
b.append(IO.hash(a));
}
+ for(IrisEntity i : entities)
+ {
+ a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
+ IO.writeAll(new File(folder, "entities/" + i.getLoadKey() + ".json"), a);
+ b.append(IO.hash(a));
+ }
+
for(IrisLootTable i : loot)
{
a = new JSONObject(new Gson().toJson(i)).toString(minify ? 0 : 4);
diff --git a/src/main/java/com/volmit/iris/gen/ContextualChunkGenerator.java b/src/main/java/com/volmit/iris/gen/ContextualChunkGenerator.java
index 343635758..ffc6dc5ba 100644
--- a/src/main/java/com/volmit/iris/gen/ContextualChunkGenerator.java
+++ b/src/main/java/com/volmit/iris/gen/ContextualChunkGenerator.java
@@ -333,6 +333,11 @@ public abstract class ContextualChunkGenerator extends ChunkGenerator implements
public void close()
{
+ if(!isDev())
+ {
+ return;
+ }
+
getNoLoot().clear();
getNoLoot().trimToSize();
HandlerList.unregisterAll(this);
diff --git a/src/main/java/com/volmit/iris/gen/DimensionChunkGenerator.java b/src/main/java/com/volmit/iris/gen/DimensionChunkGenerator.java
index 55a5e8517..e3e4f71ad 100644
--- a/src/main/java/com/volmit/iris/gen/DimensionChunkGenerator.java
+++ b/src/main/java/com/volmit/iris/gen/DimensionChunkGenerator.java
@@ -52,7 +52,7 @@ public abstract class DimensionChunkGenerator extends ContextualChunkGenerator
if(!folder.exists())
{
- Iris.error("Missing World iris/dimensions folder!");
+ Iris.error("Missing World iris/dimensions folder! (" + folder.getAbsolutePath() + ")");
setDimensionName("error-missing-dimension");
return;
}
diff --git a/src/main/java/com/volmit/iris/gen/ParallaxChunkGenerator.java b/src/main/java/com/volmit/iris/gen/ParallaxChunkGenerator.java
index fe6e1120f..00fde5316 100644
--- a/src/main/java/com/volmit/iris/gen/ParallaxChunkGenerator.java
+++ b/src/main/java/com/volmit/iris/gen/ParallaxChunkGenerator.java
@@ -26,6 +26,7 @@ import com.volmit.iris.util.HeightMap;
import com.volmit.iris.util.IObjectPlacer;
import com.volmit.iris.util.IrisLock;
import com.volmit.iris.util.IrisStructureResult;
+import com.volmit.iris.util.J;
import com.volmit.iris.util.KList;
import com.volmit.iris.util.KMap;
import com.volmit.iris.util.PrecisionStopwatch;
@@ -62,6 +63,7 @@ public abstract class ParallaxChunkGenerator extends TerrainChunkGenerator imple
setParallaxMap(new AtomicWorldData(world));
setGlText(new GenLayerText(this, rng.nextParallelRNG(32485)));
setGlUpdate(null);
+ J.a(() -> getDimension().getParallaxSize(this));
}
protected void onClose()
diff --git a/src/main/java/com/volmit/iris/gen/TerrainChunkGenerator.java b/src/main/java/com/volmit/iris/gen/TerrainChunkGenerator.java
index 8595de5c3..7d8fa1765 100644
--- a/src/main/java/com/volmit/iris/gen/TerrainChunkGenerator.java
+++ b/src/main/java/com/volmit/iris/gen/TerrainChunkGenerator.java
@@ -138,6 +138,7 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
IrisRegion region = sampleRegion(rx, rz);
IrisBiome biome = sampleTrueBiome(rx, rz, noise);
IrisBiome landBiome = null;
+ Biome onlyBiome = Iris.biome3d ? null : biome.getGroundBiome(getMasterRandom(), rz, getDimension().getFluidHeight(), rx);
if(biome == null)
{
@@ -204,17 +205,27 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
if(!biomeAssigned && biomeMap != null)
{
biomeAssigned = true;
- sliver.set(k, biome.getGroundBiome(getMasterRandom(), rz, k, rx));
- biomeMap.setBiome(x, z, biome);
- for(int kv = max; kv < biomeMax; kv++)
+ if(Iris.biome3d)
{
- Biome skyBiome = biome.getSkyBiome(getMasterRandom(), rz, kv, rx);
- sliver.set(kv, skyBiome);
+ sliver.set(k, biome.getGroundBiome(getMasterRandom(), rz, k, rx));
+
+ for(int kv = max; kv < biomeMax; kv++)
+ {
+ Biome skyBiome = biome.getSkyBiome(getMasterRandom(), rz, kv, rx);
+ sliver.set(kv, skyBiome);
+ }
}
+
+ else
+ {
+ sliver.set(getFluidHeight(), onlyBiome);
+ }
+
+ biomeMap.setBiome(x, z, biome);
}
- if(k <= Math.max(height, fluidHeight))
+ if(Iris.biome3d && k <= Math.max(height, fluidHeight))
{
sliver.set(k, biome.getGroundBiome(getMasterRandom(), rz, k, rx));
}
@@ -278,10 +289,13 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
{
for(CaveResult i : caveResults)
{
- for(int j = i.getFloor(); j <= i.getCeiling(); j++)
+ if(Iris.biome3d)
{
- sliver.set(j, caveBiome);
- sliver.set(j, caveBiome.getGroundBiome(getMasterRandom(), rz, j, rx));
+ for(int j = i.getFloor(); j <= i.getCeiling(); j++)
+ {
+ sliver.set(j, caveBiome);
+ sliver.set(j, caveBiome.getGroundBiome(getMasterRandom(), rz, j, rx));
+ }
}
KList floor = caveBiome.generateLayers(wx, wz, rockRandom, i.getFloor() - 2, i.getFloor() - 2);
diff --git a/src/main/java/com/volmit/iris/gen/atomics/AtomicSliver.java b/src/main/java/com/volmit/iris/gen/atomics/AtomicSliver.java
index ea47b70ce..5d75d31da 100644
--- a/src/main/java/com/volmit/iris/gen/atomics/AtomicSliver.java
+++ b/src/main/java/com/volmit/iris/gen/atomics/AtomicSliver.java
@@ -29,6 +29,7 @@ public class AtomicSliver
public static boolean forgetful = false;
private transient KMap truebiome;
private transient KMap biome;
+ private transient Biome onlyBiome;
private transient IrisLock lock = new IrisLock("Sliver");
private transient int highestBiome = 0;
private transient long last = M.ms();
@@ -41,6 +42,7 @@ public class AtomicSliver
public AtomicSliver(int x, int z)
{
+ onlyBiome = null;
this.x = x;
this.z = z;
blockUpdates = new KSet<>();
@@ -164,9 +166,9 @@ public class AtomicSliver
public Biome getBiome(int h)
{
- if(forgetful)
+ if(!Iris.biome3d)
{
- return Biome.THE_VOID;
+ return onlyBiome != null ? onlyBiome : Biome.THE_VOID;
}
last = M.ms();
@@ -182,7 +184,17 @@ public class AtomicSliver
public void set(int h, Biome d)
{
lock.lock();
- biome.put(h, d);
+
+ if(Iris.biome3d)
+ {
+ biome.put(h, d);
+ }
+
+ else
+ {
+ onlyBiome = d;
+ }
+
modified = true;
highestBiome = h > highestBiome ? h : highestBiome;
lock.unlock();
@@ -220,13 +232,18 @@ public class AtomicSliver
lock.unlock();
}
+ @SuppressWarnings("deprecation")
public void write(BiomeGrid d)
{
- if(forgetful)
+ lock.lock();
+
+ if(!Iris.biome3d)
{
+ d.setBiome(x, z, onlyBiome);
+ lock.unlock();
return;
}
- lock.lock();
+
for(int i = 0; i <= highestBiome; i++)
{
if(biome.get(i) != null)
@@ -234,15 +251,12 @@ public class AtomicSliver
d.setBiome(x, i, z, biome.get(i));
}
}
+
lock.unlock();
}
public void write(HeightMap height)
{
- if(forgetful)
- {
- return;
- }
lock.lock();
height.setHeight(x, z, highestBlock);
lock.unlock();
@@ -250,10 +264,6 @@ public class AtomicSliver
public void read(DataInputStream din) throws IOException
{
- if(forgetful)
- {
- return;
- }
lock.lock();
this.block = new KMap();
diff --git a/src/main/java/com/volmit/iris/gen/layer/GenLayerUpdate.java b/src/main/java/com/volmit/iris/gen/layer/GenLayerUpdate.java
index 4456dc97e..1c0c3c3ec 100644
--- a/src/main/java/com/volmit/iris/gen/layer/GenLayerUpdate.java
+++ b/src/main/java/com/volmit/iris/gen/layer/GenLayerUpdate.java
@@ -62,6 +62,7 @@ public class GenLayerUpdate extends BlockPopulator
}
p.end();
gen.getMetrics().getUpdate().put(p.getMilliseconds());
+
}
public void update(Chunk c, int x, int y, int z, int rx, int rz, RNG rng)
diff --git a/src/main/java/com/volmit/iris/object/IrisDimension.java b/src/main/java/com/volmit/iris/object/IrisDimension.java
index abec7a09a..1f7e9d64b 100644
--- a/src/main/java/com/volmit/iris/object/IrisDimension.java
+++ b/src/main/java/com/volmit/iris/object/IrisDimension.java
@@ -637,8 +637,6 @@ public class IrisDimension extends IrisRegistrant
IrisLock t = new IrisLock("t");
Iris.verbose("Checking sizes for " + Form.f(objects.size()) + " referenced objects.");
- int tc = g.getThreads();
- g.changeThreadCount(64);
for(String i : objects)
{
g.getAccelerant().queue("tx-psize", () ->
@@ -661,7 +659,6 @@ public class IrisDimension extends IrisRegistrant
}
g.getAccelerant().waitFor("tx-psize");
- g.changeThreadCount(tc);
int x = Math.max(xg.get(), Math.max(yg.get(), zg.get()));
int z = x;
diff --git a/src/main/java/com/volmit/iris/object/IrisEnchantment.java b/src/main/java/com/volmit/iris/object/IrisEnchantment.java
index 05e251269..413e76e18 100644
--- a/src/main/java/com/volmit/iris/object/IrisEnchantment.java
+++ b/src/main/java/com/volmit/iris/object/IrisEnchantment.java
@@ -5,7 +5,6 @@ import java.lang.reflect.Field;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.meta.ItemMeta;
-import com.volmit.iris.Iris;
import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.MaxNumber;
@@ -47,9 +46,17 @@ public class IrisEnchantment
public void apply(RNG rng, ItemMeta meta)
{
- if(rng.nextDouble() < chance)
+ try
{
- meta.addEnchant(getEnchant(), getLevel(rng), true);
+ if(rng.nextDouble() < chance)
+ {
+ meta.addEnchant(getEnchant(), getLevel(rng), true);
+ }
+ }
+
+ catch(Throwable e)
+ {
+
}
}
@@ -71,8 +78,6 @@ public class IrisEnchantment
}
}
- Iris.warn("Can't find enchantment type: " + getEnchantment());
-
return null;
}
diff --git a/src/main/java/com/volmit/iris/object/IrisEntity.java b/src/main/java/com/volmit/iris/object/IrisEntity.java
index 99954de0c..139c8e5a5 100644
--- a/src/main/java/com/volmit/iris/object/IrisEntity.java
+++ b/src/main/java/com/volmit/iris/object/IrisEntity.java
@@ -244,7 +244,7 @@ public class IrisEntity extends IrisRegistrant
}
}
- if(e instanceof Mob)
+ if(Iris.awareEntities && e instanceof Mob)
{
Mob m = (Mob) e;
m.setAware(isAware());
diff --git a/src/main/java/com/volmit/iris/object/IrisEntitySpawn.java b/src/main/java/com/volmit/iris/object/IrisEntitySpawn.java
index 3498e0b1e..0c167cee2 100644
--- a/src/main/java/com/volmit/iris/object/IrisEntitySpawn.java
+++ b/src/main/java/com/volmit/iris/object/IrisEntitySpawn.java
@@ -40,8 +40,8 @@ public class IrisEntitySpawn
@Desc("The 1 in RARITY chance for this entity to spawn")
private int rarity = 1;
- private AtomicCache rng = new AtomicCache<>();
- private AtomicCache ent = new AtomicCache<>();
+ private transient AtomicCache rng = new AtomicCache<>();
+ private transient AtomicCache ent = new AtomicCache<>();
public Entity on(IrisChunkGenerator g, Location at, EntityType t, EntitySpawnEvent ee)
{
diff --git a/src/main/java/com/volmit/iris/object/IrisLoot.java b/src/main/java/com/volmit/iris/object/IrisLoot.java
index 052374791..c0b923d7e 100644
--- a/src/main/java/com/volmit/iris/object/IrisLoot.java
+++ b/src/main/java/com/volmit/iris/object/IrisLoot.java
@@ -69,7 +69,7 @@ public class IrisLoot
private double maxDurability = 1;
@DontObfuscate
- @Desc("Define a custom model identifier")
+ @Desc("Define a custom model identifier 1.14+ only")
private Integer customModel = null;
@DontObfuscate
@@ -123,98 +123,8 @@ public class IrisLoot
public ItemStack get(boolean debug, RNG rng)
{
- ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
- ItemMeta m = is.getItemMeta();
-
- if(getType().getMaxDurability() > 0 && m instanceof Damageable)
+ try
{
- 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(IrisAttributeModifier i : getAttributes())
- {
- i.apply(rng, m);
- }
-
- m.setCustomModelData(getCustomModel());
- m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
- m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
- m.setUnbreakable(isUnbreakable());
-
- for(ItemFlag i : getItemFlags())
- {
- m.addItemFlags(i);
- }
-
- KList lore = new KList<>();
-
- 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());
- }
- }
-
- else
- {
- lore.add(mf);
- }
- });
-
- if(debug)
- {
- if(lore.isNotEmpty())
- {
- lore.add(C.GRAY + "--------------------");
- }
-
- lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
- }
-
- 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(getDyeColor() != null && m instanceof Colorable)
- {
- ((Colorable) m).setColor(getDyeColor());
- }
-
- is.setItemMeta(m);
- return is;
- }
-
- public ItemStack get(boolean debug, IrisLootTable table, RNG rng, int x, int y, int z)
- {
- if(debug)
- {
- chance.reset();
- }
-
- if(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;
- }
-
ItemStack is = new ItemStack(getType(), Math.max(1, rng.i(getMinAmount(), getMaxAmount())));
ItemMeta m = is.getItemMeta();
@@ -235,7 +145,11 @@ public class IrisLoot
i.apply(rng, m);
}
- m.setCustomModelData(getCustomModel());
+ if(Iris.customModels)
+ {
+ m.setCustomModelData(getCustomModel());
+ }
+
m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
m.setUnbreakable(isUnbreakable());
@@ -272,15 +186,127 @@ public class IrisLoot
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) + ")");
+ lore.add(C.GRAY + "1 in " + (getRarity()) + " Chance (" + Form.pc(1D / (getRarity()), 5) + ")");
}
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(getDyeColor() != null && m instanceof Colorable)
+ {
+ ((Colorable) m).setColor(getDyeColor());
+ }
+
is.setItemMeta(m);
return is;
}
+ catch(Throwable e)
+ {
+
+ }
+
+ return new ItemStack(Material.AIR);
+ }
+
+ public ItemStack get(boolean debug, IrisLootTable table, RNG rng, int x, int y, int z)
+ {
+ if(debug)
+ {
+ chance.reset();
+ }
+
+ if(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;
+ }
+
+ 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))));
+ }
+
+ for(IrisEnchantment i : getEnchantments())
+ {
+ i.apply(rng, m);
+ }
+
+ for(IrisAttributeModifier i : getAttributes())
+ {
+ i.apply(rng, m);
+ }
+
+ if(Iris.customModels)
+ {
+ m.setCustomModelData(getCustomModel());
+ }
+
+ m.setLocalizedName(C.translateAlternateColorCodes('&', displayName));
+ m.setDisplayName(C.translateAlternateColorCodes('&', displayName));
+ m.setUnbreakable(isUnbreakable());
+
+ for(ItemFlag i : getItemFlags())
+ {
+ m.addItemFlags(i);
+ }
+
+ KList lore = new KList<>();
+
+ 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());
+ }
+ }
+
+ else
+ {
+ lore.add(mf);
+ }
+ });
+
+ 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;
}
}
diff --git a/src/main/java/com/volmit/iris/util/BiomeStorage.java b/src/main/java/com/volmit/iris/util/BiomeStorage.java
deleted file mode 100644
index e20ac1e31..000000000
--- a/src/main/java/com/volmit/iris/util/BiomeStorage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package com.volmit.iris.util;
-
-import org.bukkit.block.Biome;
-import org.bukkit.generator.ChunkGenerator.BiomeGrid;
-
-public class BiomeStorage
-{
- private static final int e;
- private static final int f;
- public static final int a;
- public static final int b;
- public static final int c;
- private final Biome[] g;
-
- static
- {
- e = (int) Math.round(Math.log(16.0) / Math.log(2.0)) - 2;
- f = (int) Math.round(Math.log(256.0) / Math.log(2.0)) - 2;
- a = 1 << BiomeStorage.e + BiomeStorage.e + BiomeStorage.f;
- b = (1 << BiomeStorage.e) - 1;
- c = (1 << BiomeStorage.f) - 1;
- }
-
- public BiomeStorage(final Biome[] aBiome)
- {
- this.g = aBiome;
- }
-
- public BiomeStorage()
- {
- this(new Biome[BiomeStorage.a]);
- }
-
- public BiomeStorage b()
- {
- return new BiomeStorage(this.g.clone());
- }
-
- public void inject(BiomeGrid grid)
- {
- for(int i = 0; i < 256; i++)
- {
- for(int j = 0; j < 16; j++)
- {
- for(int k = 0; k < 16; k++)
- {
- Biome b = getBiome(j, i, k);
-
- if(b == null || b.equals(Biome.THE_VOID))
- {
- continue;
- }
-
- grid.setBiome(j, i, k, b);
- }
- }
- }
- }
-
- public Biome getBiome(final int i, final int j, final int k)
- {
- final int l = i & BiomeStorage.b;
- final int i2 = MathHelper.clamp(j, 0, BiomeStorage.c);
- final int j2 = k & BiomeStorage.b;
- return this.g[i2 << BiomeStorage.e + BiomeStorage.e | j2 << BiomeStorage.e | l];
- }
-
- public void setBiome(final int i, final int j, final int k, final Biome biome)
- {
- final int l = i & BiomeStorage.b;
- final int i2 = MathHelper.clamp(j, 0, BiomeStorage.c);
- final int j2 = k & BiomeStorage.b;
- this.g[i2 << BiomeStorage.e + BiomeStorage.e | j2 << BiomeStorage.e | l] = biome;
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/volmit/iris/util/InvertedBiomeGrid.java b/src/main/java/com/volmit/iris/util/InvertedBiomeGrid.java
index 0a30bb9fa..81f5641a1 100644
--- a/src/main/java/com/volmit/iris/util/InvertedBiomeGrid.java
+++ b/src/main/java/com/volmit/iris/util/InvertedBiomeGrid.java
@@ -3,6 +3,8 @@ package com.volmit.iris.util;
import org.bukkit.block.Biome;
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
+import com.volmit.iris.Iris;
+
public class InvertedBiomeGrid implements BiomeGrid
{
private BiomeGrid grid;
@@ -22,6 +24,11 @@ public class InvertedBiomeGrid implements BiomeGrid
@Override
public Biome getBiome(int arg0, int arg1, int arg2)
{
+ if(!Iris.biome3d)
+ {
+ return getBiome(arg0, arg2);
+ }
+
return grid.getBiome(arg0, 255 - arg1, arg2);
}
@@ -35,6 +42,12 @@ public class InvertedBiomeGrid implements BiomeGrid
@Override
public void setBiome(int arg0, int arg1, int arg2, Biome arg3)
{
+ if(!Iris.biome3d)
+ {
+ setBiome(arg0, arg2, arg3);
+ return;
+ }
+
grid.setBiome(arg0, 255 - arg1, arg2, arg3);
}
}
diff --git a/src/main/java/com/volmit/iris/util/PhasicBiomeStorage.java b/src/main/java/com/volmit/iris/util/PhasicBiomeStorage.java
deleted file mode 100644
index a3bec5c1d..000000000
--- a/src/main/java/com/volmit/iris/util/PhasicBiomeStorage.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.volmit.iris.util;
-
-import org.bukkit.block.Biome;
-
-public class PhasicBiomeStorage
-{
- private static final int e = (int) Math.round(Math.log(16.0D) / Math.log(2.0D)) - 2;
- private static final int f = (int) Math.round(Math.log(256.0D) / Math.log(2.0D)) - 2;
- public static final int a;
- public static final int b;
- public static final int c;
- private final Biome[] g;
-
- static
- {
- a = 1 << e + e + f;
- b = (1 << e) - 1;
- c = (1 << f) - 1;
- }
-
- public PhasicBiomeStorage(Biome[] abiomebase)
- {
- this.g = abiomebase;
- }
-
- public PhasicBiomeStorage()
- {
- this(new Biome[a]);
- }
-
- public static int clamp(int var0, int var1, int var2)
- {
- if(var0 < var1)
- {
- return var1;
- }
- else
- {
- return var0 > var2 ? var2 : var0;
- }
- }
-
- public Biome getBiome(int i, int j, int k)
- {
- int l = i & b;
- int i1 = clamp(j, 0, c);
- int j1 = k & b;
- return this.g[i1 << e + e | j1 << e | l];
- }
-
- public void setBiome(int i, int j, int k, Biome biome)
- {
- int l = i & b;
- int i1 = clamp(j, 0, c);
- int j1 = k & b;
- this.g[i1 << e + e | j1 << e | l] = biome;
- }
-}
diff --git a/src/main/java/com/volmit/iris/util/PreemptiveChunk.java b/src/main/java/com/volmit/iris/util/PreemptiveChunk.java
deleted file mode 100644
index 0a4cc8173..000000000
--- a/src/main/java/com/volmit/iris/util/PreemptiveChunk.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.volmit.iris.util;
-
-import org.bukkit.Material;
-import org.bukkit.block.Biome;
-import org.bukkit.block.data.BlockData;
-import org.bukkit.generator.ChunkGenerator.BiomeGrid;
-import org.bukkit.generator.ChunkGenerator.ChunkData;
-import org.bukkit.material.MaterialData;
-
-@SuppressWarnings("deprecation")
-public class PreemptiveChunk implements BiomeGrid, ChunkData
-{
- private ChunkData c;
- private BiomeStorage b;
-
- public PreemptiveChunk(ChunkData c)
- {
- this.c = c;
- this.b = new BiomeStorage();
- }
-
- public void inject(ChunkData ic, BiomeGrid ib)
- {
- for(int i = 0; i < 16; i++)
- {
- for(int j = 0; j < 256; j++)
- {
- for(int k = 0; k < 16; k++)
- {
- if(!getType(i, j, k).equals(Material.AIR))
- {
- ic.setBlock(i, j, k, getBlockData(i, j, k));
- }
- }
- }
- }
-
- b.inject(ib);
- }
-
- @Override
- public Biome getBiome(int arg0, int arg1)
- {
- throw new UnsupportedOperationException("Not Supported. Use x y z");
- }
-
- @Override
- public Biome getBiome(int x, int y, int z)
- {
- return b.getBiome(x, y, z);
- }
-
- @Override
- public void setBiome(int x, int z, Biome arg2)
- {
- for(int i = 0; i < 256; i++)
- {
- b.setBiome(x, i, z, arg2);
- }
- }
-
- @Override
- public void setBiome(int arg0, int arg1, int arg2, Biome arg3)
- {
- b.setBiome(arg0, arg1, arg2, arg3);
- }
-
- @Override
- public BlockData getBlockData(int arg0, int arg1, int arg2)
- {
- return c.getBlockData(arg0, arg1, arg2);
- }
-
- @Deprecated
- @Override
- public byte getData(int arg0, int arg1, int arg2)
- {
- return c.getData(arg0, arg1, arg2);
- }
-
- @Override
- public int getMaxHeight()
- {
- return c.getMaxHeight();
- }
-
- @Override
- public Material getType(int arg0, int arg1, int arg2)
- {
- return c.getType(arg0, arg1, arg2);
- }
-
- @Deprecated
- @Override
- public MaterialData getTypeAndData(int arg0, int arg1, int arg2)
- {
- return c.getTypeAndData(arg0, arg1, arg2);
- }
-
- @Override
- public void setBlock(int arg0, int arg1, int arg2, Material arg3)
- {
- c.setBlock(arg0, arg1, arg2, arg3);
- }
-
- @Deprecated
- @Override
- public void setBlock(int arg0, int arg1, int arg2, MaterialData arg3)
- {
- c.setBlock(arg0, arg1, arg2, arg3);
- }
-
- @Override
- public void setBlock(int arg0, int arg1, int arg2, BlockData arg3)
- {
- c.setBlock(arg0, arg1, arg2, arg3);
- }
-
- @Override
- public void setRegion(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, Material arg6)
- {
- c.setRegion(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- }
-
- @Deprecated
- @Override
- public void setRegion(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, MaterialData arg6)
- {
- c.setRegion(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- }
-
- @Override
- public void setRegion(int arg0, int arg1, int arg2, int arg3, int arg4, int arg5, BlockData arg6)
- {
- c.setRegion(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
- }
-}
diff --git a/src/main/java/com/volmit/iris/util/PregenJob.java b/src/main/java/com/volmit/iris/util/PregenJob.java
index f0dc58e7d..94fa3898a 100644
--- a/src/main/java/com/volmit/iris/util/PregenJob.java
+++ b/src/main/java/com/volmit/iris/util/PregenJob.java
@@ -157,7 +157,16 @@ public class PregenJob implements Listener
if(chunkSpiraler.hasNext())
{
chunkSpiraler.next();
- consumer.accept(new ChunkPosition(chunkX, chunkZ), Color.YELLOW);
+
+ try
+ {
+ consumer.accept(new ChunkPosition(chunkX, chunkZ), Color.YELLOW);
+ }
+
+ catch(Throwable e)
+ {
+
+ }
if(isChunkWithin(chunkX, chunkZ))
{
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index b375413a3..cc8978c6c 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -8,5 +8,5 @@ description: More than a Dimenson!
commands:
iris:
aliases: [ir, irs]
-api-version: 1.16
+api-version: 1.14
hotload-dependencies: false
\ No newline at end of file