Iris Mods

This commit is contained in:
Daniel Mills 2021-07-22 11:12:17 -04:00
parent bdb00b8d58
commit a8299b4f54
9 changed files with 445 additions and 0 deletions

View File

@ -40,6 +40,7 @@ public class IrisDataManager {
private ResourceLoader<IrisJigsawPool> jigsawPoolLoader; private ResourceLoader<IrisJigsawPool> jigsawPoolLoader;
private ResourceLoader<IrisJigsawStructure> jigsawStructureLoader; private ResourceLoader<IrisJigsawStructure> jigsawStructureLoader;
private ResourceLoader<IrisEntity> entityLoader; private ResourceLoader<IrisEntity> entityLoader;
private ResourceLoader<IrisMod> modLoader;
private ResourceLoader<IrisBlockData> blockLoader; private ResourceLoader<IrisBlockData> blockLoader;
private ObjectResourceLoader objectLoader; private ObjectResourceLoader objectLoader;
private boolean closed; private boolean closed;
@ -64,6 +65,7 @@ public class IrisDataManager {
this.entityLoader = null; this.entityLoader = null;
this.regionLoader = null; this.regionLoader = null;
this.biomeLoader = null; this.biomeLoader = null;
this.modLoader = null;
this.dimensionLoader = null; this.dimensionLoader = null;
this.jigsawPoolLoader = null; this.jigsawPoolLoader = null;
this.jigsawPieceLoader = null; this.jigsawPieceLoader = null;
@ -92,6 +94,7 @@ public class IrisDataManager {
this.entityLoader = new ResourceLoader<>(packs, this, "entities", "Entity", IrisEntity.class); this.entityLoader = new ResourceLoader<>(packs, this, "entities", "Entity", IrisEntity.class);
this.regionLoader = new ResourceLoader<>(packs, this, "regions", "Region", IrisRegion.class); this.regionLoader = new ResourceLoader<>(packs, this, "regions", "Region", IrisRegion.class);
this.biomeLoader = new ResourceLoader<>(packs, this, "biomes", "Biome", IrisBiome.class); this.biomeLoader = new ResourceLoader<>(packs, this, "biomes", "Biome", IrisBiome.class);
this.modLoader = new ResourceLoader<>(packs, this, "mods", "Mod", IrisMod.class);
this.dimensionLoader = new ResourceLoader<>(packs, this, "dimensions", "Dimension", IrisDimension.class); this.dimensionLoader = new ResourceLoader<>(packs, this, "dimensions", "Dimension", IrisDimension.class);
this.jigsawPoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisJigsawPool.class); this.jigsawPoolLoader = new ResourceLoader<>(packs, this, "jigsaw-pools", "Jigsaw Pool", IrisJigsawPool.class);
this.jigsawStructureLoader = new ResourceLoader<>(packs, this, "jigsaw-structures", "Jigsaw Structure", IrisJigsawStructure.class); this.jigsawStructureLoader = new ResourceLoader<>(packs, this, "jigsaw-structures", "Jigsaw Structure", IrisJigsawStructure.class);
@ -111,6 +114,7 @@ public class IrisDataManager {
objectLoader.clearCache(); objectLoader.clearCache();
jigsawPieceLoader.clearCache(); jigsawPieceLoader.clearCache();
jigsawPoolLoader.clearCache(); jigsawPoolLoader.clearCache();
modLoader.clearCache();
jigsawStructureLoader.clearCache(); jigsawStructureLoader.clearCache();
regionLoader.clearCache(); regionLoader.clearCache();
dimensionLoader.clearCache(); dimensionLoader.clearCache();
@ -127,6 +131,7 @@ public class IrisDataManager {
blockLoader.clearList(); blockLoader.clearList();
entityLoader.clearList(); entityLoader.clearList();
biomeLoader.clearList(); biomeLoader.clearList();
modLoader.clearList();
regionLoader.clearList(); regionLoader.clearList();
dimensionLoader.clearList(); dimensionLoader.clearList();
generatorLoader.clearList(); generatorLoader.clearList();
@ -144,6 +149,10 @@ public class IrisDataManager {
return loadAny(key, (dm) -> dm.getBiomeLoader().load(key, false)); return loadAny(key, (dm) -> dm.getBiomeLoader().load(key, false));
} }
public static IrisMod loadAnyMod(String key) {
return loadAny(key, (dm) -> dm.getModLoader().load(key, false));
}
public static IrisJigsawPiece loadAnyJigsawPiece(String key) { public static IrisJigsawPiece loadAnyJigsawPiece(String key) {
return loadAny(key, (dm) -> dm.getJigsawPieceLoader().load(key, false)); return loadAny(key, (dm) -> dm.getJigsawPieceLoader().load(key, false));
} }

View File

@ -0,0 +1,118 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.Iris;
import com.volmit.iris.core.IrisDataManager;
import com.volmit.iris.engine.cache.AtomicCache;
import com.volmit.iris.engine.data.DataProvider;
import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.math.Position2;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.bukkit.Material;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData;
import java.io.File;
import java.io.IOException;
@SuppressWarnings("DefaultAnnotationParam")
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
@Desc("Represents a dimension")
@Data
@EqualsAndHashCode(callSuper = false)
public class IrisMod extends IrisRegistrant {
@MinNumber(2)
@Required
@Desc("The human readable name of this dimension")
private String name = "A Dimension Mod";
@Desc("If this mod only works with a specific dimension, define it's load key here. Such as overworld, or flat. Otherwise iris will assume this mod works with anything.")
private String forDimension = "";
@MinNumber(-1)
@MaxNumber(512)
@Desc("Override the fluid height. Otherwise set it to -1")
private int overrideFluidHeight = -1;
@Desc("A list of biomes to remove")
@RegistryListBiome
@ArrayType(type = String.class, min = 1)
private KList<String> removeBiomes = new KList<>();
@Desc("A list of objects to remove")
@RegistryListObject
@ArrayType(type = String.class, min = 1)
private KList<String> removeObjects = new KList<>();
@Desc("A list of regions to remove")
@RegistryListRegion
@ArrayType(type = String.class, min = 1)
private KList<String> removeRegions = new KList<>();
@Desc("A list of regions to inject")
@RegistryListRegion
@ArrayType(type = String.class, min = 1)
private KList<String> injectRegions = new KList<>();
@ArrayType(min = 1, type = IrisModBiomeInjector.class)
@Desc("Inject biomes into existing regions")
private KList<IrisModBiomeInjector> biomeInjectors = new KList<>();
@ArrayType(min = 1, type = IrisModBiomeReplacer.class)
@Desc("Replace biomes with other biomes")
private KList<IrisModBiomeReplacer> biomeReplacers = new KList<>();
@ArrayType(min = 1, type = IrisModObjectReplacer.class)
@Desc("Replace objects with other objects")
private KList<IrisModObjectReplacer> objectReplacers = new KList<>();
@ArrayType(min = 1, type = IrisModObjectPlacementBiomeInjector.class)
@Desc("Inject placers into existing biomes")
private KList<IrisModObjectPlacementBiomeInjector> biomeObjectPlacementInjectors = new KList<>();
@ArrayType(min = 1, type = IrisModObjectPlacementRegionInjector.class)
@Desc("Inject placers into existing regions")
private KList<IrisModObjectPlacementRegionInjector> regionObjectPlacementInjectors = new KList<>();
@ArrayType(min = 1, type = IrisModRegionReplacer.class)
@Required
@Desc("Replace biomes with other biomes")
private KList<IrisModRegionReplacer> regionReplacers = new KList<>();
@ArrayType(min = 1, type = IrisObjectReplace.class)
@Required
@Desc("Replace blocks with other blocks")
private KList<IrisObjectReplace> blockReplacers = new KList<>();
@ArrayType(min = 1, type = IrisModNoiseStyleReplacer.class)
@Required
@Desc("Replace noise styles with other styles")
private KList<IrisModNoiseStyleReplacer> styleReplacers = new KList<>();
}

View File

@ -0,0 +1,46 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListBiome;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A biome injector")
@Data
public class IrisModBiomeInjector {
@Required
@Desc("The region to find")
@RegistryListBiome
private String region = "";
@Required
@Desc("A biome to inject into the region")
@RegistryListBiome
private String replace = "";
}

View File

@ -0,0 +1,48 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.cache.AtomicCache;
import com.volmit.iris.engine.interpolation.IrisInterpolation;
import com.volmit.iris.engine.noise.CNG;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.math.RNG;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A biome replacer")
@Data
public class IrisModBiomeReplacer {
@Required
@Desc("A list of biomes to find")
@RegistryListBiome
@ArrayType(type = String.class, min = 1)
private KList<String> find = new KList<>();
@Required
@Desc("A biome to replace it with")
@RegistryListBiome
private String replace = "";
}

View File

@ -0,0 +1,47 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A noise style replacer")
@Data
public class IrisModNoiseStyleReplacer {
@Required
@Desc("A noise style to find")
@ArrayType(type = String.class, min = 1)
private NoiseStyle find = NoiseStyle.IRIS;
@Required
@Desc("If replaceTypeOnly is set to true, Iris will keep the existing generator style and only replace the type itself. Otherwise it will use the replace tag for every style using the find type.")
private boolean replaceTypeOnly = false;
@Required
@Desc("A noise style to replace it with")
@RegistryListBiome
private IrisGeneratorStyle replace = new IrisGeneratorStyle();
}

View File

@ -0,0 +1,46 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.ArrayType;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.engine.object.annotations.RegistryListBiome;
import com.volmit.iris.engine.object.annotations.Required;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("An object placement injector")
@Data
public class IrisModObjectPlacementBiomeInjector {
@Required
@Desc("The biome to find")
@RegistryListBiome
private String biome = "";
@Required
@Desc("A biome to inject into the region")
@ArrayType(type = IrisObjectPlacement.class, min = 1)
private KList<IrisObjectPlacement> place = new KList<>();
}

View File

@ -0,0 +1,43 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("An object placement injector")
@Data
public class IrisModObjectPlacementRegionInjector {
@Required
@Desc("The biome to find")
@RegistryListRegion
private String biome = "";
@Required
@Desc("A biome to inject into the region")
@ArrayType(type = IrisObjectPlacement.class, min = 1)
private KList<IrisObjectPlacement> place = new KList<>();
}

View File

@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A biome replacer")
@Data
public class IrisModObjectReplacer {
@Required
@Desc("A list of objects to find")
@RegistryListObject
@ArrayType(type = String.class, min = 1)
private KList<String> find = new KList<>();
@Required
@Desc("An object to replace it with")
@RegistryListBiome
private String replace = "";
}

View File

@ -0,0 +1,44 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2021 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.engine.object;
import com.volmit.iris.engine.object.annotations.*;
import com.volmit.iris.util.collection.KList;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Desc("A region replacer")
@Data
public class IrisModRegionReplacer {
@Required
@Desc("A list of regions to find")
@RegistryListRegion
@ArrayType(type = String.class, min = 1)
private KList<String> find = new KList<>();
@Required
@Desc("A region to replace it with")
@RegistryListRegion
private String replace = "";
}