Search in sources :

Example 66 with Identifier

use of net.minecraft.util.Identifier in project fabric by FabricMC.

the class MixinLootManager method apply.

@Inject(method = "method_20712", at = @At("RETURN"))
private void apply(Map<Identifier, JsonObject> objectMap, ResourceManager manager, Profiler profiler, CallbackInfo info) {
    Map<Identifier, LootSupplier> newSuppliers = new HashMap<>();
    suppliers.forEach((id, supplier) -> {
        FabricLootSupplierBuilder builder = FabricLootSupplierBuilder.of(supplier);
        // noinspection ConstantConditions
        LootTableLoadingCallback.EVENT.invoker().onLootTableLoading(manager, (LootManager) (Object) this, id, builder, (s) -> newSuppliers.put(id, s));
        newSuppliers.computeIfAbsent(id, (i) -> builder.create());
    });
    suppliers = ImmutableMap.copyOf(newSuppliers);
}
Also used : Identifier(net.minecraft.util.Identifier) LootSupplier(net.minecraft.world.loot.LootSupplier) HashMap(java.util.HashMap) FabricLootSupplierBuilder(net.fabricmc.fabric.api.loot.v1.FabricLootSupplierBuilder) JsonObject(com.google.gson.JsonObject) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 67 with Identifier

use of net.minecraft.util.Identifier in project Liminal-Library by LudoCrypt.

the class LimLib method onInitialize.

@Override
public void onInitialize() {
    LiminalSkyRegistry.register(new Identifier("limlib", "regular_sky"), SkyHook.RegularSky.CODEC);
    LiminalSkyRegistry.register(new Identifier("limlib", "skybox_sky"), SkyHook.SkyboxSky.CODEC);
    LiminalShaderRegistry.register(new Identifier("limlib", "simple_shader"), LiminalShader.SimpleShader.CODEC);
    LiminalSoundRegistry.register(new Identifier("limlib", "simple_sound"), LiminalTravelSound.SimpleTravelSound.CODEC);
    LiminalSoundRegistry.register(new Identifier("limlib", "regex_sound"), LiminalTravelSound.RegexTravelSound.CODEC);
}
Also used : Identifier(net.minecraft.util.Identifier)

Example 68 with Identifier

use of net.minecraft.util.Identifier in project frame-fabric by moddingplayground.

the class RecipeProvider method createFileMapAdvancements.

public Map<Identifier, JsonElement> createFileMapAdvancements() {
    Map<Identifier, JsonElement> map = Maps.newHashMap();
    for (Supplier<AbstractRecipeGenerator> generator : this.getGenerators()) {
        AbstractRecipeGenerator gen = generator.get();
        gen.accept((id, factory) -> factory.offerTo(provider -> {
            JsonObject json = provider.toAdvancementJson();
            if (json != null && map.put(id, json) != null)
                throw new IllegalStateException("Duplicate recipe advancement " + id);
        }, id));
        Identifier rootId = gen.getId("root");
        if (!map.containsKey(rootId)) {
            map.put(rootId, Advancement.Builder.create().criterion("impossible", new ImpossibleCriterion.Conditions()).toJson());
        }
    }
    return map;
}
Also used : JsonObject(com.google.gson.JsonObject) DataType(net.moddingplayground.frame.impl.toymaker.DataType) DataCache(net.minecraft.data.DataCache) Maps(com.google.common.collect.Maps) Supplier(java.util.function.Supplier) ImpossibleCriterion(net.minecraft.advancement.criterion.ImpossibleCriterion) JsonElement(com.google.gson.JsonElement) AbstractRecipeGenerator(net.moddingplayground.frame.api.toymaker.v0.generator.recipe.AbstractRecipeGenerator) RecipeGeneratorStore(net.moddingplayground.frame.api.toymaker.v0.registry.generator.RecipeGeneratorStore) Map(java.util.Map) Identifier(net.minecraft.util.Identifier) Advancement(net.minecraft.advancement.Advancement) DataGenerator(net.minecraft.data.DataGenerator) ImpossibleCriterion(net.minecraft.advancement.criterion.ImpossibleCriterion) Identifier(net.minecraft.util.Identifier) JsonElement(com.google.gson.JsonElement) JsonObject(com.google.gson.JsonObject) AbstractRecipeGenerator(net.moddingplayground.frame.api.toymaker.v0.generator.recipe.AbstractRecipeGenerator)

Example 69 with Identifier

use of net.minecraft.util.Identifier in project frame-fabric by moddingplayground.

the class AbstractTagGenerator method getId.

public Identifier getId(Identifier id) {
    String format = this.getFormat();
    RegistryKey<? extends Registry<T>> key = this.registry.getKey();
    Identifier reg = key.getValue();
    return new Identifier(id.getNamespace(), format.formatted(reg.getPath(), id.getPath()));
}
Also used : Identifier(net.minecraft.util.Identifier)

Example 70 with Identifier

use of net.minecraft.util.Identifier in project frame-fabric by moddingplayground.

the class AbstractModelGenerator method name.

public Identifier name(T object, String nameFormat, String pattern, String reformat) {
    Identifier id = this.getRegistry().getId(object);
    String path = id.getPath();
    path = path.replaceAll(pattern, reformat);
    return new Identifier(id.getNamespace(), String.format(nameFormat, path));
}
Also used : Identifier(net.minecraft.util.Identifier)

Aggregations

Identifier (net.minecraft.util.Identifier)343 NbtList (net.minecraft.nbt.NbtList)36 ItemStack (net.minecraft.item.ItemStack)31 Item (net.minecraft.item.Item)28 NbtCompound (net.minecraft.nbt.NbtCompound)22 NbtElement (net.minecraft.nbt.NbtElement)22 Inject (org.spongepowered.asm.mixin.injection.Inject)22 IOException (java.io.IOException)18 Block (net.minecraft.block.Block)18 MinecraftClient (net.minecraft.client.MinecraftClient)15 BlockItem (net.minecraft.item.BlockItem)15 BlockPos (net.minecraft.util.math.BlockPos)15 Map (java.util.Map)12 BlockState (net.minecraft.block.BlockState)12 ArrayList (java.util.ArrayList)11 VertexConsumer (net.minecraft.client.render.VertexConsumer)11 ResourceManager (net.minecraft.resource.ResourceManager)11 SoundEvent (net.minecraft.sound.SoundEvent)11 ServerPlayerEntity (net.minecraft.server.network.ServerPlayerEntity)10 LiteralText (net.minecraft.text.LiteralText)10