Advertisement
Guest User

Untitled

a guest
Jul 31st, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 39.10 KB | None | 0 0
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode
  4.  
  5. package net.minecraft.src;
  6.  
  7. import java.util.ArrayList;
  8. import java.util.Random;
  9.  
  10. // Referenced classes of package net.minecraft.src:
  11. // Material, IBlockAccess, AxisAlignedBB, EntityPlayer,
  12. // World, ItemStack, EntityItem, Vec3D,
  13. // MovingObjectPosition, StatList, StatCollector, StepSound,
  14. // StepSoundStone, StepSoundSand, BlockStone, BlockGrass,
  15. // BlockDirt, BlockSapling, BlockFlowing, BlockStationary,
  16. // BlockSand, BlockGravel, BlockOre, BlockLog,
  17. // BlockLeaves, BlockSponge, BlockGlass, BlockDispenser,
  18. // BlockSandStone, BlockNote, BlockBed, BlockRail,
  19. // BlockDetectorRail, BlockPistonBase, BlockWeb, BlockTallGrass,
  20. // BlockDeadBush, BlockPistonExtension, BlockCloth, BlockPistonMoving,
  21. // BlockFlower, BlockMushroom, BlockOreStorage, BlockStep,
  22. // BlockTNT, BlockBookshelf, BlockObsidian, BlockTorch,
  23. // BlockFire, BlockMobSpawner, BlockStairs, BlockChest,
  24. // BlockRedstoneWire, BlockWorkbench, BlockCrops, BlockFarmland,
  25. // BlockFurnace, BlockSign, TileEntitySign, BlockDoor,
  26. // BlockLadder, BlockLever, BlockPressurePlate, EnumMobType,
  27. // BlockRedstoneOre, BlockRedstoneTorch, BlockButton, BlockSnow,
  28. // BlockIce, BlockSnowBlock, BlockCactus, BlockClay,
  29. // BlockReed, BlockJukeBox, BlockFence, BlockPumpkin,
  30. // BlockNetherrack, BlockSoulSand, BlockGlowStone, BlockPortal,
  31. // BlockCake, BlockRedstoneRepeater, BlockLockedChest, BlockTrapDoor,
  32. // Item, ItemCloth, ItemLog, ItemSlab,
  33. // ItemSapling, ItemLeaves, ItemPiston, ItemBlock,
  34. // Entity, EntityLiving
  35.  
  36. public class Block
  37. {
  38.  
  39. protected Block(int i, Material material)
  40. {
  41. blockConstructorCalled = true;
  42. enableStats = true;
  43. stepSound = soundPowderFootstep;
  44. blockParticleGravity = 1.0F;
  45. slipperiness = 0.6F;
  46. if(blocksList[i] != null)
  47. {
  48. throw new IllegalArgumentException((new StringBuilder()).append("Slot ").append(i).append(" is already occupied by ").append(blocksList[i]).append(" when adding ").append(this).toString());
  49. } else
  50. {
  51. blockMaterial = material;
  52. blocksList[i] = this;
  53. blockID = i;
  54. setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
  55. opaqueCubeLookup[i] = isOpaqueCube();
  56. lightOpacity[i] = isOpaqueCube() ? 255 : 0;
  57. canBlockGrass[i] = !material.getCanBlockGrass();
  58. isBlockContainer[i] = false;
  59. return;
  60. }
  61. }
  62.  
  63. protected Block disableNeighborNotifyOnMetadataChange()
  64. {
  65. field_28032_t[blockID] = true;
  66. return this;
  67. }
  68.  
  69. protected void initializeBlock()
  70. {
  71. }
  72.  
  73. protected Block(int i, int j, Material material)
  74. {
  75. this(i, material);
  76. blockIndexInTexture = j;
  77. }
  78.  
  79. protected Block setStepSound(StepSound stepsound)
  80. {
  81. stepSound = stepsound;
  82. return this;
  83. }
  84.  
  85. protected Block setLightOpacity(int i)
  86. {
  87. lightOpacity[blockID] = i;
  88. return this;
  89. }
  90.  
  91. protected Block setLightValue(float f)
  92. {
  93. lightValue[blockID] = (int)(15F * f);
  94. return this;
  95. }
  96.  
  97. protected Block setResistance(float f)
  98. {
  99. blockResistance = f * 3F;
  100. return this;
  101. }
  102.  
  103. public boolean renderAsNormalBlock()
  104. {
  105. return true;
  106. }
  107.  
  108. public int getRenderType()
  109. {
  110. return 0;
  111. }
  112.  
  113. protected Block setHardness(float f)
  114. {
  115. blockHardness = f;
  116. if(blockResistance < f * 5F)
  117. {
  118. blockResistance = f * 5F;
  119. }
  120. return this;
  121. }
  122.  
  123. protected Block setBlockUnbreakable()
  124. {
  125. setHardness(-1F);
  126. return this;
  127. }
  128.  
  129. public float getHardness()
  130. {
  131. return blockHardness;
  132. }
  133.  
  134. protected Block setTickOnLoad(boolean flag)
  135. {
  136. tickOnLoad[blockID] = flag;
  137. return this;
  138. }
  139.  
  140. public void setBlockBounds(float f, float f1, float f2, float f3, float f4, float f5)
  141. {
  142. minX = f;
  143. minY = f1;
  144. minZ = f2;
  145. maxX = f3;
  146. maxY = f4;
  147. maxZ = f5;
  148. }
  149.  
  150. public float getBlockBrightness(IBlockAccess iblockaccess, int i, int j, int k)
  151. {
  152. return iblockaccess.getBrightness(i, j, k, lightValue[blockID]);
  153. }
  154.  
  155. public boolean shouldSideBeRendered(IBlockAccess iblockaccess, int i, int j, int k, int l)
  156. {
  157. if(l == 0 && minY > 0.0D)
  158. {
  159. return true;
  160. }
  161. if(l == 1 && maxY < 1.0D)
  162. {
  163. return true;
  164. }
  165. if(l == 2 && minZ > 0.0D)
  166. {
  167. return true;
  168. }
  169. if(l == 3 && maxZ < 1.0D)
  170. {
  171. return true;
  172. }
  173. if(l == 4 && minX > 0.0D)
  174. {
  175. return true;
  176. }
  177. if(l == 5 && maxX < 1.0D)
  178. {
  179. return true;
  180. } else
  181. {
  182. return !iblockaccess.isBlockOpaqueCube(i, j, k);
  183. }
  184. }
  185.  
  186. public boolean getIsBlockSolid(IBlockAccess iblockaccess, int i, int j, int k, int l)
  187. {
  188. return iblockaccess.getBlockMaterial(i, j, k).isSolid();
  189. }
  190.  
  191. public int getBlockTexture(IBlockAccess iblockaccess, int i, int j, int k, int l)
  192. {
  193. return getBlockTextureFromSideAndMetadata(l, iblockaccess.getBlockMetadata(i, j, k));
  194. }
  195.  
  196. public int getBlockTextureFromSideAndMetadata(int i, int j)
  197. {
  198. return getBlockTextureFromSide(i);
  199. }
  200.  
  201. public int getBlockTextureFromSide(int i)
  202. {
  203. return blockIndexInTexture;
  204. }
  205.  
  206. public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int i, int j, int k)
  207. {
  208. return AxisAlignedBB.getBoundingBoxFromPool((double)i + minX, (double)j + minY, (double)k + minZ, (double)i + maxX, (double)j + maxY, (double)k + maxZ);
  209. }
  210.  
  211. public void getCollidingBoundingBoxes(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, ArrayList arraylist)
  212. {
  213. AxisAlignedBB axisalignedbb1 = getCollisionBoundingBoxFromPool(world, i, j, k);
  214. if(axisalignedbb1 != null && axisalignedbb.intersectsWith(axisalignedbb1))
  215. {
  216. arraylist.add(axisalignedbb1);
  217. }
  218. }
  219.  
  220. public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k)
  221. {
  222. return AxisAlignedBB.getBoundingBoxFromPool((double)i + minX, (double)j + minY, (double)k + minZ, (double)i + maxX, (double)j + maxY, (double)k + maxZ);
  223. }
  224.  
  225. public boolean isOpaqueCube()
  226. {
  227. return true;
  228. }
  229.  
  230. public boolean canCollideCheck(int i, boolean flag)
  231. {
  232. return isCollidable();
  233. }
  234.  
  235. public boolean isCollidable()
  236. {
  237. return true;
  238. }
  239.  
  240. public void updateTick(World world, int i, int j, int k, Random random)
  241. {
  242. }
  243.  
  244. public void randomDisplayTick(World world, int i, int j, int k, Random random)
  245. {
  246. }
  247.  
  248. public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int l)
  249. {
  250. }
  251.  
  252. public void onNeighborBlockChange(World world, int i, int j, int k, int l)
  253. {
  254. }
  255.  
  256. public int tickRate()
  257. {
  258. return 10;
  259. }
  260.  
  261. public void onBlockAdded(World world, int i, int j, int k)
  262. {
  263. }
  264.  
  265. public void onBlockRemoval(World world, int i, int j, int k)
  266. {
  267. }
  268.  
  269. public int quantityDropped(Random random)
  270. {
  271. return 1;
  272. }
  273.  
  274. public int idDropped(int i, Random random)
  275. {
  276. return blockID;
  277. }
  278.  
  279. public float blockStrength(EntityPlayer entityplayer)
  280. {
  281. if(blockHardness < 0.0F)
  282. {
  283. return 0.0F;
  284. }
  285. if(!entityplayer.canHarvestBlock(this))
  286. {
  287. return 1.0F / blockHardness / 100F;
  288. } else
  289. {
  290. return entityplayer.getCurrentPlayerStrVsBlock(this) / blockHardness / 30F;
  291. }
  292. }
  293.  
  294. public final void dropBlockAsItem(World world, int i, int j, int k, int l)
  295. {
  296. dropBlockAsItemWithChance(world, i, j, k, l, 1.0F);
  297. }
  298.  
  299. public void dropBlockAsItemWithChance(World world, int i, int j, int k, int l, float f)
  300. {
  301. if(world.multiplayerWorld)
  302. {
  303. return;
  304. }
  305. int i1 = quantityDropped(world.rand);
  306. for(int j1 = 0; j1 < i1; j1++)
  307. {
  308. if(world.rand.nextFloat() > f)
  309. {
  310. continue;
  311. }
  312. int k1 = idDropped(l, world.rand);
  313. if(k1 > 0)
  314. {
  315. dropBlockAsItem_do(world, i, j, k, new ItemStack(k1, 1, damageDropped(l)));
  316. }
  317. }
  318.  
  319. }
  320.  
  321. protected void dropBlockAsItem_do(World world, int i, int j, int k, ItemStack itemstack)
  322. {
  323. if(world.multiplayerWorld)
  324. {
  325. return;
  326. } else
  327. {
  328. float f = 0.7F;
  329. double d = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  330. double d1 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  331. double d2 = (double)(world.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
  332. EntityItem entityitem = new EntityItem(world, (double)i + d, (double)j + d1, (double)k + d2, itemstack);
  333. entityitem.delayBeforeCanPickup = 10;
  334. world.entityJoinedWorld(entityitem);
  335. return;
  336. }
  337. }
  338.  
  339. protected int damageDropped(int i)
  340. {
  341. return 0;
  342. }
  343.  
  344. public float getExplosionResistance(Entity entity)
  345. {
  346. return blockResistance / 5F;
  347. }
  348.  
  349. public MovingObjectPosition collisionRayTrace(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1)
  350. {
  351. setBlockBoundsBasedOnState(world, i, j, k);
  352. vec3d = vec3d.addVector(-i, -j, -k);
  353. vec3d1 = vec3d1.addVector(-i, -j, -k);
  354. Vec3D vec3d2 = vec3d.getIntermediateWithXValue(vec3d1, minX);
  355. Vec3D vec3d3 = vec3d.getIntermediateWithXValue(vec3d1, maxX);
  356. Vec3D vec3d4 = vec3d.getIntermediateWithYValue(vec3d1, minY);
  357. Vec3D vec3d5 = vec3d.getIntermediateWithYValue(vec3d1, maxY);
  358. Vec3D vec3d6 = vec3d.getIntermediateWithZValue(vec3d1, minZ);
  359. Vec3D vec3d7 = vec3d.getIntermediateWithZValue(vec3d1, maxZ);
  360. if(!isVecInsideYZBounds(vec3d2))
  361. {
  362. vec3d2 = null;
  363. }
  364. if(!isVecInsideYZBounds(vec3d3))
  365. {
  366. vec3d3 = null;
  367. }
  368. if(!isVecInsideXZBounds(vec3d4))
  369. {
  370. vec3d4 = null;
  371. }
  372. if(!isVecInsideXZBounds(vec3d5))
  373. {
  374. vec3d5 = null;
  375. }
  376. if(!isVecInsideXYBounds(vec3d6))
  377. {
  378. vec3d6 = null;
  379. }
  380. if(!isVecInsideXYBounds(vec3d7))
  381. {
  382. vec3d7 = null;
  383. }
  384. Vec3D vec3d8 = null;
  385. if(vec3d2 != null && (vec3d8 == null || vec3d.distanceTo(vec3d2) < vec3d.distanceTo(vec3d8)))
  386. {
  387. vec3d8 = vec3d2;
  388. }
  389. if(vec3d3 != null && (vec3d8 == null || vec3d.distanceTo(vec3d3) < vec3d.distanceTo(vec3d8)))
  390. {
  391. vec3d8 = vec3d3;
  392. }
  393. if(vec3d4 != null && (vec3d8 == null || vec3d.distanceTo(vec3d4) < vec3d.distanceTo(vec3d8)))
  394. {
  395. vec3d8 = vec3d4;
  396. }
  397. if(vec3d5 != null && (vec3d8 == null || vec3d.distanceTo(vec3d5) < vec3d.distanceTo(vec3d8)))
  398. {
  399. vec3d8 = vec3d5;
  400. }
  401. if(vec3d6 != null && (vec3d8 == null || vec3d.distanceTo(vec3d6) < vec3d.distanceTo(vec3d8)))
  402. {
  403. vec3d8 = vec3d6;
  404. }
  405. if(vec3d7 != null && (vec3d8 == null || vec3d.distanceTo(vec3d7) < vec3d.distanceTo(vec3d8)))
  406. {
  407. vec3d8 = vec3d7;
  408. }
  409. if(vec3d8 == null)
  410. {
  411. return null;
  412. }
  413. byte byte0 = -1;
  414. if(vec3d8 == vec3d2)
  415. {
  416. byte0 = 4;
  417. }
  418. if(vec3d8 == vec3d3)
  419. {
  420. byte0 = 5;
  421. }
  422. if(vec3d8 == vec3d4)
  423. {
  424. byte0 = 0;
  425. }
  426. if(vec3d8 == vec3d5)
  427. {
  428. byte0 = 1;
  429. }
  430. if(vec3d8 == vec3d6)
  431. {
  432. byte0 = 2;
  433. }
  434. if(vec3d8 == vec3d7)
  435. {
  436. byte0 = 3;
  437. }
  438. return new MovingObjectPosition(i, j, k, byte0, vec3d8.addVector(i, j, k));
  439. }
  440.  
  441. private boolean isVecInsideYZBounds(Vec3D vec3d)
  442. {
  443. if(vec3d == null)
  444. {
  445. return false;
  446. } else
  447. {
  448. return vec3d.yCoord >= minY && vec3d.yCoord <= maxY && vec3d.zCoord >= minZ && vec3d.zCoord <= maxZ;
  449. }
  450. }
  451.  
  452. private boolean isVecInsideXZBounds(Vec3D vec3d)
  453. {
  454. if(vec3d == null)
  455. {
  456. return false;
  457. } else
  458. {
  459. return vec3d.xCoord >= minX && vec3d.xCoord <= maxX && vec3d.zCoord >= minZ && vec3d.zCoord <= maxZ;
  460. }
  461. }
  462.  
  463. private boolean isVecInsideXYBounds(Vec3D vec3d)
  464. {
  465. if(vec3d == null)
  466. {
  467. return false;
  468. } else
  469. {
  470. return vec3d.xCoord >= minX && vec3d.xCoord <= maxX && vec3d.yCoord >= minY && vec3d.yCoord <= maxY;
  471. }
  472. }
  473.  
  474. public void onBlockDestroyedByExplosion(World world, int i, int j, int k)
  475. {
  476. }
  477.  
  478. public int getRenderBlockPass()
  479. {
  480. return 0;
  481. }
  482.  
  483. public boolean canPlaceBlockOnSide(World world, int i, int j, int k, int l)
  484. {
  485. return canPlaceBlockAt(world, i, j, k);
  486. }
  487.  
  488. public boolean canPlaceBlockAt(World world, int i, int j, int k)
  489. {
  490. int l = world.getBlockId(i, j, k);
  491. return l == 0 || blocksList[l].blockMaterial.getIsGroundCover();
  492. }
  493.  
  494. public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
  495. {
  496. return false;
  497. }
  498.  
  499. public void onEntityWalking(World world, int i, int j, int k, Entity entity)
  500. {
  501. }
  502.  
  503. public void onBlockPlaced(World world, int i, int j, int k, int l)
  504. {
  505. }
  506.  
  507. public void onBlockClicked(World world, int i, int j, int k, EntityPlayer entityplayer)
  508. {
  509. }
  510.  
  511. public void velocityToAddToEntity(World world, int i, int j, int k, Entity entity, Vec3D vec3d)
  512. {
  513. }
  514.  
  515. public void setBlockBoundsBasedOnState(IBlockAccess iblockaccess, int i, int j, int k)
  516. {
  517. }
  518.  
  519. public int getRenderColor(int i)
  520. {
  521. return 0xffffff;
  522. }
  523.  
  524. public int colorMultiplier(IBlockAccess iblockaccess, int i, int j, int k)
  525. {
  526. return 0xffffff;
  527. }
  528.  
  529. public boolean isPoweringTo(IBlockAccess iblockaccess, int i, int j, int k, int l)
  530. {
  531. return false;
  532. }
  533.  
  534. public boolean canProvidePower()
  535. {
  536. return false;
  537. }
  538.  
  539. public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity)
  540. {
  541. }
  542.  
  543. public boolean isIndirectlyPoweringTo(World world, int i, int j, int k, int l)
  544. {
  545. return false;
  546. }
  547.  
  548. public void setBlockBoundsForItemRender()
  549. {
  550. }
  551.  
  552. public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l)
  553. {
  554. entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
  555. dropBlockAsItem(world, i, j, k, l);
  556. }
  557.  
  558. public boolean canBlockStay(World world, int i, int j, int k)
  559. {
  560. return true;
  561. }
  562.  
  563. public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving)
  564. {
  565. }
  566.  
  567. public Block setBlockName(String s)
  568. {
  569. blockName = (new StringBuilder()).append("tile.").append(s).toString();
  570. return this;
  571. }
  572.  
  573. public String translateBlockName()
  574. {
  575. return StatCollector.translateToLocal((new StringBuilder()).append(getBlockName()).append(".name").toString());
  576. }
  577.  
  578. public String getBlockName()
  579. {
  580. return blockName;
  581. }
  582.  
  583. public void playBlock(World world, int i, int j, int k, int l, int i1)
  584. {
  585. }
  586.  
  587. public boolean getEnableStats()
  588. {
  589. return enableStats;
  590. }
  591.  
  592. protected Block disableStats()
  593. {
  594. enableStats = false;
  595. return this;
  596. }
  597.  
  598. public int getMobilityFlag()
  599. {
  600. return blockMaterial.getMaterialMobility();
  601. }
  602.  
  603. static Class _mthclass$(String s)
  604. {
  605. try
  606. {
  607. return Class.forName(s);
  608. }
  609. catch(ClassNotFoundException classnotfoundexception)
  610. {
  611. throw new NoClassDefFoundError(classnotfoundexception.getMessage());
  612. }
  613. }
  614.  
  615. public static final StepSound soundPowderFootstep;
  616. public static final StepSound soundWoodFootstep;
  617. public static final StepSound soundGravelFootstep;
  618. public static final StepSound soundGrassFootstep;
  619. public static final StepSound soundStoneFootstep;
  620. public static final StepSound soundMetalFootstep;
  621. public static final StepSound soundGlassFootstep;
  622. public static final StepSound soundClothFootstep;
  623. public static final StepSound soundSandFootstep;
  624. public static final Block blocksList[];
  625. public static final boolean tickOnLoad[] = new boolean[256];
  626. public static final boolean opaqueCubeLookup[] = new boolean[256];
  627. public static final boolean isBlockContainer[] = new boolean[256];
  628. public static final int lightOpacity[] = new int[256];
  629. public static final boolean canBlockGrass[];
  630. public static final int lightValue[] = new int[256];
  631. public static final boolean field_28032_t[] = new boolean[256];
  632. public static final Block stone;
  633. public static final BlockGrass grass;
  634. public static final Block dirt;
  635. public static final Block cobblestone;
  636. public static final Block planks;
  637. public static final Block sapling;
  638. public static final Block bedrock;
  639. public static final Block waterMoving;
  640. public static final Block waterStill;
  641. public static final Block lavaMoving;
  642. public static final Block lavaStill;
  643. public static final Block sand;
  644. public static final Block gravel;
  645. public static final Block oreGold;
  646. public static final Block oreIron;
  647. public static final Block oreCoal;
  648. public static final Block wood;
  649. public static final BlockLeaves leaves;
  650. public static final Block sponge;
  651. public static final Block glass;
  652. public static final Block oreLapis;
  653. public static final Block blockLapis;
  654. public static final Block dispenser;
  655. public static final Block sandStone;
  656. public static final Block musicBlock;
  657. public static final Block blockBed;
  658. public static final Block railPowered;
  659. public static final Block railDetector;
  660. public static final Block pistonStickyBase;
  661. public static final Block web;
  662. public static final BlockTallGrass tallGrass;
  663. public static final BlockDeadBush deadBush;
  664. public static final Block pistonBase;
  665. public static final BlockPistonExtension pistonExtension;
  666. public static final Block cloth;
  667. public static final BlockPistonMoving pistonMoving;
  668. public static final BlockFlower plantYellow;
  669. public static final BlockFlower plantRed;
  670. public static final BlockFlower mushroomBrown;
  671. public static final BlockFlower mushroomRed;
  672. public static final Block blockGold;
  673. public static final Block blockSteel;
  674. public static final Block stairDouble;
  675. public static final Block stairSingle;
  676. public static final Block brick;
  677. public static final Block tnt;
  678. public static final Block bookShelf;
  679. public static final Block cobblestoneMossy;
  680. public static final Block obsidian;
  681. public static final Block torchWood;
  682. public static final BlockFire fire;
  683. public static final Block mobSpawner;
  684. public static final Block stairCompactPlanks;
  685. public static final Block chest;
  686. public static final Block redstoneWire;
  687. public static final Block oreDiamond;
  688. public static final Block blockDiamond;
  689. public static final Block workbench;
  690. public static final Block crops;
  691. public static final Block tilledField;
  692. public static final Block stoneOvenIdle;
  693. public static final Block stoneOvenActive;
  694. public static final Block signPost;
  695. public static final Block doorWood;
  696. public static final Block ladder;
  697. public static final Block rail;
  698. public static final Block stairCompactCobblestone;
  699. public static final Block signWall;
  700. public static final Block lever;
  701. public static final Block pressurePlateStone;
  702. public static final Block doorSteel;
  703. public static final Block pressurePlatePlanks;
  704. public static final Block oreRedstone;
  705. public static final Block oreRedstoneGlowing;
  706. public static final Block torchRedstoneIdle;
  707. public static final Block torchRedstoneActive;
  708. public static final Block button;
  709. public static final Block snow;
  710. public static final Block ice;
  711. public static final Block blockSnow;
  712. public static final Block cactus;
  713. public static final Block blockClay;
  714. public static final Block reed;
  715. public static final Block jukebox;
  716. public static final Block fence;
  717. public static final Block pumpkin;
  718. public static final Block netherrack;
  719. public static final Block slowSand;
  720. public static final Block glowStone;
  721. public static final BlockPortal portal;
  722. public static final Block pumpkinLantern;
  723. public static final Block cake;
  724. public static final Block redstoneRepeaterIdle;
  725. public static final Block redstoneRepeaterActive;
  726. public static final Block lockedChest;
  727. public static final Block trapdoor;
  728. public static final Block glowingGold;
  729. public static final Block oreTutorial = new BlockOre(101, 224).setHardness(5F).setResistance(10F).setBlockName("oreTutorial");
  730. public int blockIndexInTexture;
  731. public final int blockID;
  732. protected float blockHardness;
  733. protected float blockResistance;
  734. protected boolean blockConstructorCalled;
  735. protected boolean enableStats;
  736. public double minX;
  737. public double minY;
  738. public double minZ;
  739. public double maxX;
  740. public double maxY;
  741. public double maxZ;
  742. public StepSound stepSound;
  743. public float blockParticleGravity;
  744. public final Material blockMaterial;
  745. public float slipperiness;
  746. private String blockName;
  747.  
  748. static
  749. {
  750. soundPowderFootstep = new StepSound("stone", 1.0F, 1.0F);
  751. soundWoodFootstep = new StepSound("wood", 1.0F, 1.0F);
  752. soundGravelFootstep = new StepSound("gravel", 1.0F, 1.0F);
  753. soundGrassFootstep = new StepSound("grass", 1.0F, 1.0F);
  754. soundStoneFootstep = new StepSound("stone", 1.0F, 1.0F);
  755. soundMetalFootstep = new StepSound("stone", 1.0F, 1.5F);
  756. soundGlassFootstep = new StepSoundStone("stone", 1.0F, 1.0F);
  757. soundClothFootstep = new StepSound("cloth", 1.0F, 1.0F);
  758. soundSandFootstep = new StepSoundSand("sand", 1.0F, 1.0F);
  759. blocksList = new Block[256];
  760. canBlockGrass = new boolean[256];
  761. stone = (new BlockStone(1, 1)).setHardness(1.5F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("stone");
  762. grass = (BlockGrass)(new BlockGrass(2)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("grass");
  763. dirt = (new BlockDirt(3, 2)).setHardness(0.5F).setStepSound(soundGravelFootstep).setBlockName("dirt");
  764. cobblestone = (new Block(4, 16, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("stonebrick");
  765. planks = (new Block(5, 4, Material.wood)).setHardness(2.0F).setResistance(5F).setStepSound(soundWoodFootstep).setBlockName("wood").disableNeighborNotifyOnMetadataChange();
  766. sapling = (new BlockSapling(6, 15)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("sapling").disableNeighborNotifyOnMetadataChange();
  767. bedrock = (new Block(7, 17, Material.rock)).setBlockUnbreakable().setResistance(6000000F).setStepSound(soundStoneFootstep).setBlockName("bedrock").disableStats();
  768. waterMoving = (new BlockFlowing(8, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange();
  769. waterStill = (new BlockStationary(9, Material.water)).setHardness(100F).setLightOpacity(3).setBlockName("water").disableStats().disableNeighborNotifyOnMetadataChange();
  770. lavaMoving = (new BlockFlowing(10, Material.lava)).setHardness(0.0F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange();
  771. lavaStill = (new BlockStationary(11, Material.lava)).setHardness(100F).setLightValue(1.0F).setLightOpacity(255).setBlockName("lava").disableStats().disableNeighborNotifyOnMetadataChange();
  772. sand = (new BlockSand(12, 18)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("sand");
  773. gravel = (new BlockGravel(13, 19)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("gravel");
  774. oreGold = (new BlockOre(14, 32)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreGold");
  775. oreIron = (new BlockOre(15, 33)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreIron");
  776. oreCoal = (new BlockOre(16, 34)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreCoal");
  777. wood = (new BlockLog(17)).setHardness(2.0F).setStepSound(soundWoodFootstep).setBlockName("log").disableNeighborNotifyOnMetadataChange();
  778. leaves = (BlockLeaves)(new BlockLeaves(18, 52)).setHardness(0.2F).setLightOpacity(1).setStepSound(soundGrassFootstep).setBlockName("leaves").disableStats().disableNeighborNotifyOnMetadataChange();
  779. sponge = (new BlockSponge(19)).setHardness(0.6F).setStepSound(soundGrassFootstep).setBlockName("sponge");
  780. glass = (new BlockGlass(20, 49, Material.glass, false)).setHardness(0.3F).setStepSound(soundGlassFootstep).setBlockName("glass");
  781. oreLapis = (new BlockOre(21, 160)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreLapis");
  782. blockLapis = (new Block(22, 144, Material.rock)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("blockLapis");
  783. dispenser = (new BlockDispenser(23)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("dispenser").disableNeighborNotifyOnMetadataChange();
  784. sandStone = (new BlockSandStone(24)).setStepSound(soundStoneFootstep).setHardness(0.8F).setBlockName("sandStone");
  785. musicBlock = (new BlockNote(25)).setHardness(0.8F).setBlockName("musicBlock").disableNeighborNotifyOnMetadataChange();
  786. blockBed = (new BlockBed(26)).setHardness(0.2F).setBlockName("bed").disableStats().disableNeighborNotifyOnMetadataChange();
  787. railPowered = (new BlockRail(27, 179, true)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("goldenRail").disableNeighborNotifyOnMetadataChange();
  788. railDetector = (new BlockDetectorRail(28, 195)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("detectorRail").disableNeighborNotifyOnMetadataChange();
  789. pistonStickyBase = (new BlockPistonBase(29, 106, true)).setBlockName("pistonStickyBase").disableNeighborNotifyOnMetadataChange();
  790. web = (new BlockWeb(30, 11)).setLightOpacity(1).setHardness(4F).setBlockName("web");
  791. tallGrass = (BlockTallGrass)(new BlockTallGrass(31, 39)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tallgrass");
  792. deadBush = (BlockDeadBush)(new BlockDeadBush(32, 55)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("deadbush");
  793. pistonBase = (new BlockPistonBase(33, 107, false)).setBlockName("pistonBase").disableNeighborNotifyOnMetadataChange();
  794. pistonExtension = (BlockPistonExtension)(new BlockPistonExtension(34, 107)).disableNeighborNotifyOnMetadataChange();
  795. cloth = (new BlockCloth()).setHardness(0.8F).setStepSound(soundClothFootstep).setBlockName("cloth").disableNeighborNotifyOnMetadataChange();
  796. pistonMoving = new BlockPistonMoving(36);
  797. plantYellow = (BlockFlower)(new BlockFlower(37, 13)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("flower");
  798. plantRed = (BlockFlower)(new BlockFlower(38, 12)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("rose");
  799. mushroomBrown = (BlockFlower)(new BlockMushroom(39, 29)).setHardness(0.0F).setStepSound(soundGrassFootstep).setLightValue(0.125F).setBlockName("mushroom");
  800. mushroomRed = (BlockFlower)(new BlockMushroom(40, 28)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("mushroom");
  801. blockGold = (new BlockOreStorage(41, 23)).setHardness(3F).setResistance(10F).setStepSound(soundMetalFootstep).setBlockName("blockGold");
  802. blockSteel = (new BlockOreStorage(42, 22)).setHardness(5F).setResistance(10F).setStepSound(soundMetalFootstep).setBlockName("blockIron");
  803. stairDouble = (new BlockStep(43, true)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab");
  804. stairSingle = (new BlockStep(44, false)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("stoneSlab");
  805. brick = (new Block(45, 7, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("brick");
  806. tnt = (new BlockTNT(46, 8)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("tnt");
  807. bookShelf = (new BlockBookshelf(47, 35)).setHardness(1.5F).setStepSound(soundWoodFootstep).setBlockName("bookshelf");
  808. cobblestoneMossy = (new Block(48, 36, Material.rock)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("stoneMoss");
  809. obsidian = (new BlockObsidian(49, 37)).setHardness(10F).setResistance(2000F).setStepSound(soundStoneFootstep).setBlockName("obsidian");
  810. torchWood = (new BlockTorch(50, 80)).setHardness(0.0F).setLightValue(0.9375F).setStepSound(soundWoodFootstep).setBlockName("torch").disableNeighborNotifyOnMetadataChange();
  811. fire = (BlockFire)(new BlockFire(51, 31)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("fire").disableStats().disableNeighborNotifyOnMetadataChange();
  812. mobSpawner = (new BlockMobSpawner(52, 65)).setHardness(5F).setStepSound(soundMetalFootstep).setBlockName("mobSpawner").disableStats();
  813. stairCompactPlanks = (new BlockStairs(53, planks)).setBlockName("stairsWood").disableNeighborNotifyOnMetadataChange();
  814. chest = (new BlockChest(54)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("chest").disableNeighborNotifyOnMetadataChange();
  815. redstoneWire = (new BlockRedstoneWire(55, 164)).setHardness(0.0F).setStepSound(soundPowderFootstep).setBlockName("redstoneDust").disableStats().disableNeighborNotifyOnMetadataChange();
  816. oreDiamond = (new BlockOre(56, 50)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreDiamond");
  817. blockDiamond = (new BlockOreStorage(57, 24)).setHardness(5F).setResistance(10F).setStepSound(soundMetalFootstep).setBlockName("blockDiamond");
  818. workbench = (new BlockWorkbench(58)).setHardness(2.5F).setStepSound(soundWoodFootstep).setBlockName("workbench");
  819. crops = (new BlockCrops(59, 88)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("crops").disableStats().disableNeighborNotifyOnMetadataChange();
  820. tilledField = (new BlockFarmland(60)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("farmland");
  821. stoneOvenIdle = (new BlockFurnace(61, false)).setHardness(3.5F).setStepSound(soundStoneFootstep).setBlockName("furnace").disableNeighborNotifyOnMetadataChange();
  822. stoneOvenActive = (new BlockFurnace(62, true)).setHardness(3.5F).setStepSound(soundStoneFootstep).setLightValue(0.875F).setBlockName("furnace").disableNeighborNotifyOnMetadataChange();
  823. signPost = (new BlockSign(63, net.minecraft.src.TileEntitySign.class, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange();
  824. doorWood = (new BlockDoor(64, Material.wood)).setHardness(3F).setStepSound(soundWoodFootstep).setBlockName("doorWood").disableStats().disableNeighborNotifyOnMetadataChange();
  825. ladder = (new BlockLadder(65, 83)).setHardness(0.4F).setStepSound(soundWoodFootstep).setBlockName("ladder").disableNeighborNotifyOnMetadataChange();
  826. rail = (new BlockRail(66, 128, false)).setHardness(0.7F).setStepSound(soundMetalFootstep).setBlockName("rail").disableNeighborNotifyOnMetadataChange();
  827. stairCompactCobblestone = (new BlockStairs(67, cobblestone)).setBlockName("stairsStone").disableNeighborNotifyOnMetadataChange();
  828. signWall = (new BlockSign(68, net.minecraft.src.TileEntitySign.class, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("sign").disableStats().disableNeighborNotifyOnMetadataChange();
  829. lever = (new BlockLever(69, 96)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("lever").disableNeighborNotifyOnMetadataChange();
  830. pressurePlateStone = (new BlockPressurePlate(70, stone.blockIndexInTexture, EnumMobType.mobs, Material.rock)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange();
  831. doorSteel = (new BlockDoor(71, Material.iron)).setHardness(5F).setStepSound(soundMetalFootstep).setBlockName("doorIron").disableStats().disableNeighborNotifyOnMetadataChange();
  832. pressurePlatePlanks = (new BlockPressurePlate(72, planks.blockIndexInTexture, EnumMobType.everything, Material.wood)).setHardness(0.5F).setStepSound(soundWoodFootstep).setBlockName("pressurePlate").disableNeighborNotifyOnMetadataChange();
  833. oreRedstone = (new BlockRedstoneOre(73, 51, false)).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange();
  834. oreRedstoneGlowing = (new BlockRedstoneOre(74, 51, true)).setLightValue(0.625F).setHardness(3F).setResistance(5F).setStepSound(soundStoneFootstep).setBlockName("oreRedstone").disableNeighborNotifyOnMetadataChange();
  835. torchRedstoneIdle = (new BlockRedstoneTorch(75, 115, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange();
  836. torchRedstoneActive = (new BlockRedstoneTorch(76, 99, true)).setHardness(0.0F).setLightValue(0.5F).setStepSound(soundWoodFootstep).setBlockName("notGate").disableNeighborNotifyOnMetadataChange();
  837. button = (new BlockButton(77, stone.blockIndexInTexture)).setHardness(0.5F).setStepSound(soundStoneFootstep).setBlockName("button").disableNeighborNotifyOnMetadataChange();
  838. snow = (new BlockSnow(78, 66)).setHardness(0.1F).setStepSound(soundClothFootstep).setBlockName("snow");
  839. ice = (new BlockIce(79, 67)).setHardness(0.5F).setLightOpacity(3).setStepSound(soundGlassFootstep).setBlockName("ice");
  840. blockSnow = (new BlockSnowBlock(80, 66)).setHardness(0.2F).setStepSound(soundClothFootstep).setBlockName("snow");
  841. cactus = (new BlockCactus(81, 70)).setHardness(0.4F).setStepSound(soundClothFootstep).setBlockName("cactus");
  842. blockClay = (new BlockClay(82, 72)).setHardness(0.6F).setStepSound(soundGravelFootstep).setBlockName("clay");
  843. reed = (new BlockReed(83, 73)).setHardness(0.0F).setStepSound(soundGrassFootstep).setBlockName("reeds").disableStats();
  844. jukebox = (new BlockJukeBox(84, 74)).setHardness(2.0F).setResistance(10F).setStepSound(soundStoneFootstep).setBlockName("jukebox").disableNeighborNotifyOnMetadataChange();
  845. fence = (new BlockFence(85, 4)).setHardness(2.0F).setResistance(5F).setStepSound(soundWoodFootstep).setBlockName("fence").disableNeighborNotifyOnMetadataChange();
  846. pumpkin = (new BlockPumpkin(86, 102, false)).setHardness(1.0F).setStepSound(soundWoodFootstep).setBlockName("pumpkin").disableNeighborNotifyOnMetadataChange();
  847. netherrack = (new BlockNetherrack(87, 103)).setHardness(0.4F).setStepSound(soundStoneFootstep).setBlockName("hellrock");
  848. slowSand = (new BlockSoulSand(88, 104)).setHardness(0.5F).setStepSound(soundSandFootstep).setBlockName("hellsand");
  849. glowStone = (new BlockGlowStone(89, 105, Material.rock)).setHardness(0.3F).setStepSound(soundGlassFootstep).setLightValue(1.0F).setBlockName("lightgem");
  850. portal = (BlockPortal)(new BlockPortal(90, 14)).setHardness(-1F).setStepSound(soundGlassFootstep).setLightValue(0.75F).setBlockName("portal");
  851. pumpkinLantern = (new BlockPumpkin(91, 102, true)).setHardness(1.0F).setStepSound(soundWoodFootstep).setLightValue(1.0F).setBlockName("litpumpkin").disableNeighborNotifyOnMetadataChange();
  852. cake = (new BlockCake(92, 121)).setHardness(0.5F).setStepSound(soundClothFootstep).setBlockName("cake").disableStats().disableNeighborNotifyOnMetadataChange();
  853. redstoneRepeaterIdle = (new BlockRedstoneRepeater(93, false)).setHardness(0.0F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange();
  854. redstoneRepeaterActive = (new BlockRedstoneRepeater(94, true)).setHardness(0.0F).setLightValue(0.625F).setStepSound(soundWoodFootstep).setBlockName("diode").disableStats().disableNeighborNotifyOnMetadataChange();
  855. lockedChest = (new BlockLockedChest(95)).setHardness(0.0F).setLightValue(1.0F).setStepSound(soundWoodFootstep).setBlockName("lockedchest").setTickOnLoad(true).disableNeighborNotifyOnMetadataChange();
  856. trapdoor = (new BlockTrapDoor(96, Material.wood)).setHardness(3F).setStepSound(soundWoodFootstep).setBlockName("trapdoor").disableStats().disableNeighborNotifyOnMetadataChange();
  857. glowingGold = new BlockOreStorage(100, 32).setHardness(3F).setResistance(10F).setLightValue(1.0F).setBlockName("glowingGold");
  858. Item.itemsList[cloth.blockID] = (new ItemCloth(cloth.blockID - 256)).setItemName("cloth");
  859. Item.itemsList[wood.blockID] = (new ItemLog(wood.blockID - 256)).setItemName("log");
  860. Item.itemsList[stairSingle.blockID] = (new ItemSlab(stairSingle.blockID - 256)).setItemName("stoneSlab");
  861. Item.itemsList[sapling.blockID] = (new ItemSapling(sapling.blockID - 256)).setItemName("sapling");
  862. Item.itemsList[leaves.blockID] = (new ItemLeaves(leaves.blockID - 256)).setItemName("leaves");
  863. Item.itemsList[pistonBase.blockID] = new ItemPiston(pistonBase.blockID - 256);
  864. Item.itemsList[pistonStickyBase.blockID] = new ItemPiston(pistonStickyBase.blockID - 256);
  865. for(int i = 0; i < 256; i++)
  866. {
  867. if(blocksList[i] != null && Item.itemsList[i] == null)
  868. {
  869. Item.itemsList[i] = new ItemBlock(i - 256);
  870. blocksList[i].initializeBlock();
  871. }
  872. }
  873.  
  874. canBlockGrass[0] = true;
  875. StatList.initBreakableStats();
  876. }
  877. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement