Search in sources :

Example 1 with IGraveData

use of com.minecolonies.api.colony.IGraveData in project minecolonies by Minecolonies.

the class ColonyDeathpoints method tryCreatingWaypoint.

@Nullable
private static Waypoint tryCreatingWaypoint(@NotNull final Journeymap jmap, @NotNull final IColonyView colony, @NotNull final IChunk chunk, @NotNull final BlockPos pos) {
    if (!jmap.getApi().playerAccepts(MOD_ID, DisplayType.Waypoint))
        return null;
    final TileEntity blockEntity = chunk.getBlockEntity(pos);
    if (blockEntity instanceof AbstractTileEntityGrave) {
        final IGraveData grave = ((AbstractTileEntityGrave) blockEntity).getGraveData();
        if (grave != null) {
            final String text = grave.getCitizenJobName() == null ? LanguageHandler.format(COM_MINECOLONIES_JMAP_PREFIX + "deathpoint_name", grave.getCitizenName()) : LanguageHandler.format(COM_MINECOLONIES_JMAP_PREFIX + "deathpoint_namejob", grave.getCitizenName(), grave.getCitizenJobName());
            final Waypoint waypoint = new Waypoint(MOD_ID, text, colony.getDimension(), pos);
            waypoint.setEditable(true).setPersistent(false).setIcon(deathIcon.get()).setColor(0x888888);
            jmap.show(waypoint);
            return waypoint;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) Waypoint(journeymap.client.api.display.Waypoint) IGraveData(com.minecolonies.api.colony.IGraveData) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with IGraveData

use of com.minecolonies.api.colony.IGraveData in project minecolonies by ldtteam.

the class ColonyDeathpoints method tryCreatingWaypoint.

@Nullable
private static Waypoint tryCreatingWaypoint(@NotNull final Journeymap jmap, @NotNull final IColonyView colony, @NotNull final IChunk chunk, @NotNull final BlockPos pos) {
    if (!jmap.getApi().playerAccepts(MOD_ID, DisplayType.Waypoint))
        return null;
    final TileEntity blockEntity = chunk.getBlockEntity(pos);
    if (blockEntity instanceof AbstractTileEntityGrave) {
        final IGraveData grave = ((AbstractTileEntityGrave) blockEntity).getGraveData();
        if (grave != null) {
            final String text = grave.getCitizenJobName() == null ? LanguageHandler.format(COM_MINECOLONIES_JMAP_PREFIX + "deathpoint_name", grave.getCitizenName()) : LanguageHandler.format(COM_MINECOLONIES_JMAP_PREFIX + "deathpoint_namejob", grave.getCitizenName(), grave.getCitizenJobName());
            final Waypoint waypoint = new Waypoint(MOD_ID, text, colony.getDimension(), pos);
            waypoint.setEditable(true).setPersistent(false).setIcon(deathIcon.get()).setColor(0x888888);
            jmap.show(waypoint);
            return waypoint;
        }
    }
    return null;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) Waypoint(journeymap.client.api.display.Waypoint) IGraveData(com.minecolonies.api.colony.IGraveData) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

IGraveData (com.minecolonies.api.colony.IGraveData)2 AbstractTileEntityGrave (com.minecolonies.api.tileentities.AbstractTileEntityGrave)2 Waypoint (journeymap.client.api.display.Waypoint)2 TileEntity (net.minecraft.tileentity.TileEntity)2 Nullable (org.jetbrains.annotations.Nullable)2