Advertisement
xfanta

Block.java from spigot

Aug 31st, 2016
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 36.57 KB | None | 0 0
  1. package net.minecraft.server;
  2.  
  3. import java.util.Iterator;
  4. import java.util.List;
  5. import java.util.Random;
  6.  
  7. public class Block {
  8.  
  9.     public static final RegistryMaterials REGISTRY = new RegistryBlocks("air");
  10.     private CreativeModeTab creativeTab;
  11.     protected String d;
  12.     public static final StepSound e = new StepSound("stone", 1.0F, 1.0F);
  13.     public static final StepSound f = new StepSound("wood", 1.0F, 1.0F);
  14.     public static final StepSound g = new StepSound("gravel", 1.0F, 1.0F);
  15.     public static final StepSound h = new StepSound("grass", 1.0F, 1.0F);
  16.     public static final StepSound i = new StepSound("stone", 1.0F, 1.0F);
  17.     public static final StepSound j = new StepSound("stone", 1.0F, 1.5F);
  18.     public static final StepSound k = new StepSoundStone("stone", 1.0F, 1.0F);
  19.     public static final StepSound l = new StepSound("cloth", 1.0F, 1.0F);
  20.     public static final StepSound m = new StepSound("sand", 1.0F, 1.0F);
  21.     public static final StepSound n = new StepSound("snow", 1.0F, 1.0F);
  22.     public static final StepSound o = new StepSoundLadder("ladder", 1.0F, 1.0F);
  23.     public static final StepSound p = new StepSoundAnvil("anvil", 0.3F, 1.0F);
  24.     protected boolean q;
  25.     protected int r;
  26.     protected boolean s;
  27.     protected int t;
  28.     protected boolean u;
  29.     protected float strength;
  30.     protected float durability;
  31.     protected boolean x = true;
  32.     protected boolean y = true;
  33.     protected boolean z;
  34.     protected boolean isTileEntity;
  35.     protected double minX;
  36.     protected double minY;
  37.     protected double minZ;
  38.     protected double maxX;
  39.     protected double maxY;
  40.     protected double maxZ;
  41.     public StepSound stepSound;
  42.     public float I;
  43.     protected final Material material;
  44.     public float frictionFactor;
  45.     private String name;
  46.  
  47.     public static int getId(Block block) {
  48.         return REGISTRY.b(block);
  49.     }
  50.  
  51.     public static Block getById(int i) {
  52.         return (Block) REGISTRY.a(i);
  53.     }
  54.  
  55.     public static Block a(Item item) {
  56.         return getById(Item.getId(item));
  57.     }
  58.  
  59.     public static Block b(String s) {
  60.         if (REGISTRY.b(s)) {
  61.             return (Block) REGISTRY.get(s);
  62.         } else {
  63.             try {
  64.                 return (Block) REGISTRY.a(Integer.parseInt(s));
  65.             } catch (NumberFormatException numberformatexception) {
  66.                 return null;
  67.             }
  68.         }
  69.     }
  70.  
  71.     public boolean j() {
  72.         return this.q;
  73.     }
  74.  
  75.     public int k() {
  76.         return this.r;
  77.     }
  78.  
  79.     public int m() {
  80.         return this.t;
  81.     }
  82.  
  83.     public boolean n() {
  84.         return this.u;
  85.     }
  86.  
  87.     public Material getMaterial() {
  88.         return this.material;
  89.     }
  90.  
  91.     public MaterialMapColor f(int i) {
  92.         return this.getMaterial().r();
  93.     }
  94.  
  95.     public static void p() {
  96.         REGISTRY.a(0, "air", (new BlockAir()).c("air"));
  97.         REGISTRY.a(1, "stone", (new BlockStone()).c(1.5F).b(10.0F).a(i).c("stone").d("stone"));
  98.         REGISTRY.a(2, "grass", (new BlockGrass()).c(0.6F).a(h).c("grass").d("grass"));
  99.         REGISTRY.a(3, "dirt", (new BlockDirt()).c(0.5F).a(g).c("dirt").d("dirt"));
  100.         Block block = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
  101.  
  102.         REGISTRY.a(4, "cobblestone", block);
  103.         Block block1 = (new BlockWood()).c(2.0F).b(5.0F).a(f).c("wood").d("planks");
  104.  
  105.         REGISTRY.a(5, "planks", block1);
  106.         REGISTRY.a(6, "sapling", (new BlockSapling()).c(0.0F).a(h).c("sapling").d("sapling"));
  107.         REGISTRY.a(7, "bedrock", (new Block(Material.STONE)).s().b(6000000.0F).a(i).c("bedrock").H().a(CreativeModeTab.b).d("bedrock"));
  108.         REGISTRY.a(8, "flowing_water", (new BlockFlowing(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_flow"));
  109.         REGISTRY.a(9, "water", (new BlockStationary(Material.WATER)).c(100.0F).g(3).c("water").H().d("water_still"));
  110.         REGISTRY.a(10, "flowing_lava", (new BlockFlowing(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_flow"));
  111.         REGISTRY.a(11, "lava", (new BlockStationary(Material.LAVA)).c(100.0F).a(1.0F).c("lava").H().d("lava_still"));
  112.         REGISTRY.a(12, "sand", (new BlockSand()).c(0.5F).a(m).c("sand").d("sand"));
  113.         REGISTRY.a(13, "gravel", (new BlockGravel()).c(0.6F).a(g).c("gravel").d("gravel"));
  114.         REGISTRY.a(14, "gold_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreGold").d("gold_ore"));
  115.         REGISTRY.a(15, "iron_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreIron").d("iron_ore"));
  116.         REGISTRY.a(16, "coal_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreCoal").d("coal_ore"));
  117.         REGISTRY.a(17, "log", (new BlockLog1()).c("log").d("log"));
  118.         REGISTRY.a(18, "leaves", (new BlockLeaves1()).c("leaves").d("leaves"));
  119.         REGISTRY.a(19, "sponge", (new BlockSponge()).c(0.6F).a(h).c("sponge").d("sponge"));
  120.         REGISTRY.a(20, "glass", (new BlockGlass(Material.SHATTERABLE, false)).c(0.3F).a(k).c("glass").d("glass"));
  121.         REGISTRY.a(21, "lapis_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreLapis").d("lapis_ore"));
  122.         REGISTRY.a(22, "lapis_block", (new BlockOreBlock(MaterialMapColor.H)).c(3.0F).b(5.0F).a(i).c("blockLapis").a(CreativeModeTab.b).d("lapis_block"));
  123.         REGISTRY.a(23, "dispenser", (new BlockDispenser()).c(3.5F).a(i).c("dispenser").d("dispenser"));
  124.         Block block2 = (new BlockSandStone()).a(i).c(0.8F).c("sandStone").d("sandstone");
  125.  
  126.         REGISTRY.a(24, "sandstone", block2);
  127.         REGISTRY.a(25, "noteblock", (new BlockNote()).c(0.8F).c("musicBlock").d("noteblock"));
  128.         REGISTRY.a(26, "bed", (new BlockBed()).c(0.2F).c("bed").H().d("bed"));
  129.         REGISTRY.a(27, "golden_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("goldenRail").d("rail_golden"));
  130.         REGISTRY.a(28, "detector_rail", (new BlockMinecartDetector()).c(0.7F).a(j).c("detectorRail").d("rail_detector"));
  131.         REGISTRY.a(29, "sticky_piston", (new BlockPiston(true)).c("pistonStickyBase"));
  132.         REGISTRY.a(30, "web", (new BlockWeb()).g(1).c(4.0F).c("web").d("web"));
  133.         REGISTRY.a(31, "tallgrass", (new BlockLongGrass()).c(0.0F).a(h).c("tallgrass"));
  134.         REGISTRY.a(32, "deadbush", (new BlockDeadBush()).c(0.0F).a(h).c("deadbush").d("deadbush"));
  135.         REGISTRY.a(33, "piston", (new BlockPiston(false)).c("pistonBase"));
  136.         REGISTRY.a(34, "piston_head", new BlockPistonExtension());
  137.         REGISTRY.a(35, "wool", (new BlockCloth(Material.CLOTH)).c(0.8F).a(l).c("cloth").d("wool_colored"));
  138.         REGISTRY.a(36, "piston_extension", new BlockPistonMoving());
  139.         REGISTRY.a(37, "yellow_flower", (new BlockFlowers(0)).c(0.0F).a(h).c("flower1").d("flower_dandelion"));
  140.         REGISTRY.a(38, "red_flower", (new BlockFlowers(1)).c(0.0F).a(h).c("flower2").d("flower_rose"));
  141.         REGISTRY.a(39, "brown_mushroom", (new BlockMushroom()).c(0.0F).a(h).a(0.125F).c("mushroom").d("mushroom_brown"));
  142.         REGISTRY.a(40, "red_mushroom", (new BlockMushroom()).c(0.0F).a(h).c("mushroom").d("mushroom_red"));
  143.         REGISTRY.a(41, "gold_block", (new BlockOreBlock(MaterialMapColor.F)).c(3.0F).b(10.0F).a(j).c("blockGold").d("gold_block"));
  144.         REGISTRY.a(42, "iron_block", (new BlockOreBlock(MaterialMapColor.h)).c(5.0F).b(10.0F).a(j).c("blockIron").d("iron_block"));
  145.         REGISTRY.a(43, "double_stone_slab", (new BlockStep(true)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
  146.         REGISTRY.a(44, "stone_slab", (new BlockStep(false)).c(2.0F).b(10.0F).a(i).c("stoneSlab"));
  147.         Block block3 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("brick").a(CreativeModeTab.b).d("brick");
  148.  
  149.         REGISTRY.a(45, "brick_block", block3);
  150.         REGISTRY.a(46, "tnt", (new BlockTNT()).c(0.0F).a(h).c("tnt").d("tnt"));
  151.         REGISTRY.a(47, "bookshelf", (new BlockBookshelf()).c(1.5F).a(f).c("bookshelf").d("bookshelf"));
  152.         REGISTRY.a(48, "mossy_cobblestone", (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy"));
  153.         REGISTRY.a(49, "obsidian", (new BlockObsidian()).c(50.0F).b(2000.0F).a(i).c("obsidian").d("obsidian"));
  154.         REGISTRY.a(50, "torch", (new BlockTorch()).c(0.0F).a(0.9375F).a(f).c("torch").d("torch_on"));
  155.         REGISTRY.a(51, "fire", (new BlockFire()).c(0.0F).a(1.0F).a(f).c("fire").H().d("fire"));
  156.         REGISTRY.a(52, "mob_spawner", (new BlockMobSpawner()).c(5.0F).a(j).c("mobSpawner").H().d("mob_spawner"));
  157.         REGISTRY.a(53, "oak_stairs", (new BlockStairs(block1, 0)).c("stairsWood"));
  158.         REGISTRY.a(54, "chest", (new BlockChest(0)).c(2.5F).a(f).c("chest"));
  159.         REGISTRY.a(55, "redstone_wire", (new BlockRedstoneWire()).c(0.0F).a(e).c("redstoneDust").H().d("redstone_dust"));
  160.         REGISTRY.a(56, "diamond_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreDiamond").d("diamond_ore"));
  161.         REGISTRY.a(57, "diamond_block", (new BlockOreBlock(MaterialMapColor.G)).c(5.0F).b(10.0F).a(j).c("blockDiamond").d("diamond_block"));
  162.         REGISTRY.a(58, "crafting_table", (new BlockWorkbench()).c(2.5F).a(f).c("workbench").d("crafting_table"));
  163.         REGISTRY.a(59, "wheat", (new BlockCrops()).c("crops").d("wheat"));
  164.         Block block4 = (new BlockSoil()).c(0.6F).a(g).c("farmland").d("farmland");
  165.  
  166.         REGISTRY.a(60, "farmland", block4);
  167.         REGISTRY.a(61, "furnace", (new BlockFurnace(false)).c(3.5F).a(i).c("furnace").a(CreativeModeTab.c));
  168.         REGISTRY.a(62, "lit_furnace", (new BlockFurnace(true)).c(3.5F).a(i).a(0.875F).c("furnace"));
  169.         REGISTRY.a(63, "standing_sign", (new BlockSign(TileEntitySign.class, true)).c(1.0F).a(f).c("sign").H());
  170.         REGISTRY.a(64, "wooden_door", (new BlockDoor(Material.WOOD)).c(3.0F).a(f).c("doorWood").H().d("door_wood"));
  171.         REGISTRY.a(65, "ladder", (new BlockLadder()).c(0.4F).a(o).c("ladder").d("ladder"));
  172.         REGISTRY.a(66, "rail", (new BlockMinecartTrack()).c(0.7F).a(j).c("rail").d("rail_normal"));
  173.         REGISTRY.a(67, "stone_stairs", (new BlockStairs(block, 0)).c("stairsStone"));
  174.         REGISTRY.a(68, "wall_sign", (new BlockSign(TileEntitySign.class, false)).c(1.0F).a(f).c("sign").H());
  175.         REGISTRY.a(69, "lever", (new BlockLever()).c(0.5F).a(f).c("lever").d("lever"));
  176.         REGISTRY.a(70, "stone_pressure_plate", (new BlockPressurePlateBinary("stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(i).c("pressurePlate"));
  177.         REGISTRY.a(71, "iron_door", (new BlockDoor(Material.ORE)).c(5.0F).a(j).c("doorIron").H().d("door_iron"));
  178.         REGISTRY.a(72, "wooden_pressure_plate", (new BlockPressurePlateBinary("planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(f).c("pressurePlate"));
  179.         REGISTRY.a(73, "redstone_ore", (new BlockRedstoneOre(false)).c(3.0F).b(5.0F).a(i).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore"));
  180.         REGISTRY.a(74, "lit_redstone_ore", (new BlockRedstoneOre(true)).a(0.625F).c(3.0F).b(5.0F).a(i).c("oreRedstone").d("redstone_ore"));
  181.         REGISTRY.a(75, "unlit_redstone_torch", (new BlockRedstoneTorch(false)).c(0.0F).a(f).c("notGate").d("redstone_torch_off"));
  182.         REGISTRY.a(76, "redstone_torch", (new BlockRedstoneTorch(true)).c(0.0F).a(0.5F).a(f).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on"));
  183.         REGISTRY.a(77, "stone_button", (new BlockStoneButton()).c(0.5F).a(i).c("button"));
  184.         REGISTRY.a(78, "snow_layer", (new BlockSnow()).c(0.1F).a(n).c("snow").g(0).d("snow"));
  185.         REGISTRY.a(79, "ice", (new BlockIce()).c(0.5F).g(3).a(k).c("ice").d("ice"));
  186.         REGISTRY.a(80, "snow", (new BlockSnowBlock()).c(0.2F).a(n).c("snow").d("snow"));
  187.         REGISTRY.a(81, "cactus", (new BlockCactus()).c(0.4F).a(l).c("cactus").d("cactus"));
  188.         REGISTRY.a(82, "clay", (new BlockClay()).c(0.6F).a(g).c("clay").d("clay"));
  189.         REGISTRY.a(83, "reeds", (new BlockReed()).c(0.0F).a(h).c("reeds").H().d("reeds"));
  190.         REGISTRY.a(84, "jukebox", (new BlockJukeBox()).c(2.0F).b(10.0F).a(i).c("jukebox").d("jukebox"));
  191.         REGISTRY.a(85, "fence", (new BlockFence("planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(f).c("fence"));
  192.         Block block5 = (new BlockPumpkin(false)).c(1.0F).a(f).c("pumpkin").d("pumpkin");
  193.  
  194.         REGISTRY.a(86, "pumpkin", block5);
  195.         REGISTRY.a(87, "netherrack", (new BlockBloodStone()).c(0.4F).a(i).c("hellrock").d("netherrack"));
  196.         REGISTRY.a(88, "soul_sand", (new BlockSlowSand()).c(0.5F).a(m).c("hellsand").d("soul_sand"));
  197.         REGISTRY.a(89, "glowstone", (new BlockLightStone(Material.SHATTERABLE)).c(0.3F).a(k).a(1.0F).c("lightgem").d("glowstone"));
  198.         REGISTRY.a(90, "portal", (new BlockPortal()).c(-1.0F).a(k).a(0.75F).c("portal").d("portal"));
  199.         REGISTRY.a(91, "lit_pumpkin", (new BlockPumpkin(true)).c(1.0F).a(f).a(1.0F).c("litpumpkin").d("pumpkin"));
  200.         REGISTRY.a(92, "cake", (new BlockCake()).c(0.5F).a(l).c("cake").H().d("cake"));
  201.         REGISTRY.a(93, "unpowered_repeater", (new BlockRepeater(false)).c(0.0F).a(f).c("diode").H().d("repeater_off"));
  202.         REGISTRY.a(94, "powered_repeater", (new BlockRepeater(true)).c(0.0F).a(0.625F).a(f).c("diode").H().d("repeater_on"));
  203.         REGISTRY.a(95, "stained_glass", (new BlockStainedGlass(Material.SHATTERABLE)).c(0.3F).a(k).c("stainedGlass").d("glass"));
  204.         REGISTRY.a(96, "trapdoor", (new BlockTrapdoor(Material.WOOD)).c(3.0F).a(f).c("trapdoor").H().d("trapdoor"));
  205.         REGISTRY.a(97, "monster_egg", (new BlockMonsterEggs()).c(0.75F).c("monsterStoneEgg"));
  206.         Block block6 = (new BlockSmoothBrick()).c(1.5F).b(10.0F).a(i).c("stonebricksmooth").d("stonebrick");
  207.  
  208.         REGISTRY.a(98, "stonebrick", block6);
  209.         REGISTRY.a(99, "brown_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 0)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
  210.         REGISTRY.a(100, "red_mushroom_block", (new BlockHugeMushroom(Material.WOOD, 1)).c(0.2F).a(f).c("mushroom").d("mushroom_block"));
  211.         REGISTRY.a(101, "iron_bars", (new BlockThin("iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(j).c("fenceIron"));
  212.         REGISTRY.a(102, "glass_pane", (new BlockThin("glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(k).c("thinGlass"));
  213.         Block block7 = (new BlockMelon()).c(1.0F).a(f).c("melon").d("melon");
  214.  
  215.         REGISTRY.a(103, "melon_block", block7);
  216.         REGISTRY.a(104, "pumpkin_stem", (new BlockStem(block5)).c(0.0F).a(f).c("pumpkinStem").d("pumpkin_stem"));
  217.         REGISTRY.a(105, "melon_stem", (new BlockStem(block7)).c(0.0F).a(f).c("pumpkinStem").d("melon_stem"));
  218.         REGISTRY.a(106, "vine", (new BlockVine()).c(0.2F).a(h).c("vine").d("vine"));
  219.         REGISTRY.a(107, "fence_gate", (new BlockFenceGate()).c(2.0F).b(5.0F).a(f).c("fenceGate"));
  220.         REGISTRY.a(108, "brick_stairs", (new BlockStairs(block3, 0)).c("stairsBrick"));
  221.         REGISTRY.a(109, "stone_brick_stairs", (new BlockStairs(block6, 0)).c("stairsStoneBrickSmooth"));
  222.         REGISTRY.a(110, "mycelium", (new BlockMycel()).c(0.6F).a(h).c("mycel").d("mycelium"));
  223.         REGISTRY.a(111, "waterlily", (new BlockWaterLily()).c(0.0F).a(h).c("waterlily").d("waterlily"));
  224.         Block block8 = (new Block(Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
  225.  
  226.         REGISTRY.a(112, "nether_brick", block8);
  227.         REGISTRY.a(113, "nether_brick_fence", (new BlockFence("nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(i).c("netherFence"));
  228.         REGISTRY.a(114, "nether_brick_stairs", (new BlockStairs(block8, 0)).c("stairsNetherBrick"));
  229.         REGISTRY.a(115, "nether_wart", (new BlockNetherWart()).c("netherStalk").d("nether_wart"));
  230.         REGISTRY.a(116, "enchanting_table", (new BlockEnchantmentTable()).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table"));
  231.         REGISTRY.a(117, "brewing_stand", (new BlockBrewingStand()).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand"));
  232.         REGISTRY.a(118, "cauldron", (new BlockCauldron()).c(2.0F).c("cauldron").d("cauldron"));
  233.         REGISTRY.a(119, "end_portal", (new BlockEnderPortal(Material.PORTAL)).c(-1.0F).b(6000000.0F));
  234.         REGISTRY.a(120, "end_portal_frame", (new BlockEnderPortalFrame()).a(k).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe"));
  235.         REGISTRY.a(121, "end_stone", (new Block(Material.STONE)).c(3.0F).b(15.0F).a(i).c("whiteStone").a(CreativeModeTab.b).d("end_stone"));
  236.         REGISTRY.a(122, "dragon_egg", (new BlockDragonEgg()).c(3.0F).b(15.0F).a(i).a(0.125F).c("dragonEgg").d("dragon_egg"));
  237.         REGISTRY.a(123, "redstone_lamp", (new BlockRedstoneLamp(false)).c(0.3F).a(k).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off"));
  238.         REGISTRY.a(124, "lit_redstone_lamp", (new BlockRedstoneLamp(true)).c(0.3F).a(k).c("redstoneLight").d("redstone_lamp_on"));
  239.         REGISTRY.a(125, "double_wooden_slab", (new BlockWoodStep(true)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
  240.         REGISTRY.a(126, "wooden_slab", (new BlockWoodStep(false)).c(2.0F).b(5.0F).a(f).c("woodSlab"));
  241.         REGISTRY.a(127, "cocoa", (new BlockCocoa()).c(0.2F).b(5.0F).a(f).c("cocoa").d("cocoa"));
  242.         REGISTRY.a(128, "sandstone_stairs", (new BlockStairs(block2, 0)).c("stairsSandStone"));
  243.         REGISTRY.a(129, "emerald_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("oreEmerald").d("emerald_ore"));
  244.         REGISTRY.a(130, "ender_chest", (new BlockEnderChest()).c(22.5F).b(1000.0F).a(i).c("enderChest").a(0.5F));
  245.         REGISTRY.a(131, "tripwire_hook", (new BlockTripwireHook()).c("tripWireSource").d("trip_wire_source"));
  246.         REGISTRY.a(132, "tripwire", (new BlockTripwire()).c("tripWire").d("trip_wire"));
  247.         REGISTRY.a(133, "emerald_block", (new BlockOreBlock(MaterialMapColor.I)).c(5.0F).b(10.0F).a(j).c("blockEmerald").d("emerald_block"));
  248.         REGISTRY.a(134, "spruce_stairs", (new BlockStairs(block1, 1)).c("stairsWoodSpruce"));
  249.         REGISTRY.a(135, "birch_stairs", (new BlockStairs(block1, 2)).c("stairsWoodBirch"));
  250.         REGISTRY.a(136, "jungle_stairs", (new BlockStairs(block1, 3)).c("stairsWoodJungle"));
  251.         REGISTRY.a(137, "command_block", (new BlockCommand()).s().b(6000000.0F).c("commandBlock").d("command_block"));
  252.         REGISTRY.a(138, "beacon", (new BlockBeacon()).c("beacon").a(1.0F).d("beacon"));
  253.         REGISTRY.a(139, "cobblestone_wall", (new BlockCobbleWall(block)).c("cobbleWall"));
  254.         REGISTRY.a(140, "flower_pot", (new BlockFlowerPot()).c(0.0F).a(e).c("flowerPot").d("flower_pot"));
  255.         REGISTRY.a(141, "carrots", (new BlockCarrots()).c("carrots").d("carrots"));
  256.         REGISTRY.a(142, "potatoes", (new BlockPotatoes()).c("potatoes").d("potatoes"));
  257.         REGISTRY.a(143, "wooden_button", (new BlockWoodButton()).c(0.5F).a(f).c("button"));
  258.         REGISTRY.a(144, "skull", (new BlockSkull()).c(1.0F).a(i).c("skull").d("skull"));
  259.         REGISTRY.a(145, "anvil", (new BlockAnvil()).c(5.0F).a(p).b(2000.0F).c("anvil"));
  260.         REGISTRY.a(146, "trapped_chest", (new BlockChest(1)).c(2.5F).a(f).c("chestTrap"));
  261.         REGISTRY.a(147, "light_weighted_pressure_plate", (new BlockPressurePlateWeighted("gold_block", Material.ORE, 15)).c(0.5F).a(f).c("weightedPlate_light"));
  262.         REGISTRY.a(148, "heavy_weighted_pressure_plate", (new BlockPressurePlateWeighted("iron_block", Material.ORE, 150)).c(0.5F).a(f).c("weightedPlate_heavy"));
  263.         REGISTRY.a(149, "unpowered_comparator", (new BlockRedstoneComparator(false)).c(0.0F).a(f).c("comparator").H().d("comparator_off"));
  264.         REGISTRY.a(150, "powered_comparator", (new BlockRedstoneComparator(true)).c(0.0F).a(0.625F).a(f).c("comparator").H().d("comparator_on"));
  265.         REGISTRY.a(151, "daylight_detector", (new BlockDaylightDetector()).c(0.2F).a(f).c("daylightDetector").d("daylight_detector"));
  266.         REGISTRY.a(152, "redstone_block", (new BlockRedstone(MaterialMapColor.f)).c(5.0F).b(10.0F).a(j).c("blockRedstone").d("redstone_block"));
  267.         REGISTRY.a(153, "quartz_ore", (new BlockOre()).c(3.0F).b(5.0F).a(i).c("netherquartz").d("quartz_ore"));
  268.         REGISTRY.a(154, "hopper", (new BlockHopper()).c(3.0F).b(8.0F).a(f).c("hopper").d("hopper"));
  269.         Block block9 = (new BlockQuartz()).a(i).c(0.8F).c("quartzBlock").d("quartz_block");
  270.  
  271.         REGISTRY.a(155, "quartz_block", block9);
  272.         REGISTRY.a(156, "quartz_stairs", (new BlockStairs(block9, 0)).c("stairsQuartz"));
  273.         REGISTRY.a(157, "activator_rail", (new BlockPoweredRail()).c(0.7F).a(j).c("activatorRail").d("rail_activator"));
  274.         REGISTRY.a(158, "dropper", (new BlockDropper()).c(3.5F).a(i).c("dropper").d("dropper"));
  275.         REGISTRY.a(159, "stained_hardened_clay", (new BlockCloth(Material.STONE)).c(1.25F).b(7.0F).a(i).c("clayHardenedStained").d("hardened_clay_stained"));
  276.         REGISTRY.a(160, "stained_glass_pane", (new BlockStainedGlassPane()).c(0.3F).a(k).c("thinStainedGlass").d("glass"));
  277.         REGISTRY.a(161, "leaves2", (new BlockLeaves2()).c("leaves").d("leaves"));
  278.         REGISTRY.a(162, "log2", (new BlockLog2()).c("log").d("log"));
  279.         REGISTRY.a(163, "acacia_stairs", (new BlockStairs(block1, 4)).c("stairsWoodAcacia"));
  280.         REGISTRY.a(164, "dark_oak_stairs", (new BlockStairs(block1, 5)).c("stairsWoodDarkOak"));
  281.         REGISTRY.a(170, "hay_block", (new BlockHay()).c(0.5F).a(h).c("hayBlock").a(CreativeModeTab.b).d("hay_block"));
  282.         REGISTRY.a(171, "carpet", (new BlockCarpet()).c(0.1F).a(l).c("woolCarpet").g(0));
  283.         REGISTRY.a(172, "hardened_clay", (new BlockHardenedClay()).c(1.25F).b(7.0F).a(i).c("clayHardened").d("hardened_clay"));
  284.         REGISTRY.a(173, "coal_block", (new Block(Material.STONE)).c(5.0F).b(10.0F).a(i).c("blockCoal").a(CreativeModeTab.b).d("coal_block"));
  285.         REGISTRY.a(174, "packed_ice", (new BlockPackedIce()).c(0.5F).a(k).c("icePacked").d("ice_packed"));
  286.         REGISTRY.a(175, "double_plant", new BlockTallPlant());
  287.         Iterator iterator = REGISTRY.iterator();
  288.  
  289.         while (iterator.hasNext()) {
  290.             Block block10 = (Block) iterator.next();
  291.  
  292.             if (block10.material == Material.AIR) {
  293.                 block10.u = false;
  294.             } else {
  295.                 boolean flag = false;
  296.                 boolean flag1 = block10.b() == 10;
  297.                 boolean flag2 = block10 instanceof BlockStepAbstract;
  298.                 boolean flag3 = block10 == block4;
  299.                 boolean flag4 = block10.s;
  300.                 boolean flag5 = block10.r == 0;
  301.  
  302.                 if (flag1 || flag2 || flag3 || flag4 || flag5) {
  303.                     flag = true;
  304.                 }
  305.  
  306.                 block10.u = flag;
  307.             }
  308.         }
  309.     }
  310.  
  311.     protected Block(Material material) {
  312.         this.stepSound = e;
  313.         this.I = 1.0F;
  314.         this.frictionFactor = 0.6F;
  315.         this.material = material;
  316.         this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  317.         this.q = this.c();
  318.         this.r = this.c() ? 255 : 0;
  319.         this.s = !material.blocksLight();
  320.     }
  321.  
  322.     protected Block a(StepSound stepsound) {
  323.         this.stepSound = stepsound;
  324.         return this;
  325.     }
  326.  
  327.     protected Block g(int i) {
  328.         this.r = i;
  329.         return this;
  330.     }
  331.  
  332.     protected Block a(float f) {
  333.         this.t = (int) (15.0F * f);
  334.         return this;
  335.     }
  336.  
  337.     protected Block b(float f) {
  338.         this.durability = f * 3.0F;
  339.         return this;
  340.     }
  341.  
  342.     public boolean r() {
  343.         return this.material.k() && this.d() && !this.isPowerSource();
  344.     }
  345.  
  346.     public boolean d() {
  347.         return true;
  348.     }
  349.  
  350.     public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
  351.         return !this.material.isSolid();
  352.     }
  353.  
  354.     public int b() {
  355.         return 0;
  356.     }
  357.  
  358.     protected Block c(float f) {
  359.         this.strength = f;
  360.         if (this.durability < f * 5.0F) {
  361.             this.durability = f * 5.0F;
  362.         }
  363.  
  364.         return this;
  365.     }
  366.  
  367.     protected Block s() {
  368.         this.c(-1.0F);
  369.         return this;
  370.     }
  371.  
  372.     public float f(World world, int i, int j, int k) {
  373.         return this.strength;
  374.     }
  375.  
  376.     protected Block a(boolean flag) {
  377.         this.z = flag;
  378.         return this;
  379.     }
  380.  
  381.     public boolean isTicking() {
  382.         return this.z;
  383.     }
  384.  
  385.     public boolean isTileEntity() {
  386.         return this.isTileEntity;
  387.     }
  388.  
  389.     protected final void a(float f, float f1, float f2, float f3, float f4, float f5) {
  390.         this.minX = (double) f;
  391.         this.minY = (double) f1;
  392.         this.minZ = (double) f2;
  393.         this.maxX = (double) f3;
  394.         this.maxY = (double) f4;
  395.         this.maxZ = (double) f5;
  396.     }
  397.  
  398.     public boolean d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
  399.         return iblockaccess.getType(i, j, k).getMaterial().isBuildable();
  400.     }
  401.  
  402.     public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
  403.         AxisAlignedBB axisalignedbb1 = this.a(world, i, j, k);
  404.  
  405.         if (axisalignedbb1 != null && axisalignedbb.b(axisalignedbb1)) {
  406.             list.add(axisalignedbb1);
  407.         }
  408.     }
  409.  
  410.     public AxisAlignedBB a(World world, int i, int j, int k) {
  411.         return AxisAlignedBB.a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
  412.     }
  413.  
  414.     public boolean c() {
  415.         return true;
  416.     }
  417.  
  418.     public boolean a(int i, boolean flag) {
  419.         return this.v();
  420.     }
  421.  
  422.     public boolean v() {
  423.         return true;
  424.     }
  425.  
  426.     public void a(World world, int i, int j, int k, Random random) {}
  427.  
  428.     public void postBreak(World world, int i, int j, int k, int l) {}
  429.  
  430.     public void doPhysics(World world, int i, int j, int k, Block block) {}
  431.  
  432.     public int a(World world) {
  433.         return 10;
  434.     }
  435.  
  436.     public void onPlace(World world, int i, int j, int k) {
  437.         org.spigotmc.AsyncCatcher.catchOp( "block onPlace"); // Spigot
  438.     }
  439.  
  440.     public void remove(World world, int i, int j, int k, Block block, int l) {
  441.         org.spigotmc.AsyncCatcher.catchOp( "block remove"); // Spigot
  442.     }
  443.  
  444.     public int a(Random random) {
  445.         return 1;
  446.     }
  447.  
  448.     public Item getDropType(int i, Random random, int j) {
  449.         return Item.getItemOf(this);
  450.     }
  451.  
  452.     public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
  453.         float f = this.f(world, i, j, k);
  454.  
  455.         return f < 0.0F ? 0.0F : (!entityhuman.a(this) ? entityhuman.a(this, false) / f / 100.0F : entityhuman.a(this, true) / f / 30.0F);
  456.     }
  457.  
  458.     public final void b(World world, int i, int j, int k, int l, int i1) {
  459.         this.dropNaturally(world, i, j, k, l, 1.0F, i1);
  460.     }
  461.  
  462.     public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
  463.         if (!world.isStatic) {
  464.             int j1 = this.getDropCount(i1, world.random);
  465.  
  466.             for (int k1 = 0; k1 < j1; ++k1) {
  467.                 // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
  468.                 if (world.random.nextFloat() < f) {
  469.                     Item item = this.getDropType(l, world.random, i1);
  470.  
  471.                     if (item != null) {
  472.                         this.a(world, i, j, k, new ItemStack(item, 1, this.getDropData(l)));
  473.                     }
  474.                 }
  475.             }
  476.         }
  477.     }
  478.  
  479.     protected void a(World world, int i, int j, int k, ItemStack itemstack) {
  480.         if (!world.isStatic && world.getGameRules().getBoolean("doTileDrops")) {
  481.             float f = 0.7F;
  482.             double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
  483.             double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
  484.             double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
  485.             EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack);
  486.  
  487.             entityitem.pickupDelay = 10;
  488.             world.addEntity(entityitem);
  489.         }
  490.     }
  491.  
  492.     protected void dropExperience(World world, int i, int j, int k, int l) {
  493.         if (!world.isStatic) {
  494.             while (l > 0) {
  495.                 int i1 = EntityExperienceOrb.getOrbValue(l);
  496.  
  497.                 l -= i1;
  498.                 world.addEntity(new EntityExperienceOrb(world, (double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, i1));
  499.             }
  500.         }
  501.     }
  502.  
  503.     public int getDropData(int i) {
  504.         return 0;
  505.     }
  506.  
  507.     public float a(Entity entity) {
  508.         return this.durability / 5.0F;
  509.     }
  510.  
  511.     public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) {
  512.         this.updateShape(world, i, j, k);
  513.         vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
  514.         vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
  515.         Vec3D vec3d2 = vec3d.b(vec3d1, this.minX);
  516.         Vec3D vec3d3 = vec3d.b(vec3d1, this.maxX);
  517.         Vec3D vec3d4 = vec3d.c(vec3d1, this.minY);
  518.         Vec3D vec3d5 = vec3d.c(vec3d1, this.maxY);
  519.         Vec3D vec3d6 = vec3d.d(vec3d1, this.minZ);
  520.         Vec3D vec3d7 = vec3d.d(vec3d1, this.maxZ);
  521.  
  522.         if (!this.a(vec3d2)) {
  523.             vec3d2 = null;
  524.         }
  525.  
  526.         if (!this.a(vec3d3)) {
  527.             vec3d3 = null;
  528.         }
  529.  
  530.         if (!this.b(vec3d4)) {
  531.             vec3d4 = null;
  532.         }
  533.  
  534.         if (!this.b(vec3d5)) {
  535.             vec3d5 = null;
  536.         }
  537.  
  538.         if (!this.c(vec3d6)) {
  539.             vec3d6 = null;
  540.         }
  541.  
  542.         if (!this.c(vec3d7)) {
  543.             vec3d7 = null;
  544.         }
  545.  
  546.         Vec3D vec3d8 = null;
  547.  
  548.         if (vec3d2 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d2) < vec3d.distanceSquared(vec3d8))) {
  549.             vec3d8 = vec3d2;
  550.         }
  551.  
  552.         if (vec3d3 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d3) < vec3d.distanceSquared(vec3d8))) {
  553.             vec3d8 = vec3d3;
  554.         }
  555.  
  556.         if (vec3d4 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d4) < vec3d.distanceSquared(vec3d8))) {
  557.             vec3d8 = vec3d4;
  558.         }
  559.  
  560.         if (vec3d5 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d5) < vec3d.distanceSquared(vec3d8))) {
  561.             vec3d8 = vec3d5;
  562.         }
  563.  
  564.         if (vec3d6 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d6) < vec3d.distanceSquared(vec3d8))) {
  565.             vec3d8 = vec3d6;
  566.         }
  567.  
  568.         if (vec3d7 != null && (vec3d8 == null || vec3d.distanceSquared(vec3d7) < vec3d.distanceSquared(vec3d8))) {
  569.             vec3d8 = vec3d7;
  570.         }
  571.  
  572.         if (vec3d8 == null) {
  573.             return null;
  574.         } else {
  575.             byte b0 = -1;
  576.  
  577.             if (vec3d8 == vec3d2) {
  578.                 b0 = 4;
  579.             }
  580.  
  581.             if (vec3d8 == vec3d3) {
  582.                 b0 = 5;
  583.             }
  584.  
  585.             if (vec3d8 == vec3d4) {
  586.                 b0 = 0;
  587.             }
  588.  
  589.             if (vec3d8 == vec3d5) {
  590.                 b0 = 1;
  591.             }
  592.  
  593.             if (vec3d8 == vec3d6) {
  594.                 b0 = 2;
  595.             }
  596.  
  597.             if (vec3d8 == vec3d7) {
  598.                 b0 = 3;
  599.             }
  600.  
  601.             return new MovingObjectPosition(i, j, k, b0, vec3d8.add((double) i, (double) j, (double) k));
  602.         }
  603.     }
  604.  
  605.     private boolean a(Vec3D vec3d) {
  606.         return vec3d == null ? false : vec3d.b >= this.minY && vec3d.b <= this.maxY && vec3d.c >= this.minZ && vec3d.c <= this.maxZ;
  607.     }
  608.  
  609.     private boolean b(Vec3D vec3d) {
  610.         return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.c >= this.minZ && vec3d.c <= this.maxZ;
  611.     }
  612.  
  613.     private boolean c(Vec3D vec3d) {
  614.         return vec3d == null ? false : vec3d.a >= this.minX && vec3d.a <= this.maxX && vec3d.b >= this.minY && vec3d.b <= this.maxY;
  615.     }
  616.  
  617.     public void wasExploded(World world, int i, int j, int k, Explosion explosion) {}
  618.  
  619.     public boolean canPlace(World world, int i, int j, int k, int l, ItemStack itemstack) {
  620.         return this.canPlace(world, i, j, k, l);
  621.     }
  622.  
  623.     public boolean canPlace(World world, int i, int j, int k, int l) {
  624.         return this.canPlace(world, i, j, k);
  625.     }
  626.  
  627.     public boolean canPlace(World world, int i, int j, int k) {
  628.         return world.getType(i, j, k).material.isReplaceable();
  629.     }
  630.  
  631.     public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
  632.         return false;
  633.     }
  634.  
  635.     public void b(World world, int i, int j, int k, Entity entity) {}
  636.  
  637.     public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
  638.         return i1;
  639.     }
  640.  
  641.     public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
  642.  
  643.     public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {}
  644.  
  645.     public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
  646.  
  647.     public final double x() {
  648.         return this.minX;
  649.     }
  650.  
  651.     public final double y() {
  652.         return this.maxX;
  653.     }
  654.  
  655.     public final double z() {
  656.         return this.minY;
  657.     }
  658.  
  659.     public final double A() {
  660.         return this.maxY;
  661.     }
  662.  
  663.     public final double B() {
  664.         return this.minZ;
  665.     }
  666.  
  667.     public final double C() {
  668.         return this.maxZ;
  669.     }
  670.  
  671.     public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
  672.         return 0;
  673.     }
  674.  
  675.     public boolean isPowerSource() {
  676.         return false;
  677.     }
  678.  
  679.     public void a(World world, int i, int j, int k, Entity entity) {}
  680.  
  681.     public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
  682.         return 0;
  683.     }
  684.  
  685.     public void g() {}
  686.  
  687.     public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
  688.         entityhuman.a(StatisticList.MINE_BLOCK_COUNT[getId(this)], 1);
  689.         entityhuman.applyExhaustion(0.025F);
  690.         if (this.E() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
  691.             ItemStack itemstack = this.j(l);
  692.  
  693.             if (itemstack != null) {
  694.                 this.a(world, i, j, k, itemstack);
  695.             }
  696.         } else {
  697.             int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman);
  698.  
  699.             this.b(world, i, j, k, l, i1);
  700.         }
  701.     }
  702.  
  703.     protected boolean E() {
  704.         return this.d() && !this.isTileEntity;
  705.     }
  706.  
  707.     protected ItemStack j(int i) {
  708.         int j = 0;
  709.         Item item = Item.getItemOf(this);
  710.  
  711.         if (item != null && item.n()) {
  712.             j = i;
  713.         }
  714.  
  715.         return new ItemStack(item, 1, j);
  716.     }
  717.  
  718.     public int getDropCount(int i, Random random) {
  719.         return this.a(random);
  720.     }
  721.  
  722.     public boolean j(World world, int i, int j, int k) {
  723.         return true;
  724.     }
  725.  
  726.     public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {}
  727.  
  728.     public void postPlace(World world, int i, int j, int k, int l) {}
  729.  
  730.     public Block c(String s) {
  731.         this.name = s;
  732.         return this;
  733.     }
  734.  
  735.     public String getName() {
  736.         return LocaleI18n.get(this.a() + ".name");
  737.     }
  738.  
  739.     public String a() {
  740.         return "tile." + this.name;
  741.     }
  742.  
  743.     public boolean a(World world, int i, int j, int k, int l, int i1) {
  744.         return false;
  745.     }
  746.  
  747.     public boolean G() {
  748.         return this.y;
  749.     }
  750.  
  751.     protected Block H() {
  752.         this.y = false;
  753.         return this;
  754.     }
  755.  
  756.     public int h() {
  757.         return this.material.getPushReaction();
  758.     }
  759.  
  760.     public void a(World world, int i, int j, int k, Entity entity, float f) {}
  761.  
  762.     public int getDropData(World world, int i, int j, int k) {
  763.         return this.getDropData(world.getData(i, j, k));
  764.     }
  765.  
  766.     public Block a(CreativeModeTab creativemodetab) {
  767.         this.creativeTab = creativemodetab;
  768.         return this;
  769.     }
  770.  
  771.     public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
  772.  
  773.     public void f(World world, int i, int j, int k, int l) {}
  774.  
  775.     public void l(World world, int i, int j, int k) {}
  776.  
  777.     public boolean L() {
  778.         return true;
  779.     }
  780.  
  781.     public boolean a(Explosion explosion) {
  782.         return true;
  783.     }
  784.  
  785.     public boolean c(Block block) {
  786.         return this == block;
  787.     }
  788.  
  789.     public static boolean a(Block block, Block block1) {
  790.         return block != null && block1 != null ? (block == block1 ? true : block.c(block1)) : false;
  791.     }
  792.  
  793.     public boolean isComplexRedstone() {
  794.         return false;
  795.     }
  796.  
  797.     public int g(World world, int i, int j, int k, int l) {
  798.         return 0;
  799.     }
  800.  
  801.     protected Block d(String s) {
  802.         this.d = s;
  803.         return this;
  804.     }
  805.  
  806.     // CraftBukkit start
  807.     public int getExpDrop(World world, int data, int enchantmentLevel) {
  808.         return 0;
  809.     }
  810.     // CraftBukkit end
  811.  
  812.     // Spigot start
  813.     public static float range(float min, float value, float max) {
  814.         if (value < min) {
  815.             return min;
  816.         }
  817.         if (value > max) {
  818.             return max;
  819.         }
  820.         return value;
  821.     }
  822.     // Spigot end
  823. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement