mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-28 11:39:07 +00:00
Re-added MythicMob support
- Re-added Mythic Mob support via everyone's favourite friend: Reflection - Added room for Citizens to be supported using the same system - MythicMobs can be spawned by adding `"specialType": "MythicMobs:<mobName>"` to your entity file. In future, Citizens could also be used here
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.annotations;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import static java.lang.annotation.ElementType.FIELD;
|
||||
import static java.lang.annotation.ElementType.PARAMETER;
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({PARAMETER, TYPE, FIELD})
|
||||
public @interface RegistryListSpecialEntity {
|
||||
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import com.volmit.iris.core.project.loader.IrisRegistrant;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.annotations.ArrayType;
|
||||
import com.volmit.iris.engine.object.annotations.Desc;
|
||||
import com.volmit.iris.engine.object.annotations.RegistryListSpecialEntity;
|
||||
import com.volmit.iris.engine.object.annotations.Required;
|
||||
import com.volmit.iris.engine.object.loot.IrisLoot;
|
||||
import com.volmit.iris.engine.object.loot.IrisLootReference;
|
||||
@@ -150,6 +151,10 @@ public class IrisEntity extends IrisRegistrant {
|
||||
@Desc("The surface type to spawn this mob on")
|
||||
private IrisSurface surface = IrisSurface.LAND;
|
||||
|
||||
@RegistryListSpecialEntity
|
||||
@Desc("Create a mob from another plugin, such as Mythic Mobs. Should be in the format of a namespace of PluginName:MobName")
|
||||
private String specialType = "";
|
||||
|
||||
public Entity spawn(Engine gen, Location at) {
|
||||
return spawn(gen, at, new RNG(at.hashCode()));
|
||||
}
|
||||
@@ -308,6 +313,15 @@ public class IrisEntity extends IrisRegistrant {
|
||||
return ae.get();
|
||||
}
|
||||
|
||||
if (isSpecialType()) {
|
||||
if (specialType.toLowerCase().startsWith("mythicmobs:")) {
|
||||
return Iris.linkMythicMobs.spawnMob(specialType.substring(11), at);
|
||||
} else {
|
||||
Iris.warn("Invalid mob type to spawn: '" + specialType + "'!");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return at.getWorld().spawnEntity(at, getType());
|
||||
}
|
||||
@@ -318,6 +332,10 @@ public class IrisEntity extends IrisRegistrant {
|
||||
// TODO: return Iris.linkCitizens.supported() && someType is not empty;
|
||||
}
|
||||
|
||||
public boolean isSpecialType() {
|
||||
return specialType != null && !specialType.equals("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFolderName() {
|
||||
return "entities";
|
||||
|
||||
Reference in New Issue
Block a user