Guest User

Untitled

a guest
Jan 23rd, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.55 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Collection;
  5. import java.util.HashMap;
  6.  
  7. import net.minecraft.client.Minecraft;
  8. /***
  9. *
  10. * @author Ki113d & vxstorm
  11. *
  12. */
  13. public class mod_DefenceCraft extends BaseMod {
  14.  
  15. public mod_DefenceCraft() {
  16. ModLoader.SetInGameHook(this, true, false);
  17. registerBlocks();
  18. addRecipes();
  19. }
  20.  
  21. public void registerBlocks() {
  22. ModLoader.RegisterBlock(flareBlockLit);
  23. ModLoader.RegisterBlock(flareBlockUnlit);
  24. }
  25.  
  26. public void addRecipes() {
  27. ModLoader.AddRecipe(new ItemStack(flareBlockLit, 1), new Object[]{
  28. " ", "# ", "# ", Character.valueOf('#'), Block.dirt});
  29.  
  30. ModLoader.AddRecipe(new ItemStack(flareBlockLit, 1), new Object[]{
  31. " ", " ", " ##", Character.valueOf('#'), Block.dirt});
  32. }
  33.  
  34. public static void addNewFlare(World world, int i, int j, int k, boolean lit) {
  35. if (lit) {
  36. world.setBlockWithNotify(i, j, k, flareBlockLit.blockID);
  37. } else {
  38. world.setBlockWithNotify(i, j, k, flareBlockUnlit.blockID);
  39. }
  40. }
  41.  
  42. public String Version() {
  43. return "Fucking Alpha bro!";
  44. }
  45.  
  46. public static void addFlareToList(BlockFlare bf) {
  47. flareList.put(bf.ID, bf);
  48. }
  49.  
  50. @Override
  51. public boolean OnTickInGame(Minecraft minecraft) {
  52. if (flareList.isEmpty()) {
  53. return true;
  54. }
  55. Collection<BlockFlare> collec = flareList.values();
  56. Object[] flareArray = collec.toArray();
  57. checkForBurnOut(flareArray);
  58. return true;
  59. }
  60.  
  61. public void checkForBurnOut(Object[] obj) {
  62. for (int i = 0; i < obj.length; i++) {
  63. System.out.println("i = " + i);
  64. BlockFlare temp = (BlockFlare) obj[i];
  65. System.out.println(temp.time + "\n" + temp.ID);
  66. if (temp.time-- == 0) {
  67. temp.burnOut();
  68. flareList.remove(temp.ID);
  69. }
  70. }
  71. }
  72.  
  73. public void removeFlareFromList(BlockFlare bf) {
  74.  
  75. }
  76.  
  77. public static final Block flareBlockLit;
  78. public static final Block flareBlockUnlit;
  79. public static HashMap<Long, BlockFlare> flareList;
  80.  
  81. static {
  82. flareList = new HashMap<Long, BlockFlare>();
  83. flareBlockLit = (new BlockFlare(253, ModLoader.addOverride(
  84. "/terrain.png", "/com/DefenceCraft/flareLit.png"), true,
  85. System.currentTimeMillis() / 200)).setHardness(
  86. 0.0F).setLightValue(1.0F).setStepSound(Block.soundWoodFootstep)
  87. .setBlockName("Flare Lit").disableNeighborNotifyOnMetadataChange();
  88.  
  89. flareBlockUnlit = (new BlockFlare(254, ModLoader.addOverride(
  90. "/terrain.png", "/com/DefenceCraft/flareUnlit.png"), false,
  91. 0)).setHardness(0.0F).setLightValue(0.0F).setStepSound(
  92. Block.soundWoodFootstep).setBlockName(
  93. "Flare Unlit").disableNeighborNotifyOnMetadataChange();
  94. }
  95. }
Add Comment
Please, Sign In to add comment