Fix for 1.14.1

This commit is contained in:
Brianna 2019-05-16 01:32:04 -04:00
parent cd4ab8002b
commit 95fae5f3a5
3 changed files with 10 additions and 6 deletions

View File

@ -4,7 +4,7 @@ stages:
variables:
name: "EpicSpawners"
path: "/builds/$CI_PROJECT_PATH"
version: "5.9.5"
version: "5.9.6"
build:
stage: build

View File

@ -45,7 +45,7 @@ public class SpawnOptionEntity implements SpawnOption {
private Map<String, Integer> cache = new HashMap<>();
private Class<?> clazzMobSpawnerData, clazzEnumMobSpawn, clazzWorldServer, clazzGeneratorAccess, clazzEntityTypes, clazzNBTTagCompound, clazzCraftWorld, clazzWorld, clazzChunkRegionLoader, clazzEntity, clazzCraftEntity, clazzEntityInsentient, clazzGroupDataEntity, clazzDifficultyDamageScaler, clazzBlockPosition, clazzIWorldReader, clazzAxisAlignedBB;
private Method methodB, methodSetString, methodSetPosition, methodA, methodAddEntity, methodGetHandle, methodChunkRegionLoaderA, methodEntityGetBukkitEntity, methodCraftEntityTeleport, methodEntityInsentientPrepare, methodChunkRegionLoaderA2, methodGetDamageScaler, methodGetCubes, methodGetBoundingBox;
private Method methodGetEntity, methodSetString, methodSetPosition, methodA, methodAddEntity, methodGetHandle, methodChunkRegionLoaderA, methodEntityGetBukkitEntity, methodCraftEntityTeleport, methodEntityInsentientPrepare, methodChunkRegionLoaderA2, methodGetDamageScaler, methodGetCubes, methodGetBoundingBox;
private Field fieldWorldRandom;
public SpawnOptionEntity(EntityType... types) {
@ -80,7 +80,11 @@ public class SpawnOptionEntity implements SpawnOption {
clazzIWorldReader = Class.forName("net.minecraft.server." + ver + ".IWorldReader");
clazzGeneratorAccess = Class.forName("net.minecraft.server." + ver + ".GeneratorAccess");
methodB = clazzMobSpawnerData.getDeclaredMethod("b");
try {
methodGetEntity = clazzMobSpawnerData.getDeclaredMethod("getEntity");
} catch (NoSuchMethodException e) {
methodGetEntity = clazzMobSpawnerData.getDeclaredMethod("b");
}
methodSetString = clazzNBTTagCompound.getDeclaredMethod("setString", String.class, String.class);
methodGetBoundingBox = clazzEntity.getDeclaredMethod("getBoundingBox");
@ -175,14 +179,14 @@ public class SpawnOptionEntity implements SpawnOption {
private void spawnEntity(EntityType type, Spawner spawner, SpawnerData data) {
try {
Object objMobSpawnerData = clazzMobSpawnerData.newInstance();
Object objNTBTagCompound = methodB.invoke(objMobSpawnerData);
Object objNTBTagCompound = methodGetEntity.invoke(objMobSpawnerData);
String name = type.name().toLowerCase().replace("pig_zombie", "zombie_pigman").replace("snowman", "snow_golem").replace("mushroom_cow", "mooshroom");
methodSetString.invoke(objNTBTagCompound, "id", "minecraft:" + name);
short spawnRange = 4;
for (int i = 0; i < 25; i++) {
Object objNBTTagCompound = methodB.invoke(objMobSpawnerData);
Object objNBTTagCompound = methodGetEntity.invoke(objMobSpawnerData);
Object objCraftWorld = clazzCraftWorld.cast(spawner.getWorld());
objCraftWorld = methodGetHandle.invoke(objCraftWorld);
Object objWorld = clazzWorld.cast(objCraftWorld);

View File

@ -16,7 +16,7 @@
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.14-pre5-2</version>
<version>1.14.1</version>
<scope>provided</scope>
</dependency>
<dependency>