file_name
stringlengths 6
86
| file_path
stringlengths 45
249
| content
stringlengths 47
6.26M
| file_size
int64 47
6.26M
| language
stringclasses 1
value | extension
stringclasses 1
value | repo_name
stringclasses 767
values | repo_stars
int64 8
14.4k
| repo_forks
int64 0
1.17k
| repo_open_issues
int64 0
788
| repo_created_at
stringclasses 767
values | repo_pushed_at
stringclasses 767
values |
---|---|---|---|---|---|---|---|---|---|---|---|
ItemChickenRaw.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemChickenRaw.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemChickenRaw extends ItemEdible {
public ItemChickenRaw() {
this(0, 1);
}
public ItemChickenRaw(Integer meta) {
this(meta, 1);
}
public ItemChickenRaw(Integer meta, int count) {
super(RAW_CHICKEN, meta, count, "Raw Chicken");
}
}
| 370 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecord13.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecord13.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecord13 extends ItemRecord {
public ItemRecord13() {
this(0, 1);
}
public ItemRecord13(Integer meta) {
this(meta, 1);
}
public ItemRecord13(Integer meta, int count) {
super(RECORD_13, meta, count);
}
@Override
public String getSoundId() {
return "record.13";
}
}
| 409 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemItemFrame.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemItemFrame.java | package cn.nukkit.item;
import cn.nukkit.block.BlockItemFrame;
/**
* Created by Pub4Game on 03.07.2016.
*/
public class ItemItemFrame extends Item {
public ItemItemFrame() {
this(0, 1);
}
public ItemItemFrame(Integer meta) {
this(meta, 1);
}
public ItemItemFrame(Integer meta, int count) {
super(ITEM_FRAME, meta, count, "Item Frame");
this.block = new BlockItemFrame();
}
}
| 438 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMuttonRaw.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMuttonRaw.java | package cn.nukkit.item;
public class ItemMuttonRaw extends ItemEdible {
public ItemMuttonRaw() {
this(0, 1);
}
public ItemMuttonRaw(Integer meta) {
this(meta, 1);
}
public ItemMuttonRaw(Integer meta, int count) {
super(RAW_MUTTON, meta, count, "Raw Mutton");
}
}
| 315 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
Item.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/Item.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.Server;
import cn.nukkit.block.Block;
import cn.nukkit.block.BlockAir;
import cn.nukkit.entity.Entity;
import cn.nukkit.inventory.Fuel;
import cn.nukkit.item.enchantment.Enchantment;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.math.Vector3;
import cn.nukkit.nbt.NBTIO;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.ListTag;
import cn.nukkit.nbt.tag.StringTag;
import cn.nukkit.nbt.tag.Tag;
import cn.nukkit.utils.Binary;
import cn.nukkit.utils.Config;
import cn.nukkit.utils.MainLogger;
import cn.nukkit.utils.Utils;
import java.io.File;
import java.io.IOException;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class Item implements Cloneable {
//All Block IDs are here too
public static final int AIR = 0;
public static final int STONE = 1;
public static final int GRASS = 2;
public static final int DIRT = 3;
public static final int COBBLESTONE = 4;
public static final int COBBLE = 4;
public static final int PLANK = 5;
public static final int PLANKS = 5;
public static final int WOODEN_PLANK = 5;
public static final int WOODEN_PLANKS = 5;
public static final int SAPLING = 6;
public static final int SAPLINGS = 6;
public static final int BEDROCK = 7;
public static final int WATER = 8;
public static final int STILL_WATER = 9;
public static final int LAVA = 10;
public static final int STILL_LAVA = 11;
public static final int SAND = 12;
public static final int GRAVEL = 13;
public static final int GOLD_ORE = 14;
public static final int IRON_ORE = 15;
public static final int COAL_ORE = 16;
public static final int LOG = 17;
public static final int WOOD = 17;
public static final int TRUNK = 17;
public static final int LEAVES = 18;
public static final int LEAVE = 18;
public static final int SPONGE = 19;
public static final int GLASS = 20;
public static final int LAPIS_ORE = 21;
public static final int LAPIS_BLOCK = 22;
public static final int DISPENSER = 23;
public static final int SANDSTONE = 24;
public static final int NOTEBLOCK = 25;
public static final int BED_BLOCK = 26;
public static final int POWERED_RAIL = 27;
public static final int DETECTOR_RAIL = 28;
public static final int STICKY_PISTON = 29;
public static final int COBWEB = 30;
public static final int TALL_GRASS = 31;
public static final int BUSH = 32;
public static final int DEAD_BUSH = 32;
public static final int PISTON = 33;
public static final int PISTON_HEAD = 34;
public static final int WOOL = 35;
public static final int DANDELION = 37;
public static final int POPPY = 38;
public static final int ROSE = 38;
public static final int FLOWER = 38;
public static final int RED_FLOWER = 38;
public static final int BROWN_MUSHROOM = 39;
public static final int RED_MUSHROOM = 40;
public static final int GOLD_BLOCK = 41;
public static final int IRON_BLOCK = 42;
public static final int DOUBLE_SLAB = 43;
public static final int DOUBLE_STONE_SLAB = 43;
public static final int DOUBLE_SLABS = 43;
public static final int SLAB = 44;
public static final int STONE_SLAB = 44;
public static final int SLABS = 44;
public static final int BRICKS = 45;
public static final int BRICKS_BLOCK = 45;
public static final int TNT = 46;
public static final int BOOKSHELF = 47;
public static final int MOSS_STONE = 48;
public static final int MOSSY_STONE = 48;
public static final int OBSIDIAN = 49;
public static final int TORCH = 50;
public static final int FIRE = 51;
public static final int MONSTER_SPAWNER = 52;
public static final int WOOD_STAIRS = 53;
public static final int WOODEN_STAIRS = 53;
public static final int OAK_WOOD_STAIRS = 53;
public static final int OAK_WOODEN_STAIRS = 53;
public static final int CHEST = 54;
public static final int REDSTONE_WIRE = 55;
public static final int DIAMOND_ORE = 56;
public static final int DIAMOND_BLOCK = 57;
public static final int CRAFTING_TABLE = 58;
public static final int WORKBENCH = 58;
public static final int WHEAT_BLOCK = 59;
public static final int FARMLAND = 60;
public static final int FURNACE = 61;
public static final int BURNING_FURNACE = 62;
public static final int LIT_FURNACE = 62;
public static final int SIGN_POST = 63;
public static final int DOOR_BLOCK = 64;
public static final int WOODEN_DOOR_BLOCK = 64;
public static final int WOOD_DOOR_BLOCK = 64;
public static final int LADDER = 65;
public static final int RAIL = 66;
public static final int COBBLE_STAIRS = 67;
public static final int COBBLESTONE_STAIRS = 67;
public static final int WALL_SIGN = 68;
public static final int LEVER = 69;
public static final int STONE_PRESSURE_PLATE = 70;
public static final int IRON_DOOR_BLOCK = 71;
public static final int WOODEN_PRESSURE_PLATE = 72;
public static final int REDSTONE_ORE = 73;
public static final int GLOWING_REDSTONE_ORE = 74;
public static final int LIT_REDSTONE_ORE = 74;
public static final int UNLIT_REDSTONE_TORCH = 75;
public static final int REDSTONE_TORCH = 76;
public static final int STONE_BUTTON = 77;
public static final int SNOW = 78;
public static final int SNOW_LAYER = 78;
public static final int ICE = 79;
public static final int SNOW_BLOCK = 80;
public static final int CACTUS = 81;
public static final int CLAY_BLOCK = 82;
public static final int REEDS = 83;
public static final int SUGARCANE_BLOCK = 83;
public static final int JUKEBOX = 84;
public static final int FENCE = 85;
public static final int PUMPKIN = 86;
public static final int NETHERRACK = 87;
public static final int SOUL_SAND = 88;
public static final int GLOWSTONE = 89;
public static final int GLOWSTONE_BLOCK = 89;
public static final int NETHER_PORTAL = 90;
public static final int LIT_PUMPKIN = 91;
public static final int JACK_O_LANTERN = 91;
public static final int CAKE_BLOCK = 92;
public static final int UNPOWERED_REPEATER = 93;
public static final int POWERED_REPEATER = 94;
public static final int INVISIBLE_BEDROCK = 95;
public static final int TRAPDOOR = 96;
public static final int MONSTER_EGG = 97;
public static final int STONE_BRICKS = 98;
public static final int STONE_BRICK = 98;
public static final int BROWN_MUSHROOM_BLOCK = 99;
public static final int RED_MUSHROOM_BLOCK = 100;
public static final int IRON_BAR = 101;
public static final int IRON_BARS = 101;
public static final int GLASS_PANE = 102;
public static final int GLASS_PANEL = 102;
public static final int MELON_BLOCK = 103;
public static final int PUMPKIN_STEM = 104;
public static final int MELON_STEM = 105;
public static final int VINE = 106;
public static final int VINES = 106;
public static final int FENCE_GATE = 107;
public static final int FENCE_GATE_OAK = 107;
public static final int BRICK_STAIRS = 108;
public static final int STONE_BRICK_STAIRS = 109;
public static final int MYCELIUM = 110;
public static final int WATER_LILY = 111;
public static final int LILY_PAD = 111;
public static final int NETHER_BRICKS = 112;
public static final int NETHER_BRICK_BLOCK = 112;
public static final int NETHER_BRICK_FENCE = 113;
public static final int NETHER_BRICKS_STAIRS = 114;
public static final int NETHER_WART_BLOCK = 115;
public static final int ENCHANTING_TABLE = 116;
public static final int ENCHANT_TABLE = 116;
public static final int ENCHANTMENT_TABLE = 116;
public static final int BREWING_STAND_BLOCK = 117;
public static final int BREWING_BLOCK = 117;
public static final int CAULDRON_BLOCK = 118;
public static final int END_PORTAL = 119;
public static final int END_PORTAL_FRAME = 120;
public static final int END_STONE = 121;
public static final int DRAGON_EGG = 122;
public static final int REDSTONE_LAMP = 123;
public static final int LIT_REDSTONE_LAMP = 124;
public static final int DROPPER = 125;
public static final int ACTIVATOR_RAIL = 126;
public static final int COCOA = 127;
public static final int COCOA_BLOCK = 127;
public static final int SANDSTONE_STAIRS = 128;
public static final int EMERALD_ORE = 129;
public static final int ENDER_CHEST = 130;
public static final int TRIPWIRE_HOOK = 131;
public static final int TRIPWIRE = 132;
public static final int EMERALD_BLOCK = 133;
public static final int SPRUCE_WOOD_STAIRS = 134;
public static final int SPRUCE_WOODEN_STAIRS = 134;
public static final int BIRCH_WOOD_STAIRS = 135;
public static final int BIRCH_WOODEN_STAIRS = 135;
public static final int JUNGLE_WOOD_STAIRS = 136;
public static final int JUNGLE_WOODEN_STAIRS = 136;
public static final int BEACON = 138;
public static final int COBBLE_WALL = 139;
public static final int STONE_WALL = 139;
public static final int COBBLESTONE_WALL = 139;
public static final int FLOWER_POT_BLOCK = 140;
public static final int CARROT_BLOCK = 141;
public static final int POTATO_BLOCK = 142;
public static final int WOODEN_BUTTON = 143;
public static final int SKULL_BLOCK = 144;
public static final int ANVIL = 145;
public static final int TRAPPED_CHEST = 146;
public static final int LIGHT_WEIGHTED_PRESSURE_PLATE = 147;
public static final int HEAVY_WEIGHTED_PRESSURE_PLATE = 148;
public static final int UNPOWERED_COMPARATOR = 149;
public static final int POWERED_COMPARATOR = 150;
public static final int DAYLIGHT_DETECTOR = 151;
public static final int REDSTONE_BLOCK = 152;
public static final int QUARTZ_ORE = 153;
public static final int HOPPER_BLOCK = 154;
public static final int QUARTZ_BLOCK = 155;
public static final int QUARTZ_STAIRS = 156;
public static final int DOUBLE_WOOD_SLAB = 157;
public static final int DOUBLE_WOODEN_SLAB = 157;
public static final int DOUBLE_WOOD_SLABS = 157;
public static final int DOUBLE_WOODEN_SLABS = 157;
public static final int WOOD_SLAB = 158;
public static final int WOODEN_SLAB = 158;
public static final int WOOD_SLABS = 158;
public static final int WOODEN_SLABS = 158;
public static final int STAINED_TERRACOTTA = 159;
public static final int STAINED_HARDENED_CLAY = 159;
public static final int STAINED_GLASS_PANE = 160;
public static final int LEAVES2 = 161;
public static final int LEAVE2 = 161;
public static final int WOOD2 = 162;
public static final int TRUNK2 = 162;
public static final int LOG2 = 162;
public static final int ACACIA_WOOD_STAIRS = 163;
public static final int ACACIA_WOODEN_STAIRS = 163;
public static final int DARK_OAK_WOOD_STAIRS = 164;
public static final int DARK_OAK_WOODEN_STAIRS = 164;
public static final int SLIME_BLOCK = 165;
public static final int IRON_TRAPDOOR = 167;
public static final int PRISMARINE = 168;
public static final int SEA_LANTERN = 169;
public static final int HAY_BALE = 170;
public static final int CARPET = 171;
public static final int TERRACOTTA = 172;
public static final int COAL_BLOCK = 173;
public static final int PACKED_ICE = 174;
public static final int DOUBLE_PLANT = 175;
public static final int DAYLIGHT_DETECTOR_INVERTED = 178;
public static final int RED_SANDSTONE = 179;
public static final int RED_SANDSTONE_STAIRS = 180;
public static final int DOUBLE_RED_SANDSTONE_SLAB = 181;
public static final int RED_SANDSTONE_SLAB = 182;
public static final int FENCE_GATE_SPRUCE = 183;
public static final int FENCE_GATE_BIRCH = 184;
public static final int FENCE_GATE_JUNGLE = 185;
public static final int FENCE_GATE_DARK_OAK = 186;
public static final int FENCE_GATE_ACACIA = 187;
public static final int SPRUCE_DOOR_BLOCK = 193;
public static final int BIRCH_DOOR_BLOCK = 194;
public static final int JUNGLE_DOOR_BLOCK = 195;
public static final int ACACIA_DOOR_BLOCK = 196;
public static final int DARK_OAK_DOOR_BLOCK = 197;
public static final int GRASS_PATH = 198;
public static final int ITEM_FRAME_BLOCK = 199;
public static final int CHORUS_FLOWER = 200;
public static final int PURPUR_BLOCK = 201;
public static final int PURPUR_STAIRS = 203;
public static final int END_BRICKS = 206;
public static final int END_ROD = 208;
public static final int END_GATEWAY = 209;
public static final int MAGMA = 213;
public static final int BLOCK_NETHER_WART_BLOCK = 214;
public static final int RED_NETHER_BRICK = 215;
public static final int BONE_BLOCK = 216;
public static final int SHULKER_BOX = 218;
public static final int PURPLE_GLAZED_TERRACOTTA = 219;
public static final int WHITE_GLAZED_TERRACOTTA = 220;
public static final int ORANGE_GLAZED_TERRACOTTA = 221;
public static final int MAGENTA_GLAZED_TERRACOTTA = 222;
public static final int LIGHT_BLUE_GLAZED_TERRACOTTA = 223;
public static final int YELLOW_GLAZED_TERRACOTTA = 224;
public static final int LIME_GLAZED_TERRACOTTA = 225;
public static final int PINK_GLAZED_TERRACOTTA = 226;
public static final int GRAY_GLAZED_TERRACOTTA = 227;
public static final int SILVER_GLAZED_TERRACOTTA = 228;
public static final int CYAN_GLAZED_TERRACOTTA = 229;
public static final int BLUE_GLAZED_TERRACOTTA = 231;
public static final int BROWN_GLAZED_TERRACOTTA = 232;
public static final int GREEN_GLAZED_TERRACOTTA = 233;
public static final int RED_GLAZED_TERRACOTTA = 234;
public static final int BLACK_GLAZED_TERRACOTTA = 235;
public static final int CONCRETE = 236;
public static final int CONCRETE_POWDER = 237;
public static final int CHORUS_PLANT = 240;
public static final int STAINED_GLASS = 241;
public static final int PODZOL = 243;
public static final int BEETROOT_BLOCK = 244;
public static final int STONECUTTER = 245;
public static final int GLOWING_OBSIDIAN = 246;
public static final int NETHER_REACTOR = 247; //Should not be removed
public static final int PISTON_EXTENSION = 250;
public static final int OBSERVER = 251;
//Normal Item IDs
public static final int IRON_SHOVEL = 256;
public static final int IRON_PICKAXE = 257;
public static final int IRON_AXE = 258;
public static final int FLINT_STEEL = 259;
public static final int FLINT_AND_STEEL = 259;
public static final int APPLE = 260;
public static final int BOW = 261;
public static final int ARROW = 262;
public static final int COAL = 263;
public static final int DIAMOND = 264;
public static final int IRON_INGOT = 265;
public static final int GOLD_INGOT = 266;
public static final int IRON_SWORD = 267;
public static final int WOODEN_SWORD = 268;
public static final int WOODEN_SHOVEL = 269;
public static final int WOODEN_PICKAXE = 270;
public static final int WOODEN_AXE = 271;
public static final int STONE_SWORD = 272;
public static final int STONE_SHOVEL = 273;
public static final int STONE_PICKAXE = 274;
public static final int STONE_AXE = 275;
public static final int DIAMOND_SWORD = 276;
public static final int DIAMOND_SHOVEL = 277;
public static final int DIAMOND_PICKAXE = 278;
public static final int DIAMOND_AXE = 279;
public static final int STICK = 280;
public static final int STICKS = 280;
public static final int BOWL = 281;
public static final int MUSHROOM_STEW = 282;
public static final int GOLD_SWORD = 283;
public static final int GOLDEN_SWORD = 283;
public static final int GOLD_SHOVEL = 284;
public static final int GOLDEN_SHOVEL = 284;
public static final int GOLD_PICKAXE = 285;
public static final int GOLDEN_PICKAXE = 285;
public static final int GOLD_AXE = 286;
public static final int GOLDEN_AXE = 286;
public static final int STRING = 287;
public static final int FEATHER = 288;
public static final int GUNPOWDER = 289;
public static final int WOODEN_HOE = 290;
public static final int STONE_HOE = 291;
public static final int IRON_HOE = 292;
public static final int DIAMOND_HOE = 293;
public static final int GOLD_HOE = 294;
public static final int GOLDEN_HOE = 294;
public static final int SEEDS = 295;
public static final int WHEAT_SEEDS = 295;
public static final int WHEAT = 296;
public static final int BREAD = 297;
public static final int LEATHER_CAP = 298;
public static final int LEATHER_TUNIC = 299;
public static final int LEATHER_PANTS = 300;
public static final int LEATHER_BOOTS = 301;
public static final int CHAIN_HELMET = 302;
public static final int CHAIN_CHESTPLATE = 303;
public static final int CHAIN_LEGGINGS = 304;
public static final int CHAIN_BOOTS = 305;
public static final int IRON_HELMET = 306;
public static final int IRON_CHESTPLATE = 307;
public static final int IRON_LEGGINGS = 308;
public static final int IRON_BOOTS = 309;
public static final int DIAMOND_HELMET = 310;
public static final int DIAMOND_CHESTPLATE = 311;
public static final int DIAMOND_LEGGINGS = 312;
public static final int DIAMOND_BOOTS = 313;
public static final int GOLD_HELMET = 314;
public static final int GOLD_CHESTPLATE = 315;
public static final int GOLD_LEGGINGS = 316;
public static final int GOLD_BOOTS = 317;
public static final int FLINT = 318;
public static final int RAW_PORKCHOP = 319;
public static final int COOKED_PORKCHOP = 320;
public static final int PAINTING = 321;
public static final int GOLDEN_APPLE = 322;
public static final int SIGN = 323;
public static final int WOODEN_DOOR = 324;
public static final int BUCKET = 325;
public static final int MINECART = 328;
public static final int SADDLE = 329;
public static final int IRON_DOOR = 330;
public static final int REDSTONE = 331;
public static final int REDSTONE_DUST = 331;
public static final int SNOWBALL = 332;
public static final int BOAT = 333;
public static final int LEATHER = 334;
public static final int BRICK = 336;
public static final int CLAY = 337;
public static final int SUGARCANE = 338;
public static final int SUGAR_CANE = 338;
public static final int SUGAR_CANES = 338;
public static final int PAPER = 339;
public static final int BOOK = 340;
public static final int SLIMEBALL = 341;
public static final int MINECART_WITH_CHEST = 342;
public static final int EGG = 344;
public static final int COMPASS = 345;
public static final int FISHING_ROD = 346;
public static final int CLOCK = 347;
public static final int GLOWSTONE_DUST = 348;
public static final int RAW_FISH = 349;
public static final int COOKED_FISH = 350;
public static final int DYE = 351;
public static final int BONE = 352;
public static final int SUGAR = 353;
public static final int CAKE = 354;
public static final int BED = 355;
public static final int REPEATER = 356;
public static final int COOKIE = 357;
public static final int MAP = 358;
public static final int SHEARS = 359;
public static final int MELON = 360;
public static final int MELON_SLICE = 360;
public static final int PUMPKIN_SEEDS = 361;
public static final int MELON_SEEDS = 362;
public static final int RAW_BEEF = 363;
public static final int STEAK = 364;
public static final int COOKED_BEEF = 364;
public static final int RAW_CHICKEN = 365;
public static final int COOKED_CHICKEN = 366;
public static final int ROTTEN_FLESH = 367;
public static final int ENDER_PEARL = 368;
public static final int BLAZE_ROD = 369;
public static final int GHAST_TEAR = 370;
public static final int GOLD_NUGGET = 371;
public static final int GOLDEN_NUGGET = 371;
public static final int NETHER_WART = 372;
public static final int POTION = 373;
public static final int GLASS_BOTTLE = 374;
public static final int BOTTLE = 374;
public static final int SPIDER_EYE = 375;
public static final int FERMENTED_SPIDER_EYE = 376;
public static final int BLAZE_POWDER = 377;
public static final int MAGMA_CREAM = 378;
public static final int BREWING_STAND = 379;
public static final int BREWING = 379;
public static final int CAULDRON = 380;
public static final int ENDER_EYE = 381;
public static final int GLISTERING_MELON = 382;
public static final int SPAWN_EGG = 383;
public static final int EXPERIENCE_BOTTLE = 384;
public static final int FIRE_CHARGE = 385;
public static final int BOOK_AND_QUILL = 386;
public static final int WRITTEN_BOOK = 387;
public static final int EMERALD = 388;
public static final int ITEM_FRAME = 389;
public static final int FLOWER_POT = 390;
public static final int CARROT = 391;
public static final int CARROTS = 391;
public static final int POTATO = 392;
public static final int POTATOES = 392;
public static final int BAKED_POTATO = 393;
public static final int BAKED_POTATOES = 393;
public static final int POISONOUS_POTATO = 394;
public static final int EMPTY_MAP = 395;
public static final int GOLDEN_CARROT = 396;
public static final int SKULL = 397;
public static final int CARROT_ON_A_STICK = 398;
public static final int NETHER_STAR = 399;
public static final int PUMPKIN_PIE = 400;
public static final int ENCHANTED_BOOK = 403;
public static final int ENCHANT_BOOK = 403;
public static final int COMPARATOR = 404;
public static final int NETHER_BRICK = 405;
public static final int QUARTZ = 406;
public static final int NETHER_QUARTZ = 406;
public static final int MINECART_WITH_TNT = 407;
public static final int MINECART_WITH_HOPPER = 408;
public static final int PRISMARINE_SHARD = 409;
public static final int HOPPER = 410;
public static final int RAW_RABBIT = 411;
public static final int COOKED_RABBIT = 412;
public static final int RABBIT_STEW = 413;
public static final int RABBIT_FOOT = 414;
public static final int RABBIT_HIDE = 415;
public static final int LEATHER_HORSE_ARMOR = 416;
public static final int IRON_HORSE_ARMOR = 417;
public static final int GOLD_HORSE_ARMOR = 418;
public static final int DIAMOND_HORSE_ARMOR = 419;
public static final int LEAD = 420;
public static final int NAME_TAG = 421;
public static final int PRISMARINE_CRYSTALS = 422;
public static final int RAW_MUTTON = 423;
public static final int COOKED_MUTTON = 424;
public static final int END_CRYSTAL = 426;
public static final int SPRUCE_DOOR = 427;
public static final int BIRCH_DOOR = 428;
public static final int JUNGLE_DOOR = 429;
public static final int ACACIA_DOOR = 430;
public static final int DARK_OAK_DOOR = 431;
public static final int CHORUS_FRUIT = 432;
public static final int POPPED_CHORUS_FRUIT = 433;
public static final int DRAGON_BREATH = 437;
public static final int SPLASH_POTION = 438;
public static final int LINGERING_POTION = 441;
public static final int ELYTRA = 444;
public static final int SHULKER_SHELL = 445;
public static final int BEETROOT = 457;
public static final int BEETROOT_SEEDS = 458;
public static final int BEETROOT_SEED = 458;
public static final int BEETROOT_SOUP = 459;
public static final int RAW_SALMON = 460;
public static final int CLOWNFISH = 461;
public static final int PUFFERFISH = 462;
public static final int COOKED_SALMON = 463;
public static final int GOLDEN_APPLE_ENCHANTED = 466;
public static final int RECORD_13 = 500;
public static final int RECORD_CAT = 501;
public static final int RECORD_BLOCKS = 502;
public static final int RECORD_CHIRP = 503;
public static final int RECORD_FAR = 504;
public static final int RECORD_MALL = 505;
public static final int RECORD_MELLOHI = 506;
public static final int RECORD_STAL = 507;
public static final int RECORD_STRAD = 508;
public static final int RECORD_WARD = 509;
public static final int RECORD_11 = 510;
public static final int RECORD_WAIT = 511;
protected static String UNKNOWN_STR = "Unknown";
public static Class[] list = null;
protected Block block = null;
protected final int id;
protected int meta;
protected boolean hasMeta = true;
private byte[] tags = new byte[0];
private CompoundTag cachedNBT = null;
public int count;
protected int durability = 0;
protected String name;
public Item(int id) {
this(id, 0, 1, UNKNOWN_STR);
}
public Item(int id, Integer meta) {
this(id, meta, 1, UNKNOWN_STR);
}
public Item(int id, Integer meta, int count) {
this(id, meta, count, UNKNOWN_STR);
}
public Item(int id, Integer meta, int count, String name) {
this.id = id & 0xffff;
if (meta != null && meta >= 0) {
this.meta = meta & 0xffff;
} else {
this.hasMeta = false;
}
this.count = count;
this.name = name;
/*f (this.block != null && this.id <= 0xff && Block.list[id] != null) { //probably useless
this.block = Block.get(this.id, this.meta);
this.name = this.block.getName();
}*/
}
public boolean hasMeta() {
return hasMeta;
}
public boolean canBeActivated() {
return false;
}
public static void init() {
if (list == null) {
list = new Class[65535];
list[IRON_SHOVEL] = ItemShovelIron.class; //256
list[IRON_PICKAXE] = ItemPickaxeIron.class; //257
list[IRON_AXE] = ItemAxeIron.class; //258
list[FLINT_AND_STEEL] = ItemFlintSteel.class; //259
list[APPLE] = ItemApple.class; //260
list[BOW] = ItemBow.class; //261
list[ARROW] = ItemArrow.class; //262
list[COAL] = ItemCoal.class; //263
list[DIAMOND] = ItemDiamond.class; //264
list[IRON_INGOT] = ItemIngotIron.class; //265
list[GOLD_INGOT] = ItemIngotGold.class; //266
list[IRON_SWORD] = ItemSwordIron.class; //267
list[WOODEN_SWORD] = ItemSwordWood.class; //268
list[WOODEN_SHOVEL] = ItemShovelWood.class; //269
list[WOODEN_PICKAXE] = ItemPickaxeWood.class; //270
list[WOODEN_AXE] = ItemAxeWood.class; //271
list[STONE_SWORD] = ItemSwordStone.class; //272
list[STONE_SHOVEL] = ItemShovelStone.class; //273
list[STONE_PICKAXE] = ItemPickaxeStone.class; //274
list[STONE_AXE] = ItemAxeStone.class; //275
list[DIAMOND_SWORD] = ItemSwordDiamond.class; //276
list[DIAMOND_SHOVEL] = ItemShovelDiamond.class; //277
list[DIAMOND_PICKAXE] = ItemPickaxeDiamond.class; //278
list[DIAMOND_AXE] = ItemAxeDiamond.class; //279
list[STICK] = ItemStick.class; //280
list[BOWL] = ItemBowl.class; //281
list[MUSHROOM_STEW] = ItemMushroomStew.class; //282
list[GOLD_SWORD] = ItemSwordGold.class; //283
list[GOLD_SHOVEL] = ItemShovelGold.class; //284
list[GOLD_PICKAXE] = ItemPickaxeGold.class; //285
list[GOLD_AXE] = ItemAxeGold.class; //286
list[STRING] = ItemString.class; //287
list[FEATHER] = ItemFeather.class; //288
list[GUNPOWDER] = ItemGunpowder.class; //289
list[WOODEN_HOE] = ItemHoeWood.class; //290
list[STONE_HOE] = ItemHoeStone.class; //291
list[IRON_HOE] = ItemHoeIron.class; //292
list[DIAMOND_HOE] = ItemHoeDiamond.class; //293
list[GOLD_HOE] = ItemHoeGold.class; //294
list[WHEAT_SEEDS] = ItemSeedsWheat.class; //295
list[WHEAT] = ItemWheat.class; //296
list[BREAD] = ItemBread.class; //297
list[LEATHER_CAP] = ItemHelmetLeather.class; //298
list[LEATHER_TUNIC] = ItemChestplateLeather.class; //299
list[LEATHER_PANTS] = ItemLeggingsLeather.class; //300
list[LEATHER_BOOTS] = ItemBootsLeather.class; //301
list[CHAIN_HELMET] = ItemHelmetChain.class; //302
list[CHAIN_CHESTPLATE] = ItemChestplateChain.class; //303
list[CHAIN_LEGGINGS] = ItemLeggingsChain.class; //304
list[CHAIN_BOOTS] = ItemBootsChain.class; //305
list[IRON_HELMET] = ItemHelmetIron.class; //306
list[IRON_CHESTPLATE] = ItemChestplateIron.class; //307
list[IRON_LEGGINGS] = ItemLeggingsIron.class; //308
list[IRON_BOOTS] = ItemBootsIron.class; //309
list[DIAMOND_HELMET] = ItemHelmetDiamond.class; //310
list[DIAMOND_CHESTPLATE] = ItemChestplateDiamond.class; //311
list[DIAMOND_LEGGINGS] = ItemLeggingsDiamond.class; //312
list[DIAMOND_BOOTS] = ItemBootsDiamond.class; //313
list[GOLD_HELMET] = ItemHelmetGold.class; //314
list[GOLD_CHESTPLATE] = ItemChestplateGold.class; //315
list[GOLD_LEGGINGS] = ItemLeggingsGold.class; //316
list[GOLD_BOOTS] = ItemBootsGold.class; //317
list[FLINT] = ItemFlint.class; //318
list[RAW_PORKCHOP] = ItemPorkchopRaw.class; //319
list[COOKED_PORKCHOP] = ItemPorkchopCooked.class; //320
list[PAINTING] = ItemPainting.class; //321
list[GOLDEN_APPLE] = ItemAppleGold.class; //322
list[SIGN] = ItemSign.class; //323
list[WOODEN_DOOR] = ItemDoorWood.class; //324
list[BUCKET] = ItemBucket.class; //325
list[MINECART] = ItemMinecart.class; //328
list[SADDLE] = ItemSaddle.class; //329
list[IRON_DOOR] = ItemDoorIron.class; //330
list[REDSTONE] = ItemRedstone.class; //331
list[SNOWBALL] = ItemSnowball.class; //332
list[BOAT] = ItemBoat.class; //333
list[LEATHER] = ItemLeather.class; //334
list[BRICK] = ItemBrick.class; //336
list[CLAY] = ItemClay.class; //337
list[SUGARCANE] = ItemSugarcane.class; //338
list[PAPER] = ItemPaper.class; //339
list[BOOK] = ItemBook.class; //340
list[SLIMEBALL] = ItemSlimeball.class; //341
list[MINECART_WITH_CHEST] = ItemMinecartChest.class; //342
list[EGG] = ItemEgg.class; //344
list[COMPASS] = ItemCompass.class; //345
list[FISHING_ROD] = ItemFishingRod.class; //346
list[CLOCK] = ItemClock.class; //347
list[GLOWSTONE_DUST] = ItemGlowstoneDust.class; //348
list[RAW_FISH] = ItemFish.class; //349
list[COOKED_FISH] = ItemFishCooked.class; //350
list[DYE] = ItemDye.class; //351
list[BONE] = ItemBone.class; //352
list[SUGAR] = ItemSugar.class; //353
list[CAKE] = ItemCake.class; //354
list[BED] = ItemBed.class; //355
list[REPEATER] = ItemRedstoneRepeater.class; //356
list[COOKIE] = ItemCookie.class; //357
list[MAP] = ItemMap.class; //358
list[SHEARS] = ItemShears.class; //359
list[MELON] = ItemMelon.class; //360
list[PUMPKIN_SEEDS] = ItemSeedsPumpkin.class; //361
list[MELON_SEEDS] = ItemSeedsMelon.class; //362
list[RAW_BEEF] = ItemBeefRaw.class; //363
list[STEAK] = ItemSteak.class; //364
list[RAW_CHICKEN] = ItemChickenRaw.class; //365
list[COOKED_CHICKEN] = ItemChickenCooked.class; //366
list[ROTTEN_FLESH] = ItemRottenFlesh.class; //367
list[ENDER_PEARL] = ItemEnderPearl.class; //368
list[BLAZE_ROD] = ItemBlazeRod.class; //369
//TODO: list[GHAST_TEAR] = ItemGhastTear.class; //370
list[GOLD_NUGGET] = ItemNuggetGold.class; //371
list[NETHER_WART] = ItemNetherWart.class; //372
list[POTION] = ItemPotion.class; //373
list[GLASS_BOTTLE] = ItemGlassBottle.class; //374
list[SPIDER_EYE] = ItemSpiderEye.class; //375
//TODO: list[FERMENTED_SPIDER_EYE] = ItemSpiderEyeFermented.class; //376
//TODO: list[BLAZE_POWDER] = ItemBlazePowder.class; //377
//TODO: list[MAGMA_CREAM] = ItemMagmaCream.class; //378
list[BREWING_STAND] = ItemBrewingStand.class; //379
list[CAULDRON] = ItemCauldron.class; //380
list[ENDER_EYE] = ItemEnderEye.class; //381
//TODO: list[GLISTERING_MELON] = ItemMelonGlistering.class; //382
list[SPAWN_EGG] = ItemSpawnEgg.class; //383
list[EXPERIENCE_BOTTLE] = ItemExpBottle.class; //384
//TODO: list[FIRE_CHARGE] = ItemFireCharge.class; //385
//TODO: list[BOOK_AND_QUILL] = ItemBookAndQuill.class; //386
list[WRITTEN_BOOK] = ItemBookWritten.class; //387
list[EMERALD] = ItemEmerald.class; //388
list[ITEM_FRAME] = ItemItemFrame.class; //389
list[FLOWER_POT] = ItemFlowerPot.class; //390
list[CARROT] = ItemCarrot.class; //391
list[BAKED_POTATO] = ItemPotatoBaked.class; //393
list[POISONOUS_POTATO] = ItemPotatoPoisonous.class; //394
//TODO: list[EMPTY_MAP] = ItemEmptyMap.class; //395
//TODO: list[GOLDEN_CARROT] = ItemCarrotGolden.class; //396
list[SKULL] = ItemSkull.class; //397
list[CARROT_ON_A_STICK] = ItemCarrotOnAStick.class; //398
list[NETHER_STAR] = ItemNetherStar.class; //399
list[PUMPKIN_PIE] = ItemPumpkinPie.class; //400
list[ENCHANTED_BOOK] = ItemBookEnchanted.class; //403
list[COMPARATOR] = ItemRedstoneComparator.class; //404
list[NETHER_BRICK] = ItemNetherBrick.class; //405
list[QUARTZ] = ItemQuartz.class; //406
list[MINECART_WITH_TNT] = ItemMinecartTNT.class; //407
list[MINECART_WITH_HOPPER] = ItemMinecartHopper.class; //408
list[PRISMARINE_SHARD] = ItemPrismarineShard.class; //409
list[HOPPER] = ItemHopper.class;
list[RAW_RABBIT] = ItemRabbitRaw.class; //411
list[COOKED_RABBIT] = ItemRabbitCooked.class; //412
list[RABBIT_STEW] = ItemRabbitStew.class; //413
list[RABBIT_FOOT] = ItemRabbitFoot.class; //414
//TODO: list[RABBIT_HIDE] = ItemRabbitHide.class; //415
list[LEATHER_HORSE_ARMOR] = ItemHorseArmorLeather.class; //416
list[IRON_HORSE_ARMOR] = ItemHorseArmorIron.class; //417
list[GOLD_HORSE_ARMOR] = ItemHorseArmorGold.class; //418
list[DIAMOND_HORSE_ARMOR] = ItemHorseArmorDiamond.class; //419
//TODO: list[LEAD] = ItemLead.class; //420
//TODO: list[NAME_TAG] = ItemNameTag.class; //421
list[PRISMARINE_CRYSTALS] = ItemPrismarineCrystals.class; //422
list[RAW_MUTTON] = ItemMuttonRaw.class; //423
list[COOKED_MUTTON] = ItemMuttonCooked.class; //424
list[END_CRYSTAL] = ItemEndCrystal.class; //426
list[SPRUCE_DOOR] = ItemDoorSpruce.class; //427
list[BIRCH_DOOR] = ItemDoorBirch.class; //428
list[JUNGLE_DOOR] = ItemDoorJungle.class; //429
list[ACACIA_DOOR] = ItemDoorAcacia.class; //430
list[DARK_OAK_DOOR] = ItemDoorDarkOak.class; //431
//TODO: list[CHORUS_FRUIT] = ItemChorusFruit.class; //432
//TODO: list[POPPED_CHORUS_FRUIT] = ItemChorusFruitPopped.class; //433
//TODO: list[DRAGON_BREATH] = ItemDragonBreath.class; //437
list[SPLASH_POTION] = ItemPotionSplash.class; //438
//TODO: list[LINGERING_POTION] = ItemPotionLingering.class; //441
list[ELYTRA] = ItemElytra.class; //444
//TODO: list[SHULKER_SHELL] = ItemShulkerShell.class; //445
list[BEETROOT] = ItemBeetroot.class; //457
list[BEETROOT_SEEDS] = ItemSeedsBeetroot.class; //458
list[BEETROOT_SOUP] = ItemBeetrootSoup.class; //459
list[RAW_SALMON] = ItemSalmon.class; //460
list[CLOWNFISH] = ItemClownfish.class; //461
list[PUFFERFISH] = ItemPufferfish.class; //462
list[COOKED_SALMON] = ItemSalmonCooked.class; //463
list[GOLDEN_APPLE_ENCHANTED] = ItemAppleGoldEnchanted.class; //466
list[RECORD_11] = ItemRecord11.class;
list[RECORD_CAT] = ItemRecordCat.class;
list[RECORD_13] = ItemRecord13.class;
list[RECORD_BLOCKS] = ItemRecordBlocks.class;
list[RECORD_CHIRP] = ItemRecordChirp.class;
list[RECORD_FAR] = ItemRecordFar.class;
list[RECORD_WARD] = ItemRecordWard.class;
list[RECORD_MALL] = ItemRecordMall.class;
list[RECORD_MELLOHI] = ItemRecordMellohi.class;
list[RECORD_STAL] = ItemRecordStal.class;
list[RECORD_STRAD] = ItemRecordStrad.class;
list[RECORD_WAIT] = ItemRecordWait.class;
for (int i = 0; i < 256; ++i) {
if (Block.list[i] != null) {
list[i] = Block.list[i];
}
}
}
initCreativeItems();
}
private static final ArrayList<Item> creative = new ArrayList<>();
private static void initCreativeItems() {
clearCreativeItems();
Server server = Server.getInstance();
String path = server.getDataPath() + "creativeitems.json";
if (!new File(path).exists()) {
try {
Utils.writeFile(path, Server.class.getClassLoader().getResourceAsStream("creativeitems.json"));
} catch (IOException e) {
MainLogger.getLogger().logException(e);
return;
}
}
List<Map> list = new Config(path, Config.YAML).getMapList("items");
for (Map map : list) {
try {
int id = (int) map.get("id");
int damage = (int) map.getOrDefault("damage", 0);
String hex = (String) map.get("nbt_hex");
byte[] nbt = hex != null ? Utils.parseHexBinary(hex) : new byte[0];
addCreativeItem(Item.get(id, damage, 1, nbt));
} catch (Exception e) {
MainLogger.getLogger().logException(e);
}
}
}
public static void clearCreativeItems() {
Item.creative.clear();
}
public static ArrayList<Item> getCreativeItems() {
return new ArrayList<>(Item.creative);
}
public static void addCreativeItem(Item item) {
Item.creative.add(item.clone());
}
public static void removeCreativeItem(Item item) {
int index = getCreativeItemIndex(item);
if (index != -1) {
Item.creative.remove(index);
}
}
public static boolean isCreativeItem(Item item) {
for (Item aCreative : Item.creative) {
if (item.equals(aCreative, !item.isTool())) {
return true;
}
}
return false;
}
public static Item getCreativeItem(int index) {
return (index >= 0 && index < Item.creative.size()) ? Item.creative.get(index) : null;
}
public static int getCreativeItemIndex(Item item) {
for (int i = 0; i < Item.creative.size(); i++) {
if (item.equals(Item.creative.get(i), !item.isTool())) {
return i;
}
}
return -1;
}
public static Item get(int id) {
return get(id, 0);
}
public static Item get(int id, Integer meta) {
return get(id, meta, 1);
}
public static Item get(int id, Integer meta, int count) {
return get(id, meta, count, new byte[0]);
}
public static Item get(int id, Integer meta, int count, byte[] tags) {
try {
Class c = list[id];
Item item;
if (c == null) {
item = new Item(id, meta, count);
} else if (id < 256) {
if (meta >= 0) {
item = new ItemBlock(Block.get(id, meta), meta, count);
} else {
item = new ItemBlock(Block.get(id), meta, count);
}
} else {
item = ((Item) c.getConstructor(Integer.class, int.class).newInstance(meta, count));
}
if (tags.length != 0) {
item.setCompoundTag(tags);
}
return item;
} catch (Exception e) {
return new Item(id, meta, count).setCompoundTag(tags);
}
}
public static Item fromString(String str) {
String[] b = str.trim().replace(' ', '_').replace("minecraft:", "").split(":");
int id = 0;
int meta = 0;
Pattern integerPattern = Pattern.compile("^[1-9]\\d*$");
if (integerPattern.matcher(b[0]).matches()) {
id = Integer.valueOf(b[0]);
} else {
try {
id = Item.class.getField(b[0].toUpperCase()).getInt(null);
} catch (Exception ignore) {
}
}
id = id & 0xFFFF;
if (b.length != 1) meta = Integer.valueOf(b[1]) & 0xFFFF;
return get(id, meta);
}
public static Item fromJson(Map<String, Object> data) {
String nbt = (String) data.getOrDefault("nbt_hex", "");
return get(Utils.toInt(data.get("id")), Utils.toInt(data.getOrDefault("damage", 0)), Utils.toInt(data.getOrDefault("count", 1)), nbt.isEmpty() ? new byte[0] : Utils.parseHexBinary(nbt));
}
public static Item[] fromStringMultiple(String str) {
String[] b = str.split(",");
Item[] items = new Item[b.length - 1];
for (int i = 0; i < b.length; i++) {
items[i] = fromString(b[i]);
}
return items;
}
public Item setCompoundTag(CompoundTag tag) {
this.setNamedTag(tag);
return this;
}
public Item setCompoundTag(byte[] tags) {
this.tags = tags;
this.cachedNBT = null;
return this;
}
public byte[] getCompoundTag() {
return tags;
}
public boolean hasCompoundTag() {
return this.tags != null && this.tags.length > 0;
}
public boolean hasCustomBlockData() {
if (!this.hasCompoundTag()) {
return false;
}
CompoundTag tag = this.getNamedTag();
return tag.contains("BlockEntityTag") && tag.get("BlockEntityTag") instanceof CompoundTag;
}
public Item clearCustomBlockData() {
if (!this.hasCompoundTag()) {
return this;
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("BlockEntityTag") && tag.get("BlockEntityTag") instanceof CompoundTag) {
tag.remove("BlockEntityTag");
this.setNamedTag(tag);
}
return this;
}
public Item setCustomBlockData(CompoundTag compoundTag) {
CompoundTag tags = compoundTag.copy();
tags.setName("BlockEntityTag");
CompoundTag tag;
if (!this.hasCompoundTag()) {
tag = new CompoundTag();
} else {
tag = this.getNamedTag();
}
tag.putCompound("BlockEntityTag", tags);
this.setNamedTag(tag);
return this;
}
public CompoundTag getCustomBlockData() {
if (!this.hasCompoundTag()) {
return null;
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("BlockEntityTag")) {
Tag bet = tag.get("BlockEntityTag");
if (bet instanceof CompoundTag) {
return (CompoundTag) bet;
}
}
return null;
}
public boolean hasEnchantments() {
if (!this.hasCompoundTag()) {
return false;
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("ench")) {
Tag enchTag = tag.get("ench");
if (enchTag instanceof ListTag) {
return true;
}
}
return false;
}
public Enchantment getEnchantment(int id) {
return getEnchantment((short) (id & 0xffff));
}
public Enchantment getEnchantment(short id) {
if (!this.hasEnchantments()) {
return null;
}
for (CompoundTag entry : this.getNamedTag().getList("ench", CompoundTag.class).getAll()) {
if (entry.getShort("id") == id) {
Enchantment e = Enchantment.getEnchantment(entry.getShort("id"));
if (e != null) {
e.setLevel(entry.getShort("lvl"));
return e;
}
}
}
return null;
}
public void addEnchantment(Enchantment... enchantments) {
CompoundTag tag;
if (!this.hasCompoundTag()) {
tag = new CompoundTag();
} else {
tag = this.getNamedTag();
}
ListTag<CompoundTag> ench;
if (!tag.contains("ench")) {
ench = new ListTag<>("ench");
tag.putList(ench);
} else {
ench = tag.getList("ench", CompoundTag.class);
}
for (Enchantment enchantment : enchantments) {
boolean found = false;
for (int k = 0; k < ench.size(); k++) {
CompoundTag entry = ench.get(k);
if (entry.getShort("id") == enchantment.getId()) {
ench.add(k, new CompoundTag()
.putShort("id", enchantment.getId())
.putShort("lvl", enchantment.getLevel())
);
found = true;
break;
}
}
if (!found) {
ench.add(new CompoundTag()
.putShort("id", enchantment.getId())
.putShort("lvl", enchantment.getLevel())
);
}
}
this.setNamedTag(tag);
}
public Enchantment[] getEnchantments() {
if (!this.hasEnchantments()) {
return new Enchantment[0];
}
List<Enchantment> enchantments = new ArrayList<>();
ListTag<CompoundTag> ench = this.getNamedTag().getList("ench", CompoundTag.class);
for (CompoundTag entry : ench.getAll()) {
Enchantment e = Enchantment.getEnchantment(entry.getShort("id"));
if (e != null) {
e.setLevel(entry.getShort("lvl"));
enchantments.add(e);
}
}
return enchantments.stream().toArray(Enchantment[]::new);
}
public boolean hasCustomName() {
if (!this.hasCompoundTag()) {
return false;
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("display")) {
Tag tag1 = tag.get("display");
if (tag1 instanceof CompoundTag && ((CompoundTag) tag1).contains("Name") && ((CompoundTag) tag1).get("Name") instanceof StringTag) {
return true;
}
}
return false;
}
public String getCustomName() {
if (!this.hasCompoundTag()) {
return "";
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("display")) {
Tag tag1 = tag.get("display");
if (tag1 instanceof CompoundTag && ((CompoundTag) tag1).contains("Name") && ((CompoundTag) tag1).get("Name") instanceof StringTag) {
return ((CompoundTag) tag1).getString("Name");
}
}
return "";
}
public Item setCustomName(String name) {
if (name == null || name.equals("")) {
this.clearCustomName();
}
CompoundTag tag;
if (!this.hasCompoundTag()) {
tag = new CompoundTag();
} else {
tag = this.getNamedTag();
}
if (tag.contains("display") && tag.get("display") instanceof CompoundTag) {
tag.getCompound("display").putString("Name", name);
} else {
tag.putCompound("display", new CompoundTag("display")
.putString("Name", name)
);
}
this.setNamedTag(tag);
return this;
}
public Item clearCustomName() {
if (!this.hasCompoundTag()) {
return this;
}
CompoundTag tag = this.getNamedTag();
if (tag.contains("display") && tag.get("display") instanceof CompoundTag) {
tag.getCompound("display").remove("Name");
if (tag.getCompound("display").isEmpty()) {
tag.remove("display");
}
this.setNamedTag(tag);
}
return this;
}
public String[] getLore() {
Tag tag = this.getNamedTagEntry("display");
ArrayList<String> lines = new ArrayList<>();
if (tag instanceof CompoundTag) {
CompoundTag nbt = (CompoundTag) tag;
ListTag<StringTag> lore = nbt.getList("Lore", StringTag.class);
if (lore.size() > 0) {
for (StringTag stringTag : lore.getAll()) {
lines.add(stringTag.data);
}
}
}
return lines.toArray(new String[0]);
}
public Item setLore(String... lines) {
CompoundTag tag;
if (!this.hasCompoundTag()) {
tag = new CompoundTag();
} else {
tag = this.getNamedTag();
}
ListTag<StringTag> lore = new ListTag<>("Lore");
for (String line : lines) {
lore.add(new StringTag("", line));
}
if (!tag.contains("display")) {
tag.putCompound("display", new CompoundTag("display").putList(lore));
} else {
tag.getCompound("display").putList(lore);
}
this.setNamedTag(tag);
return this;
}
public Tag getNamedTagEntry(String name) {
CompoundTag tag = this.getNamedTag();
if (tag != null) {
return tag.contains(name) ? tag.get(name) : null;
}
return null;
}
public CompoundTag getNamedTag() {
if (!this.hasCompoundTag()) {
return null;
}
if (this.cachedNBT == null) {
this.cachedNBT = parseCompoundTag(this.tags);
}
if (this.cachedNBT != null) {
this.cachedNBT.setName("");
}
return this.cachedNBT;
}
public Item setNamedTag(CompoundTag tag) {
if (tag.isEmpty()) {
return this.clearNamedTag();
}
tag.setName(null);
this.cachedNBT = tag;
this.tags = writeCompoundTag(tag);
return this;
}
public Item clearNamedTag() {
return this.setCompoundTag(new byte[0]);
}
public static CompoundTag parseCompoundTag(byte[] tag) {
try {
return NBTIO.read(tag, ByteOrder.LITTLE_ENDIAN);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public byte[] writeCompoundTag(CompoundTag tag) {
try {
tag.setName("");
return NBTIO.write(tag, ByteOrder.LITTLE_ENDIAN);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public boolean isNull() {
return this.count <= 0 || this.id == AIR;
}
final public String getName() {
return this.hasCustomName() ? this.getCustomName() : this.name;
}
final public boolean canBePlaced() {
return ((this.block != null) && this.block.canBePlaced());
}
public Block getBlock() {
if (this.block != null) {
return this.block.clone();
} else {
return new BlockAir();
}
}
public int getId() {
return id;
}
public int getDamage() {
return meta;
}
public void setDamage(Integer meta) {
if (meta != null) {
this.meta = meta & 0xffff;
} else {
this.hasMeta = false;
}
}
public int getMaxStackSize() {
return 64;
}
final public Short getFuelTime() {
if (!Fuel.duration.containsKey(id)) {
return null;
}
if (this.id != BUCKET || this.meta == 10) {
return Fuel.duration.get(this.id);
}
return null;
}
public boolean useOn(Entity entity) {
return false;
}
public boolean useOn(Block block) {
return false;
}
public boolean isTool() {
return false;
}
public int getMaxDurability() {
return -1;
}
public int getTier() {
return 0;
}
public boolean isPickaxe() {
return false;
}
public boolean isAxe() {
return false;
}
public boolean isSword() {
return false;
}
public boolean isShovel() {
return false;
}
public boolean isHoe() {
return false;
}
public boolean isShears() {
return false;
}
public boolean isArmor() {
return false;
}
public boolean isHelmet() {
return false;
}
public boolean isChestplate() {
return false;
}
public boolean isLeggings() {
return false;
}
public boolean isBoots() {
return false;
}
public int getEnchantAbility() {
return 0;
}
public int getAttackDamage() {
return 1;
}
public int getArmorPoints() {
return 0;
}
public int getToughness() {
return 0;
}
public boolean isUnbreakable() {
return false;
}
@Override
final public String toString() {
return "Item " + this.name + " (" + this.id + ":" + (!this.hasMeta ? "?" : this.meta) + ")x" + this.count + (this.hasCompoundTag() ? " tags:0x" + Binary.bytesToHexString(this.getCompoundTag()) : "");
}
public int getDestroySpeed(Block block, Player player) {
return 1;
}
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
return false;
}
/**
* Called when a player uses the item on air, for example throwing a projectile.
* Returns whether the item was changed, for example count decrease or durability change.
*/
public boolean onClickAir(Player player, Vector3 directionVector) {
return false;
}
/**
* Called when a player is using this item and releases it. Used to handle bow shoot actions.
* Returns whether the item was changed, for example count decrease or durability change.
*/
public boolean onReleaseUsing(Player player) {
return false;
}
@Override
public final boolean equals(Object item) {
return item instanceof Item && this.equals((Item) item, true);
}
public final boolean equals(Item item, boolean checkDamage) {
return equals(item, checkDamage, true);
}
public final boolean equals(Item item, boolean checkDamage, boolean checkCompound) {
if (this.getId() == item.getId() && (!checkDamage || this.getDamage() == item.getDamage())) {
if (checkCompound) {
if (Arrays.equals(this.getCompoundTag(), item.getCompoundTag())) {
return true;
} else if (this.hasCompoundTag() && item.hasCompoundTag()) {
return this.getNamedTag().equals(item.getNamedTag());
}
} else {
return true;
}
}
return false;
}
/**
* Returns whether the specified item stack has the same ID, damage, NBT and count as this item stack.
*/
public final boolean equalsExact(Item other) {
return this.equals(other, true, true) && this.count == other.count;
}
@Deprecated
public final boolean deepEquals(Item item) {
return equals(item, true);
}
@Deprecated
public final boolean deepEquals(Item item, boolean checkDamage) {
return equals(item, checkDamage, true);
}
@Deprecated
public final boolean deepEquals(Item item, boolean checkDamage, boolean checkCompound) {
return equals(item, checkDamage, checkCompound);
}
@Override
public Item clone() {
try {
Item item = (Item) super.clone();
item.tags = this.tags.clone();
return item;
} catch (CloneNotSupportedException e) {
return null;
}
}
}
| 57,657 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSign.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSign.java | package cn.nukkit.item;
import cn.nukkit.block.BlockSignPost;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemSign extends Item {
public ItemSign() {
this(0, 1);
}
public ItemSign(Integer meta) {
this(meta, 1);
}
public ItemSign(Integer meta, int count) {
super(SIGN, 0, count, "Sign");
this.block = new BlockSignPost();
}
@Override
public int getMaxStackSize() {
return 16;
}
}
| 479 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMelon.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMelon.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemMelon extends ItemEdible {
public ItemMelon() {
this(0, 1);
}
public ItemMelon(Integer meta) {
this(meta, 1);
}
public ItemMelon(Integer meta, int count) {
super(MELON, meta, count, "Melon");
}
}
| 338 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemDye.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemDye.java | package cn.nukkit.item;
import cn.nukkit.block.BlockCocoa;
import cn.nukkit.utils.BlockColor;
import cn.nukkit.utils.DyeColor;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemDye extends Item {
@Deprecated
public static final int WHITE = DyeColor.WHITE.getDyeData();
@Deprecated
public static final int ORANGE = DyeColor.ORANGE.getDyeData();
@Deprecated
public static final int MAGENTA = DyeColor.MAGENTA.getDyeData();
@Deprecated
public static final int LIGHT_BLUE = DyeColor.LIGHT_BLUE.getDyeData();
@Deprecated
public static final int YELLOW = DyeColor.YELLOW.getDyeData();
@Deprecated
public static final int LIME = DyeColor.LIME.getDyeData();
@Deprecated
public static final int PINK = DyeColor.PINK.getDyeData();
@Deprecated
public static final int GRAY = DyeColor.GRAY.getDyeData();
@Deprecated
public static final int LIGHT_GRAY = DyeColor.LIGHT_GRAY.getDyeData();
@Deprecated
public static final int CYAN = DyeColor.CYAN.getDyeData();
@Deprecated
public static final int PURPLE = DyeColor.PURPLE.getDyeData();
@Deprecated
public static final int BLUE = DyeColor.BLUE.getDyeData();
@Deprecated
public static final int BROWN = DyeColor.BROWN.getDyeData();
@Deprecated
public static final int GREEN = DyeColor.GREEN.getDyeData();
@Deprecated
public static final int RED = DyeColor.RED.getDyeData();
@Deprecated
public static final int BLACK = DyeColor.BLACK.getDyeData();
public ItemDye() {
this(0, 1);
}
public ItemDye(Integer meta) {
this(meta, 1);
}
public ItemDye(DyeColor dyeColor) {
this(dyeColor.getDyeData(), 1);
}
public ItemDye(DyeColor dyeColor, int amount) {
this(dyeColor.getDyeData(), amount);
}
public ItemDye(Integer meta, int amount) {
super(DYE, meta, amount, "Dye");
if (this.meta == DyeColor.BROWN.getDyeData()) {
this.block = new BlockCocoa();
}
}
@Deprecated
public static BlockColor getColor(int meta) {
return DyeColor.getByDyeData(meta).getColor();
}
public DyeColor getDyeColor() {
return DyeColor.getByDyeData(meta);
}
@Deprecated
public static String getColorName(int meta) {
return DyeColor.getByDyeData(meta).getName();
}
}
| 2,382 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemAxeIron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemAxeIron.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemAxeIron extends ItemTool {
public ItemAxeIron() {
this(0, 1);
}
public ItemAxeIron(Integer meta) {
this(meta, 1);
}
public ItemAxeIron(Integer meta, int count) {
super(IRON_AXE, meta, count, "Iron Axe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_IRON;
}
@Override
public boolean isAxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_IRON;
}
@Override
public int getAttackDamage() {
return 5;
}
}
| 676 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHelmetGold.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHelmetGold.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemHelmetGold extends ItemArmor {
public ItemHelmetGold() {
this(0, 1);
}
public ItemHelmetGold(Integer meta) {
this(meta, 1);
}
public ItemHelmetGold(Integer meta, int count) {
super(GOLD_HELMET, meta, count, "Gold Helmet");
}
@Override
public int getTier() {
return ItemArmor.TIER_GOLD;
}
@Override
public boolean isHelmet() {
return true;
}
@Override
public int getArmorPoints() {
return 2;
}
@Override
public int getMaxDurability() {
return 78;
}
}
| 676 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemShovelIron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemShovelIron.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemShovelIron extends ItemTool {
public ItemShovelIron() {
this(0, 1);
}
public ItemShovelIron(Integer meta) {
this(meta, 1);
}
public ItemShovelIron(Integer meta, int count) {
super(IRON_SHOVEL, meta, count, "Iron Shovel");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_IRON;
}
@Override
public boolean isShovel() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_IRON;
}
@Override
public int getAttackDamage() {
return 3;
}
}
| 697 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemGlassBottle.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemGlassBottle.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
public class ItemGlassBottle extends Item {
public ItemGlassBottle() {
this(0, 1);
}
public ItemGlassBottle(Integer meta) {
this(meta, 1);
}
public ItemGlassBottle(Integer meta, int count) {
super(GLASS_BOTTLE, meta, count, "Glass Bottle");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
if (target.getId() == WATER || target.getId() == STILL_WATER) {
Item potion = new ItemPotion();
if (this.count == 1) {
player.getInventory().setItemInHand(potion);
} else if (this.count > 1) {
this.count--;
player.getInventory().setItemInHand(this);
if (player.getInventory().canAddItem(potion)) {
player.getInventory().addItem(potion);
} else {
player.getLevel().dropItem(player.add(0, 1.3, 0), potion, player.getDirectionVector().multiply(0.4));
}
}
}
return false;
}
}
| 1,355 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemFlint.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemFlint.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemFlint extends Item {
public ItemFlint() {
this(0, 1);
}
public ItemFlint(Integer meta) {
this(meta, 1);
}
public ItemFlint(Integer meta, int count) {
super(FLINT, meta, count, "Flint");
}
}
| 332 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemGlowstoneDust.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemGlowstoneDust.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemGlowstoneDust extends Item {
public ItemGlowstoneDust() {
this(0, 1);
}
public ItemGlowstoneDust(Integer meta) {
this(meta, 1);
}
public ItemGlowstoneDust(Integer meta, int count) {
super(GLOWSTONE_DUST, meta, count, "Glowstone Dust");
}
}
| 382 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordMall.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordMall.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordMall extends ItemRecord {
public ItemRecordMall() {
this(0, 1);
}
public ItemRecordMall(Integer meta) {
this(meta, 1);
}
public ItemRecordMall(Integer meta, int count) {
super(RECORD_MALL, meta, count);
}
@Override
public String getSoundId() {
return "record.mall";
}
}
| 421 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecord.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecord.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public abstract class ItemRecord extends Item {
public ItemRecord(int id, Integer meta, int count) {
super(id, meta, count, "Music Disc");
}
@Override
public int getMaxStackSize() {
return 1;
}
public abstract String getSoundId();
}
| 332 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHelmetLeather.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHelmetLeather.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemHelmetLeather extends ItemColorArmor {
public ItemHelmetLeather() {
this(0, 1);
}
public ItemHelmetLeather(Integer meta) {
this(meta, 1);
}
public ItemHelmetLeather(Integer meta, int count) {
super(LEATHER_CAP, meta, count, "Leather Cap");
}
@Override
public int getTier() {
return ItemArmor.TIER_LEATHER;
}
@Override
public boolean isHelmet() {
return true;
}
@Override
public int getArmorPoints() {
return 1;
}
@Override
public int getMaxDurability() {
return 56;
}
}
| 696 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRabbitFoot.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRabbitFoot.java | package cn.nukkit.item;
/**
* Created by Snake1999 on 2016/1/14.
* Package cn.nukkit.item in project nukkit.
*/
public class ItemRabbitFoot extends Item {
public ItemRabbitFoot() {
this(0, 1);
}
public ItemRabbitFoot(Integer meta) {
this(meta, 1);
}
public ItemRabbitFoot(Integer meta, int count) {
super(RABBIT_FOOT, meta, count, "Rabbit Foot");
}
}
| 406 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemString.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemString.java | package cn.nukkit.item;
import cn.nukkit.block.BlockTripWire;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemString extends Item {
public ItemString() {
this(0, 1);
}
public ItemString(Integer meta) {
this(meta, 1);
}
public ItemString(Integer meta, int count) {
super(STRING, meta, count, "String");
this.block = new BlockTripWire();
}
}
| 419 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBrewingStand.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBrewingStand.java | package cn.nukkit.item;
import cn.nukkit.block.BlockBrewingStand;
public class ItemBrewingStand extends Item {
public ItemBrewingStand() {
this(0, 1);
}
public ItemBrewingStand(Integer meta) {
this(meta, 1);
}
public ItemBrewingStand(Integer meta, int count) {
super(BREWING_STAND, 0, count, "Brewing Stand");
this.block = new BlockBrewingStand();
}
} | 413 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPotatoBaked.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPotatoBaked.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPotatoBaked extends Item {
public ItemPotatoBaked() {
this(0, 1);
}
public ItemPotatoBaked(Integer meta) {
this(meta, 1);
}
public ItemPotatoBaked(Integer meta, int count) {
super(BAKED_POTATO, meta, count, "Baked Potato");
}
}
| 371 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemClay.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemClay.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemClay extends Item {
public ItemClay() {
this(0, 1);
}
public ItemClay(Integer meta) {
this(meta, 1);
}
public ItemClay(Integer meta, int count) {
super(CLAY, meta, count, "Clay");
}
}
| 326 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordWait.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordWait.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordWait extends ItemRecord {
public ItemRecordWait() {
this(0, 1);
}
public ItemRecordWait(Integer meta) {
this(meta, 1);
}
public ItemRecordWait(Integer meta, int count) {
super(RECORD_WAIT, meta, count);
}
@Override
public String getSoundId() {
return "record.wait";
}
}
| 421 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPickaxeGold.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPickaxeGold.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPickaxeGold extends ItemTool {
public ItemPickaxeGold() {
this(0, 1);
}
public ItemPickaxeGold(Integer meta) {
this(meta, 1);
}
public ItemPickaxeGold(Integer meta, int count) {
super(GOLD_PICKAXE, meta, count, "Gold Pickaxe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_GOLD;
}
@Override
public boolean isPickaxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_GOLD;
}
@Override
public int getAttackDamage() {
return 2;
}
}
| 704 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPorkchopRaw.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPorkchopRaw.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPorkchopRaw extends ItemEdible {
public ItemPorkchopRaw() {
this(0, 1);
}
public ItemPorkchopRaw(Integer meta) {
this(meta, 1);
}
public ItemPorkchopRaw(Integer meta, int count) {
super(RAW_PORKCHOP, meta, count, "Raw Porkchop");
}
}
| 376 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordStrad.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordStrad.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordStrad extends ItemRecord {
public ItemRecordStrad() {
this(0, 1);
}
public ItemRecordStrad(Integer meta) {
this(meta, 1);
}
public ItemRecordStrad(Integer meta, int count) {
super(RECORD_STRAD, meta, count);
}
@Override
public String getSoundId() {
return "record.strad";
}
}
| 427 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMinecartChest.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMinecartChest.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.block.BlockRail;
import cn.nukkit.entity.item.EntityMinecartChest;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.DoubleTag;
import cn.nukkit.nbt.tag.FloatTag;
import cn.nukkit.nbt.tag.ListTag;
import cn.nukkit.utils.Rail;
public class ItemMinecartChest extends Item {
public ItemMinecartChest() {
this(0, 1);
}
public ItemMinecartChest(Integer meta) {
this(meta, 1);
}
public ItemMinecartChest(Integer meta, int count) {
super(MINECART_WITH_CHEST, meta, count, "Minecart with Chest");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
if (Rail.isRailBlock(target)) {
Rail.Orientation type = ((BlockRail) target).getOrientation();
double adjacent = 0.0D;
if (type.isAscending()) {
adjacent = 0.5D;
}
EntityMinecartChest minecart = new EntityMinecartChest(
level.getChunk(target.getFloorX() >> 4, target.getFloorZ() >> 4), new CompoundTag("")
.putList(new ListTag<>("Pos")
.add(new DoubleTag("", target.getX() + 0.5))
.add(new DoubleTag("", target.getY() + 0.0625D + adjacent))
.add(new DoubleTag("", target.getZ() + 0.5)))
.putList(new ListTag<>("Motion")
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0)))
.putList(new ListTag<>("Rotation")
.add(new FloatTag("", 0))
.add(new FloatTag("", 0)))
);
minecart.spawnToAll();
count -= 1;
return true;
}
return false;
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 2,238 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemNetherWart.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemNetherWart.java | package cn.nukkit.item;
import cn.nukkit.block.BlockNetherWart;
/**
* Created by Leonidius20 on 22.03.17.
*/
public class ItemNetherWart extends Item {
public ItemNetherWart() {
this(0, 1);
}
public ItemNetherWart(Integer meta) {
this(meta, 1);
}
public ItemNetherWart(Integer meta, int count) {
super(NETHER_WART, meta, count, "Nether Wart");
this.block = new BlockNetherWart(meta);
}
}
| 452 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCake.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCake.java | package cn.nukkit.item;
import cn.nukkit.block.BlockCake;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemCake extends Item {
public ItemCake() {
this(0, 1);
}
public ItemCake(Integer meta) {
this(meta, 1);
}
public ItemCake(Integer meta, int count) {
super(CAKE, 0, count, "Cake");
this.block = new BlockCake();
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 470 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRedstoneComparator.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRedstoneComparator.java | package cn.nukkit.item;
import cn.nukkit.block.BlockRedstoneComparatorUnpowered;
/**
* @author CreeperFace
*/
public class ItemRedstoneComparator extends Item {
public ItemRedstoneComparator() {
this(0);
}
public ItemRedstoneComparator(Integer meta) {
this(0, 1);
}
public ItemRedstoneComparator(Integer meta, int count) {
super(COMPARATOR, meta, count, "Redstone Comparator");
this.block = new BlockRedstoneComparatorUnpowered();
}
} | 497 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSteak.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSteak.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemSteak extends ItemEdible {
public ItemSteak() {
this(0, 1);
}
public ItemSteak(Integer meta) {
this(meta, 1);
}
public ItemSteak(Integer meta, int count) {
super(STEAK, meta, count, "Steak");
}
}
| 338 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemQuartz.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemQuartz.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemQuartz extends Item {
public ItemQuartz() {
this(0, 1);
}
public ItemQuartz(Integer meta) {
this(meta, 1);
}
public ItemQuartz(Integer meta, int count) {
super(NETHER_QUARTZ, 0, count, "Nether Quartz");
}
}
| 349 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemClock.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemClock.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemClock extends Item {
public ItemClock() {
this(0, 1);
}
public ItemClock(Integer meta) {
this(meta, 1);
}
public ItemClock(Integer meta, int count) {
super(CLOCK, meta, count, "Clock");
}
}
| 332 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemColorArmor.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemColorArmor.java | package cn.nukkit.item;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.utils.BlockColor;
import cn.nukkit.utils.DyeColor;
/**
* Created by fromgate on 27.03.2016.
*/
abstract public class ItemColorArmor extends ItemArmor {
public ItemColorArmor(int id) {
super(id);
}
public ItemColorArmor(int id, Integer meta) {
super(id, meta);
}
public ItemColorArmor(int id, Integer meta, int count) {
super(id, meta, count);
}
public ItemColorArmor(int id, Integer meta, int count, String name) {
super(id, meta, count, name);
}
/**
* Set leather armor color
*
* @param dyeColor - Dye color data value
* @return - Return colored item
*/
@Deprecated
public ItemColorArmor setColor(int dyeColor) {
BlockColor blockColor = DyeColor.getByDyeData(dyeColor).getColor();
return setColor(blockColor.getRed(), blockColor.getGreen(), blockColor.getBlue());
}
/**
* Set leather armor color
*
* @param dyeColor - DyeColor object
* @return - Return colored item
*/
public ItemColorArmor setColor(DyeColor dyeColor) {
BlockColor blockColor = dyeColor.getColor();
return setColor(blockColor.getRed(), blockColor.getGreen(), blockColor.getBlue());
}
/**
* Set leather armor color
*
* @param color - BlockColor object
* @return - Return colored item
*/
public ItemColorArmor setColor(BlockColor color) {
return setColor(color.getRed(), color.getGreen(), color.getBlue());
}
/**
* Set leather armor color
*
* @param r - red
* @param g - green
* @param b - blue
* @return - Return colored item
*/
public ItemColorArmor setColor(int r, int g, int b) {
int rgb = r << 16 | g << 8 | b;
CompoundTag tag = this.hasCompoundTag() ? this.getNamedTag() : new CompoundTag();
tag.putInt("customColor", rgb);
this.setNamedTag(tag);
return this;
}
/**
* Get color of Leather Item
*
* @return - BlockColor, or null if item has no color
*/
public BlockColor getColor() {
if (!this.hasCompoundTag()) return null;
CompoundTag tag = this.getNamedTag();
if (!tag.exist("customColor")) return null;
int rgb = tag.getInt("customColor");
return new BlockColor(rgb);
}
}
| 2,417 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSugarcane.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSugarcane.java | package cn.nukkit.item;
import cn.nukkit.block.BlockSugarcane;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemSugarcane extends Item {
public ItemSugarcane() {
this(0, 1);
}
public ItemSugarcane(Integer meta) {
this(meta, 1);
}
public ItemSugarcane(Integer meta, int count) {
super(SUGARCANE, 0, count, "Sugar Cane");
this.block = new BlockSugarcane();
}
}
| 437 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPotionSplash.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPotionSplash.java | package cn.nukkit.item;
import cn.nukkit.nbt.tag.CompoundTag;
/**
* Created on 2015/12/27 by xtypr.
* Package cn.nukkit.item in project Nukkit .
*/
public class ItemPotionSplash extends ProjectileItem {
public ItemPotionSplash(Integer meta) {
this(meta, 1);
}
public ItemPotionSplash(Integer meta, int count) {
super(SPLASH_POTION, meta, count, "Splash Potion");
}
@Override
public int getMaxStackSize() {
return 1;
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public String getProjectileEntityType() {
return "ThrownPotion";
}
@Override
public float getThrowForce() {
return 1f;
}
@Override
protected void correctNBT(CompoundTag nbt) {
nbt.putInt("PotionId", this.meta);
}
}
| 846 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemEnderEye.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemEnderEye.java | package cn.nukkit.item;
public class ItemEnderEye extends Item {
public ItemEnderEye() {
this(0, 1);
}
public ItemEnderEye(Integer meta) {
this(meta, 1);
}
public ItemEnderEye(Integer meta, int count) {
super(ENDER_EYE, meta, count, "Ender Eye");
}
}
| 303 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSeedsWheat.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSeedsWheat.java | package cn.nukkit.item;
import cn.nukkit.block.BlockWheat;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemSeedsWheat extends Item {
public ItemSeedsWheat() {
this(0, 1);
}
public ItemSeedsWheat(Integer meta) {
this(meta, 1);
}
public ItemSeedsWheat(Integer meta, int count) {
super(WHEAT_SEEDS, 0, count, "Wheat Seeds");
this.block = new BlockWheat();
}
}
| 436 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBrick.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBrick.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBrick extends Item {
public ItemBrick() {
this(0, 1);
}
public ItemBrick(Integer meta) {
this(meta, 1);
}
public ItemBrick(Integer meta, int count) {
super(BRICK, 0, count, "Brick");
}
}
| 329 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordStal.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordStal.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordStal extends ItemRecord {
public ItemRecordStal() {
this(0, 1);
}
public ItemRecordStal(Integer meta) {
this(meta, 1);
}
public ItemRecordStal(Integer meta, int count) {
super(RECORD_STAL, meta, count);
}
@Override
public String getSoundId() {
return "record.stal";
}
}
| 421 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBookWritten.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBookWritten.java | package cn.nukkit.item;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.ListTag;
import java.util.concurrent.ThreadLocalRandom;
public class ItemBookWritten extends Item {
protected boolean isWritten = false;
public ItemBookWritten() {
this(0, 1);
}
public ItemBookWritten(Integer meta, int count) {
super(Item.WRITTEN_BOOK, 0, count, "Book");
}
public Item writeBook(String author, String title, String[] pages) {
ListTag<CompoundTag> pageList = new ListTag<>("pages");
for (String page : pages) {
pageList.add(new CompoundTag().putString("photoname", "").putString("text", page));
}
return writeBook(author, title, pageList);
}
public Item writeBook(String author, String title, ListTag<CompoundTag> pages) {
if (pages.size() > 50 || pages.size() <= 0) return this; //Minecraft does not support more than 50 pages
if (this.isWritten) return this; //Book content can only be updated once
CompoundTag tag;
if (!this.hasCompoundTag()) {
tag = new CompoundTag();
} else {
tag = this.getNamedTag();
}
tag.putString("author", author);
tag.putString("title", title);
tag.putList(pages);
tag.putInt("generation", 0);
long randomId = 1095216660480L + ThreadLocalRandom.current().nextLong(0L, 2147483647L);
tag.putLong("id", randomId);
this.isWritten = true;
return this.setNamedTag(tag);
}
public String getAuthor() {
if (!this.isWritten) return "";
return this.getNamedTag().getString("author");
}
public String getTitle() {
if (!this.isWritten) return "Book";
return this.getNamedTag().getString("title");
}
public String[] getPages() {
if (!this.isWritten) return new String[0];
ListTag<CompoundTag> tag = (ListTag<CompoundTag>) this.getNamedTag().getList("pages");
String[] pages = new String[tag.size()];
int i = 0;
for (CompoundTag pageCompound : tag.getAll()) {
pages[i] = pageCompound.getString("text");
i++;
}
return pages;
}
} | 2,226 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBootsChain.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBootsChain.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBootsChain extends ItemArmor {
public ItemBootsChain() {
this(0, 1);
}
public ItemBootsChain(Integer meta) {
this(meta, 1);
}
public ItemBootsChain(Integer meta, int count) {
super(CHAIN_BOOTS, meta, count, "Chainmail Boots");
}
@Override
public int getTier() {
return ItemArmor.TIER_CHAIN;
}
@Override
public boolean isBoots() {
return true;
}
@Override
public int getArmorPoints() {
return 1;
}
@Override
public int getMaxDurability() {
return 196;
}
}
| 681 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHoeStone.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHoeStone.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemHoeStone extends ItemTool {
public ItemHoeStone() {
this(0, 1);
}
public ItemHoeStone(Integer meta) {
this(meta, 1);
}
public ItemHoeStone(Integer meta, int count) {
super(STONE_HOE, meta, count, "Stone Hoe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_STONE;
}
@Override
public boolean isHoe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_STONE;
}
}
| 610 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordMellohi.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordMellohi.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordMellohi extends ItemRecord {
public ItemRecordMellohi() {
this(0, 1);
}
public ItemRecordMellohi(Integer meta) {
this(meta, 1);
}
public ItemRecordMellohi(Integer meta, int count) {
super(RECORD_MELLOHI, meta, count);
}
@Override
public String getSoundId() {
return "record.mellohi";
}
}
| 439 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMuttonCooked.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMuttonCooked.java | package cn.nukkit.item;
public class ItemMuttonCooked extends ItemEdible {
public ItemMuttonCooked() {
this(0, 1);
}
public ItemMuttonCooked(Integer meta) {
this(meta, 1);
}
public ItemMuttonCooked(Integer meta, int count) {
super(COOKED_MUTTON, meta, count, "Cooked Mutton");
}
}
| 333 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSkull.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSkull.java | package cn.nukkit.item;
import cn.nukkit.block.Block;
/**
* Created by Snake1999 on 2016/2/3.
* Package cn.nukkit.item in project Nukkit.
*/
public class ItemSkull extends Item {
public static final int SKELETON_SKULL = 0;
public static final int WITHER_SKELETON_SKULL = 1;
public static final int ZOMBIE_HEAD = 2;
public static final int HEAD = 3;
public static final int CREEPER_HEAD = 4;
public static final int DRAGON_HEAD = 5;
public ItemSkull() {
this(0, 1);
}
public ItemSkull(Integer meta) {
this(meta, 1);
}
public ItemSkull(Integer meta, int count) {
super(SKULL, meta, count, getItemSkullName(meta));
this.block = Block.get(Block.SKULL_BLOCK);
}
public static String getItemSkullName(int meta) {
switch (meta) {
case 1:
return "Wither Skeleton Skull";
case 2:
return "Zombie Head";
case 3:
return "Head";
case 4:
return "Creeper Head";
case 5:
return "Dragon Head";
case 0:
default:
return "Skeleton Skull";
}
}
}
| 1,218 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordWard.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordWard.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordWard extends ItemRecord {
public ItemRecordWard() {
this(0, 1);
}
public ItemRecordWard(Integer meta) {
this(meta, 1);
}
public ItemRecordWard(Integer meta, int count) {
super(RECORD_WARD, meta, count);
}
@Override
public String getSoundId() {
return "record.ward";
}
}
| 421 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemDoorDarkOak.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemDoorDarkOak.java | package cn.nukkit.item;
import cn.nukkit.block.BlockDoorDarkOak;
public class ItemDoorDarkOak extends Item {
public ItemDoorDarkOak() {
this(0, 1);
}
public ItemDoorDarkOak(Integer meta) {
this(meta, 1);
}
public ItemDoorDarkOak(Integer meta, int count) {
super(DARK_OAK_DOOR, 0, count, "Dark Oak Door");
this.block = new BlockDoorDarkOak();
}
}
| 407 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMap.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMap.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.network.protocol.ClientboundMapItemDataPacket;
import cn.nukkit.utils.MainLogger;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
/**
* Created by CreeperFace on 18.3.2017.
*/
public class ItemMap extends Item {
public static int mapCount = 0;
public ItemMap() {
this(0, 1);
}
public ItemMap(Integer meta) {
this(meta, 1);
}
public ItemMap(Integer meta, int count) {
super(MAP, 0, count, "Map");
if (!hasCompoundTag() || !getNamedTag().contains("map_uuid")) {
CompoundTag tag = new CompoundTag();
tag.putString("map_uuid", "" + mapCount++);
this.setNamedTag(tag);
}
}
public void setImage(File file) throws IOException {
setImage(ImageIO.read(file));
}
public void setImage(BufferedImage img) {
try {
BufferedImage image = img;
if (img.getHeight() != 128 || img.getWidth() != 128) { //resize
image = new BufferedImage(128, 128, img.getType());
Graphics2D g = image.createGraphics();
g.drawImage(img, 0, 0, 128, 128, null);
g.dispose();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
this.getNamedTag().putByteArray("Colors", baos.toByteArray());
} catch (IOException e) {
MainLogger.getLogger().logException(e);
}
}
protected BufferedImage loadImageFromNBT() {
try {
byte[] data = getNamedTag().getByteArray("Colors");
return ImageIO.read(new ByteArrayInputStream(data));
} catch (IOException e) {
MainLogger.getLogger().logException(e);
}
return null;
}
public long getMapId() {
return Long.valueOf(getNamedTag().getString("map_uuid"));
}
public void sendImage(Player p) {
BufferedImage image = loadImageFromNBT();
ClientboundMapItemDataPacket pk = new ClientboundMapItemDataPacket();
pk.mapId = getMapId();
pk.update = 2;
pk.scale = 0;
pk.width = 128;
pk.height = 128;
pk.offsetX = 0;
pk.offsetZ = 0;
pk.image = image;
p.dataPacket(pk);
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 2,720 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemEndCrystal.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemEndCrystal.java | package cn.nukkit.item;
public class ItemEndCrystal extends Item {
public ItemEndCrystal() {
this(0, 1);
}
public ItemEndCrystal(Integer meta) {
this(meta, 1);
}
public ItemEndCrystal(Integer meta, int count) {
super(END_CRYSTAL, meta, count, "End Crystal");
}
}
| 315 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCauldron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCauldron.java | package cn.nukkit.item;
import cn.nukkit.block.BlockCauldron;
/**
* author: CreeperFace
* Nukkit Project
*/
public class ItemCauldron extends Item {
public ItemCauldron() {
this(0, 1);
}
public ItemCauldron(Integer meta) {
this(meta, 1);
}
public ItemCauldron(Integer meta, int count) {
super(CAULDRON, meta, count, "Cauldron");
this.block = new BlockCauldron();
}
} | 430 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPickaxeWood.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPickaxeWood.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPickaxeWood extends ItemTool {
public ItemPickaxeWood() {
this(0, 1);
}
public ItemPickaxeWood(Integer meta) {
this(meta, 1);
}
public ItemPickaxeWood(Integer meta, int count) {
super(WOODEN_PICKAXE, meta, count, "Wooden Pickaxe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_WOODEN;
}
@Override
public boolean isPickaxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_WOODEN;
}
@Override
public int getAttackDamage() {
return 2;
}
}
| 712 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordChirp.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordChirp.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordChirp extends ItemRecord {
public ItemRecordChirp() {
this(0, 1);
}
public ItemRecordChirp(Integer meta) {
this(meta, 1);
}
public ItemRecordChirp(Integer meta, int count) {
super(RECORD_CHIRP, meta, count);
}
@Override
public String getSoundId() {
return "record.chirp";
}
}
| 427 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemShovelDiamond.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemShovelDiamond.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemShovelDiamond extends ItemTool {
public ItemShovelDiamond() {
this(0, 1);
}
public ItemShovelDiamond(Integer meta) {
this(meta, 1);
}
public ItemShovelDiamond(Integer meta, int count) {
super(DIAMOND_SHOVEL, meta, count, "Diamond Shovel");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_DIAMOND;
}
@Override
public boolean isShovel() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_DIAMOND;
}
@Override
public int getAttackDamage() {
return 4;
}
}
| 721 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRecordFar.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRecordFar.java | package cn.nukkit.item;
/**
* @author CreeperFace
*/
public class ItemRecordFar extends ItemRecord {
public ItemRecordFar() {
this(0, 1);
}
public ItemRecordFar(Integer meta) {
this(meta, 1);
}
public ItemRecordFar(Integer meta, int count) {
super(RECORD_FAR, meta, count);
}
@Override
public String getSoundId() {
return "record.far";
}
}
| 415 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemLeatherHorseArmor.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemLeatherHorseArmor.java | package cn.nukkit.item;
public class ItemLeatherHorseArmor extends Item {
public ItemLeatherHorseArmor() {
this(0, 1);
}
public ItemLeatherHorseArmor(Integer meta) {
this(meta, 1);
}
public ItemLeatherHorseArmor(Integer meta, int count) {
super(LEATHER_HORSE_ARMOR, meta, count, "Leather horse armor");
}
}
| 358 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemShovelWood.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemShovelWood.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemShovelWood extends ItemTool {
public ItemShovelWood() {
this(0, 1);
}
public ItemShovelWood(Integer meta) {
this(meta, 1);
}
public ItemShovelWood(Integer meta, int count) {
super(WOODEN_SHOVEL, meta, count, "Wooden Shovel");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_WOODEN;
}
@Override
public boolean isShovel() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_WOODEN;
}
@Override
public int getAttackDamage() {
return 1;
}
}
| 705 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSpawnEgg.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSpawnEgg.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.entity.Entity;
import cn.nukkit.level.Level;
import cn.nukkit.level.format.FullChunk;
import cn.nukkit.math.BlockFace;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.DoubleTag;
import cn.nukkit.nbt.tag.FloatTag;
import cn.nukkit.nbt.tag.ListTag;
import java.util.Random;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemSpawnEgg extends Item {
public ItemSpawnEgg() {
this(0, 1);
}
public ItemSpawnEgg(Integer meta) {
this(meta, 1);
}
public ItemSpawnEgg(Integer meta, int count) {
super(SPAWN_EGG, meta, count, "Spawn EntityEgg");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
FullChunk chunk = level.getChunk((int) block.getX() >> 4, (int) block.getZ() >> 4);
if (chunk == null) {
return false;
}
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<DoubleTag>("Pos")
.add(new DoubleTag("", block.getX() + 0.5))
.add(new DoubleTag("", block.getY()))
.add(new DoubleTag("", block.getZ() + 0.5)))
.putList(new ListTag<DoubleTag>("Motion")
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0)))
.putList(new ListTag<FloatTag>("Rotation")
.add(new FloatTag("", new Random().nextFloat() * 360))
.add(new FloatTag("", 0)));
if (this.hasCustomName()) {
nbt.putString("CustomName", this.getCustomName());
}
Entity entity = Entity.createEntity(this.meta, chunk, nbt);
if (entity != null) {
if (player.isSurvival()) {
Item item = player.getInventory().getItemInHand();
item.setCount(item.getCount() - 1);
player.getInventory().setItemInHand(item);
}
entity.spawnToAll();
return true;
}
return false;
}
}
| 2,347 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemGunpowder.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemGunpowder.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemGunpowder extends Item {
public ItemGunpowder() {
this(0, 1);
}
public ItemGunpowder(Integer meta) {
this(meta, 1);
}
public ItemGunpowder(Integer meta, int count) {
super(GUNPOWDER, meta, count, "Gunpowder");
}
}
| 356 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemFlintSteel.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemFlintSteel.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.*;
import cn.nukkit.event.block.BlockIgniteEvent;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.math.Vector3;
import java.util.concurrent.ThreadLocalRandom;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemFlintSteel extends ItemTool {
public ItemFlintSteel() {
this(0, 1);
}
public ItemFlintSteel(Integer meta) {
this(meta, 1);
}
public ItemFlintSteel(Integer meta, int count) {
super(FLINT_STEEL, meta, count, "Flint and Steel");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
if (block.getId() == AIR && (target instanceof BlockSolid || target instanceof BlockSolidMeta)) {
if (target.getId() == OBSIDIAN) {
int targetX = target.getFloorX();
int targetY = target.getFloorY();
int targetZ = target.getFloorZ();
int x_max = targetX;
int x_min = targetX;
int x;
for (x = targetX + 1; level.getBlock(new Vector3(x, targetY, targetZ)).getId() == OBSIDIAN; x++) {
x_max++;
}
for (x = targetX - 1; level.getBlock(new Vector3(x, targetY, targetZ)).getId() == OBSIDIAN; x--) {
x_min--;
}
int count_x = x_max - x_min + 1;
int z_max = targetZ;
int z_min = targetZ;
int z;
for (z = targetZ + 1; level.getBlock(new Vector3(targetX, targetY, z)).getId() == OBSIDIAN; z++) {
z_max++;
}
for (z = targetZ - 1; level.getBlock(new Vector3(targetX, targetY, z)).getId() == OBSIDIAN; z--) {
z_min--;
}
int count_z = z_max - z_min + 1;
int z_max_y = targetY;
int z_min_y = targetY;
int y;
for (y = targetY; level.getBlock(new Vector3(targetX, y, z_max)).getId() == OBSIDIAN; y++) {
z_max_y++;
}
for (y = targetY; level.getBlock(new Vector3(targetX, y, z_min)).getId() == OBSIDIAN; y++) {
z_min_y++;
}
int y_max = Math.min(z_max_y, z_min_y) - 1;
int count_y = y_max - targetY + 2;
if ((count_x >= 4 && count_x <= 23 || count_z >= 4 && count_z <= 23) && count_y >= 5 && count_y <= 23) {
int count_up = 0;
for (int up_z = z_min; level.getBlock(new Vector3(targetX, y_max, up_z)).getId() == OBSIDIAN && up_z <= z_max; up_z++) {
count_up++;
}
if (count_up == count_z) {
for (int block_z = z_min + 1; block_z < z_max; block_z++) {
for (int block_y = targetY + 1; block_y < y_max; block_y++) {
level.setBlock(new Vector3(targetX, block_y, block_z), new BlockNetherPortal());
}
}
return true;
}
}
}
BlockFire fire = new BlockFire();
fire.x = block.x;
fire.y = block.y;
fire.z = block.z;
fire.level = level;
if (fire.isBlockTopFacingSurfaceSolid(fire.down()) || fire.canNeighborBurn()) {
BlockIgniteEvent e = new BlockIgniteEvent(block, null, player, BlockIgniteEvent.BlockIgniteCause.FLINT_AND_STEEL);
block.getLevel().getServer().getPluginManager().callEvent(e);
if (!e.isCancelled()) {
level.setBlock(fire, fire, true);
level.scheduleUpdate(fire, fire.tickRate() + ThreadLocalRandom.current().nextInt(10));
}
return true;
}
if ((player.gamemode & 0x01) == 0 && this.useOn(block)) {
if (this.getDamage() >= this.getMaxDurability()) {
this.count = 0;
} else {
this.meta++;
}
}
return true;
}
return false;
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_FLINT_STEEL;
}
}
| 4,617 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSpiderEye.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSpiderEye.java | package cn.nukkit.item;
/**
* Created by Snake1999 on 2016/1/14.
* Package cn.nukkit.item in project nukkit.
*/
public class ItemSpiderEye extends Item {
public ItemSpiderEye() {
this(0, 1);
}
public ItemSpiderEye(Integer meta) {
this(meta, 1);
}
public ItemSpiderEye(Integer meta, int count) {
super(SPIDER_EYE, meta, count, "Spider Eye");
}
}
| 400 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBook.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBook.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBook extends Item {
public ItemBook() {
this(0, 1);
}
public ItemBook(Integer meta) {
this(meta, 1);
}
public ItemBook(Integer meta, int count) {
super(BOOK, meta, count, "Book");
}
@Override
public int getEnchantAbility() {
return 1;
}
}
| 402 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHorseArmorIron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHorseArmorIron.java | package cn.nukkit.item;
public class ItemHorseArmorIron extends Item {
public ItemHorseArmorIron() {
this(0, 0);
}
public ItemHorseArmorIron(Integer meta) {
this(meta, 0);
}
public ItemHorseArmorIron(Integer meta, int count) {
super(IRON_HORSE_ARMOR, meta, count, "Iron Horse Armor");
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 414 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCookie.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCookie.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemCookie extends ItemEdible {
public ItemCookie() {
this(0, 1);
}
public ItemCookie(Integer meta) {
this(meta, 1);
}
public ItemCookie(Integer meta, int count) {
super(COOKIE, meta, count, "Cookie");
}
}
| 344 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemMinecartHopper.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemMinecartHopper.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.block.BlockRail;
import cn.nukkit.entity.item.EntityMinecartHopper;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.DoubleTag;
import cn.nukkit.nbt.tag.FloatTag;
import cn.nukkit.nbt.tag.ListTag;
import cn.nukkit.utils.Rail;
public class ItemMinecartHopper extends Item {
public ItemMinecartHopper() {
this(0, 1);
}
public ItemMinecartHopper(Integer meta) {
this(meta, 1);
}
public ItemMinecartHopper(Integer meta, int count) {
super(MINECART_WITH_HOPPER, meta, count, "Minecart with Hopper");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
if (Rail.isRailBlock(target)) {
Rail.Orientation type = ((BlockRail) target).getOrientation();
double adjacent = 0.0D;
if (type.isAscending()) {
adjacent = 0.5D;
}
EntityMinecartHopper minecart = new EntityMinecartHopper(
level.getChunk(target.getFloorX() >> 4, target.getFloorZ() >> 4), new CompoundTag("")
.putList(new ListTag<>("Pos")
.add(new DoubleTag("", target.getX() + 0.5))
.add(new DoubleTag("", target.getY() + 0.0625D + adjacent))
.add(new DoubleTag("", target.getZ() + 0.5)))
.putList(new ListTag<>("Motion")
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0)))
.putList(new ListTag<>("Rotation")
.add(new FloatTag("", 0))
.add(new FloatTag("", 0)))
);
minecart.spawnToAll();
count -= 1;
return true;
}
return false;
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 2,247 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemFeather.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemFeather.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemFeather extends Item {
public ItemFeather() {
this(0, 1);
}
public ItemFeather(Integer meta) {
this(meta, 1);
}
public ItemFeather(Integer meta, int count) {
super(FEATHER, 0, count, "Feather");
}
}
| 341 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCarrotOnAStick.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCarrotOnAStick.java | package cn.nukkit.item;
/**
* Created by lion on 21.03.17.
*/
public class ItemCarrotOnAStick extends Item {
public ItemCarrotOnAStick() {
this(0, 1);
}
public ItemCarrotOnAStick(Integer meta) {
this(meta, 1);
}
public ItemCarrotOnAStick(Integer meta, int count) {
super(CARROT_ON_A_STICK, meta, count, "Carrot on a stick");
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 458 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemLeggingsDiamond.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemLeggingsDiamond.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemLeggingsDiamond extends ItemArmor {
public ItemLeggingsDiamond() {
this(0, 1);
}
public ItemLeggingsDiamond(Integer meta) {
this(meta, 1);
}
public ItemLeggingsDiamond(Integer meta, int count) {
super(DIAMOND_LEGGINGS, meta, count, "Diamond Leggings");
}
@Override
public boolean isLeggings() {
return true;
}
@Override
public int getTier() {
return ItemArmor.TIER_DIAMOND;
}
@Override
public int getArmorPoints() {
return 6;
}
@Override
public int getMaxDurability() {
return 496;
}
@Override
public int getToughness() {
return 2;
}
}
| 783 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPaper.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPaper.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPaper extends Item {
public ItemPaper() {
this(0, 1);
}
public ItemPaper(Integer meta) {
this(meta, 1);
}
public ItemPaper(Integer meta, int count) {
super(PAPER, meta, count, "Paper");
}
}
| 332 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemDoorIron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemDoorIron.java | package cn.nukkit.item;
import cn.nukkit.block.BlockDoorIron;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemDoorIron extends Item {
public ItemDoorIron() {
this(0, 1);
}
public ItemDoorIron(Integer meta) {
this(meta, 1);
}
public ItemDoorIron(Integer meta, int count) {
super(IRON_DOOR, 0, count, "Iron Door");
this.block = new BlockDoorIron();
}
}
| 431 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemNetherStar.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemNetherStar.java | package cn.nukkit.item;
public class ItemNetherStar extends Item {
public ItemNetherStar() {
this(0, 1);
}
public ItemNetherStar(Integer meta) {
this(meta, 1);
}
public ItemNetherStar(Integer meta, int count) {
super(NETHER_STAR, 0, count, "Nether Star");
}
}
| 328 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBootsGold.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBootsGold.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBootsGold extends ItemArmor {
public ItemBootsGold() {
this(0, 1);
}
public ItemBootsGold(Integer meta) {
this(meta, 1);
}
public ItemBootsGold(Integer meta, int count) {
super(GOLD_BOOTS, meta, count, "Gold Boots");
}
@Override
public int getTier() {
return ItemArmor.TIER_GOLD;
}
@Override
public boolean isBoots() {
return true;
}
@Override
public int getArmorPoints() {
return 1;
}
@Override
public int getMaxDurability() {
return 92;
}
}
| 669 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPrismarineCrystals.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPrismarineCrystals.java | package cn.nukkit.item;
public class ItemPrismarineCrystals extends Item {
public ItemPrismarineCrystals() {
this(0, 1);
}
public ItemPrismarineCrystals(Integer meta) {
this(meta, 1);
}
public ItemPrismarineCrystals(Integer meta, int count) {
super(PRISMARINE_CRYSTALS, 0, count, "Prismarine Crystals");
}
}
| 376 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemFishCooked.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemFishCooked.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemFishCooked extends ItemFish {
public ItemFishCooked() {
this(0, 1);
}
public ItemFishCooked(Integer meta) {
this(meta, 1);
}
public ItemFishCooked(Integer meta, int count) {
super(COOKED_FISH, meta, count, "Cooked Fish");
}
}
| 369 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBread.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBread.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBread extends ItemEdible {
public ItemBread() {
this(0, 1);
}
public ItemBread(Integer meta) {
this(meta, 1);
}
public ItemBread(Integer meta, int count) {
super(BREAD, meta, count, "Bread");
}
}
| 338 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHoeIron.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHoeIron.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemHoeIron extends ItemTool {
public ItemHoeIron() {
this(0, 1);
}
public ItemHoeIron(Integer meta) {
this(meta, 1);
}
public ItemHoeIron(Integer meta, int count) {
super(IRON_HOE, meta, count, "Iron Hoe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_IRON;
}
@Override
public boolean isHoe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_IRON;
}
}
| 602 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemSalmon.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemSalmon.java | package cn.nukkit.item;
/**
* Created by Snake1999 on 2016/1/14.
* Package cn.nukkit.item in project nukkit.
*/
public class ItemSalmon extends ItemFish {
public ItemSalmon() {
this(0, 1);
}
public ItemSalmon(Integer meta) {
this(meta, 1);
}
public ItemSalmon(Integer meta, int count) {
super(RAW_SALMON, meta, count, "Raw Salmon");
}
}
| 393 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCarrot.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCarrot.java | package cn.nukkit.item;
import cn.nukkit.block.BlockCarrot;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemCarrot extends ItemEdible {
public ItemCarrot() {
this(0, 1);
}
public ItemCarrot(Integer meta) {
this(meta, 1);
}
public ItemCarrot(Integer meta, int count) {
super(CARROT, 0, count, "Carrot");
this.block = new BlockCarrot();
}
}
| 419 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemAxeDiamond.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemAxeDiamond.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemAxeDiamond extends ItemTool {
public ItemAxeDiamond() {
this(0, 1);
}
public ItemAxeDiamond(Integer meta) {
this(meta, 1);
}
public ItemAxeDiamond(Integer meta, int count) {
super(DIAMOND_AXE, meta, count, "Diamond Axe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_DIAMOND;
}
@Override
public boolean isAxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_DIAMOND;
}
@Override
public int getAttackDamage() {
return 6;
}
}
| 700 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemAxeWood.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemAxeWood.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemAxeWood extends ItemTool {
public ItemAxeWood() {
this(0, 1);
}
public ItemAxeWood(Integer meta) {
this(meta, 1);
}
public ItemAxeWood(Integer meta, int count) {
super(WOODEN_AXE, meta, count, "Wooden Axe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_WOODEN;
}
@Override
public boolean isAxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_WOODEN;
}
@Override
public int getAttackDamage() {
return 3;
}
}
| 684 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemChestplateDiamond.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemChestplateDiamond.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemChestplateDiamond extends ItemArmor {
public ItemChestplateDiamond() {
this(0, 1);
}
public ItemChestplateDiamond(Integer meta) {
this(meta, 1);
}
public ItemChestplateDiamond(Integer meta, int count) {
super(DIAMOND_CHESTPLATE, meta, count, "Diamond Chestplate");
}
@Override
public int getTier() {
return ItemArmor.TIER_DIAMOND;
}
@Override
public boolean isChestplate() {
return true;
}
@Override
public int getArmorPoints() {
return 8;
}
@Override
public int getMaxDurability() {
return 529;
}
@Override
public int getToughness() {
return 2;
}
}
| 797 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemLeggingsChain.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemLeggingsChain.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemLeggingsChain extends ItemArmor {
public ItemLeggingsChain() {
this(0, 1);
}
public ItemLeggingsChain(Integer meta) {
this(meta, 1);
}
public ItemLeggingsChain(Integer meta, int count) {
super(CHAIN_LEGGINGS, meta, count, "Chain Leggings");
}
@Override
public int getTier() {
return ItemArmor.TIER_CHAIN;
}
@Override
public boolean isLeggings() {
return true;
}
@Override
public int getArmorPoints() {
return 4;
}
@Override
public int getMaxDurability() {
return 226;
}
}
| 698 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemAppleGoldEnchanted.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemAppleGoldEnchanted.java | package cn.nukkit.item;
/**
* Created by Snake1999 on 2016/1/14.
* Package cn.nukkit.item in project nukkit.
*/
public class ItemAppleGoldEnchanted extends ItemEdible {
public ItemAppleGoldEnchanted() {
this(0, 1);
}
public ItemAppleGoldEnchanted(Integer meta) {
this(meta, 1);
}
public ItemAppleGoldEnchanted(Integer meta, int count) {
super(GOLDEN_APPLE_ENCHANTED, meta, count, "Enchanted Golden Apple");
}
}
| 465 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemWheat.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemWheat.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemWheat extends Item {
public ItemWheat() {
this(0, 1);
}
public ItemWheat(Integer meta) {
this(meta, 1);
}
public ItemWheat(Integer meta, int count) {
super(WHEAT, meta, count, "Wheat");
}
}
| 332 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRabbitStew.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRabbitStew.java | package cn.nukkit.item;
/**
* Created by Snake1999 on 2016/1/14.
* Package cn.nukkit.item in project nukkit.
*/
public class ItemRabbitStew extends ItemEdible {
public ItemRabbitStew() {
this(0, 1);
}
public ItemRabbitStew(Integer meta) {
this(meta, 1);
}
public ItemRabbitStew(Integer meta, int count) {
super(RABBIT_STEW, meta, count, "Rabbit Stew");
}
}
| 412 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBow.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBow.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.Server;
import cn.nukkit.block.BlockAir;
import cn.nukkit.entity.projectile.EntityArrow;
import cn.nukkit.entity.projectile.EntityProjectile;
import cn.nukkit.event.entity.EntityShootBowEvent;
import cn.nukkit.event.entity.ProjectileLaunchEvent;
import cn.nukkit.item.enchantment.Enchantment;
import cn.nukkit.level.Sound;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.DoubleTag;
import cn.nukkit.nbt.tag.FloatTag;
import cn.nukkit.nbt.tag.ListTag;
import java.util.Random;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemBow extends ItemTool {
public ItemBow() {
this(0, 1);
}
public ItemBow(Integer meta) {
this(meta, 1);
}
public ItemBow(Integer meta, int count) {
super(BOW, meta, count, "Bow");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_BOW;
}
@Override
public int getEnchantAbility() {
return 1;
}
public boolean onReleaseUsing(Player player) {
Item itemArrow = Item.get(Item.ARROW, 0, 1);
if (player.isSurvival() && !player.getInventory().contains(itemArrow)) {
player.getInventory().sendContents(player);
return false;
}
double damage = 2;
boolean flame = false;
if (this.hasEnchantments()) {
Enchantment bowDamage = this.getEnchantment(Enchantment.ID_BOW_POWER);
if (bowDamage != null && bowDamage.getLevel() > 0) {
damage += 0.25 * (bowDamage.getLevel() + 1);
}
Enchantment flameEnchant = this.getEnchantment(Enchantment.ID_BOW_FLAME);
flame = flameEnchant != null && flameEnchant.getLevel() > 0;
}
CompoundTag nbt = new CompoundTag()
.putList(new ListTag<DoubleTag>("Pos")
.add(new DoubleTag("", player.x))
.add(new DoubleTag("", player.y + player.getEyeHeight()))
.add(new DoubleTag("", player.z)))
.putList(new ListTag<DoubleTag>("Motion")
.add(new DoubleTag("", -Math.sin(player.yaw / 180 * Math.PI) * Math.cos(player.pitch / 180 * Math.PI)))
.add(new DoubleTag("", -Math.sin(player.pitch / 180 * Math.PI)))
.add(new DoubleTag("", Math.cos(player.yaw / 180 * Math.PI) * Math.cos(player.pitch / 180 * Math.PI))))
.putList(new ListTag<FloatTag>("Rotation")
.add(new FloatTag("", (player.yaw > 180 ? 360 : 0) - (float) player.yaw))
.add(new FloatTag("", (float) -player.pitch)))
.putShort("Fire", player.isOnFire() || flame ? 45 * 60 : 0)
.putDouble("damage", damage);
int diff = (Server.getInstance().getTick() - player.getStartActionTick());
double p = (double) diff / 20;
double f = Math.min((p * p + p * 2) / 3, 1) * 2;
EntityShootBowEvent entityShootBowEvent = new EntityShootBowEvent(player, this, new EntityArrow(player.chunk, nbt, player, f == 2), f);
if (f < 0.1 || diff < 5) {
entityShootBowEvent.setCancelled();
}
Server.getInstance().getPluginManager().callEvent(entityShootBowEvent);
if (entityShootBowEvent.isCancelled()) {
entityShootBowEvent.getProjectile().kill();
player.getInventory().sendContents(player);
} else {
entityShootBowEvent.getProjectile().setMotion(entityShootBowEvent.getProjectile().getMotion().multiply(entityShootBowEvent.getForce()));
if (player.isSurvival()) {
Enchantment infinity;
if (!this.hasEnchantments() || (infinity = this.getEnchantment(Enchantment.ID_BOW_INFINITY)) == null || infinity.getLevel() <= 0)
player.getInventory().removeItem(itemArrow);
if (!this.isUnbreakable()) {
Enchantment durability = this.getEnchantment(Enchantment.ID_DURABILITY);
if (!(durability != null && durability.getLevel() > 0 && (100 / (durability.getLevel() + 1)) <= new Random().nextInt(100))) {
this.setDamage(this.getDamage() + 1);
if (this.getDamage() >= 385) {
player.getInventory().setItemInHand(new ItemBlock(new BlockAir(), 0, 0));
} else {
player.getInventory().setItemInHand(this);
}
}
}
}
if (entityShootBowEvent.getProjectile() instanceof EntityProjectile) {
ProjectileLaunchEvent projectev = new ProjectileLaunchEvent(entityShootBowEvent.getProjectile());
Server.getInstance().getPluginManager().callEvent(projectev);
if (projectev.isCancelled()) {
entityShootBowEvent.getProjectile().kill();
} else {
entityShootBowEvent.getProjectile().spawnToAll();
player.level.addSound(player, Sound.RANDOM_BOW, 1, 1, player.getViewers().values());
}
} else {
entityShootBowEvent.getProjectile().spawnToAll();
}
}
return true;
}
}
| 5,401 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemDoorWood.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemDoorWood.java | package cn.nukkit.item;
import cn.nukkit.block.BlockDoorWood;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemDoorWood extends Item {
public ItemDoorWood() {
this(0, 1);
}
public ItemDoorWood(Integer meta) {
this(meta, 1);
}
public ItemDoorWood(Integer meta, int count) {
super(WOODEN_DOOR, 0, count, "Oak Door");
this.block = new BlockDoorWood();
}
}
| 432 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemEnderPearl.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemEnderPearl.java | package cn.nukkit.item;
public class ItemEnderPearl extends ProjectileItem {
public ItemEnderPearl() {
this(0, 1);
}
public ItemEnderPearl(Integer meta) {
this(meta, 1);
}
public ItemEnderPearl(Integer meta, int count) {
super(ENDER_PEARL, 0, count, "Ender Pearl");
}
@Override
public int getMaxStackSize() {
return 16;
}
@Override
public String getProjectileEntityType() {
return "EnderPearl";
}
@Override
public float getThrowForce() {
return 1.5f;
}
}
| 570 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHorseArmorGold.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHorseArmorGold.java | package cn.nukkit.item;
public class ItemHorseArmorGold extends Item {
public ItemHorseArmorGold() {
this(0, 0);
}
public ItemHorseArmorGold(Integer meta) {
this(meta, 0);
}
public ItemHorseArmorGold(Integer meta, int count) {
super(GOLD_HORSE_ARMOR, meta, count, "Gold Horse Armor");
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 414 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemEdible.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemEdible.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public abstract class ItemEdible extends Item {
public ItemEdible(int id, Integer meta, int count, String name) {
super(id, meta, count, name);
}
public ItemEdible(int id) {
super(id);
}
public ItemEdible(int id, Integer meta) {
super(id, meta);
}
public ItemEdible(int id, Integer meta, int count) {
super(id, meta, count);
}
}
| 471 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPotion.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPotion.java | package cn.nukkit.item;
public class ItemPotion extends Item {
public static final int NO_EFFECTS = 0;
public static final int MUNDANE = 1;
public static final int MUNDANE_II = 2;
public static final int THICK = 3;
public static final int AWKWARD = 4;
public static final int NIGHT_VISION = 5;
public static final int NIGHT_VISION_LONG = 6;
public static final int INVISIBLE = 7;
public static final int INVISIBLE_LONG = 8;
public static final int LEAPING = 9;
public static final int LEAPING_LONG = 10;
public static final int LEAPING_II = 11;
public static final int FIRE_RESISTANCE = 12;
public static final int FIRE_RESISTANCE_LONG = 13;
public static final int SPEED = 14;
public static final int SPEED_LONG = 15;
public static final int SPEED_II = 16;
public static final int SLOWNESS = 17;
public static final int SLOWNESS_LONG = 18;
public static final int WATER_BREATHING = 19;
public static final int WATER_BREATHING_LONG = 20;
public static final int INSTANT_HEALTH = 21;
public static final int INSTANT_HEALTH_II = 22;
public static final int HARMING = 23;
public static final int HARMING_II = 24;
public static final int POISON = 25;
public static final int POISON_LONG = 26;
public static final int POISON_II = 27;
public static final int REGENERATION = 28;
public static final int REGENERATION_LONG = 29;
public static final int REGENERATION_II = 30;
public static final int STRENGTH = 31;
public static final int STRENGTH_LONG = 32;
public static final int STRENGTH_II = 33;
public static final int WEAKNESS = 34;
public static final int WEAKNESS_LONG = 35;
public static final int DECAY = 36;
public ItemPotion() {
this(0, 1);
}
public ItemPotion(Integer meta) {
this(meta, 1);
}
public ItemPotion(Integer meta, int count) {
super(POTION, meta, count, "Potion");
}
@Override
public int getMaxStackSize() {
return 1;
}
} | 2,059 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemHopper.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemHopper.java | package cn.nukkit.item;
import cn.nukkit.block.BlockHopper;
/**
* Created by CreeperFace on 13.5.2017.
*/
public class ItemHopper extends Item {
public ItemHopper() {
this(0);
}
public ItemHopper(Integer meta) {
this(meta, 1);
}
public ItemHopper(Integer meta, int count) {
super(HOPPER, 0, count, "Hopper");
this.block = new BlockHopper();
}
}
| 408 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemAxeStone.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemAxeStone.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemAxeStone extends ItemTool {
public ItemAxeStone() {
this(0, 1);
}
public ItemAxeStone(Integer meta) {
this(meta, 1);
}
public ItemAxeStone(Integer meta, int count) {
super(STONE_AXE, meta, count, "Stone Axe");
}
@Override
public int getMaxDurability() {
return ItemTool.DURABILITY_STONE;
}
@Override
public boolean isAxe() {
return true;
}
@Override
public int getTier() {
return ItemTool.TIER_STONE;
}
@Override
public int getAttackDamage() {
return 4;
}
}
| 684 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemBoat.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemBoat.java | package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.block.Block;
import cn.nukkit.entity.item.EntityBoat;
import cn.nukkit.level.Level;
import cn.nukkit.math.BlockFace;
import cn.nukkit.nbt.tag.CompoundTag;
import cn.nukkit.nbt.tag.DoubleTag;
import cn.nukkit.nbt.tag.FloatTag;
import cn.nukkit.nbt.tag.ListTag;
/**
* Created by yescallop on 2016/2/13.
*/
public class ItemBoat extends Item {
public ItemBoat() {
this(0, 1);
}
public ItemBoat(Integer meta) {
this(meta, 1);
}
public ItemBoat(Integer meta, int count) {
super(BOAT, meta, count, "Boat");
}
@Override
public boolean canBeActivated() {
return true;
}
@Override
public boolean onActivate(Level level, Player player, Block block, Block target, BlockFace face, double fx, double fy, double fz) {
if (face != BlockFace.UP) return false;
EntityBoat boat = new EntityBoat(
level.getChunk(block.getFloorX() >> 4, block.getFloorZ() >> 4), new CompoundTag("")
.putList(new ListTag<DoubleTag>("Pos")
.add(new DoubleTag("", block.getX() + 0.5))
.add(new DoubleTag("", block.getY() - 0.0625))
.add(new DoubleTag("", block.getZ() + 0.5)))
.putList(new ListTag<DoubleTag>("Motion")
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0))
.add(new DoubleTag("", 0)))
.putList(new ListTag<FloatTag>("Rotation")
.add(new FloatTag("", (float) ((player.yaw + 90f) % 360)))
.add(new FloatTag("", 0)))
.putByte("woodID", this.getDamage())
);
if (player.isSurvival()) {
Item item = player.getInventory().getItemInHand();
item.setCount(item.getCount() - 1);
player.getInventory().setItemInHand(item);
}
boat.spawnToAll();
return true;
}
@Override
public int getMaxStackSize() {
return 1;
}
}
| 2,120 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemEgg.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemEgg.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemEgg extends ProjectileItem {
public ItemEgg() {
this(0, 1);
}
public ItemEgg(Integer meta) {
this(meta, 1);
}
public ItemEgg(Integer meta, int count) {
super(EGG, meta, count, "Egg");
}
@Override
public String getProjectileEntityType() {
return "Egg";
}
@Override
public float getThrowForce() {
return 1.5f;
}
}
| 496 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemDiamondHorseArmor.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemDiamondHorseArmor.java | package cn.nukkit.item;
public class ItemDiamondHorseArmor extends Item {
public ItemDiamondHorseArmor() {
this(0, 0);
}
public ItemDiamondHorseArmor(Integer meta) {
this(meta, 0);
}
public ItemDiamondHorseArmor(Integer meta, int count) {
super(GOLD_HORSE_ARMOR, meta, count, "Diamond horse armor");
}
}
| 355 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemCoal.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemCoal.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemCoal extends Item {
public ItemCoal() {
this(0, 1);
}
public ItemCoal(Integer meta) {
this(meta, 1);
}
public ItemCoal(Integer meta, int count) {
super(COAL, meta, count, "Coal");
if (this.meta == 1) {
this.name = "Charcoal";
}
}
}
| 402 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemPorkchopCooked.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemPorkchopCooked.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemPorkchopCooked extends ItemEdible {
public ItemPorkchopCooked() {
this(0, 1);
}
public ItemPorkchopCooked(Integer meta) {
this(meta, 1);
}
public ItemPorkchopCooked(Integer meta, int count) {
super(COOKED_PORKCHOP, meta, count, "Cooked Porkchop");
}
}
| 394 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemRedstoneRepeater.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemRedstoneRepeater.java | package cn.nukkit.item;
import cn.nukkit.block.BlockRedstoneRepeaterUnpowered;
/**
* @author CreeperFace
*/
public class ItemRedstoneRepeater extends Item {
public ItemRedstoneRepeater() {
this(0);
}
public ItemRedstoneRepeater(Integer meta) {
this(0, 1);
}
public ItemRedstoneRepeater(Integer meta, int count) {
super(REPEATER, meta, count, "Redstone Repeater");
this.block = new BlockRedstoneRepeaterUnpowered();
}
}
| 482 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
ItemNuggetGold.java | /FileExtraction/Java_unseen/Nukkit_Nukkit/src/main/java/cn/nukkit/item/ItemNuggetGold.java | package cn.nukkit.item;
/**
* author: MagicDroidX
* Nukkit Project
*/
public class ItemNuggetGold extends Item {
public ItemNuggetGold() {
this(0, 1);
}
public ItemNuggetGold(Integer meta) {
this(meta, 1);
}
public ItemNuggetGold(Integer meta, int count) {
super(GOLD_NUGGET, meta, count, "Gold Nugget");
}
}
| 364 | Java | .java | Nukkit/Nukkit | 821 | 272 | 171 | 2015-05-23T09:51:41Z | 2024-03-21T12:28:05Z |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.