Merge remote-tracking branch 'origin/master'

This commit is contained in:
Andrew 2020-10-15 22:38:06 -07:00
commit c84c462aeb
14 changed files with 206 additions and 6 deletions

3
.idea/.gitignore generated vendored Normal file
View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -36,5 +36,10 @@
<option name="name" value="CodeMC" /> <option name="name" value="CodeMC" />
<option name="url" value="https://repo.codemc.org/repository/maven-public" /> <option name="url" value="https://repo.codemc.org/repository/maven-public" />
</remote-repository> </remote-repository>
<remote-repository>
<option name="id" value="nexus" />
<option name="name" value="Lumine Releases" />
<option name="url" value="https://mvn.lumine.io/repository/maven-public/" />
</remote-repository>
</component> </component>
</project> </project>

View File

@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: io.lumine.xikage:MythicMobs:4.9.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/io/lumine/xikage/MythicMobs/4.9.1/MythicMobs-4.9.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/io/lumine/xikage/MythicMobs/4.9.1/MythicMobs-4.9.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/io/lumine/xikage/MythicMobs/4.9.1/MythicMobs-4.9.1-sources.jar!/" />
</SOURCES>
</library>
</component>

View File

@ -42,6 +42,7 @@
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.14.4:1.14.4" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bukkit.craftbukkit:cb-1.14.4:1.14.4" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.bstats:bstats-bukkit:1.7" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: io.lumine.xikage:MythicMobs:4.9.1" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.18.10" level="project" />
<orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.5" level="project" /> <orderEntry type="library" scope="PROVIDED" name="Maven: com.google.code.gson:gson:2.8.5" level="project" />
</component> </component>

11
pom.xml
View File

@ -152,6 +152,11 @@
<id>CodeMC</id> <id>CodeMC</id>
<url>https://repo.codemc.org/repository/maven-public</url> <url>https://repo.codemc.org/repository/maven-public</url>
</repository> </repository>
<repository>
<id>nexus</id>
<name>Lumine Releases</name>
<url>https://mvn.lumine.io/repository/maven-public/</url>
</repository>
<repository> <repository>
<id>WorldEdit</id> <id>WorldEdit</id>
<url>https://maven.enginehub.org/repo/</url> <url>https://maven.enginehub.org/repo/</url>
@ -197,6 +202,12 @@
<version>7.2.0-SNAPSHOT</version> <version>7.2.0-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>io.lumine.xikage</groupId>
<artifactId>MythicMobs</artifactId>
<version>4.9.1</version>
<scope>provided</scope>
</dependency>
<!-- Utilities --> <!-- Utilities -->
<dependency> <dependency>
<groupId>com.github.ben-manes.caffeine</groupId> <groupId>com.github.ben-manes.caffeine</groupId>

View File

@ -23,6 +23,7 @@ import com.volmit.iris.gen.provisions.ProvisionBukkit;
import com.volmit.iris.gen.scaffold.IrisGenConfiguration; import com.volmit.iris.gen.scaffold.IrisGenConfiguration;
import com.volmit.iris.gen.scaffold.TerrainTarget; import com.volmit.iris.gen.scaffold.TerrainTarget;
import com.volmit.iris.link.MultiverseCoreLink; import com.volmit.iris.link.MultiverseCoreLink;
import com.volmit.iris.link.MythicMobsLink;
import com.volmit.iris.manager.EditManager; import com.volmit.iris.manager.EditManager;
import com.volmit.iris.manager.IrisBoardManager; import com.volmit.iris.manager.IrisBoardManager;
import com.volmit.iris.manager.IrisDataManager; import com.volmit.iris.manager.IrisDataManager;
@ -59,6 +60,7 @@ public class Iris extends MortarPlugin
public static IrisBoardManager board; public static IrisBoardManager board;
public static String nmsTag = findNMSTag(); public static String nmsTag = findNMSTag();
public static MultiverseCoreLink linkMultiverseCore; public static MultiverseCoreLink linkMultiverseCore;
public static MythicMobsLink linkMythicMobs;
private static IrisLock lock = new IrisLock("Iris"); private static IrisLock lock = new IrisLock("Iris");
private static final Queue<Runnable> syncJobs = new ShurikenQueue<>(); private static final Queue<Runnable> syncJobs = new ShurikenQueue<>();
public static boolean customModels = doesSupportCustomModels(); public static boolean customModels = doesSupportCustomModels();
@ -156,6 +158,7 @@ public class Iris extends MortarPlugin
struct = new StructureManager(); struct = new StructureManager();
board = new IrisBoardManager(); board = new IrisBoardManager();
linkMultiverseCore = new MultiverseCoreLink(); linkMultiverseCore = new MultiverseCoreLink();
linkMythicMobs = new MythicMobsLink();
edit = new EditManager(); edit = new EditManager();
J.a(() -> IO.delete(getTemp())); J.a(() -> IO.delete(getTemp()));
J.a(this::bstats); J.a(this::bstats);

View File

@ -353,9 +353,12 @@ public abstract class ParallaxTerrainProvider extends TopographicTerrainProvider
placeObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + g++) * i * j) + i - j + 3566522)); placeObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + g++) * i * j) + i - j + 3566522));
} }
for(IrisObjectPlacement k : r.getSurfaceObjects()) if(r != null)
{ {
placeObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + g++) * i * j) + i - j + 3569222)); for(IrisObjectPlacement k : r.getSurfaceObjects())
{
placeObject(k, i, j, random.nextParallelRNG((34 * ((i * 30) + (j * 30) + g++) * i * j) + i - j + 3569222));
}
} }
return g; return g;

View File

@ -85,6 +85,11 @@ public abstract class PostBlockTerrainProvider extends ParallaxTerrainProvider i
@Override @Override
public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData) public BlockData getPostBlock(int x, int y, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{ {
if(y > 255 || y < 0)
{
return null;
}
if(x >> 4 == currentPostX && z >> 4 == currentPostZ) if(x >> 4 == currentPostX && z >> 4 == currentPostZ)
{ {
getPostLock().lock(); getPostLock().lock();

View File

@ -402,6 +402,11 @@ public class PostMasterPatcher extends IrisPostBlockFilter
private int nearestCaveFloor(int floor, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) private int nearestCaveFloor(int floor, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{ {
if(floor > 255)
{
return 255;
}
if(B.isAir(getPostBlock(x, floor, z, currentPostX, currentPostZ, currentData))) if(B.isAir(getPostBlock(x, floor, z, currentPostX, currentPostZ, currentData)))
{ {
if(B.isAir(getPostBlock(x, floor - 1, z, currentPostX, currentPostZ, currentData))) if(B.isAir(getPostBlock(x, floor - 1, z, currentPostX, currentPostZ, currentData)))
@ -430,6 +435,11 @@ public class PostMasterPatcher extends IrisPostBlockFilter
private int nearestCaveCeiling(int ceiling, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData) private int nearestCaveCeiling(int ceiling, int x, int z, int currentPostX, int currentPostZ, ChunkData currentData)
{ {
if(ceiling > 255)
{
return 255;
}
if(B.isAir(getPostBlock(x, ceiling, z, currentPostX, currentPostZ, currentData))) if(B.isAir(getPostBlock(x, ceiling, z, currentPostX, currentPostZ, currentData)))
{ {
if(B.isAir(getPostBlock(x, ceiling + 1, z, currentPostX, currentPostZ, currentData))) if(B.isAir(getPostBlock(x, ceiling + 1, z, currentPostX, currentPostZ, currentData)))

View File

@ -0,0 +1,64 @@
package com.volmit.iris.link;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.plugin.Plugin;
import com.volmit.iris.util.KList;
import io.lumine.xikage.mythicmobs.MythicMobs;
import io.lumine.xikage.mythicmobs.mobs.MythicMob;
public class MythicMobsLink
{
public MythicMobsLink()
{
}
public boolean supported()
{
return getMythicMobs() != null;
}
public Entity spawn(String name, Location a)
{
if(!supported())
{
return null;
}
MythicMobs m = (MythicMobs) getMythicMobs();
return m.getMobManager().spawnMob(name, a).getEntity().getBukkitEntity();
}
public String[] getMythicMobTypes()
{
KList<String> v = new KList<>();
if(supported())
{
MythicMobs m = (MythicMobs) getMythicMobs();
for(MythicMob i : m.getMobManager().getMobTypes())
{
v.add(i.getInternalName());
}
}
return v.toArray(new String[v.size()]);
}
public Plugin getMythicMobs()
{
Plugin p = Bukkit.getPluginManager().getPlugin("MythicMobs");
if(p == null)
{
return null;
}
return p;
}
}

View File

@ -26,6 +26,7 @@ import com.volmit.iris.util.RegistryListFont;
import com.volmit.iris.util.RegistryListGenerator; import com.volmit.iris.util.RegistryListGenerator;
import com.volmit.iris.util.RegistryListItemType; import com.volmit.iris.util.RegistryListItemType;
import com.volmit.iris.util.RegistryListLoot; import com.volmit.iris.util.RegistryListLoot;
import com.volmit.iris.util.RegistryListMythical;
import com.volmit.iris.util.RegistryListObject; import com.volmit.iris.util.RegistryListObject;
import com.volmit.iris.util.RegistryListRegion; import com.volmit.iris.util.RegistryListRegion;
import com.volmit.iris.util.RegistryListStructure; import com.volmit.iris.util.RegistryListStructure;
@ -207,6 +208,22 @@ public class SchemaBuilder
} }
else if(k.isAnnotationPresent(RegistryListMythical.class))
{
String key = "enum-reg-mythical";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
j.put("enum", new JSONArray(Iris.linkMythicMobs.getMythicMobTypes()));
definitions.put(key, j);
}
fancyType = "Mythic Mob Type";
prop.put("$ref", "#/definitions/" + key);
description.add(SYMBOL_TYPE__N + " Must be a valid Mythic Mob Type (use ctrl+space for auto complete!) Define mythic mobs with the mythic mobs plugin configuration files.");
}
else if(k.isAnnotationPresent(RegistryListBlockType.class)) else if(k.isAnnotationPresent(RegistryListBlockType.class))
{ {
String key = "enum-block-type"; String key = "enum-block-type";
@ -553,6 +570,31 @@ public class SchemaBuilder
description.add(SYMBOL_TYPE__N + " Must be a valid Biome (use ctrl+space for auto complete!)"); description.add(SYMBOL_TYPE__N + " Must be a valid Biome (use ctrl+space for auto complete!)");
} }
else if(k.isAnnotationPresent(RegistryListMythical.class))
{
fancyType = "List of Mythic Mob Types";
String key = "enum-reg-mythical";
if(!definitions.containsKey(key))
{
JSONObject j = new JSONObject();
JSONArray ja = new JSONArray();
for(String i : Iris.linkMythicMobs.getMythicMobTypes())
{
ja.put(i);
}
j.put("enum", ja);
definitions.put(key, j);
}
JSONObject items = new JSONObject();
items.put("$ref", "#/definitions/" + key);
prop.put("items", items);
description.add(SYMBOL_TYPE__N + " Must be a valid Mythic Mob Type (use ctrl+space for auto complete!) Configure mob types in the mythic mobs plugin configuration files.");
}
else if(k.isAnnotationPresent(RegistryListBlockType.class)) else if(k.isAnnotationPresent(RegistryListBlockType.class))
{ {
fancyType = "List of Block Types"; fancyType = "List of Block Types";
@ -839,6 +881,7 @@ public class SchemaBuilder
{ {
warnings.add("Unexpected Schema Type: " + type + " for field " + k.getName() + " (" + k.getType().getSimpleName() + ") in class " + cl.getSimpleName()); warnings.add("Unexpected Schema Type: " + type + " for field " + k.getName() + " (" + k.getType().getSimpleName() + ") in class " + cl.getSimpleName());
} }
KList<String> d = new KList<>(); KList<String> d = new KList<>();
d.add(k.getName()); d.add(k.getName());
d.add(getFieldDescription(k)); d.add(getFieldDescription(k));

View File

@ -24,6 +24,7 @@ import com.volmit.iris.util.Desc;
import com.volmit.iris.util.DontObfuscate; import com.volmit.iris.util.DontObfuscate;
import com.volmit.iris.util.KList; import com.volmit.iris.util.KList;
import com.volmit.iris.util.RNG; import com.volmit.iris.util.RNG;
import com.volmit.iris.util.RegistryListMythical;
import com.volmit.iris.util.Required; import com.volmit.iris.util.Required;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -41,11 +42,15 @@ import lombok.experimental.Accessors;
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class IrisEntity extends IrisRegistrant public class IrisEntity extends IrisRegistrant
{ {
@Required @Required
@DontObfuscate @DontObfuscate
@Desc("The type of entity to spawn") @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.PIG; 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 = "";
@DontObfuscate @DontObfuscate
@Desc("The custom name of this entity") @Desc("The custom name of this entity")
@ -136,7 +141,7 @@ public class IrisEntity extends IrisRegistrant
public Entity spawn(ParallaxTerrainProvider gen, Location at, RNG rng) public Entity spawn(ParallaxTerrainProvider gen, Location at, RNG rng)
{ {
Entity e = at.getWorld().spawnEntity(at, getType()); Entity e = doSpawn(at);
e.setCustomName(getCustomName() != null ? C.translateAlternateColorCodes('&', getCustomName()) : null); e.setCustomName(getCustomName() != null ? C.translateAlternateColorCodes('&', getCustomName()) : null);
e.setCustomNameVisible(isCustomNameVisible()); e.setCustomNameVisible(isCustomNameVisible());
e.setGlowing(isGlowing()); e.setGlowing(isGlowing());
@ -259,4 +264,19 @@ public class IrisEntity extends IrisRegistrant
return e; return e;
} }
private Entity doSpawn(Location at)
{
if(isMythical())
{
return Iris.linkMythicMobs.spawn(getMythicalType(), at);
}
return at.getWorld().spawnEntity(at, getType());
}
public boolean isMythical()
{
return Iris.linkMythicMobs.supported() && !getMythicalType().trim().isEmpty();
}
} }

View File

@ -490,6 +490,11 @@ public class B
public static boolean isAir(BlockData d) public static boolean isAir(BlockData d)
{ {
if(d == null)
{
return true;
}
return d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR) || d.getMaterial().equals(Material.VOID_AIR); return d.getMaterial().equals(Material.AIR) || d.getMaterial().equals(Material.CAVE_AIR) || d.getMaterial().equals(Material.VOID_AIR);
} }
} }

View File

@ -0,0 +1,14 @@
package com.volmit.iris.util;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(RUNTIME)
@Target({PARAMETER, TYPE, FIELD})
public @interface RegistryListMythical
{
}