use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry in project minecolonies by Minecolonies.
the class CommandRaidAll method build.
@Override
public LiteralArgumentBuilder<CommandSource> build() {
final List<String> raidTypes = new ArrayList<>();
for (final ColonyEventTypeRegistryEntry type : IMinecoloniesAPI.getInstance().getColonyEventRegistry().getValues()) {
if (!type.getRegistryName().getPath().equals(PirateGroundRaidEvent.PIRATE_GROUND_RAID_EVENT_TYPE_ID.getPath()) && !type.getRegistryName().getPath().equals(NorsemenShipRaidEvent.NORSEMEN_RAID_EVENT_TYPE_ID.getPath())) {
raidTypes.add(type.getRegistryName().getPath());
}
}
String[] opt = new String[2];
opt[0] = RAID_NOW;
opt[1] = RAID_TONIGHT;
return IMCCommand.newLiteral(getName()).then(IMCCommand.newArgument(RAID_TIME_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(opt, builder)).then(IMCCommand.newArgument(RAID_TYPE_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(raidTypes, builder)).executes(this::onSpecificExecute)).executes(this::checkPreConditionAndExecute));
}
use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry in project minecolonies by Minecolonies.
the class EventManager method readFromNBT.
@Override
public void readFromNBT(@NotNull final CompoundNBT compound) {
if (compound.contains(TAG_EVENT_MANAGER)) {
final CompoundNBT eventManagerNBT = compound.getCompound(TAG_EVENT_MANAGER);
final ListNBT eventListNBT = eventManagerNBT.getList(TAG_EVENT_LIST, Constants.NBT.TAG_COMPOUND);
for (final INBT base : eventListNBT) {
final CompoundNBT tagCompound = (CompoundNBT) base;
final ResourceLocation eventTypeID = new ResourceLocation(MOD_ID, tagCompound.getString(TAG_NAME));
final ColonyEventTypeRegistryEntry registryEntry = MinecoloniesAPIProxy.getInstance().getColonyEventRegistry().getValue(eventTypeID);
if (registryEntry == null) {
Log.getLogger().warn("Event is missing registryEntry!:" + eventTypeID.getPath());
continue;
}
final IColonyEvent colonyEvent = registryEntry.deserializeEvent(colony, tagCompound);
events.put(colonyEvent.getID(), colonyEvent);
}
currentEventID = eventManagerNBT.getInt(TAG_EVENT_ID);
structureManager.readFromNBT(compound);
}
}
use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry in project minecolonies by Minecolonies.
the class ModColonyEventTypeInitializer method init.
public static void init(final RegistryEvent.Register<ColonyEventTypeRegistryEntry> event) {
final IForgeRegistry<ColonyEventTypeRegistryEntry> reg = event.getRegistry();
reg.register(new ColonyEventTypeRegistryEntry(PirateRaidEvent::loadFromNBT, PirateRaidEvent.PIRATE_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(BarbarianRaidEvent::loadFromNBT, BarbarianRaidEvent.BARBARIAN_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(EgyptianRaidEvent::loadFromNBT, EgyptianRaidEvent.EGYPTIAN_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(AmazonRaidEvent::loadFromNBT, AmazonRaidEvent.AMAZON_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(NorsemenRaidEvent::loadFromNBT, NorsemenRaidEvent.NORSEMEN_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(NorsemenShipRaidEvent::loadFromNBT, NorsemenShipRaidEvent.NORSEMEN_RAID_EVENT_TYPE_ID));
reg.register(new ColonyEventTypeRegistryEntry(PirateGroundRaidEvent::loadFromNBT, PirateGroundRaidEvent.PIRATE_GROUND_RAID_EVENT_TYPE_ID));
}
use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry in project minecolonies by Minecolonies.
the class CommandRaid method build.
@Override
public LiteralArgumentBuilder<CommandSource> build() {
final List<String> raidTypes = new ArrayList<>();
for (final ColonyEventTypeRegistryEntry type : IMinecoloniesAPI.getInstance().getColonyEventRegistry().getValues()) {
if (!type.getRegistryName().getPath().equals(PirateGroundRaidEvent.PIRATE_GROUND_RAID_EVENT_TYPE_ID.getPath()) && !type.getRegistryName().getPath().equals(NorsemenShipRaidEvent.NORSEMEN_RAID_EVENT_TYPE_ID.getPath())) {
raidTypes.add(type.getRegistryName().getPath());
}
}
String[] opt = new String[2];
opt[0] = RAID_NOW;
opt[1] = RAID_TONIGHT;
return IMCCommand.newLiteral(getName()).then(IMCCommand.newArgument(RAID_TIME_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(opt, builder)).then(IMCCommand.newArgument(COLONYID_ARG, IntegerArgumentType.integer(1)).then(IMCCommand.newArgument(RAID_TYPE_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(raidTypes, builder)).executes(this::onSpecificExecute)).executes(this::checkPreConditionAndExecute)));
}
use of com.minecolonies.api.colony.colonyEvents.registry.ColonyEventTypeRegistryEntry in project minecolonies by ldtteam.
the class CommandRaid method build.
@Override
public LiteralArgumentBuilder<CommandSource> build() {
final List<String> raidTypes = new ArrayList<>();
for (final ColonyEventTypeRegistryEntry type : IMinecoloniesAPI.getInstance().getColonyEventRegistry().getValues()) {
if (!type.getRegistryName().getPath().equals(PirateGroundRaidEvent.PIRATE_GROUND_RAID_EVENT_TYPE_ID.getPath()) && !type.getRegistryName().getPath().equals(NorsemenShipRaidEvent.NORSEMEN_RAID_EVENT_TYPE_ID.getPath())) {
raidTypes.add(type.getRegistryName().getPath());
}
}
String[] opt = new String[2];
opt[0] = RAID_NOW;
opt[1] = RAID_TONIGHT;
return IMCCommand.newLiteral(getName()).then(IMCCommand.newArgument(RAID_TIME_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(opt, builder)).then(IMCCommand.newArgument(COLONYID_ARG, IntegerArgumentType.integer(1)).then(IMCCommand.newArgument(RAID_TYPE_ARG, StringArgumentType.string()).suggests((ctx, builder) -> ISuggestionProvider.suggest(raidTypes, builder)).executes(this::onSpecificExecute)).executes(this::checkPreConditionAndExecute)));
}
Aggregations