Search in sources :

Example 1 with Block

use of net.minecraft.server.v1_12_R1.Block in project acidisland by tastybento.

the class NMSHandler method setFlowerPotBlock.

/* (non-Javadoc)
     * @see com.wasteofplastic.askyblock.nms.NMSAbstraction#setBlock(org.bukkit.block.Block, org.bukkit.inventory.ItemStack)
     */
@Override
public void setFlowerPotBlock(final Block block, final ItemStack itemStack) {
    if (block.getType().equals(Material.FLOWER_POT)) {
        Location loc = block.getLocation();
        CraftWorld cw = (CraftWorld) block.getWorld();
        BlockPosition bp = new BlockPosition(loc.getX(), loc.getY(), loc.getZ());
        TileEntityFlowerPot te = (TileEntityFlowerPot) cw.getHandle().getTileEntity(bp);
        // Bukkit.getLogger().info("Debug: flowerpot materialdata = " + (new ItemStack(potItem, 1,(short) potItemData).toString()));
        net.minecraft.server.v1_12_R1.ItemStack cis = CraftItemStack.asNMSCopy(itemStack);
        te.setContents(cis);
        te.update();
    }
}
Also used : BlockPosition(net.minecraft.server.v1_12_R1.BlockPosition) TileEntityFlowerPot(net.minecraft.server.v1_12_R1.TileEntityFlowerPot) CraftWorld(org.bukkit.craftbukkit.v1_12_R1.CraftWorld) Location(org.bukkit.Location)

Example 2 with Block

use of net.minecraft.server.v1_12_R1.Block in project solinia3-core by mixxit.

the class ItemStackAdapter method generateWeaponAbilityLoreText.

private static Collection<String> generateWeaponAbilityLoreText(ISoliniaItem soliniaItem) {
    List<String> loreTxt = new ArrayList<String>();
    ISoliniaSpell spell;
    try {
        spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getWeaponabilityid());
        loreTxt.add(ChatColor.WHITE + "Chance to Proc on Hit: " + ChatColor.YELLOW + spell.getName() + ChatColor.RESET);
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return loreTxt;
}
Also used : ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ArrayList(java.util.ArrayList) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString)

Example 3 with Block

use of net.minecraft.server.v1_12_R1.Block in project solinia3-core by mixxit.

the class ItemStackAdapter method generateSpellLoreText.

private static List<String> generateSpellLoreText(ISoliniaItem soliniaItem) {
    List<String> loreTxt = new ArrayList<String>();
    ISoliniaSpell spell;
    try {
        spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getAbilityid());
        if (spell.getEffectid1() != 254 && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid1()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue1() == 0) && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue1() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid1()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid2() != 254 && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid2()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue2() == 0) && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue2() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid2()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid3() != 254 && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid3()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue3() == 0) && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue3() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid3()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid4() != 254 && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid4()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue4() == 0) && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue4() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid4()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid5() != 254 && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid5()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue5() == 0) && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue5() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid5()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid6() != 254 && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid6()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue6() == 0) && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue6() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid6()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid7() != 254 && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid7()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue7() == 0) && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue7() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid7()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid8() != 254 && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid8()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue8() == 0) && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue8() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid8()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid9() != 254 && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid9()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue9() == 0) && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue9() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid9()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid10() != 254 && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid10()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue10() == 0) && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue10() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid10()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid11() != 254 && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid11()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue11() == 0) && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue11() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid11()).name() + ChatColor.RESET);
        }
        if (spell.getEffectid12() != 254 && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("LIMIT_") && !(Utils.getSpellEffectType(spell.getEffectid12()).equals(SpellEffectType.CHA) && spell.getEffectBaseValue12() == 0) && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("StackingCommand_")) {
            String pos = "+";
            if (spell.getEffectBaseValue12() < 0)
                pos = "-";
            loreTxt.add(ChatColor.WHITE + "Effect: " + ChatColor.YELLOW + pos + Utils.getSpellEffectType(spell.getEffectid12()).name() + ChatColor.RESET);
        }
        loreTxt.add(ChatColor.WHITE + "Mana/Power: " + ChatColor.YELLOW + spell.getMana() + ChatColor.RESET);
        loreTxt.add(ChatColor.WHITE + "Spell Skill: " + ChatColor.YELLOW + Utils.getSkillType(spell.getSkill()).name().toUpperCase() + ChatColor.RESET);
        loreTxt.add(ChatColor.WHITE + "Range: " + ChatColor.YELLOW + spell.getRange() + ChatColor.RESET);
        if (spell.isAASpell()) {
            loreTxt.add(ChatColor.WHITE + "This spell is an AA spell" + ChatColor.RESET);
        }
        if (spell.isBuffSpell() && spell.getBuffduration() > 0) {
            loreTxt.add(ChatColor.WHITE + "Buff Duration: " + ChatColor.YELLOW + (spell.getBuffduration() * 6) + " seconds" + ChatColor.RESET);
        }
        loreTxt.add(ChatColor.WHITE + "Target Type: " + ChatColor.YELLOW + Utils.getSpellTargetType(spell.getTargettype()).name() + ChatColor.RESET);
        String classesBuilder = "";
        List<SoliniaSpellClass> allowedSpellClasses = spell.getAllowedClasses();
        int rowcount = 0;
        for (SoliniaSpellClass spellclass : allowedSpellClasses) {
            if (StateManager.getInstance().getConfigurationManager().getClassObj(spellclass.getClassname().toUpperCase()) == null)
                continue;
            classesBuilder += ChatColor.WHITE + spellclass.getClassname() + " (" + ChatColor.YELLOW + spellclass.getMinlevel() + ChatColor.WHITE + ") " + ChatColor.RESET;
            rowcount++;
            if (rowcount > 2) {
                loreTxt.add(classesBuilder);
                classesBuilder = "";
            }
        }
        // If we never reached 2 classes on a row, handle the overspill here
        if (!classesBuilder.equals(""))
            loreTxt.add(classesBuilder);
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return loreTxt;
}
Also used : ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ArrayList(java.util.ArrayList) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString) SoliniaSpellClass(com.solinia.solinia.Models.SoliniaSpellClass)

Example 4 with Block

use of net.minecraft.server.v1_12_R1.Block in project solinia3-core by mixxit.

the class ItemStackAdapter method generateConsumableAbilityLoreText.

private static Collection<String> generateConsumableAbilityLoreText(ISoliniaItem soliniaItem) {
    List<String> loreTxt = new ArrayList<String>();
    ISoliniaSpell spell;
    String consumable = "";
    if (soliniaItem.isConsumable()) {
        consumable += "Consumable ";
    }
    try {
        spell = StateManager.getInstance().getConfigurationManager().getSpell(soliniaItem.getAbilityid());
        if (spell.getEffectid1() != 254 && !Utils.getSpellEffectType(spell.getEffectid1()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid1()).name() + "(" + spell.getEffectBaseValue1() + ")" + ChatColor.RESET);
        if (spell.getEffectid2() != 254 && !Utils.getSpellEffectType(spell.getEffectid2()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid2()).name() + "(" + spell.getEffectBaseValue2() + ")" + ChatColor.RESET);
        if (spell.getEffectid3() != 254 && !Utils.getSpellEffectType(spell.getEffectid3()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid3()).name() + "(" + spell.getEffectBaseValue3() + ")" + ChatColor.RESET);
        if (spell.getEffectid4() != 254 && !Utils.getSpellEffectType(spell.getEffectid4()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid4()).name() + "(" + spell.getEffectBaseValue4() + ")" + ChatColor.RESET);
        if (spell.getEffectid5() != 254 && !Utils.getSpellEffectType(spell.getEffectid5()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid5()).name() + "(" + spell.getEffectBaseValue5() + ")" + ChatColor.RESET);
        if (spell.getEffectid6() != 254 && !Utils.getSpellEffectType(spell.getEffectid6()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid6()).name() + "(" + spell.getEffectBaseValue6() + ")" + ChatColor.RESET);
        if (spell.getEffectid7() != 254 && !Utils.getSpellEffectType(spell.getEffectid7()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid7()).name() + "(" + spell.getEffectBaseValue7() + ")" + ChatColor.RESET);
        if (spell.getEffectid8() != 254 && !Utils.getSpellEffectType(spell.getEffectid8()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid8()).name() + "(" + spell.getEffectBaseValue8() + ")" + ChatColor.RESET);
        if (spell.getEffectid9() != 254 && !Utils.getSpellEffectType(spell.getEffectid9()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid9()).name() + "(" + spell.getEffectBaseValue9() + ")" + ChatColor.RESET);
        if (spell.getEffectid10() != 254 && !Utils.getSpellEffectType(spell.getEffectid10()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid10()).name() + "(" + spell.getEffectBaseValue10() + ")" + ChatColor.RESET);
        if (spell.getEffectid11() != 254 && !Utils.getSpellEffectType(spell.getEffectid11()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid11()).name() + "(" + spell.getEffectBaseValue11() + ")" + ChatColor.RESET);
        if (spell.getEffectid12() != 254 && !Utils.getSpellEffectType(spell.getEffectid12()).name().contains("LIMIT_"))
            loreTxt.add(ChatColor.WHITE + consumable + "Ability: " + ChatColor.YELLOW + Utils.getSpellEffectType(spell.getEffectid12()).name() + "(" + spell.getEffectBaseValue12() + ")" + ChatColor.RESET);
        if (spell.isBuffSpell() && spell.getBuffduration() > 0) {
            loreTxt.add(ChatColor.WHITE + consumable + "Buff Duration: " + ChatColor.YELLOW + (spell.getBuffduration() * 6) + " seconds" + ChatColor.RESET);
        }
    } catch (CoreStateInitException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return loreTxt;
}
Also used : ISoliniaSpell(com.solinia.solinia.Interfaces.ISoliniaSpell) CoreStateInitException(com.solinia.solinia.Exceptions.CoreStateInitException) ArrayList(java.util.ArrayList) NBTTagString(net.minecraft.server.v1_12_R1.NBTTagString)

Example 5 with Block

use of net.minecraft.server.v1_12_R1.Block in project Ublisk by Derkades.

the class PlayerInteract method staffTool.

@SuppressWarnings("deprecation")
@EventHandler(priority = EventPriority.LOW)
public void staffTool(PlayerInteractEvent event) {
    ItemStack itemInHand = event.getPlayer().getInventory().getItemInMainHand();
    if (itemInHand.getType() != Material.COAL_ORE || event.getAction() != Action.RIGHT_CLICK_BLOCK) {
        return;
    }
    Player player = event.getPlayer();
    String itemName = itemInHand.getItemMeta().getDisplayName();
    final Block block = event.getClickedBlock();
    event.setCancelled(true);
    if (itemName == null) {
        sendStaffToolInfoMessage(player);
        return;
    }
    if (itemName.contains("farmland")) {
        block.setType(Material.SOIL);
        block.setData((byte) 7);
        Location loc = block.getLocation();
        Block wheat = new Location(Var.WORLD, loc.getX(), loc.getY() + 1, loc.getZ()).getBlock();
        wheat.setType(Material.CROPS);
        wheat.setData((byte) 7);
    } else if (itemName.contains("invis")) {
        block.setData((byte) 0);
        block.setType(Material.PISTON_MOVING_PIECE);
        event.getPlayer().sendMessage("Placed invisible block. To remove invisible block, type /u rinv while standing inside an invisible block.");
    } else if (itemName.contains("coal")) {
        block.setType(Material.GLASS);
        new URunnable() {

            public void run() {
                block.setType(Material.COAL_ORE);
            }
        }.runLater(1 * 20);
    } else if (itemName.contains("lighting")) {
        Chunk chunk = ((CraftChunk) block.getChunk()).getHandle();
        chunk.initLighting();
    } else {
        sendStaffToolInfoMessage(player);
    }
}
Also used : URunnable(xyz.derkades.ublisk.utils.URunnable) UPlayer(xyz.derkades.ublisk.utils.UPlayer) Player(org.bukkit.entity.Player) Block(org.bukkit.block.Block) FallingBlock(org.bukkit.entity.FallingBlock) ItemStack(org.bukkit.inventory.ItemStack) Chunk(net.minecraft.server.v1_12_R1.Chunk) CraftChunk(org.bukkit.craftbukkit.v1_12_R1.CraftChunk) Location(org.bukkit.Location) EventHandler(org.bukkit.event.EventHandler)

Aggregations

BlockPosition (net.minecraft.server.v1_12_R1.BlockPosition)12 Block (net.minecraft.server.v1_10_R1.Block)7 Block (net.minecraft.server.v1_11_R1.Block)7 Block (net.minecraft.server.v1_12_R1.Block)7 BlockPosition (net.minecraft.server.v1_10_R1.BlockPosition)6 BlockPosition (net.minecraft.server.v1_11_R1.BlockPosition)6 Block (net.minecraft.server.v1_8_R3.Block)6 CoreStateInitException (com.solinia.solinia.Exceptions.CoreStateInitException)5 ArrayList (java.util.ArrayList)5 CraftWorld (org.bukkit.craftbukkit.v1_12_R1.CraftWorld)5 FallingBlock (org.bukkit.entity.FallingBlock)5 ISoliniaSpell (com.solinia.solinia.Interfaces.ISoliniaSpell)4 PathPoint (net.minecraft.server.v1_11_R1.PathPoint)4 IBlockData (net.minecraft.server.v1_12_R1.IBlockData)4 BlockPosition (net.minecraft.server.v1_8_R3.BlockPosition)4 PathPoint (net.minecraft.server.v1_10_R1.PathPoint)3 MutableBlockPosition (net.minecraft.server.v1_11_R1.BlockPosition.MutableBlockPosition)3 MutableBlockPosition (net.minecraft.server.v1_12_R1.BlockPosition.MutableBlockPosition)3 NBTTagString (net.minecraft.server.v1_12_R1.NBTTagString)3 PathPoint (net.minecraft.server.v1_12_R1.PathPoint)3