Search in sources :

Example 36 with BlockState

use of org.spongepowered.api.block.BlockState in project RedProtect by FabioZumbi12.

the class RPPlayerListener method onInteractBlock.

// listen all
@Listener(order = Order.FIRST, beforeModifications = true)
public void onInteractBlock(InteractBlockEvent event, @First Player p) {
    RedProtect.get().logger.debug("player", "RPPlayerListener - InteractBlockEvent canceled? " + event.isCancelled());
    BlockSnapshot b = event.getTargetBlock();
    BlockState bstate = b.getState();
    Location<World> l = null;
    if (!b.getState().getType().equals(BlockTypes.AIR)) {
        l = b.getLocation().get();
        RedProtect.get().logger.debug("player", "RPPlayerListener - Is InteractBlockEvent event. The block is " + bstate.getType().getName());
    } else {
        l = p.getLocation();
    }
    Region r = RedProtect.get().rm.getTopRegion(l);
    ItemType itemInHand = ItemTypes.NONE;
    ItemStack stack = ItemStack.of(ItemTypes.NONE, 1);
    if (p.getItemInHand(HandTypes.MAIN_HAND).isPresent()) {
        stack = p.getItemInHand(HandTypes.MAIN_HAND).get();
        itemInHand = stack.getItem();
        if (RPUtil.removeGuiItem(stack)) {
            p.setItemInHand(HandTypes.MAIN_HAND, ItemStack.of(ItemTypes.NONE, 1));
            event.setCancelled(true);
        }
    } else if (p.getItemInHand(HandTypes.OFF_HAND).isPresent()) {
        stack = p.getItemInHand(HandTypes.OFF_HAND).get();
        itemInHand = stack.getItem();
        if (RPUtil.removeGuiItem(stack)) {
            p.setItemInHand(HandTypes.OFF_HAND, ItemStack.of(ItemTypes.NONE, 1));
            event.setCancelled(true);
        }
    }
    if (itemInHand.getId().equalsIgnoreCase(RedProtect.get().cfgs.getString("wands.infoWandID"))) {
        r = RedProtect.get().rm.getTopRegion(l);
        if (RedProtect.get().ph.hasUserPerm(p, "RedProtect.get().infowand")) {
            if (r == null) {
                RPLang.sendMessage(p, "playerlistener.noregion.atblock");
            } else if (r.canBuild(p)) {
                p.sendMessage(RPUtil.toText(RPLang.get("general.color") + "--------------- [&e" + r.getName() + RPLang.get("general.color") + "] ---------------"));
                p.sendMessage(r.info());
                p.sendMessage(RPUtil.toText(RPLang.get("general.color") + "-----------------------------------------"));
            } else {
                p.sendMessage(RPUtil.toText(RPLang.get("playerlistener.region.entered").replace("{region}", r.getName()).replace("{leaders}", RPUtil.UUIDtoPlayer(r.getLeadersDesc()))));
            }
            event.setCancelled(true);
            return;
        }
    }
    // start player checks
    if (r == null) {
        if (b != null && (bstate instanceof Container || RedProtect.get().cfgs.getStringList("private.allowed-blocks").contains(bstate.getType().getName()))) {
            Boolean out = RedProtect.get().cfgs.getBool("private.allow-outside");
            if (out && !cont.canOpen(b, p)) {
                if (!RedProtect.get().ph.hasPerm(p, "RedProtect.get().bypass")) {
                    RPLang.sendMessage(p, "playerlistener.region.cantopen");
                    event.setCancelled(true);
                } else {
                    int x = b.getLocation().get().getBlockX();
                    int y = b.getLocation().get().getBlockY();
                    int z = b.getLocation().get().getBlockZ();
                    RPLang.sendMessage(p, RPLang.get("playerlistener.region.opened").replace("{region}", "X:" + x + " Y:" + y + " Z:" + z));
                }
            }
        }
    } else {
        // if (r != null) && (b != null) >>
        if (b != null) {
            if (bstate.getType().equals(BlockTypes.DRAGON_EGG) || bstate.getType().equals(BlockTypes.BED) || bstate.getType().equals(BlockTypes.NOTEBLOCK) || bstate.getType().getName().contains("repeater") || bstate.getType().getName().contains("comparator")) {
                if (!r.canBuild(p)) {
                    RPLang.sendMessage(p, "playerlistener.region.cantinteract");
                    event.setCancelled(true);
                }
            } else if ((b.getState() instanceof Carrier) || RedProtect.get().cfgs.getStringList("private.allowed-blocks").contains(bstate.getType().getName())) {
                if ((r.canChest(p) && !cont.canOpen(b, p) || (!r.canChest(p) && cont.canOpen(b, p)) || (!r.canChest(p) && !cont.canOpen(b, p)))) {
                    if (!RedProtect.get().ph.hasPerm(p, "RedProtect.get().bypass")) {
                        RPLang.sendMessage(p, "playerlistener.region.cantopen");
                        event.setCancelled(true);
                    } else {
                        RPLang.sendMessage(p, RPLang.get("playerlistener.region.opened").replace("{region}", RPUtil.UUIDtoPlayer(r.getLeadersDesc())));
                    }
                }
            } else if (bstate.getType().getName().contains("lever")) {
                if (!r.canLever(p)) {
                    if (!RedProtect.get().ph.hasPerm(p, "RedProtect.get().bypass")) {
                        RPLang.sendMessage(p, "playerlistener.region.cantlever");
                        event.setCancelled(true);
                    } else {
                        RPLang.sendMessage(p, RPLang.get("playerlistener.region.levertoggled").replace("{region}", RPUtil.UUIDtoPlayer(r.getLeadersDesc())));
                    }
                }
            } else if (bstate.getType().getName().contains("button")) {
                if (!r.canButton(p)) {
                    if (!RedProtect.get().ph.hasPerm(p, "RedProtect.get().bypass")) {
                        RPLang.sendMessage(p, "playerlistener.region.cantbutton");
                        event.setCancelled(true);
                    } else {
                        RPLang.sendMessage(p, RPLang.get("playerlistener.region.buttonactivated").replace("{region}", RPUtil.UUIDtoPlayer(r.getLeadersDesc())));
                    }
                }
            } else if (RPDoor.isOpenable(b)) {
                if (!r.canDoor(p)) /* || (r.canDoor(p) && !cont.canOpen(b, p))*/
                {
                    if (!RedProtect.get().ph.hasPerm(p, "RedProtect.get().bypass")) {
                        RPLang.sendMessage(p, "playerlistener.region.cantdoor");
                        event.setCancelled(true);
                    } else {
                        RPLang.sendMessage(p, "playerlistener.region.opendoor");
                        RPDoor.ChangeDoor(b, r);
                    }
                } else {
                    RPDoor.ChangeDoor(b, r);
                }
            } else if (bstate.getType().getName().contains("rail")) {
                if (!r.canMinecart(p)) {
                    RPLang.sendMessage(p, "blocklistener.region.cantplace");
                    event.setCancelled(true);
                }
            } else if (bstate.getType().getName().contains("sign") && !r.canSign(p)) {
                if (b.get(Keys.SIGN_LINES).isPresent()) {
                    List<Text> sign = b.get(Keys.SIGN_LINES).get();
                    for (String tag : RedProtect.get().cfgs.getStringList("region-settings.allow-sign-interact-tags")) {
                        // check first rule
                        if (tag.equalsIgnoreCase(sign.get(0).toPlain())) {
                            return;
                        }
                        // check if tag is leaders or members names
                        if (tag.equalsIgnoreCase("{membername}")) {
                            for (String leader : r.getLeaders()) {
                                if (sign.get(0).toPlain().equalsIgnoreCase(RPUtil.UUIDtoPlayer(leader))) {
                                    return;
                                }
                            }
                            for (String member : r.getMembers()) {
                                if (sign.get(0).toPlain().equalsIgnoreCase(RPUtil.UUIDtoPlayer(member))) {
                                    return;
                                }
                            }
                            for (String admin : r.getAdmins()) {
                                if (sign.get(0).toPlain().equalsIgnoreCase(RPUtil.UUIDtoPlayer(admin))) {
                                    return;
                                }
                            }
                        }
                        // check if tag is player name
                        if (tag.equalsIgnoreCase("{playername}")) {
                            if (sign.get(0).toPlain().equalsIgnoreCase(RPUtil.UUIDtoPlayer(p.getName()))) {
                                return;
                            }
                        }
                    }
                }
                RPLang.sendMessage(p, "playerlistener.region.cantinteract.signs");
                event.setCancelled(true);
            } else if ((itemInHand.equals(ItemTypes.FLINT_AND_STEEL) || itemInHand.equals(ItemTypes.WATER_BUCKET) || itemInHand.equals(ItemTypes.BUCKET) || itemInHand.equals(ItemTypes.LAVA_BUCKET) || itemInHand.equals(ItemTypes.ITEM_FRAME) || itemInHand.equals(ItemTypes.PAINTING)) && !r.canBuild(p)) {
                RPLang.sendMessage(p, RPLang.get("playerlistener.region.cantuse"));
                event.setCancelled(true);
            } else if (!r.allowMod(p) && !RPUtil.isBukkitBlock(bstate)) {
                RPLang.sendMessage(p, "playerlistener.region.cantinteract");
                event.setCancelled(true);
            }
        }
    }
}
Also used : ItemType(org.spongepowered.api.item.ItemType) BlockSnapshot(org.spongepowered.api.block.BlockSnapshot) Text(org.spongepowered.api.text.Text) World(org.spongepowered.api.world.World) RPContainer(br.net.fabiozumbi12.RedProtect.Sponge.RPContainer) Container(org.spongepowered.api.item.inventory.Container) BlockState(org.spongepowered.api.block.BlockState) Region(br.net.fabiozumbi12.RedProtect.Sponge.Region) Carrier(org.spongepowered.api.item.inventory.Carrier) ItemStack(org.spongepowered.api.item.inventory.ItemStack) Listener(org.spongepowered.api.event.Listener)

Example 37 with BlockState

use of org.spongepowered.api.block.BlockState in project TotalEconomy by Erigitic.

the class JobManager method onPlayerPlaceBlock.

/**
 * Used for the place option in jobs. Will check if the job has the place node and if it does it will check if the
 * block that was placed is present in the config of the player's job. If it is, it will grab the job exp reward as
 * well as the pay.
 *
 * @param event ChangeBlockEvent.Place
 */
@Listener
public void onPlayerPlaceBlock(ChangeBlockEvent.Place event) {
    if (event.getCause().first(Player.class).isPresent()) {
        Player player = event.getCause().first(Player.class).get();
        UUID playerUUID = player.getUniqueId();
        String playerJob = getPlayerJob(player);
        Optional<TEJob> optPlayerJob = getJob(playerJob, true);
        BlockState state = event.getTransactions().get(0).getFinal().getState();
        String blockName = state.getType().getName();
        // Enable admins to determine block information by displaying it to them - WHEN they have the flag enabled
        if (accountManager.getUserOption("totaleconomy:block-place-info", player).orElse("0").equals("1")) {
            List<BlockTrait<?>> traits = new ArrayList<>(state.getTraits());
            int count = traits.size();
            List<Text> traitTexts = new ArrayList<>(count);
            for (int i = 0; i < count; i++) {
                Object traitValue = state.getTraitValue(traits.get(i)).orElse(null);
                traitTexts.add(i, Text.of(traits.get(i).getName(), '=', traitValue != null ? traitValue.toString() : "null"));
            }
            Text t = Text.of(TextColors.GRAY, "TRAITS:\n    ", Text.joinWith(Text.of(",\n    "), traitTexts.toArray(new Text[traits.size()])));
            player.sendMessage(Text.of("Block-Name: ", blockName));
            player.sendMessage(t);
        }
        if (optPlayerJob.isPresent()) {
            Optional<TEActionReward> reward = Optional.empty();
            List<String> sets = optPlayerJob.get().getSets();
            for (String s : sets) {
                Optional<TEJobSet> optSet = getJobSet(s);
                if (!optSet.isPresent()) {
                    logger.warn("Job " + playerJob + " has the nonexistent set \"" + s + "\"");
                    continue;
                }
                Optional<TEAction> action = optSet.get().getActionFor("place", blockName);
                if (!action.isPresent()) {
                    continue;
                }
                Optional<TEActionReward> currentReward = action.get().evaluatePlace(logger, state);
                if (!reward.isPresent()) {
                    reward = currentReward;
                    continue;
                }
                if (!currentReward.isPresent()) {
                    continue;
                }
                // Use the one giving higher exp in case of duplicates
                if (currentReward.get().getExpReward() > reward.get().getExpReward()) {
                    reward = currentReward;
                }
            }
            if (reward.isPresent()) {
                TEAccount playerAccount = (TEAccount) accountManager.getOrCreateAccount(player.getUniqueId()).get();
                boolean notify = getNotificationState(playerUUID);
                int expAmount = reward.get().getExpReward();
                BigDecimal payAmount = new BigDecimal(reward.get().getMoneyReward());
                Currency currency = totalEconomy.getDefaultCurrency();
                if (reward.get().getCurrencyId() != null) {
                    Optional<Currency> currencyOpt = totalEconomy.getTECurrencyRegistryModule().getById("totaleconomy:" + reward.get().getCurrencyId());
                    if (currencyOpt.isPresent()) {
                        currency = currencyOpt.get();
                    }
                }
                if (notify) {
                    notifyPlayer(player, payAmount, currency);
                }
                addExp(player, expAmount);
                playerAccount.deposit(currency, payAmount, event.getCause());
                checkForLevel(player);
            }
        }
    }
}
Also used : BlockTrait(org.spongepowered.api.block.trait.BlockTrait) TEAccount(com.erigitic.config.TEAccount) Currency(org.spongepowered.api.service.economy.Currency) Player(org.spongepowered.api.entity.living.player.Player) Text(org.spongepowered.api.text.Text) BigDecimal(java.math.BigDecimal) BlockState(org.spongepowered.api.block.BlockState) Listener(org.spongepowered.api.event.Listener)

Example 38 with BlockState

use of org.spongepowered.api.block.BlockState in project core by CubeEngine.

the class MaterialMatcher method buildVariantMap.

private Map<BlockType, Map<String, BlockState>> buildVariantMap() {
    Map<BlockType, Map<String, BlockState>> blockStateItemsByType = new HashMap<>();
    for (Entry<String, BlockState> entry : blockStateItems.entrySet()) {
        BlockType itemType = entry.getValue().getType();
        Map<String, BlockState> itemTypes = blockStateItemsByType.computeIfAbsent(itemType, k -> new HashMap<>());
        itemTypes.put(entry.getKey(), entry.getValue());
    }
    Map<BlockType, Map<String, BlockState>> variants = new HashMap<>();
    blockStateItemsByType.entrySet().stream().filter(e -> e.getValue().size() != 1).forEach(e -> {
        Map<String, Set<String>> variantNames = new HashMap<>();
        Map<List<String>, BlockState> fullVariant = new HashMap<>();
        for (Entry<String, BlockState> entry : e.getValue().entrySet()) {
            String variant = entry.getKey();
            variant = variant.substring(variant.indexOf("[") + 1, variant.indexOf("]"));
            // multiple variants
            String[] split = variant.split(",");
            fullVariant.put(Arrays.asList(split), entry.getValue());
            for (String variantEntry : split) {
                String[] variantEntryPart = variantEntry.split("=");
                Set<String> variantValues = variantNames.computeIfAbsent(variantEntryPart[0], k -> new HashSet<>());
                variantValues.add(variantEntryPart[1]);
            }
        }
        for (Entry<String, Set<String>> entry : variantNames.entrySet()) {
            if (entry.getKey().equals("axis") || entry.getKey().equals("facing") || entry.getKey().equals("half") || entry.getKey().equals("shape") || entry.getKey().equals("open") || entry.getKey().equals("powered") || entry.getKey().equals("stage") || entry.getKey().equals("decayable")) {
                Map<List<String>, BlockState> filtered = new HashMap<>();
                for (Entry<List<String>, BlockState> offender : fullVariant.entrySet()) {
                    List<String> key = new ArrayList<>(offender.getKey());
                    for (String fv : entry.getValue()) {
                        key.remove(entry.getKey() + "=" + fv);
                    }
                    if (!key.isEmpty()) {
                        filtered.put(key, offender.getValue());
                    }
                }
                fullVariant = filtered;
            }
            if (entry.getValue().size() == 1) {
                String singleVariant = entry.getKey() + "=" + entry.getValue().iterator().next();
                fullVariant = fullVariant.entrySet().stream().collect(Collectors.toMap(fv -> {
                    List<String> split = new ArrayList<>(fv.getKey());
                    split.remove(singleVariant);
                    return split;
                }, Entry::getValue));
            }
        }
        for (Entry<List<String>, BlockState> variant : fullVariant.entrySet()) {
            if (variant.getKey().size() > 1) {
                System.out.print(e.getKey().getName() + " Has multiple Variants:");
                for (String s : variant.getKey()) {
                    System.out.print(" " + s);
                }
                System.out.print("\n");
            }
        }
        variants.put(e.getKey(), fullVariant.entrySet().stream().collect(Collectors.toMap(en -> String.join(" ", en.getKey().stream().map(s -> s.split("=")[1]).collect(toList())), Entry::getValue)));
    });
    /*
        for (Entry<ItemType, Map<String, ItemStack>> variant : variants.entrySet())
        {
            System.out.print(variant.getKey().getName() + ":\n");
            for (Entry<String, ItemStack> entry : variant.getValue().entrySet())
            {
                System.out.print("  " + entry.getKey() + ": " + entry.getValue().getTranslation().get() + "\n");
            }
        }
        */
    return variants;
}
Also used : Arrays(java.util.Arrays) Keys(org.spongepowered.api.data.key.Keys) Reflector(org.cubeengine.reflect.Reflector) ItemTypes(org.spongepowered.api.item.ItemTypes) HashMap(java.util.HashMap) LibCube(org.cubeengine.libcube.LibCube) Singleton(javax.inject.Singleton) TreeSet(java.util.TreeSet) ArrayList(java.util.ArrayList) Key(org.spongepowered.api.data.key.Key) HashSet(java.util.HashSet) Inject(javax.inject.Inject) SimpleItemStackConverter(org.cubeengine.libcube.service.config.SimpleItemStackConverter) ItemStack(org.spongepowered.api.item.inventory.ItemStack) ItemTypeConverter(org.cubeengine.libcube.service.config.ItemTypeConverter) ModuleManager(org.cubeengine.libcube.ModuleManager) Locale(java.util.Locale) Map(java.util.Map) PluginContainer(org.spongepowered.api.plugin.PluginContainer) ItemStackConverter(org.cubeengine.libcube.service.config.ItemStackConverter) Builder(org.spongepowered.api.block.BlockState.Builder) GameDictionary(org.spongepowered.api.GameDictionary) BlockTypeConverter(org.cubeengine.libcube.service.config.BlockTypeConverter) Collection(java.util.Collection) DataRegistrationNotFoundException(org.spongepowered.api.data.DataRegistrationNotFoundException) Set(java.util.Set) Sponge(org.spongepowered.api.Sponge) Collectors(java.util.stream.Collectors) SetMultimap(com.google.common.collect.SetMultimap) BlockState(org.spongepowered.api.block.BlockState) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) TreeMap(java.util.TreeMap) Entry(java.util.Map.Entry) BlockType(org.spongepowered.api.block.BlockType) Optional(java.util.Optional) Comparator(java.util.Comparator) Collections(java.util.Collections) ItemType(org.spongepowered.api.item.ItemType) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Entry(java.util.Map.Entry) BlockState(org.spongepowered.api.block.BlockState) BlockType(org.spongepowered.api.block.BlockType) ArrayList(java.util.ArrayList) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) HashMap(java.util.HashMap) Map(java.util.Map) TreeMap(java.util.TreeMap)

Example 39 with BlockState

use of org.spongepowered.api.block.BlockState in project core by CubeEngine.

the class MaterialMatcher method itemStack.

public ItemStack itemStack(String name, Locale locale) {
    if (name == null) {
        return null;
    }
    Map<String, ItemStack> map = localizedStackMap.get(locale);
    if (map != null) {
        String match = stringMatcher.matchString(name, map.keySet());
        ItemStack itemStack = map.get(match);
        if (itemStack != null) {
            return itemStack.copy();
        }
    }
    String[] parts = name.toLowerCase(Locale.ENGLISH).split("=");
    String[] typeName = parts[0].split("=");
    ItemType type = material(typeName[0], locale);
    if (type == null) {
        return null;
    }
    if (parts.length > 1) {
        String variant = parts[1];
        if (type.getBlock().isPresent()) {
            Map<String, BlockState> variants = variantMap.get(type.getBlock().get());
            if (variants != null) {
                String match2 = stringMatcher.matchString(variant, variants.keySet());
                if (match2 != null) {
                    return ItemStack.builder().fromBlockState(variants.get(match2)).quantity(1).build();
                }
            }
        }
    }
    ItemStack.Builder builder = ItemStack.builder().itemType(type).quantity(1);
    if (typeName.length == 2) {
        try {
            builder.add(Keys.ITEM_DURABILITY, Integer.valueOf(typeName[1]));
        } catch (IllegalArgumentException e) {
            return null;
        }
    }
    return builder.build();
}
Also used : BlockState(org.spongepowered.api.block.BlockState) ItemType(org.spongepowered.api.item.ItemType) ItemStack(org.spongepowered.api.item.inventory.ItemStack)

Example 40 with BlockState

use of org.spongepowered.api.block.BlockState in project LanternServer by LanternPowered.

the class BlockRegistryModule method register.

@Override
public void register(int internalId, BlockType blockType) {
    LanternBlockType blockType0 = (LanternBlockType) checkNotNull(blockType, "blockType");
    checkState(blockType0.getBlockStateBase().getBlockStates().stream().filter(s -> !((LanternBlockState) s).isExtended()).count() <= 1, "You cannot register a blockType with more then one state with this method.");
    register0(internalId, blockType0, blockState -> (byte) 0);
}
Also used : BlockTypeBuilder(org.lanternpowered.server.block.BlockTypeBuilder) LanternBlockType(org.lanternpowered.server.block.LanternBlockType) LanternDirtType(org.lanternpowered.server.data.type.LanternDirtType) JukeboxInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.JukeboxInteractionBehavior) SnowyExtendedBlockStateProvider(org.lanternpowered.server.block.extended.SnowyExtendedBlockStateProvider) LanternBooleanTraits(org.lanternpowered.server.block.trait.LanternBooleanTraits) BoundingBoxes(org.lanternpowered.server.block.aabb.BoundingBoxes) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ChestPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.ChestPlacementBehavior) LanternTreeType(org.lanternpowered.server.data.type.LanternTreeType) RegistrationDependency(org.spongepowered.api.registry.util.RegistrationDependency) LanternStoneType(org.lanternpowered.server.data.type.LanternStoneType) KeyRegistryModule(org.lanternpowered.server.game.registry.type.data.KeyRegistryModule) PropertyProviders.replaceable(org.lanternpowered.server.block.provider.property.PropertyProviders.replaceable) ChestInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.ChestInteractionBehavior) NoteBlockInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.NoteBlockInteractionBehavior) ShulkerBoxInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.ShulkerBoxInteractionBehavior) Object2ShortOpenHashMap(it.unimi.dsi.fastutil.objects.Object2ShortOpenHashMap) LanternIntegerTraits(org.lanternpowered.server.block.trait.LanternIntegerTraits) Short2ObjectOpenHashMap(it.unimi.dsi.fastutil.shorts.Short2ObjectOpenHashMap) LanternQuartzType(org.lanternpowered.server.data.type.LanternQuartzType) LanternDyeColor(org.lanternpowered.server.data.type.LanternDyeColor) BlockTypes(org.spongepowered.api.block.BlockTypes) INSTANT_BROKEN(org.lanternpowered.server.block.provider.property.PropertyProviderCollections.INSTANT_BROKEN) LanternPlantType(org.lanternpowered.server.data.type.LanternPlantType) HopperPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.HopperPlacementBehavior) SimpleBlockDropsProviderBehavior(org.lanternpowered.server.block.behavior.simple.SimpleBlockDropsProviderBehavior) Preconditions.checkState(com.google.common.base.Preconditions.checkState) SimpleBreakBehavior(org.lanternpowered.server.block.behavior.simple.SimpleBreakBehavior) LanternPortionType(org.lanternpowered.server.data.type.LanternPortionType) EquipmentTypeRegistryModule(org.lanternpowered.server.game.registry.type.item.inventory.equipment.EquipmentTypeRegistryModule) BlockState(org.spongepowered.api.block.BlockState) SlabType(org.spongepowered.api.data.type.SlabType) Direction(org.spongepowered.api.util.Direction) SimplePlacementBehavior(org.lanternpowered.server.block.behavior.simple.SimplePlacementBehavior) QuartzLinesRotationPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.QuartzLinesRotationPlacementBehavior) Lantern(org.lanternpowered.server.game.Lantern) BlockSnapshotProviderPlaceBehavior(org.lanternpowered.server.block.behavior.simple.BlockSnapshotProviderPlaceBehavior) RotationPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.RotationPlacementBehavior) InstrumentTypeRegistryModule(org.lanternpowered.server.game.registry.type.data.InstrumentTypeRegistryModule) BlockType(org.spongepowered.api.block.BlockType) Object2ShortMap(it.unimi.dsi.fastutil.objects.Object2ShortMap) Optional(java.util.Optional) CraftingTableInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.CraftingTableInteractionBehavior) LanternSlabType(org.lanternpowered.server.data.type.LanternSlabType) LanternBedPart(org.lanternpowered.server.data.type.LanternBedPart) InventorySnapshot(org.lanternpowered.server.inventory.InventorySnapshot) BlockTypeBuilderImpl(org.lanternpowered.server.block.BlockTypeBuilderImpl) LanternKeys(org.lanternpowered.server.data.key.LanternKeys) Keys(org.spongepowered.api.data.key.Keys) EnderChestInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.EnderChestInteractionBehavior) OppositeFaceDirectionalPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.OppositeFaceDirectionalPlacementBehavior) LanternRailDirection(org.lanternpowered.server.data.type.LanternRailDirection) EnumTrait(org.spongepowered.api.block.trait.EnumTrait) Byte2ObjectOpenHashMap(it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap) TranslationProvider(org.lanternpowered.server.block.TranslationProvider) Supplier(java.util.function.Supplier) ItemRegistryModule(org.lanternpowered.server.game.registry.type.item.ItemRegistryModule) TreeType(org.spongepowered.api.data.type.TreeType) PropertyProviders.equipmentType(org.lanternpowered.server.item.PropertyProviders.equipmentType) PropertyProviders.lightEmission(org.lanternpowered.server.block.provider.property.PropertyProviders.lightEmission) HorizontalRotationPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.HorizontalRotationPlacementBehavior) TorchPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.TorchPlacementBehavior) Byte2ObjectMap(it.unimi.dsi.fastutil.bytes.Byte2ObjectMap) TranslationHelper.tr(org.lanternpowered.server.text.translation.TranslationHelper.tr) LogAxisRotationPlacementBehavior(org.lanternpowered.server.block.behavior.vanilla.LogAxisRotationPlacementBehavior) PASSABLE(org.lanternpowered.server.block.provider.property.PropertyProviderCollections.PASSABLE) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) PropertyProviders.hardness(org.lanternpowered.server.block.provider.property.PropertyProviders.hardness) PropertyProviderCollections(org.lanternpowered.server.block.provider.property.PropertyProviderCollections) LanternSandType(org.lanternpowered.server.data.type.LanternSandType) LanternShrubType(org.lanternpowered.server.data.type.LanternShrubType) LanternBlockState(org.lanternpowered.server.block.state.LanternBlockState) SpongeTranslationProvider(org.lanternpowered.server.block.translation.SpongeTranslationProvider) LanternSandstoneType(org.lanternpowered.server.data.type.LanternSandstoneType) SlabItemInteractionBehavior(org.lanternpowered.server.item.behavior.vanilla.SlabItemInteractionBehavior) PropertyProviders.blastResistance(org.lanternpowered.server.block.provider.property.PropertyProviders.blastResistance) Short2ObjectMap(it.unimi.dsi.fastutil.shorts.Short2ObjectMap) TileEntityTypes(org.spongepowered.api.block.tileentity.TileEntityTypes) PropertyProviders.flammableInfo(org.lanternpowered.server.block.provider.property.PropertyProviders.flammableInfo) EquipmentTypes(org.spongepowered.api.item.inventory.equipment.EquipmentTypes) LanternEnumTraits(org.lanternpowered.server.block.trait.LanternEnumTraits) AdditionalPluginCatalogRegistryModule(org.lanternpowered.server.game.registry.AdditionalPluginCatalogRegistryModule) OpenableContainerInteractionBehavior(org.lanternpowered.server.block.behavior.vanilla.OpenableContainerInteractionBehavior) LanternBlockType(org.lanternpowered.server.block.LanternBlockType)

Aggregations

BlockState (org.spongepowered.api.block.BlockState)133 World (org.spongepowered.api.world.World)39 IBlockState (net.minecraft.block.state.IBlockState)29 BlockType (org.spongepowered.api.block.BlockType)27 BlockSnapshot (org.spongepowered.api.block.BlockSnapshot)22 Direction (org.spongepowered.api.util.Direction)21 Optional (java.util.Optional)20 TileEntity (org.spongepowered.api.block.tileentity.TileEntity)20 Vector3i (com.flowpowered.math.vector.Vector3i)19 Location (org.spongepowered.api.world.Location)18 ItemStack (org.spongepowered.api.item.inventory.ItemStack)17 LocatableBlock (org.spongepowered.api.world.LocatableBlock)14 Sponge (org.spongepowered.api.Sponge)13 ItemType (org.spongepowered.api.item.ItemType)13 ArrayList (java.util.ArrayList)12 Player (org.spongepowered.api.entity.living.player.Player)12 List (java.util.List)11 InvalidDataException (org.spongepowered.api.data.persistence.InvalidDataException)11 Vector3d (com.flowpowered.math.vector.Vector3d)10 Listener (org.spongepowered.api.event.Listener)10