mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 02:03:59 +00:00
THE SUPER DUPER COOL BUT TOTALLY NOT STABLE THING THATS NOT READY YET...
This commit is contained in:
parent
6ca6fc6989
commit
ec47ca1983
@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.volmit.iris'
|
group 'com.volmit.iris'
|
||||||
version '1.4.15'
|
version '1.5-TOTALLY-UNSTABLE'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = 'Iris'
|
def name = 'Iris'
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
|
@ -10,7 +10,9 @@ import com.volmit.iris.manager.link.MultiverseCoreLink;
|
|||||||
import com.volmit.iris.manager.link.MythicMobsLink;
|
import com.volmit.iris.manager.link.MythicMobsLink;
|
||||||
import com.volmit.iris.nms.INMS;
|
import com.volmit.iris.nms.INMS;
|
||||||
import com.volmit.iris.object.IrisCompat;
|
import com.volmit.iris.object.IrisCompat;
|
||||||
|
import com.volmit.iris.object.IrisDimension;
|
||||||
import com.volmit.iris.scaffold.IrisWorlds;
|
import com.volmit.iris.scaffold.IrisWorlds;
|
||||||
|
import com.volmit.iris.scaffold.data.DataProvider;
|
||||||
import com.volmit.iris.scaffold.engine.EngineCompositeGenerator;
|
import com.volmit.iris.scaffold.engine.EngineCompositeGenerator;
|
||||||
import com.volmit.iris.util.*;
|
import com.volmit.iris.util.*;
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
@ -61,6 +63,66 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
INMS.get();
|
INMS.get();
|
||||||
IO.delete(new File("iris"));
|
IO.delete(new File("iris"));
|
||||||
lowMemoryMode = Runtime.getRuntime().maxMemory() < 4000000000L; // 4 * 1000 * 1000 * 1000 // 4;
|
lowMemoryMode = Runtime.getRuntime().maxMemory() < 4000000000L; // 4 * 1000 * 1000 * 1000 // 4;
|
||||||
|
installDataPacks();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void installDataPacks() {
|
||||||
|
Iris.info("Checking Data Packs...");
|
||||||
|
boolean reboot = false;
|
||||||
|
File packs = new File("plugins/Iris/packs");
|
||||||
|
File dpacks = null;
|
||||||
|
|
||||||
|
look: for(File i : new File(".").listFiles())
|
||||||
|
{
|
||||||
|
if(i.isDirectory())
|
||||||
|
{
|
||||||
|
for(File j : i.listFiles())
|
||||||
|
{
|
||||||
|
if(j.isDirectory() && j.getName().equals("datapacks"))
|
||||||
|
{
|
||||||
|
dpacks = j;
|
||||||
|
break look;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dpacks == null)
|
||||||
|
{
|
||||||
|
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(packs.exists())
|
||||||
|
{
|
||||||
|
for(File i : packs.listFiles())
|
||||||
|
{
|
||||||
|
if(i.isDirectory())
|
||||||
|
{
|
||||||
|
Iris.verbose("Checking Pack: " + i.getPath());
|
||||||
|
IrisDataManager data = new IrisDataManager(i);
|
||||||
|
File dims = new File(i, "dimensions");
|
||||||
|
|
||||||
|
if(dims.exists())
|
||||||
|
{
|
||||||
|
for(File j : dims.listFiles())
|
||||||
|
{
|
||||||
|
if(j.getName().endsWith(".json"))
|
||||||
|
{
|
||||||
|
IrisDimension dim = data.getDimensionLoader().load(j.getName().split("\\Q.\\E")[0]);
|
||||||
|
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
|
||||||
|
if(dim.installDataPack(() -> data, dpacks))
|
||||||
|
{
|
||||||
|
reboot = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.info("Data Packs Setup!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getThreadCount() {
|
public static int getThreadCount() {
|
||||||
@ -377,6 +439,7 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
Iris.info("Server type & version: " + Bukkit.getVersion());
|
Iris.info("Server type & version: " + Bukkit.getVersion());
|
||||||
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
|
Iris.info("Bukkit version: " + Bukkit.getBukkitVersion());
|
||||||
Iris.info("Java version: " + getJavaVersion());
|
Iris.info("Java version: " + getJavaVersion());
|
||||||
|
Iris.info("Custom Biomes: " + INMS.get().countCustomBiomes());
|
||||||
for (int i = 0; i < info.length; i++) {
|
for (int i = 0; i < info.length; i++) {
|
||||||
splash[i] += info[i];
|
splash[i] += info[i];
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package com.volmit.iris.generator.actuator;
|
package com.volmit.iris.generator.actuator;
|
||||||
|
|
||||||
|
import com.volmit.iris.nms.INMS;
|
||||||
|
import com.volmit.iris.object.IrisBiome;
|
||||||
import com.volmit.iris.scaffold.engine.Engine;
|
import com.volmit.iris.scaffold.engine.Engine;
|
||||||
import com.volmit.iris.scaffold.engine.EngineAssignedActuator;
|
import com.volmit.iris.scaffold.engine.EngineAssignedActuator;
|
||||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||||
|
import com.volmit.iris.scaffold.hunk.view.BiomeGridHunkView;
|
||||||
import com.volmit.iris.scaffold.parallel.BurstExecutor;
|
import com.volmit.iris.scaffold.parallel.BurstExecutor;
|
||||||
import com.volmit.iris.scaffold.parallel.MultiBurst;
|
import com.volmit.iris.scaffold.parallel.MultiBurst;
|
||||||
import com.volmit.iris.util.PrecisionStopwatch;
|
import com.volmit.iris.util.PrecisionStopwatch;
|
||||||
@ -26,9 +29,36 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
|
|||||||
int zzf = zf;
|
int zzf = zf;
|
||||||
|
|
||||||
burst.queue(() -> {
|
burst.queue(() -> {
|
||||||
Biome v = getComplex().getTrueBiomeStream().get(modX(xxf + x), modZ(zzf + z)).getSkyBiome(RNG.r, x, 0, z);
|
IrisBiome ib = getComplex().getTrueBiomeStream().get(modX(xxf + x), modZ(zzf + z));
|
||||||
for (int i = 0; i < h.getHeight(); i++) {
|
|
||||||
h.set(xxf, i, zzf, v);
|
if(ib.isCustom())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Object biomeBase = INMS.get().getCustomBiomeBaseFor(getDimension().getLoadKey()+":"+ib.getCustom().getId());
|
||||||
|
((BiomeGridHunkView)h).forceBiomeBaseInto(x, 0, z, biomeBase);
|
||||||
|
|
||||||
|
for (int i = 0; i < h.getHeight(); i++) {
|
||||||
|
((BiomeGridHunkView)h).forceBiomeBaseInto(xxf, i, zzf, biomeBase);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
Biome v = ib.getSkyBiome(RNG.r, x, 0, z);
|
||||||
|
for (int i = 0; i < h.getHeight(); i++) {
|
||||||
|
h.set(xxf, i, zzf, v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Biome v = ib.getSkyBiome(RNG.r, x, 0, z);
|
||||||
|
for (int i = 0; i < h.getHeight(); i++) {
|
||||||
|
h.set(xxf, i, zzf, v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import org.bukkit.Location;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
public interface INMSBinding {
|
public interface INMSBinding {
|
||||||
Object getBiomeBaseFromId(int id);
|
Object getBiomeBaseFromId(int id);
|
||||||
@ -29,4 +30,8 @@ public interface INMSBinding {
|
|||||||
default World createWorld(WorldCreator c) {
|
default World createWorld(WorldCreator c) {
|
||||||
return c.createWorld();
|
return c.createWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int countCustomBiomes();
|
||||||
|
|
||||||
|
void forceBiomeInto(int x, int y, int z, Object somethingVeryDirty, ChunkGenerator.BiomeGrid chunk);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.nms.v17_1;
|
package com.volmit.iris.nms.v17_1;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.nms.INMSBinding;
|
import com.volmit.iris.nms.INMSBinding;
|
||||||
import com.volmit.iris.util.KMap;
|
import com.volmit.iris.util.KMap;
|
||||||
import net.minecraft.core.IRegistry;
|
import net.minecraft.core.IRegistry;
|
||||||
@ -7,18 +8,54 @@ import net.minecraft.core.IRegistryWritable;
|
|||||||
import net.minecraft.resources.MinecraftKey;
|
import net.minecraft.resources.MinecraftKey;
|
||||||
import net.minecraft.resources.ResourceKey;
|
import net.minecraft.resources.ResourceKey;
|
||||||
import net.minecraft.world.level.biome.BiomeBase;
|
import net.minecraft.world.level.biome.BiomeBase;
|
||||||
|
import net.minecraft.world.level.chunk.BiomeStorage;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_17_R1.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_17_R1.CraftWorld;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
public class NMSBinding17_1 implements INMSBinding {
|
public class NMSBinding17_1 implements INMSBinding {
|
||||||
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
private final KMap<Biome, Object> baseBiomeCache = new KMap<>();
|
||||||
|
private Field biomeStorageCache = null;
|
||||||
|
|
||||||
|
private Object getBiomeStorage(ChunkGenerator.BiomeGrid g)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return getFieldForBiomeStorage(g).get(g);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Field getFieldForBiomeStorage(Object storage) {
|
||||||
|
Field f = biomeStorageCache;
|
||||||
|
|
||||||
|
if (f != null)
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
|
||||||
|
f = storage.getClass().getDeclaredField("biome");
|
||||||
|
f.setAccessible(true);
|
||||||
|
return f;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.error(storage.getClass().getCanonicalName());
|
||||||
|
}
|
||||||
|
|
||||||
|
biomeStorageCache = f;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private IRegistryWritable<BiomeBase> getCustomBiomeRegistry() {
|
private IRegistryWritable<BiomeBase> getCustomBiomeRegistry() {
|
||||||
return ((CraftServer) Bukkit.getServer()).getHandle().getServer().getCustomRegistry().b(IRegistry.aO);
|
return ((CraftServer) Bukkit.getServer()).getHandle().getServer().getCustomRegistry().b(IRegistry.aO);
|
||||||
@ -148,6 +185,34 @@ public class NMSBinding17_1 implements INMSBinding {
|
|||||||
return biome.ordinal();
|
return biome.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countCustomBiomes() {
|
||||||
|
AtomicInteger a = new AtomicInteger(0);
|
||||||
|
getCustomBiomeRegistry().d().stream().forEach((i) -> {
|
||||||
|
MinecraftKey k = i.getKey().a();
|
||||||
|
|
||||||
|
if(k.getNamespace().equals("minecraft"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
a.incrementAndGet();
|
||||||
|
Iris.verbose("Custom Biome: " + k.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
return a.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceBiomeInto(int x, int y, int z, Object somethingVeryDirty, ChunkGenerator.BiomeGrid chunk) {
|
||||||
|
try {
|
||||||
|
BiomeStorage s = (BiomeStorage) getFieldForBiomeStorage(chunk).get(chunk);
|
||||||
|
s.setBiome(x,y,z, (BiomeBase) somethingVeryDirty);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBukkit() {
|
public boolean isBukkit() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -4,6 +4,7 @@ import com.volmit.iris.nms.INMSBinding;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
public class NMSBinding1X implements INMSBinding {
|
public class NMSBinding1X implements INMSBinding {
|
||||||
@Override
|
@Override
|
||||||
@ -54,4 +55,14 @@ public class NMSBinding1X implements INMSBinding {
|
|||||||
public int getBiomeId(Biome biome) {
|
public int getBiomeId(Biome biome) {
|
||||||
return biome.ordinal();
|
return biome.ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int countCustomBiomes() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forceBiomeInto(int x, int y, int z, Object somethingVeryDirty, ChunkGenerator.BiomeGrid chunk) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,11 +31,9 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
@Desc("This is the human readable name for this biome. This can and should be different than the file name. This is not used for loading biomes in other objects.")
|
||||||
private String name = "A Biome";
|
private String name = "A Biome";
|
||||||
|
|
||||||
/* Needs to be implemented but it's not
|
@DontObfuscate
|
||||||
@DontObfuscate
|
@Desc("If the biome type custom is defined, specify this")
|
||||||
@Desc("The palette of blocks for 'water' in this biome (overwrites dimension)")
|
private IrisBiomeCustom custom;
|
||||||
private IrisMaterialPalette fluidPalette = new IrisMaterialPalette().qclear().qadd("void_air");
|
|
||||||
*/
|
|
||||||
|
|
||||||
@DontObfuscate
|
@DontObfuscate
|
||||||
@Desc("Entity spawns to override or add to this biome. Anytime an entity spawns, it has a chance to be replaced as one of these overrides.")
|
@Desc("Entity spawns to override or add to this biome. Anytime an entity spawns, it has a chance to be replaced as one of these overrides.")
|
||||||
@ -201,6 +199,11 @@ public class IrisBiome extends IrisRegistrant implements IRare {
|
|||||||
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
return vanillaDerivative == null ? derivative : vanillaDerivative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isCustom()
|
||||||
|
{
|
||||||
|
return getCustom() != null;
|
||||||
|
}
|
||||||
|
|
||||||
public double getGenLinkMax(String loadKey) {
|
public double getGenLinkMax(String loadKey) {
|
||||||
Integer v = genCacheMax.aquire(() ->
|
Integer v = genCacheMax.aquire(() ->
|
||||||
{
|
{
|
||||||
|
113
src/main/java/com/volmit/iris/object/IrisBiomeCustom.java
Normal file
113
src/main/java/com/volmit/iris/object/IrisBiomeCustom.java
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
package com.volmit.iris.object;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.util.*;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Desc("A custom biome, generated through a datapack")
|
||||||
|
@Data
|
||||||
|
public class IrisBiomeCustom {
|
||||||
|
@DontObfuscate
|
||||||
|
@Required
|
||||||
|
@Desc("The resource key of this biome. Just a simple id such as 'plains' or something.")
|
||||||
|
private String id = "";
|
||||||
|
|
||||||
|
@MinNumber(-3)
|
||||||
|
@MaxNumber(3)
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The biome's temperature")
|
||||||
|
private double temperature = 0.8;
|
||||||
|
|
||||||
|
@MinNumber(-3)
|
||||||
|
@MaxNumber(3)
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The biome's downfall amount (snow / rain), see preci")
|
||||||
|
private double humidity = 0.4;
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The biome's downfall type")
|
||||||
|
private IrisBiomeCustomPrecipType downfallType = IrisBiomeCustomPrecipType.rain;
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The biome's category type")
|
||||||
|
private IrisBiomeCustomCategory category = IrisBiomeCustomCategory.plains;
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of the sky, top half of sky. (hex format)")
|
||||||
|
private String skyColor = "#79a8e1";
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of the fog, bottom half of sky. (hex format)")
|
||||||
|
private String fogColor = "#c0d8e1";
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of the water (hex format). Leave blank / don't define to not change")
|
||||||
|
private String waterColor = "#3f76e4";
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of water fog (hex format). Leave blank / don't define to not change")
|
||||||
|
private String waterFogColor = "#050533";
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of the grass (hex format). Leave blank / don't define to not change")
|
||||||
|
private String grassColor = "";
|
||||||
|
|
||||||
|
@DontObfuscate
|
||||||
|
@Desc("The color of foliage (hex format). Leave blank / don't define to not change")
|
||||||
|
private String foliageColor = "";
|
||||||
|
|
||||||
|
public String generateJson()
|
||||||
|
{
|
||||||
|
JSONObject effects = new JSONObject();
|
||||||
|
effects.put("sky_color", parseColor(getSkyColor()));
|
||||||
|
effects.put("fog_color", parseColor(getFogColor()));
|
||||||
|
effects.put("water_color", parseColor(getWaterColor()));
|
||||||
|
effects.put("water_fog_color", parseColor(getWaterFogColor()));
|
||||||
|
|
||||||
|
if(getGrassColor() != null)
|
||||||
|
{
|
||||||
|
effects.put("grass_color", parseColor(getGrassColor()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getFoliageColor() != null)
|
||||||
|
{
|
||||||
|
effects.put("foliage_color", parseColor(getFoliageColor()));
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject j = new JSONObject();
|
||||||
|
j.put("surface_builder", "minecraft:grass");
|
||||||
|
j.put("depth", 0.125);
|
||||||
|
j.put("scale", 0.05);
|
||||||
|
j.put("temperature", getTemperature());
|
||||||
|
j.put("downfall", getHumidity());
|
||||||
|
j.put("precipitation", getDownfallType().toString().toLowerCase());
|
||||||
|
j.put("category", getCategory().toString().toLowerCase());
|
||||||
|
j.put("effects", effects);
|
||||||
|
j.put("starts", new JSONArray());
|
||||||
|
j.put("spawners", new JSONObject());
|
||||||
|
j.put("spawn_costs", new JSONObject());
|
||||||
|
j.put("carvers", new JSONObject());
|
||||||
|
j.put("features", new JSONArray());
|
||||||
|
|
||||||
|
return j.toString(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int parseColor(String c) {
|
||||||
|
String v = (c.startsWith("#") ? c : "#" + c).trim();
|
||||||
|
try {
|
||||||
|
return Color.decode(v).getRGB();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Iris.error("Error Parsing '''color''', (" + c+ ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.volmit.iris.object;
|
||||||
|
|
||||||
|
public enum IrisBiomeCustomCategory
|
||||||
|
{
|
||||||
|
beach,
|
||||||
|
desert,
|
||||||
|
extreme_hills,
|
||||||
|
forest,
|
||||||
|
icy,
|
||||||
|
jungle,
|
||||||
|
mesa,
|
||||||
|
mushroom,
|
||||||
|
nether,
|
||||||
|
none,
|
||||||
|
ocean,
|
||||||
|
plains,
|
||||||
|
river,
|
||||||
|
savanna,
|
||||||
|
swamp,
|
||||||
|
taiga,
|
||||||
|
the_end
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.volmit.iris.object;
|
||||||
|
|
||||||
|
import com.volmit.iris.util.Desc;
|
||||||
|
import com.volmit.iris.util.DontObfuscate;
|
||||||
|
|
||||||
|
public enum IrisBiomeCustomPrecipType
|
||||||
|
{
|
||||||
|
@Desc("No downfall")
|
||||||
|
@DontObfuscate
|
||||||
|
none,
|
||||||
|
|
||||||
|
@Desc("Rain downfall")
|
||||||
|
@DontObfuscate
|
||||||
|
rain,
|
||||||
|
|
||||||
|
@Desc("Snow downfall")
|
||||||
|
@DontObfuscate
|
||||||
|
snow
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.object;
|
package com.volmit.iris.object;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.generator.noise.CNG;
|
import com.volmit.iris.generator.noise.CNG;
|
||||||
import com.volmit.iris.manager.IrisDataManager;
|
import com.volmit.iris.manager.IrisDataManager;
|
||||||
import com.volmit.iris.scaffold.cache.AtomicCache;
|
import com.volmit.iris.scaffold.cache.AtomicCache;
|
||||||
@ -10,10 +11,14 @@ import lombok.Data;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@ -452,4 +457,50 @@ public class IrisDimension extends IrisRegistrant {
|
|||||||
|
|
||||||
return landBiomeStyle;
|
return landBiomeStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean installDataPack(DataProvider data, File datapacks)
|
||||||
|
{
|
||||||
|
boolean write = false;
|
||||||
|
boolean changed = false;
|
||||||
|
|
||||||
|
for(IrisBiome i : getAllBiomes(data))
|
||||||
|
{
|
||||||
|
if(i.isCustom())
|
||||||
|
{
|
||||||
|
write = true;
|
||||||
|
File output = new File(datapacks, "iris/data/" + getLoadKey() + "/worldgen/biome/" + i.getCustom().getId() + ".json");
|
||||||
|
|
||||||
|
if(!output.exists())
|
||||||
|
{
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.verbose(" Installing Data Pack Biome: " + output.getPath());
|
||||||
|
output.getParentFile().mkdirs();
|
||||||
|
try {
|
||||||
|
IO.writeAll(output, i.getCustom().generateJson());
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(write)
|
||||||
|
{
|
||||||
|
File mcm = new File(datapacks, "iris/pack.mcmeta");
|
||||||
|
try {
|
||||||
|
IO.writeAll(mcm, "{\n" +
|
||||||
|
" \"pack\": {\n" +
|
||||||
|
" \"description\": \"Iris Data Pack. This pack contains all installed Iris Packs' resources.\",\n" +
|
||||||
|
" \"pack_format\": 7\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}\n");
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Iris.verbose(" Installing Data Pack MCMeta: " + mcm.getPath());
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package com.volmit.iris.scaffold.hunk.view;
|
package com.volmit.iris.scaffold.hunk.view;
|
||||||
|
|
||||||
|
import com.volmit.iris.nms.INMS;
|
||||||
import com.volmit.iris.scaffold.hunk.Hunk;
|
import com.volmit.iris.scaffold.hunk.Hunk;
|
||||||
|
import com.volmit.iris.util.LinkedTerrainChunk;
|
||||||
|
import com.volmit.iris.util.TerrainChunk;
|
||||||
|
import net.minecraft.world.level.chunk.BiomeStorage;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
|
import org.bukkit.craftbukkit.v1_17_R1.generator.CustomChunkGenerator;
|
||||||
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
import org.bukkit.generator.ChunkGenerator.BiomeGrid;
|
||||||
|
|
||||||
public class BiomeGridHunkView implements Hunk<Biome> {
|
public class BiomeGridHunkView implements Hunk<Biome> {
|
||||||
@ -36,4 +41,13 @@ public class BiomeGridHunkView implements Hunk<Biome> {
|
|||||||
public Biome getRaw(int x, int y, int z) {
|
public Biome getRaw(int x, int y, int z) {
|
||||||
return chunk.getBiome(x, y, z);
|
return chunk.getBiome(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void forceBiomeBaseInto(int x, int y, int z, Object somethingVeryDirty) {
|
||||||
|
if(chunk instanceof LinkedTerrainChunk)
|
||||||
|
{
|
||||||
|
INMS.get().forceBiomeInto(x,y,z,somethingVeryDirty,((LinkedTerrainChunk) chunk).getRawBiome());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
INMS.get().forceBiomeInto(x,y,z,somethingVeryDirty,chunk);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,11 @@ public class LinkedTerrainChunk implements TerrainChunk {
|
|||||||
biome3D.setBiome(x, 0, z, bio);
|
biome3D.setBiome(x, 0, z, bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BiomeGrid getRawBiome()
|
||||||
|
{
|
||||||
|
return storage;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBiome(int x, int y, int z, Biome bio) {
|
public void setBiome(int x, int y, int z, Biome bio) {
|
||||||
if (storage != null) {
|
if (storage != null) {
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.volmit.iris.util;
|
||||||
|
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
import static java.lang.annotation.ElementType.*;
|
||||||
|
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
|
|
||||||
|
@Retention(RUNTIME)
|
||||||
|
@Target({PARAMETER, TYPE, FIELD})
|
||||||
|
public @interface RegistryListBiomeDownfallType {
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user