Search in sources :

Example 91 with Identifier

use of net.minecraft.util.Identifier in project MCDungeonsWeapons by chronosacaria.

the class McdwClient method registerBowPredicates.

public static void registerBowPredicates(McdwBow bow) {
    FabricModelPredicateProviderRegistry.register(bow, new Identifier("pull"), (itemStack, clientWorld, livingEntity) -> {
        if (livingEntity == null) {
            return 0.0F;
        } else {
            return livingEntity.getActiveItem() != itemStack ? 0.0F : (float) (itemStack.getMaxUseTime() - livingEntity.getItemUseTimeLeft()) / bow.getMaxDrawTime();
        }
    });
    FabricModelPredicateProviderRegistry.register(bow, new Identifier("pulling"), (itemStack, clientWorld, livingEntity) -> livingEntity != null && livingEntity.isUsingItem() && livingEntity.getActiveItem() == itemStack ? 1.0F : 0.0F);
}
Also used : Identifier(net.minecraft.util.Identifier)

Example 92 with Identifier

use of net.minecraft.util.Identifier in project meteor-client by MeteorDevelopment.

the class BlockListSetting method load.

@Override
protected List<Block> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        Block block = Registry.BLOCK.get(new Identifier(tagI.asString()));
        if (filter == null || filter.test(block))
            get().add(block);
    }
    return get();
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) Block(net.minecraft.block.Block) NbtElement(net.minecraft.nbt.NbtElement)

Example 93 with Identifier

use of net.minecraft.util.Identifier in project meteor-client by MeteorDevelopment.

the class EnchantmentListSetting method save.

@Override
public NbtCompound save(NbtCompound tag) {
    NbtList valueTag = new NbtList();
    for (Enchantment ench : get()) {
        Identifier id = Registry.ENCHANTMENT.getId(ench);
        if (id != null)
            valueTag.add(NbtString.of(id.toString()));
    }
    tag.put("value", valueTag);
    return tag;
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) Enchantment(net.minecraft.enchantment.Enchantment)

Example 94 with Identifier

use of net.minecraft.util.Identifier in project meteor-client by MeteorDevelopment.

the class EnchantmentListSetting method load.

@Override
public List<Enchantment> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        Enchantment enchantment = Registry.ENCHANTMENT.get(new Identifier(tagI.asString()));
        if (enchantment != null)
            get().add(enchantment);
    }
    return get();
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement) Enchantment(net.minecraft.enchantment.Enchantment)

Example 95 with Identifier

use of net.minecraft.util.Identifier in project meteor-client by MeteorDevelopment.

the class EntityTypeListSetting method load.

@Override
public Object2BooleanMap<EntityType<?>> load(NbtCompound tag) {
    get().clear();
    NbtList valueTag = tag.getList("value", 8);
    for (NbtElement tagI : valueTag) {
        EntityType<?> type = Registry.ENTITY_TYPE.get(new Identifier(tagI.asString()));
        if (!onlyAttackable || EntityUtils.isAttackable(type))
            get().put(type, true);
    }
    return get();
}
Also used : Identifier(net.minecraft.util.Identifier) NbtList(net.minecraft.nbt.NbtList) NbtElement(net.minecraft.nbt.NbtElement)

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