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);
}
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();
}
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;
}
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();
}
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();
}
Aggregations