Search in sources :

Example 16 with Block

use of org.apache.tapestry5.Block in project tapestry-5 by apache.

the class BlockImplTest method to_string.

@Test
public void to_string() {
    Resource r = new ClasspathResource("foo/pages/MyPage.tml");
    Location l = new LocationImpl(r, 23);
    BlockImpl block = new BlockImpl(l, "test block");
    assertEquals(block.toString(), "Block[test block, at classpath:foo/pages/MyPage.tml, line 23]");
}
Also used : ClasspathResource(org.apache.tapestry5.ioc.internal.util.ClasspathResource) Resource(org.apache.tapestry5.commons.Resource) ClasspathResource(org.apache.tapestry5.ioc.internal.util.ClasspathResource) LocationImpl(org.apache.tapestry5.ioc.internal.util.LocationImpl) Location(org.apache.tapestry5.commons.Location) Test(org.testng.annotations.Test)

Example 17 with Block

use of org.apache.tapestry5.Block in project tapestry-5 by apache.

the class Error method updateElement.

@HeartbeatDeferred
private void updateElement(final Element element) {
    // The field may add an id attribute because of this call.
    element.attribute("data-error-block-for", field.getClientId());
    String id = field.getClientId() + "-help-block";
    element.attribute("id", id);
    Element input = element.getDocument().getElementById(field.getClientId());
    if (input != null) {
        input.attribute("aria-describedby", id);
    }
}
Also used : Element(org.apache.tapestry5.dom.Element) HeartbeatDeferred(org.apache.tapestry5.annotations.HeartbeatDeferred)

Example 18 with Block

use of org.apache.tapestry5.Block in project tapestry-5 by apache.

the class Error method beginRender.

boolean beginRender(final MarkupWriter writer) {
    // Initially invisible; will be shown on client if an error exists.
    Element element = writer.element("p", "class", !("help-block".equals(cssClass)) ? ("help-block " + cssClass) : cssClass + " invisible", "role", "alert");
    resources.renderInformalParameters(writer);
    // Wait until the end of the heartbeat to ensure the Field has had a chance to render.
    updateElement(element);
    writer.end();
    return false;
}
Also used : Element(org.apache.tapestry5.dom.Element)

Example 19 with Block

use of org.apache.tapestry5.Block in project Denizen-For-Bukkit by DenizenScript.

the class BlockHelperImpl method ringBell.

@Override
public void ringBell(Bell block) {
    org.bukkit.block.data.type.Bell bellData = (org.bukkit.block.data.type.Bell) block.getBlockData();
    Direction face = Direction.byName(bellData.getFacing().name());
    Direction dir = Direction.NORTH;
    switch(bellData.getAttachment()) {
        case DOUBLE_WALL:
        case SINGLE_WALL:
            switch(face) {
                case NORTH:
                case SOUTH:
                    dir = Direction.EAST;
                    break;
            }
            break;
        case FLOOR:
            dir = face;
            break;
    }
    CraftBlock craftBlock = (CraftBlock) block.getBlock();
    ((BellBlock) Blocks.BELL).attemptToRing(craftBlock.getCraftWorld().getHandle(), craftBlock.getPosition(), dir);
}
Also used : BellBlock(net.minecraft.world.level.block.BellBlock) org.bukkit.block(org.bukkit.block) org.bukkit.craftbukkit.v1_17_R1.block(org.bukkit.craftbukkit.v1_17_R1.block) Direction(net.minecraft.core.Direction)

Example 20 with Block

use of org.apache.tapestry5.Block in project NoCheatPlus by NoCheatPlus.

the class BlockCacheCB3100 method fetchBounds.

@Override
public double[] fetchBounds(final int x, final int y, final int z) {
    @SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
    final net.minecraft.server.v1_7_R4.Block block = net.minecraft.server.v1_7_R4.Block.getById(id);
    if (block == null) {
        // TODO: Convention for null bounds -> full ?
        return null;
    }
    // getData from cache.
    block.updateShape(iBlockAccess, x, y, z);
    // minX, minY, minZ, maxX, maxY, maxZ
    return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
Also used : Block(net.minecraft.server.v1_7_R4.Block)

Aggregations

Test (org.testng.annotations.Test)12 Block (net.minecraft.server.v1_12_R1.Block)9 Block (org.apache.tapestry5.Block)9 ByteString (com.google.protobuf.ByteString)8 ArrayList (java.util.ArrayList)8 Block (net.minecraft.server.v1_10_R1.Block)8 Block (net.minecraft.server.v1_11_R1.Block)8 BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)8 Block (net.minecraft.server.v1_8_R3.Block)8 FallingBlock (org.bukkit.entity.FallingBlock)8 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)7 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)7 AnnotateImageResponse (com.google.cloud.vision.v1.AnnotateImageResponse)6 Block (com.google.cloud.vision.v1.Block)6 Feature (com.google.cloud.vision.v1.Feature)6 ImageAnnotatorClient (com.google.cloud.vision.v1.ImageAnnotatorClient)6 Page (com.google.cloud.vision.v1.Page)6 Paragraph (com.google.cloud.vision.v1.Paragraph)6 Symbol (com.google.cloud.vision.v1.Symbol)6 Word (com.google.cloud.vision.v1.Word)6