Java 类net.minecraft.server.TileEntitySign 实例源码

项目:CraftBukkit    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    lines = new String[sign.lines.length];
    System.arraycopy(sign.lines, 0, lines, 0, lines.length);
}
项目:CraftBukkit    文件:CraftSign.java   
public static String[] sanitizeLines(String[] lines) {
    String[] astring = new String[4];

    for (int i = 0; i < 4; i++) {
        if (i < lines.length && lines[i] != null) {
            astring[i] = lines[i];
        } else {
            astring[i] = "";
        }
    }

    return TileEntitySign.sanitizeLines(astring);
}
项目:Craftbukkit    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    lines = new String[sign.lines.length];
    System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
}
项目:Almura-Server    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    // Spigot start
    if (sign == null) {
        lines = new String[]{"", "", "", ""};
        return;
    }
    // Spigot end
    lines = new String[sign.lines.length];
    System.arraycopy(sign.lines, 0, lines, 0, lines.length);
}
项目:Tweakkit-Server    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    // Spigot start
    if (sign == null) {
        lines = new String[]{"", "", "", ""};
        return;
    }
    // Spigot end
    lines = new String[sign.lines.length];
    System.arraycopy(sign.lines, 0, lines, 0, lines.length);
}
项目:Tweakkit-Server    文件:CraftSign.java   
public static String[] sanitizeLines(String[] lines) {
    String[] astring = new String[4];

    for (int i = 0; i < 4; i++) {
        if (i < lines.length && lines[i] != null) {
            astring[i] = lines[i];
        } else {
            astring[i] = "";
        }
    }

    return TileEntitySign.sanitizeLines(astring);
}
项目:SpigotSource    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    // Spigot start
    if (sign == null) {
        lines = new String[]{"", "", "", ""};
        return;
    }
    // Spigot end
    lines = new String[sign.lines.length];
    System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
}
项目:Craft-city    文件:CraftSign.java   
public CraftSign(final Block block) {
    super(block);

    CraftWorld world = (CraftWorld) block.getWorld();
    sign = (TileEntitySign) world.getTileEntityAt(getX(), getY(), getZ());
    lines = new String[sign.lines.length];
    System.arraycopy(sign.lines, 0, lines, 0, lines.length);
}
项目:Craftbukkit    文件:CraftSign.java   
public CraftSign(final Material material, final TileEntitySign te) {
    super(material);
    sign = te;
    lines = new String[sign.lines.length];
    System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
}
项目:Craftbukkit    文件:CraftSign.java   
@Override
public TileEntitySign getTileEntity() {
    return sign;
}
项目:Craftbukkit    文件:CraftMetaBlockState.java   
@Override
public void setBlockState(BlockState blockState) {
    Validate.notNull(blockState, "blockState must not be null");
    TileEntity te = ((CraftBlockState) blockState).getTileEntity();
    Validate.notNull(te, "Invalid blockState");

    boolean valid;
    switch (material) {
    case SIGN:
    case SIGN_POST:
    case WALL_SIGN:
        valid = te instanceof TileEntitySign;
        break;
    case CHEST:
    case TRAPPED_CHEST:
        valid = te instanceof TileEntityChest;
        break;
    case BURNING_FURNACE:
    case FURNACE:
        valid = te instanceof TileEntityFurnace;
        break;
    case DISPENSER:
        valid = te instanceof TileEntityDispenser;
        break;
    case DROPPER:
        valid = te instanceof TileEntityDropper;
        break;
    case HOPPER:
        valid = te instanceof TileEntityHopper;
        break;
    case MOB_SPAWNER:
        valid = te instanceof TileEntityMobSpawner;
        break;
    case NOTE_BLOCK:
        valid = te instanceof TileEntityNote;
        break;
    case JUKEBOX:
        valid = te instanceof BlockJukeBox.TileEntityRecordPlayer;
        break;
    case BREWING_STAND:
        valid = te instanceof TileEntityBrewingStand;
        break;
    case SKULL:
        valid = te instanceof TileEntitySkull;
        break;
    case COMMAND:
        valid = te instanceof TileEntityCommand;
        break;
    case BEACON:
        valid = te instanceof TileEntityBeacon;
        break;
    case BANNER:
    case WALL_BANNER:
    case STANDING_BANNER:
        valid = te instanceof TileEntityBanner;
        break;
    default:
        valid = false;
        break;
    }

    Validate.isTrue(valid, "Invalid blockState for " + material);

    blockEntityTag = new NBTTagCompound();
    te.b(blockEntityTag);
}
项目:SpigotSource    文件:CraftSign.java   
public CraftSign(final Material material, final TileEntitySign te) {
    super(material);
    sign = te;
    lines = new String[sign.lines.length];
    System.arraycopy(revertComponents(sign.lines), 0, lines, 0, lines.length);
}
项目:SpigotSource    文件:CraftSign.java   
@Override
public TileEntitySign getTileEntity() {
    return sign;
}
项目:SpigotSource    文件:CraftMetaBlockState.java   
@Override
public void setBlockState(BlockState blockState) {
    Validate.notNull(blockState, "blockState must not be null");
    TileEntity te = ((CraftBlockState) blockState).getTileEntity();
    Validate.notNull(te, "Invalid blockState");

    boolean valid;
    switch (material) {
    case SIGN:
    case SIGN_POST:
    case WALL_SIGN:
        valid = te instanceof TileEntitySign;
        break;
    case CHEST:
    case TRAPPED_CHEST:
        valid = te instanceof TileEntityChest;
        break;
    case BURNING_FURNACE:
    case FURNACE:
        valid = te instanceof TileEntityFurnace;
        break;
    case DISPENSER:
        valid = te instanceof TileEntityDispenser;
        break;
    case DROPPER:
        valid = te instanceof TileEntityDropper;
        break;
    case END_GATEWAY:
        valid = te instanceof TileEntityEndGateway;
        break;
    case HOPPER:
        valid = te instanceof TileEntityHopper;
        break;
    case MOB_SPAWNER:
        valid = te instanceof TileEntityMobSpawner;
        break;
    case NOTE_BLOCK:
        valid = te instanceof TileEntityNote;
        break;
    case JUKEBOX:
        valid = te instanceof BlockJukeBox.TileEntityRecordPlayer;
        break;
    case BREWING_STAND:
        valid = te instanceof TileEntityBrewingStand;
        break;
    case SKULL:
        valid = te instanceof TileEntitySkull;
        break;
    case COMMAND:
    case COMMAND_REPEATING:
    case COMMAND_CHAIN:
        valid = te instanceof TileEntityCommand;
        break;
    case BEACON:
        valid = te instanceof TileEntityBeacon;
        break;
    case SHIELD:
    case BANNER:
    case WALL_BANNER:
    case STANDING_BANNER:
        valid = te instanceof TileEntityBanner;
        break;
    case FLOWER_POT_ITEM:
        valid = te instanceof TileEntityFlowerPot;
        break;
    default:
        valid = false;
        break;
    }

    Validate.isTrue(valid, "Invalid blockState for " + material);

    blockEntityTag = new NBTTagCompound();
    te.save(blockEntityTag);
}