Examples of NetworkComponent


Examples of org.terasology.network.NetworkComponent

        this.system = system;
    }

    @Override
    public BaseEntityRef createRefFor(int id, LowLevelEntityManager entityManager) {
        NetworkComponent netComp = entityManager.getComponent(id, NetworkComponent.class);
        if (netComp != null && netComp.getNetworkId() != 0) {
            system.registerClientNetworkEntity(netComp.getNetworkId(), id);
            return new NetEntityRef(netComp.getNetworkId(), system, entityManager);
        }
        return super.createRefFor(id, entityManager);
    }
View Full Code Here

Examples of org.terasology.network.NetworkComponent

                queuedOutgoingEvents.add(NetData.EventMessage.newBuilder()
                        .setTargetBlockPos(NetMessageUtil.convert(blockComp.getPosition()))
                        .setEvent(eventSerializer.serialize(event)).build());
            }
        } else {
            NetworkComponent networkComponent = target.getComponent(NetworkComponent.class);
            if (networkComponent != null) {
                if (netRelevant.contains(networkComponent.getNetworkId()) || netInitial.contains(networkComponent.getNetworkId())) {
                    queuedOutgoingEvents.add(NetData.EventMessage.newBuilder()
                            .setTargetId(networkComponent.getNetworkId())
                            .setEvent(eventSerializer.serialize(event)).build());
                }
            }
        }
    }
View Full Code Here

Examples of org.terasology.network.NetworkComponent

        BlockComponent blockComponent = value.getComponent(BlockComponent.class);
        if (blockComponent != null) {
            Vector3i pos = blockComponent.getPosition();
            return context.create(pos.x, pos.y, pos.z);
        }
        NetworkComponent netComponent = value.getComponent(NetworkComponent.class);
        if (netComponent != null) {
            return context.create(netComponent.getNetworkId());
        }
        return context.createNull();
    }
View Full Code Here

Examples of org.terasology.network.NetworkComponent

            BlockComponent blockComponent = ref.getComponent(BlockComponent.class);
            if (blockComponent != null) {
                Vector3i blockPos = blockComponent.getPosition();
                items.add(context.create(blockPos.x, blockPos.y, blockPos.z));
            } else {
                NetworkComponent netComponent = ref.getComponent(NetworkComponent.class);
                if (netComponent != null) {
                    items.add(context.create(netComponent.getNetworkId()));
                } else {
                    items.add(context.createNull());
                }
            }
        }
View Full Code Here

Examples of org.terasology.network.NetworkComponent

            // Block regen should always take the same amount of time,  regardless of its hardness
            builder.addComponent(new HealthComponent(block.getHardness(), block.getHardness() / BLOCK_REGEN_SECONDS, 1.0f));
        }
        boolean isTemporary = isTemporaryBlock(builder, block);
        if (!isTemporary && !builder.hasComponent(NetworkComponent.class)) {
            builder.addComponent(new NetworkComponent());
        }

        EntityRef blockEntity;
        if (isTemporary) {
            blockEntity = builder.buildWithoutLifecycleEvents();
View Full Code Here

Examples of org.terasology.network.NetworkComponent

    @Override
    public void onEntityComponentAdded(EntityRef entity, Class<? extends Component> component) {
        if (temporaryBlockEntities.contains(entity) && entityManager.getComponentLibrary().getMetadata(component).isForceBlockActive()) {
            temporaryBlockEntities.remove(entity);
            if (!entity.hasComponent(NetworkComponent.class)) {
                entity.addComponent(new NetworkComponent());
            }
        }
    }
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.