Search in sources :

Example 6 with RegistryMaterials

use of net.minecraft.server.v1_11_R1.RegistryMaterials in project MyPet by xXKeyleXx.

the class EntityRegistry method registerEntityTypes.

@Override
@SuppressWarnings("unchecked")
public void registerEntityTypes() {
    RegistryMaterials registry = getRegistry();
    Object[] backup = backupRegistryID(registry);
    for (MyPetType type : entityClasses.keySet()) {
        try {
            registry.a(type.getTypeID(), null, entityClasses.get(type));
        } catch (NullPointerException ignored) {
        // NPE means that the entity was registered successfully but the key was not
        }
    }
    restoreRegistryID(registry, backup);
}
Also used : RegistryMaterials(net.minecraft.server.v1_12_R1.RegistryMaterials) MyPetType(de.Keyle.MyPet.api.entity.MyPetType)

Aggregations

RegistryID (net.minecraft.server.v1_11_R1.RegistryID)3 MyPetType (de.Keyle.MyPet.api.entity.MyPetType)2 RegistryMaterials (net.minecraft.server.v1_11_R1.RegistryMaterials)2 RegistryMaterials (net.minecraft.server.v1_12_R1.RegistryMaterials)2 RegistryID (net.minecraft.server.v1_12_R1.RegistryID)1