Examples of BeforeItemPutInInventory


Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory

                return false;
            }
        }

        if (itemTo.exists()) {
            BeforeItemPutInInventory putFrom = new BeforeItemPutInInventory(instigator, itemTo, slotFrom);
            from.send(putFrom);
            if (putFrom.isConsumed()) {
                return false;
            }
        }

        if (itemFrom.exists()) {
            BeforeItemPutInInventory putTo = new BeforeItemPutInInventory(instigator, itemFrom, slotTo);
            to.send(putTo);
            if (putTo.isConsumed()) {
                return false;
            }
        }

        return true;
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory

        if (removeFrom.isConsumed()) {
            return false;
        }

        if (itemTo == null) {
            BeforeItemPutInInventory putTo = new BeforeItemPutInInventory(instigator, InventoryUtils.getItemAt(from, slotFrom), slotTo);
            to.send(putTo);
            if (putTo.isConsumed()) {
                return false;
            }
        }

        return true;
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory

        }

        for (int toSlot :toSlots) {
            EntityRef toItem = getItemAt(to, toSlot);
            if (!toItem.exists()) {
                BeforeItemPutInInventory putTo = new BeforeItemPutInInventory(instigator, fromItem, toSlot);
                to.send(putTo);
                boolean allowed = !putTo.isConsumed();
                if (allowed) {
                    putItemIntoSlot(to, fromItem, toSlot);
                    putItemIntoSlot(from, EntityRef.NULL, slotFrom);
                    return true;
                }
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory

        Mockito.when(inventory.send(Matchers.any(BeforeItemPutInInventory.class))).then(
                new Answer<Object>() {
                    @Override
                    public Object answer(InvocationOnMock invocation) throws Exception {
                        BeforeItemPutInInventory event = (BeforeItemPutInInventory) invocation.getArguments()[0];
                        event.consume();
                        return null;
                    }
                }
        );
View Full Code Here

Examples of org.terasology.logic.inventory.events.BeforeItemPutInInventory

                new Answer<Object>() {
                    @Override
                    public Object answer(InvocationOnMock invocation) throws Exception {
                        Object arg = invocation.getArguments()[0];
                        if (arg instanceof BeforeItemPutInInventory) {
                            BeforeItemPutInInventory event = (BeforeItemPutInInventory) arg;
                            if (event.getSlot() == 1) {
                                event.consume();
                            }
                        }
                        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.