Search in sources :

Example 1 with AbstractTileEntityGrave

use of com.minecolonies.api.tileentities.AbstractTileEntityGrave in project minecolonies by Minecolonies.

the class BlockMinecoloniesGrave method spawnAfterBreak.

@Override
public void spawnAfterBreak(final BlockState state, final ServerWorld worldIn, final BlockPos pos, final ItemStack stack) {
    final TileEntity tileentity = worldIn.getBlockEntity(pos);
    if (tileentity instanceof TileEntityGrave) {
        final IItemHandler handler = ((AbstractTileEntityGrave) tileentity).getInventory();
        InventoryUtils.dropItemHandler(handler, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    super.spawnAfterBreak(state, worldIn, pos, stack);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) IItemHandler(net.minecraftforge.items.IItemHandler) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) TileEntityGrave(com.minecolonies.api.tileentities.TileEntityGrave)

Example 2 with AbstractTileEntityGrave

use of com.minecolonies.api.tileentities.AbstractTileEntityGrave in project minecolonies by ldtteam.

the class BlockMinecoloniesGrave method spawnAfterBreak.

@Override
public void spawnAfterBreak(final BlockState state, final ServerWorld worldIn, final BlockPos pos, final ItemStack stack) {
    final TileEntity tileentity = worldIn.getBlockEntity(pos);
    if (tileentity instanceof TileEntityGrave) {
        final IItemHandler handler = ((AbstractTileEntityGrave) tileentity).getInventory();
        InventoryUtils.dropItemHandler(handler, worldIn, pos.getX(), pos.getY(), pos.getZ());
    }
    super.spawnAfterBreak(state, worldIn, pos, stack);
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) IItemHandler(net.minecraftforge.items.IItemHandler) AbstractTileEntityGrave(com.minecolonies.api.tileentities.AbstractTileEntityGrave) TileEntityGrave(com.minecolonies.api.tileentities.TileEntityGrave)

Example 3 with AbstractTileEntityGrave

use of com.minecolonies.api.tileentities.AbstractTileEntityGrave 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 4 with AbstractTileEntityGrave

use of com.minecolonies.api.tileentities.AbstractTileEntityGrave 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

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