Search in sources :

Example 1 with RegistryID

use of net.minecraft.server.v1_12_R1.RegistryID in project MyPet by xXKeyleXx.

the class EntityRegistry method unregisterEntityTypes.

@Override
@SuppressWarnings("unchecked")
public void unregisterEntityTypes() {
    RegistryMaterials registry = getRegistry();
    RegistryID registryID = (RegistryID) ReflectionUtil.getFieldValue(RegistryMaterials_a, registry);
    Object[] entityClasses = (Object[]) ReflectionUtil.getFieldValue(RegistryID_b, registryID);
    int[] entityIDs = (int[]) ReflectionUtil.getFieldValue(RegistryID_c, registryID);
    if (entityClasses != null && entityIDs != null) {
        for (int i = 0; i < entityClasses.length; i++) {
            if (entityClasses[i] != null) {
                if (EntityMyPet.class.isAssignableFrom((Class<?>) entityClasses[i])) {
                    entityClasses[i] = null;
                    entityIDs[i] = 0;
                }
            }
        }
    }
}
Also used : RegistryMaterials(net.minecraft.server.v1_11_R1.RegistryMaterials) RegistryID(net.minecraft.server.v1_11_R1.RegistryID)

Example 2 with RegistryID

use of net.minecraft.server.v1_12_R1.RegistryID in project MyPet by xXKeyleXx.

the class EntityRegistry method backupRegistryID.

protected Object[] backupRegistryID(RegistryMaterials registry) {
    RegistryID a = (RegistryID) ReflectionUtil.getFieldValue(RegistryMaterials_a, registry);
    Object[] d = (Object[]) ReflectionUtil.getFieldValue(RegistryID_d, a);
    return Arrays.copyOf(d, d.length);
}
Also used : RegistryID(net.minecraft.server.v1_11_R1.RegistryID)

Example 3 with RegistryID

use of net.minecraft.server.v1_12_R1.RegistryID in project MyPet by xXKeyleXx.

the class EntityRegistry method restoreRegistryID.

protected void restoreRegistryID(RegistryMaterials registry, Object[] backup) {
    RegistryID a = (RegistryID) ReflectionUtil.getFieldValue(RegistryMaterials_a, registry);
    Object[] d = (Object[]) ReflectionUtil.getFieldValue(RegistryID_d, a);
    if (d != null) {
        for (int i = 0; i < backup.length; i++) {
            if (backup[i] != null) {
                d[i] = backup[i];
            }
        }
    }
}
Also used : RegistryID(net.minecraft.server.v1_11_R1.RegistryID)

Example 4 with RegistryID

use of net.minecraft.server.v1_12_R1.RegistryID in project MyPet by xXKeyleXx.

the class EntityRegistry method backupRegistryID.

protected Object[] backupRegistryID(RegistryMaterials registry) {
    RegistryID a = (RegistryID) ReflectionUtil.getFieldValue(RegistryMaterials_a, registry);
    Object[] d = (Object[]) ReflectionUtil.getFieldValue(RegistryID_d, a);
    return Arrays.copyOf(d, d.length);
}
Also used : RegistryID(net.minecraft.server.v1_12_R1.RegistryID)

Example 5 with RegistryID

use of net.minecraft.server.v1_12_R1.RegistryID in project MyPet by xXKeyleXx.

the class EntityRegistry method unregisterEntityTypes.

@Override
@SuppressWarnings("unchecked")
public void unregisterEntityTypes() {
    RegistryMaterials registry = getRegistry();
    RegistryID registryID = (RegistryID) ReflectionUtil.getFieldValue(RegistryMaterials_a, registry);
    Object[] entityClasses = (Object[]) ReflectionUtil.getFieldValue(RegistryID_b, registryID);
    int[] entityIDs = (int[]) ReflectionUtil.getFieldValue(RegistryID_c, registryID);
    if (entityClasses != null && entityIDs != null) {
        for (int i = 0; i < entityClasses.length; i++) {
            if (entityClasses[i] != null) {
                if (EntityMyPet.class.isAssignableFrom((Class<?>) entityClasses[i])) {
                    entityClasses[i] = null;
                    entityIDs[i] = 0;
                }
            }
        }
    }
}
Also used : RegistryMaterials(net.minecraft.server.v1_12_R1.RegistryMaterials) RegistryID(net.minecraft.server.v1_12_R1.RegistryID)

Aggregations

RegistryID (net.minecraft.server.v1_11_R1.RegistryID)3 RegistryID (net.minecraft.server.v1_12_R1.RegistryID)3 RegistryMaterials (net.minecraft.server.v1_11_R1.RegistryMaterials)1 RegistryMaterials (net.minecraft.server.v1_12_R1.RegistryMaterials)1