Search in sources :

Example 1 with SignTileEntity

use of net.minecraft.tileentity.SignTileEntity in project minecolonies by ldtteam.

the class WorkerUtil method updateLevelSign.

/**
 * Updated the level sign of a certain level in the world.
 *
 * @param world   the world.
 * @param level   the level to update.
 * @param levelId the id of the level.
 */
public static void updateLevelSign(final World world, final Level level, final int levelId) {
    @Nullable final BlockPos levelSignPos = level.getLevelSign();
    if (levelSignPos != null) {
        final TileEntity te = world.getBlockEntity(levelSignPos);
        if (te instanceof SignTileEntity) {
            final BlockState BlockState = world.getBlockState(levelSignPos);
            final SignTileEntity teLevelSign = (SignTileEntity) te;
            teLevelSign.setMessage(0, new StringTextComponent(TextFormatting.stripFormatting(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.minerMineNode") + ": " + levelId)));
            teLevelSign.setMessage(1, new StringTextComponent(TextFormatting.stripFormatting("Y: " + (level.getDepth() + 1))));
            teLevelSign.setMessage(2, new StringTextComponent(TextFormatting.stripFormatting(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.minerNode") + ": " + level.getNumberOfBuiltNodes())));
            teLevelSign.setMessage(3, new StringTextComponent(TextFormatting.stripFormatting("")));
            teLevelSign.setChanged();
            world.sendBlockUpdated(levelSignPos, BlockState, BlockState, 3);
        }
    }
}
Also used : SignTileEntity(net.minecraft.tileentity.SignTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) BlockState(net.minecraft.block.BlockState) SignTileEntity(net.minecraft.tileentity.SignTileEntity) BlockPos(net.minecraft.util.math.BlockPos) StringTextComponent(net.minecraft.util.text.StringTextComponent) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with SignTileEntity

use of net.minecraft.tileentity.SignTileEntity in project minecolonies by Minecolonies.

the class WorkerUtil method updateLevelSign.

/**
 * Updated the level sign of a certain level in the world.
 *
 * @param world   the world.
 * @param level   the level to update.
 * @param levelId the id of the level.
 */
public static void updateLevelSign(final World world, final Level level, final int levelId) {
    @Nullable final BlockPos levelSignPos = level.getLevelSign();
    if (levelSignPos != null) {
        final TileEntity te = world.getBlockEntity(levelSignPos);
        if (te instanceof SignTileEntity) {
            final BlockState BlockState = world.getBlockState(levelSignPos);
            final SignTileEntity teLevelSign = (SignTileEntity) te;
            teLevelSign.setMessage(0, new StringTextComponent(TextFormatting.stripFormatting(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.minerMineNode") + ": " + levelId)));
            teLevelSign.setMessage(1, new StringTextComponent(TextFormatting.stripFormatting("Y: " + (level.getDepth() + 1))));
            teLevelSign.setMessage(2, new StringTextComponent(TextFormatting.stripFormatting(LanguageHandler.format("com.minecolonies.coremod.gui.workerhuts.minerNode") + ": " + level.getNumberOfBuiltNodes())));
            teLevelSign.setMessage(3, new StringTextComponent(TextFormatting.stripFormatting("")));
            teLevelSign.setChanged();
            world.sendBlockUpdated(levelSignPos, BlockState, BlockState, 3);
        }
    }
}
Also used : SignTileEntity(net.minecraft.tileentity.SignTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) BlockState(net.minecraft.block.BlockState) SignTileEntity(net.minecraft.tileentity.SignTileEntity) BlockPos(net.minecraft.util.math.BlockPos) StringTextComponent(net.minecraft.util.text.StringTextComponent) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

BlockState (net.minecraft.block.BlockState)2 SignTileEntity (net.minecraft.tileentity.SignTileEntity)2 TileEntity (net.minecraft.tileentity.TileEntity)2 BlockPos (net.minecraft.util.math.BlockPos)2 StringTextComponent (net.minecraft.util.text.StringTextComponent)2 Nullable (org.jetbrains.annotations.Nullable)2