Example usage for net.minecraftforge.registries ForgeRegistries ENTITIES

List of usage examples for net.minecraftforge.registries ForgeRegistries ENTITIES

Introduction

In this page you can find the example usage for net.minecraftforge.registries ForgeRegistries ENTITIES.

Prototype

IForgeRegistry ENTITIES

To view the source code for net.minecraftforge.registries ForgeRegistries ENTITIES.

Click Source Link

Usage

From source file:com.teambrmodding.assistedprogression.common.item.SpawnerRelocatorItem.java

License:Creative Commons License

@OnlyIn(Dist.CLIENT)
@Override/*from  www .j a  v a  2s  . c  om*/
public void addInformation(ItemStack stack, @Nullable World world, List<ITextComponent> tooltip,
        ITooltipFlag advanced) {
    if (stack.hasTag()) {
        CompoundNBT compoundNBT = stack.getTag();
        CompoundNBT spawnData = compoundNBT.getCompound("SpawnData");
        EntityType entity = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(spawnData.getString("id")));
        String spawnType = I18n.format(entity.getName().getUnformattedComponentText());

        tooltip.add(new StringTextComponent(I18n.format("assistedprogression.text.spawnerRelocator.type",
                ChatFormatting.GOLD, ChatFormatting.ITALIC, spawnType)));
    }
    super.addInformation(stack, world, tooltip, advanced);
}