Search in sources :

Example 1 with ColonyEventDescriptionTypeRegistryEntry

use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry in project minecolonies by Minecolonies.

the class CommonMinecoloniesAPIImpl method onRegistryNewRegistry.

public void onRegistryNewRegistry(final RegistryEvent.NewRegistry event) {
    buildingRegistry = new RegistryBuilder<BuildingEntry>().setName(new ResourceLocation(Constants.MOD_ID, "buildings")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(BuildingEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    jobRegistry = new RegistryBuilder<JobEntry>().setName(new ResourceLocation(Constants.MOD_ID, "jobs")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(JobEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    guardTypeRegistry = new RegistryBuilder<GuardType>().setName(new ResourceLocation(Constants.MOD_ID, "guardtypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setDefaultKey(ModGuardTypes.KNIGHT_ID).setType(GuardType.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    interactionHandlerRegistry = new RegistryBuilder<InteractionResponseHandlerEntry>().setName(new ResourceLocation(Constants.MOD_ID, "interactionresponsehandlers")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(InteractionResponseHandlerEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    colonyEventRegistry = new RegistryBuilder<ColonyEventTypeRegistryEntry>().setName(new ResourceLocation(Constants.MOD_ID, "colonyeventtypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(ColonyEventTypeRegistryEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    colonyEventDescriptionRegistry = new RegistryBuilder<ColonyEventDescriptionTypeRegistryEntry>().setName(new ResourceLocation(Constants.MOD_ID, "colonyeventdesctypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(ColonyEventDescriptionTypeRegistryEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    recipeTypeEntryRegistry = new RegistryBuilder<RecipeTypeEntry>().setName(new ResourceLocation(Constants.MOD_ID, "recipetypeentries")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "classic")).disableSaving().allowModification().setType(RecipeTypeEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    researchRequirementRegistry = new RegistryBuilder<ResearchRequirementEntry>().setName(new ResourceLocation(Constants.MOD_ID, "researchrequirementtypes")).setDefaultKey(RESEARCH_RESEARCH_REQ_ID).disableSaving().allowModification().setType(ResearchRequirementEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    researchEffectRegistry = new RegistryBuilder<ResearchEffectEntry>().setName(new ResourceLocation(Constants.MOD_ID, "researcheffecttypes")).setDefaultKey(GLOBAL_EFFECT_ID).disableSaving().allowModification().setType(ResearchEffectEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) ColonyEventDescriptionTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry) ResearchEffectEntry(com.minecolonies.api.research.effects.registry.ResearchEffectEntry) InteractionResponseHandlerEntry(com.minecolonies.api.colony.interactionhandling.registry.InteractionResponseHandlerEntry) RecipeTypeEntry(com.minecolonies.api.crafting.registry.RecipeTypeEntry) BuildingEntry(com.minecolonies.api.colony.buildings.registry.BuildingEntry) ResourceLocation(net.minecraft.util.ResourceLocation) RegistryBuilder(net.minecraftforge.registries.RegistryBuilder) GuardType(com.minecolonies.api.colony.guardtype.GuardType) ColonyEventTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry) ResearchRequirementEntry(com.minecolonies.api.research.registry.ResearchRequirementEntry)

Example 2 with ColonyEventDescriptionTypeRegistryEntry

use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry in project minecolonies by Minecolonies.

the class EventDescriptionManager method deserializeNBT.

@Override
public void deserializeNBT(@NotNull final CompoundNBT eventManagerNBT) {
    final ListNBT eventDescListNBT = eventManagerNBT.getList(TAG_EVENT_DESC_LIST, Constants.NBT.TAG_COMPOUND);
    for (final INBT event : eventDescListNBT) {
        final CompoundNBT eventCompound = (CompoundNBT) event;
        final ResourceLocation eventTypeID = new ResourceLocation(MOD_ID, eventCompound.getString(TAG_NAME));
        final ColonyEventDescriptionTypeRegistryEntry registryEntry = MinecoloniesAPIProxy.getInstance().getColonyEventDescriptionRegistry().getValue(eventTypeID);
        if (registryEntry == null) {
            Log.getLogger().warn("Event is missing registryEntry!:" + eventTypeID.getPath());
            continue;
        }
        final IColonyEventDescription eventDescription = registryEntry.deserializeEventDescriptionFromNBT(eventCompound);
        eventDescs.add(eventDescription);
    }
}
Also used : ColonyEventDescriptionTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry) ListNBT(net.minecraft.nbt.ListNBT) IColonyEventDescription(com.minecolonies.api.colony.colonyEvents.descriptions.IColonyEventDescription) CompoundNBT(net.minecraft.nbt.CompoundNBT) INBT(net.minecraft.nbt.INBT) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 3 with ColonyEventDescriptionTypeRegistryEntry

use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry in project minecolonies by ldtteam.

the class EventDescriptionManager method deserializeNBT.

@Override
public void deserializeNBT(@NotNull final CompoundNBT eventManagerNBT) {
    final ListNBT eventDescListNBT = eventManagerNBT.getList(TAG_EVENT_DESC_LIST, Constants.NBT.TAG_COMPOUND);
    for (final INBT event : eventDescListNBT) {
        final CompoundNBT eventCompound = (CompoundNBT) event;
        final ResourceLocation eventTypeID = new ResourceLocation(MOD_ID, eventCompound.getString(TAG_NAME));
        final ColonyEventDescriptionTypeRegistryEntry registryEntry = MinecoloniesAPIProxy.getInstance().getColonyEventDescriptionRegistry().getValue(eventTypeID);
        if (registryEntry == null) {
            Log.getLogger().warn("Event is missing registryEntry!:" + eventTypeID.getPath());
            continue;
        }
        final IColonyEventDescription eventDescription = registryEntry.deserializeEventDescriptionFromNBT(eventCompound);
        eventDescs.add(eventDescription);
    }
}
Also used : ColonyEventDescriptionTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry) ListNBT(net.minecraft.nbt.ListNBT) IColonyEventDescription(com.minecolonies.api.colony.colonyEvents.descriptions.IColonyEventDescription) CompoundNBT(net.minecraft.nbt.CompoundNBT) INBT(net.minecraft.nbt.INBT) ResourceLocation(net.minecraft.util.ResourceLocation)

Example 4 with ColonyEventDescriptionTypeRegistryEntry

use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry in project minecolonies by ldtteam.

the class ModColonyEventDescriptionTypeInitializer method init.

public static void init(final RegistryEvent.Register<ColonyEventDescriptionTypeRegistryEntry> event) {
    final IForgeRegistry<ColonyEventDescriptionTypeRegistryEntry> reg = event.getRegistry();
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(CitizenBornEvent::loadFromNBT, CitizenBornEvent::loadFromPacketBuffer, CitizenBornEvent.CITIZEN_BORN_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(CitizenSpawnedEvent::loadFromNBT, CitizenSpawnedEvent::loadFromPacketBuffer, CitizenSpawnedEvent.CITIZEN_SPAWNED_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(VisitorSpawnedEvent::loadFromNBT, VisitorSpawnedEvent::loadFromPacketBuffer, VisitorSpawnedEvent.VISITOR_SPAWNED_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(CitizenDiedEvent::loadFromNBT, CitizenDiedEvent::loadFromPacketBuffer, CitizenDiedEvent.CITIZEN_DIED_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(CitizenGrownUpEvent::loadFromNBT, CitizenGrownUpEvent::loadFromPacketBuffer, CitizenGrownUpEvent.CITIZEN_GROWN_UP_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(BuildingBuiltEvent::loadFromNBT, BuildingBuiltEvent::loadFromPacketBuffer, BuildingBuiltEvent.BUILDING_BUILT_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(BuildingUpgradedEvent::loadFromNBT, BuildingUpgradedEvent::loadFromPacketBuffer, BuildingUpgradedEvent.BUILDING_UPGRADED_EVENT_ID));
    reg.register(new ColonyEventDescriptionTypeRegistryEntry(BuildingDeconstructedEvent::loadFromNBT, BuildingDeconstructedEvent::loadFromPacketBuffer, BuildingDeconstructedEvent.BUILDING_DECONSTRUCTED_EVENT_ID));
}
Also used : ColonyEventDescriptionTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry)

Example 5 with ColonyEventDescriptionTypeRegistryEntry

use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry in project minecolonies by ldtteam.

the class CommonMinecoloniesAPIImpl method onRegistryNewRegistry.

public void onRegistryNewRegistry(final RegistryEvent.NewRegistry event) {
    buildingRegistry = new RegistryBuilder<BuildingEntry>().setName(new ResourceLocation(Constants.MOD_ID, "buildings")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(BuildingEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    jobRegistry = new RegistryBuilder<JobEntry>().setName(new ResourceLocation(Constants.MOD_ID, "jobs")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(JobEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    guardTypeRegistry = new RegistryBuilder<GuardType>().setName(new ResourceLocation(Constants.MOD_ID, "guardtypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setDefaultKey(ModGuardTypes.KNIGHT_ID).setType(GuardType.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    interactionHandlerRegistry = new RegistryBuilder<InteractionResponseHandlerEntry>().setName(new ResourceLocation(Constants.MOD_ID, "interactionresponsehandlers")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(InteractionResponseHandlerEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    colonyEventRegistry = new RegistryBuilder<ColonyEventTypeRegistryEntry>().setName(new ResourceLocation(Constants.MOD_ID, "colonyeventtypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(ColonyEventTypeRegistryEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    colonyEventDescriptionRegistry = new RegistryBuilder<ColonyEventDescriptionTypeRegistryEntry>().setName(new ResourceLocation(Constants.MOD_ID, "colonyeventdesctypes")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "null")).disableSaving().allowModification().setType(ColonyEventDescriptionTypeRegistryEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    recipeTypeEntryRegistry = new RegistryBuilder<RecipeTypeEntry>().setName(new ResourceLocation(Constants.MOD_ID, "recipetypeentries")).setDefaultKey(new ResourceLocation(Constants.MOD_ID, "classic")).disableSaving().allowModification().setType(RecipeTypeEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    researchRequirementRegistry = new RegistryBuilder<ResearchRequirementEntry>().setName(new ResourceLocation(Constants.MOD_ID, "researchrequirementtypes")).setDefaultKey(RESEARCH_RESEARCH_REQ_ID).disableSaving().allowModification().setType(ResearchRequirementEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
    researchEffectRegistry = new RegistryBuilder<ResearchEffectEntry>().setName(new ResourceLocation(Constants.MOD_ID, "researcheffecttypes")).setDefaultKey(GLOBAL_EFFECT_ID).disableSaving().allowModification().setType(ResearchEffectEntry.class).setIDRange(0, Integer.MAX_VALUE - 1).create();
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) ColonyEventDescriptionTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry) ResearchEffectEntry(com.minecolonies.api.research.effects.registry.ResearchEffectEntry) InteractionResponseHandlerEntry(com.minecolonies.api.colony.interactionhandling.registry.InteractionResponseHandlerEntry) RecipeTypeEntry(com.minecolonies.api.crafting.registry.RecipeTypeEntry) BuildingEntry(com.minecolonies.api.colony.buildings.registry.BuildingEntry) ResourceLocation(net.minecraft.util.ResourceLocation) RegistryBuilder(net.minecraftforge.registries.RegistryBuilder) GuardType(com.minecolonies.api.colony.guardtype.GuardType) ColonyEventTypeRegistryEntry(com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry) ResearchRequirementEntry(com.minecolonies.api.research.registry.ResearchRequirementEntry)

Aggregations

ColonyEventDescriptionTypeRegistryEntry (com.minecolonies.api.colony.colonyEvents.registry.ColonyEventDescriptionTypeRegistryEntry)6 ResourceLocation (net.minecraft.util.ResourceLocation)4 BuildingEntry (com.minecolonies.api.colony.buildings.registry.BuildingEntry)2 IColonyEventDescription (com.minecolonies.api.colony.colonyEvents.descriptions.IColonyEventDescription)2 ColonyEventTypeRegistryEntry (com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry)2 GuardType (com.minecolonies.api.colony.guardtype.GuardType)2 InteractionResponseHandlerEntry (com.minecolonies.api.colony.interactionhandling.registry.InteractionResponseHandlerEntry)2 JobEntry (com.minecolonies.api.colony.jobs.registry.JobEntry)2 RecipeTypeEntry (com.minecolonies.api.crafting.registry.RecipeTypeEntry)2 ResearchEffectEntry (com.minecolonies.api.research.effects.registry.ResearchEffectEntry)2 ResearchRequirementEntry (com.minecolonies.api.research.registry.ResearchRequirementEntry)2 CompoundNBT (net.minecraft.nbt.CompoundNBT)2 INBT (net.minecraft.nbt.INBT)2 ListNBT (net.minecraft.nbt.ListNBT)2 RegistryBuilder (net.minecraftforge.registries.RegistryBuilder)2