use of net.minecraftforge.event.LootTableLoadEvent in project blueprint by team-abnormals.
the class LootModificationManager method apply.
@Override
protected void apply(Map<ResourceLocation, JsonElement> map, ResourceManager resourceManager, ProfilerFiller profiler) {
this.reset();
SelectionSpace unmodifiedTables = this.getUnmodifiedEntries();
for (Map.Entry<ResourceLocation, JsonElement> entry : map.entrySet()) {
ResourceLocation resourcelocation = entry.getKey();
if (resourcelocation.getPath().startsWith("_"))
continue;
try {
TargetedModifier<LootTableLoadEvent, Gson, Pair<Gson, PredicateManager>> targetedModifier = TargetedModifier.deserialize(entry.getValue().getAsJsonObject(), Pair.of(GSON, this.lootPredicateManager), LootModifiers.REGISTRY);
this.addModifiers(targetedModifier.getTargetSelector().getTargetNames(unmodifiedTables), targetedModifier.getPriority(), targetedModifier.getConfiguredModifiers());
} catch (IllegalArgumentException | JsonParseException jsonparseexception) {
Blueprint.LOGGER.error("Parsing error loading Loot Modifier: {}", resourcelocation, jsonparseexception);
}
}
Blueprint.LOGGER.info("Loot Modification Manager has assigned {} sets of modifiers", this.size());
}
Aggregations