Examples of BlockItemComponent


Examples of org.terasology.world.block.items.BlockItemComponent

        float handMovementAnimationOffset = character.handAnimation;

        int invSlotIndex = character.selectedItem;
        EntityRef heldItem = InventoryUtils.getItemAt(localPlayer.getCharacterEntity(), invSlotIndex);
        ItemComponent heldItemComp = heldItem.getComponent(ItemComponent.class);
        BlockItemComponent blockItem = heldItem.getComponent(BlockItemComponent.class);
        if (blockItem != null && blockItem.blockFamily != null) {
            renderBlock(blockItem.blockFamily, bobOffset, handMovementAnimationOffset);
        } else if (heldItemComp != null && heldItemComp.renderWithIcon) {
            renderIcon(heldItemComp.icon, bobOffset, handMovementAnimationOffset);
        } else {
View Full Code Here

Examples of org.terasology.world.block.items.BlockItemComponent

            }
        }
    }

    private byte getLuminance(EntityRef item) {
        BlockItemComponent blockItem = item.getComponent(BlockItemComponent.class);
        if (blockItem != null) {
            return blockItem.blockFamily.getArchetypeBlock().getLuminance();
        }
        return 0;
    }
View Full Code Here

Examples of org.terasology.world.block.items.BlockItemComponent

                if (getTargetItem().exists()) {
                    ItemComponent itemComp = getTargetItem().getComponent(ItemComponent.class);
                    if (itemComp != null && itemComp.icon != null) {
                        return itemComp.icon;
                    }
                    BlockItemComponent blockItemComp = getTargetItem().getComponent(BlockItemComponent.class);
                    if (blockItemComp == null || blockItemComp.blockFamily == null) {
                        return Assets.getTextureRegion("engine:items.questionMark");
                    }
                }
                return null;
            }
        });
        icon.bindMesh(new ReadOnlyBinding<Mesh>() {
            @Override
            public Mesh get() {
                BlockItemComponent blockItemComp = getTargetItem().getComponent(BlockItemComponent.class);
                if (blockItemComp != null && blockItemComp.blockFamily != null) {
                    return blockItemComp.blockFamily.getArchetypeBlock().getMesh();
                }
                return null;
            }
View Full Code Here

Examples of org.terasology.world.block.items.BlockItemComponent

                    if (getItem().exists()) {
                        ItemComponent itemComp = getItem().getComponent(ItemComponent.class);
                        if (itemComp != null) {
                            return itemComp.icon;
                        }
                        BlockItemComponent blockItemComp = getItem().getComponent(BlockItemComponent.class);
                        if (blockItemComp == null || blockItemComp.blockFamily == null) {
                            return Assets.getTextureRegion("engine:items.questionMark");
                        }
                    }
                    return null;
                }
            });
            icon.bindMesh(new ReadOnlyBinding<Mesh>() {
                @Override
                public Mesh get() {
                    BlockItemComponent blockItemComp = getItem().getComponent(BlockItemComponent.class);
                    if (blockItemComp != null && blockItemComp.blockFamily != null) {
                        return blockItemComp.blockFamily.getArchetypeBlock().getMesh();
                    }
                    return null;
                }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.