Guest User

Untitled

a guest
Dec 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.51 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. import java.util.Map;
  4. import net.minecraft.client.Minecraft;
  5. import org.lwjgl.opengl.GL11;
  6.  
  7. public class mod_Paintball extends BaseModMp
  8. {
  9. public static final Block RedBase = new BlockRedBase(115, 0).setHardness(2.0F).setResistance(5.0F).setBlockName("RedBase");
  10. public static final Item RedHelmet = (new ItemArmor(256, 1, 5, 0)).setItemName("Red Helmet");
  11. public static final Item RedPlate = (new ItemArmor(257, 1, 5, 1)).setItemName("Red Plate");
  12. public static final Item RedLegs = (new ItemArmor(258, 1, 5, 2)).setItemName("Red Legs");
  13. public static final Item RedBoots = (new ItemArmor(259, 1, 5, 3)).setItemName("Red Boots");
  14. public static final Item RedPellets = (new Item(244)).setItemName("Red Pellets");
  15. public static final Block BlueBase = new BlockBlueBase(116, 0).setHardness(2.0F).setResistance(5.0F).setBlockName("BlueBase");
  16. public static final Item BlueHelmet = (new ItemArmor(260, 1, 6, 0)).setItemName("Blue Helmet");
  17. public static final Item BluePlate = (new ItemArmor(261, 1, 6, 1)).setItemName("Blue Plate");
  18. public static final Item BlueLegs = (new ItemArmor(262, 1, 6, 2)).setItemName("Blue Legs");
  19. public static final Item BlueBoots = (new ItemArmor(263, 1, 6, 3)).setItemName("Blue Boots");
  20. public static final Item BluePellets = (new Item(250)).setItemName("Blue Pellets");
  21. public static final Item PaintballPistolRed = (new ItemPaintballPistolRed(245)).setItemName("Paintball Pistol (R)");
  22. public static final Item PaintballShotgunRed = (new ItemPaintballShotgunRed(246)).setItemName("Paintball Shotgun (R)");
  23. public static final Item PaintballGunRed = (new ItemPaintballGunRed(247)).setItemName("Paintball Gun (R)");
  24. public static final Item PaintballSniperRed = (new ItemPaintballSniperRed(248)).setItemName("Paintball Sniper (R)");
  25. public static final Item PaintballGrenadeRed = (new ItemPaintballGrenadeRed(249)).setItemName("Paintball Grenade (R)");
  26. public static final Item PaintballPistolBlue = (new ItemPaintballPistolBlue(251)).setItemName("Paintball Pistol (B)");
  27. public static final Item PaintballShotgunBlue = (new ItemPaintballShotgunBlue(252)).setItemName("Paintball Shotgun (B)");
  28. public static final Item PaintballGunBlue = (new ItemPaintballGunBlue(253)).setItemName("Paintball Gun (B)");
  29. public static final Item PaintballSniperBlue = (new ItemPaintballSniperBlue(254)).setItemName("Paintball Sniper (B)");
  30. public static final Item PaintballGrenadeBlue = (new ItemPaintballGrenadeBlue(255)).setItemName("Paintball Grenade (B)");
  31.  
  32. public static final Achievement Paintball = new Achievement(4000, "Paintball", 9, 2, PaintballGunRed, null).registerAchievement();
  33. public static final Achievement Boom = new Achievement(4001, "Boom!", 10, 3, PaintballGrenadeRed, Paintball).registerAchievement();
  34.  
  35. public mod_Paintball()
  36. {
  37. ModLoader.SetInGameHook(this, true, false);
  38. instance = this;
  39.  
  40. ModLoader.AddArmor("red");
  41. ModLoader.AddArmor("blue");
  42.  
  43. ModLoader.RegisterBlock(RedBase, ItemBaseBlock.class);
  44. ModLoader.RegisterBlock(BlueBase, ItemBaseBlock.class);
  45. ModLoader.RegisterEntityID(EntityRedPistol.class,"RedPistol",ModLoader.getUniqueEntityId());
  46. ModLoader.RegisterEntityID(EntityRedShotgun.class,"RedShotgun",ModLoader.getUniqueEntityId());
  47. ModLoader.RegisterEntityID(EntityRedPellets.class,"RedPellets",ModLoader.getUniqueEntityId());
  48. ModLoader.RegisterEntityID(EntityRedSniper.class,"RedSniper",ModLoader.getUniqueEntityId());
  49. ModLoader.RegisterEntityID(EntityRedGrenade.class,"RedGrenade",ModLoader.getUniqueEntityId());
  50. ModLoader.RegisterEntityID(EntityBluePistol.class,"BluePistol",ModLoader.getUniqueEntityId());
  51. ModLoader.RegisterEntityID(EntityBlueShotgun.class,"BlueShotgun",ModLoader.getUniqueEntityId());
  52. ModLoader.RegisterEntityID(EntityBluePellets.class,"BluePellets",ModLoader.getUniqueEntityId());
  53. ModLoader.RegisterEntityID(EntityBlueSniper.class,"BlueSniper",ModLoader.getUniqueEntityId());
  54. ModLoader.RegisterEntityID(EntityBlueGrenade.class,"BlueGrenade",ModLoader.getUniqueEntityId());
  55.  
  56. ModLoader.AddAchievementDesc(Paintball, "Paintballin'", "Shoot your friends!");
  57. ModLoader.AddAchievementDesc(Boom, "Boom!'", "Toss a grenade!");
  58.  
  59. RedBase.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratetopred.png");
  60. RedBaseSides = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratesidesred.png");
  61. RedBaseBottom = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratebottomred.png");
  62. RedHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redhelmet.png");
  63. RedPlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redplate.png");
  64. RedLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redlegs.png");
  65. RedBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redboots.png");
  66. RedPellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redpellets.png");
  67. BlueBase.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratetopblue.png");
  68. BlueBaseSides = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratesidesblue.png");
  69. BlueBaseBottom = ModLoader.addOverride("/terrain.png", "/PaintballPics/ter_cratebottomblue.png");
  70. BlueHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluehelmet.png");
  71. BluePlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueplate.png");
  72. BlueLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluelegs.png");
  73. BlueBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueboots.png");
  74. BluePellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluepellets.png");
  75. PaintballPistolRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballpistolred.png");
  76. PaintballShotgunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunred.png");
  77. PaintballGunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunred.png");
  78. PaintballSniperRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperred.png");
  79. PaintballGrenadeRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgrenadered.png");
  80. PaintballPistolBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballpistolblue.png");
  81. PaintballShotgunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunblue.png");
  82. PaintballGunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunblue.png");
  83. PaintballSniperBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperblue.png");
  84. PaintballGrenadeBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgrenadeblue.png");
  85.  
  86. ModLoader.AddName(RedBase, "Insta-Base (R)");
  87. ModLoader.AddName(RedHelmet, "Red Helmet");
  88. ModLoader.AddName(RedPlate, "Red Chest");
  89. ModLoader.AddName(RedLegs, "Red Legs");
  90. ModLoader.AddName(RedBoots, "Red Boots");
  91. ModLoader.AddName(RedPellets, "Red Pellets");
  92. ModLoader.AddName(BlueBase, "Insta-Base (B)");
  93. ModLoader.AddName(BlueHelmet, "Blue Helmet");
  94. ModLoader.AddName(BluePlate, "Blue Chest");
  95. ModLoader.AddName(BlueLegs, "Blue Legs");
  96. ModLoader.AddName(BlueBoots, "Blue Boots");
  97. ModLoader.AddName(BluePellets, "Blue Pellets");
  98. ModLoader.AddName(PaintballPistolRed, "Paintball Pistol (R)");
  99. ModLoader.AddName(PaintballShotgunRed, "Paintball Shotgun (R)");
  100. ModLoader.AddName(PaintballGunRed, "Paintball Gun (R)");
  101. ModLoader.AddName(PaintballSniperRed, "Paintball Sniper (R)");
  102. ModLoader.AddName(PaintballGrenadeRed, "Paintball Grenade (R)");
  103. ModLoader.AddName(PaintballPistolBlue, "Paintball Pistol (B)");
  104. ModLoader.AddName(PaintballShotgunBlue, "Paintball Shotgun (B)");
  105. ModLoader.AddName(PaintballGunBlue, "Paintball Gun (B)");
  106. ModLoader.AddName(PaintballSniperBlue, "Paintball Sniper (B)");
  107. ModLoader.AddName(PaintballGrenadeBlue, "Paintball Grenade (B)");
  108.  
  109. ModLoader.AddRecipe(new ItemStack(RedBase, 1), new Object[] {
  110. "XYX", "ZVZ", "XWX", Character.valueOf('V'), new ItemStack(Item.diamond), Character.valueOf('W'), new ItemStack(Block.stoneOvenIdle),
  111. Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14), Character.valueOf('Y'), new ItemStack(Block.workbench),
  112. Character.valueOf('Z'), new ItemStack(Block.chest)});
  113. ModLoader.AddRecipe(new ItemStack(RedHelmet, 1), new Object[] {
  114. "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  115. ModLoader.AddRecipe(new ItemStack(RedPlate, 1), new Object[] {
  116. "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  117. ModLoader.AddRecipe(new ItemStack(RedLegs, 1), new Object[] {
  118. "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  119. ModLoader.AddRecipe(new ItemStack(RedBoots, 1), new Object[] {
  120. "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  121. ModLoader.AddRecipe(new ItemStack(RedPellets, 32), new Object[] {
  122. " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 1)});
  123. ModLoader.AddRecipe(new ItemStack(BlueBase, 1), new Object[] {
  124. "XYX", "ZVZ", "XWX", Character.valueOf('V'), new ItemStack(Item.diamond), Character.valueOf('W'), new ItemStack(Block.stoneOvenIdle),
  125. Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11), Character.valueOf('Y'), new ItemStack(Block.workbench),
  126. Character.valueOf('Z'), new ItemStack(Block.chest)});
  127. ModLoader.AddRecipe(new ItemStack(BlueHelmet, 1), new Object[] {
  128. "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  129. ModLoader.AddRecipe(new ItemStack(BluePlate, 1), new Object[] {
  130. "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  131. ModLoader.AddRecipe(new ItemStack(BlueLegs, 1), new Object[] {
  132. "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  133. ModLoader.AddRecipe(new ItemStack(BlueBoots, 1), new Object[] {
  134. "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  135. ModLoader.AddRecipe(new ItemStack(BluePellets, 32), new Object[] {
  136. " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 4)});
  137. ModLoader.AddRecipe(new ItemStack(PaintballPistolRed, 1), new Object[] {
  138. " ", " X ", "QZ ", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  139. ModLoader.AddRecipe(new ItemStack(PaintballShotgunRed, 1), new Object[] {
  140. " ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  141. ModLoader.AddRecipe(new ItemStack(PaintballGunRed, 1), new Object[] {
  142. "X ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  143. ModLoader.AddRecipe(new ItemStack(PaintballSniperRed, 1), new Object[] {
  144. "X ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
  145. Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  146. ModLoader.AddRecipe(new ItemStack(PaintballGrenadeRed, 1), new Object[] {
  147. " X ", "XYX", " X ", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 1)});
  148. ModLoader.AddRecipe(new ItemStack(PaintballPistolBlue, 1), new Object[] {
  149. " ", " X ", "QZ ", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  150. ModLoader.AddRecipe(new ItemStack(PaintballShotgunBlue, 1), new Object[] {
  151. " ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  152. ModLoader.AddRecipe(new ItemStack(PaintballGunBlue, 1), new Object[] {
  153. "X ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  154. ModLoader.AddRecipe(new ItemStack(PaintballSniperBlue, 1), new Object[] {
  155. "X ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
  156. Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  157. ModLoader.AddRecipe(new ItemStack(PaintballGrenadeBlue, 1), new Object[] {
  158. " X ", "XYX", " X ", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 4)});
  159.  
  160. ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedPistol.class, 178);
  161. ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedShotgun.class, 179);
  162. ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedPellets.class, 180);
  163. ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedSniper.class, 181);
  164. ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedGrenade.class, 182);
  165. ModLoaderMp.RegisterNetClientHandlerEntity(EntityBluePistol.class, 183);
  166. ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueShotgun.class, 184);
  167. ModLoaderMp.RegisterNetClientHandlerEntity(EntityBluePellets.class, 185);
  168. ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueSniper.class, 186);
  169. ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueGrenade.class, 187);
  170. }
  171.  
  172. public void AddRenderer(Map map)
  173. {
  174. map.put(EntityRedPistol.class, new RenderRedPistol());
  175. map.put(EntityRedShotgun.class, new RenderRedShotgun());
  176. map.put(EntityRedPellets.class, new RenderRedPellets());
  177. map.put(EntityRedSniper.class, new RenderRedSniper());
  178. map.put(EntityRedGrenade.class, new RenderRedGrenade());
  179. map.put(EntityBluePistol.class, new RenderBluePistol());
  180. map.put(EntityBlueShotgun.class, new RenderBlueShotgun());
  181. map.put(EntityBluePellets.class, new RenderBluePellets());
  182. map.put(EntityBlueSniper.class, new RenderBlueSniper());
  183. map.put(EntityBlueGrenade.class, new RenderBlueGrenade());
  184. }
  185.  
  186. public static void shoot()
  187. {
  188. Packet230ModLoader packet230modloader = new Packet230ModLoader();
  189. packet230modloader.packetType = 0;
  190. ModLoaderMp.SendPacket(instance, packet230modloader);
  191. }
  192.  
  193. public boolean OnTickInGame(Minecraft minecraft)
  194. {
  195. ItemStack item = minecraft.thePlayer.inventory.getCurrentItem();
  196.  
  197. long l = minecraft.theWorld.worldInfo.getWorldTime();
  198. if(l > lastTime)
  199. {
  200. tick(minecraft);
  201. lastTime = l;
  202. }
  203. if(zoomOverlay)
  204. {
  205. ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
  206. int i = scaledresolution.getScaledWidth();
  207. int j = scaledresolution.getScaledHeight();
  208. GL11.glEnable(3042 /*GL_BLEND*/);
  209. GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
  210. GL11.glDepthMask(false);
  211. GL11.glBlendFunc(770, 771);
  212. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  213. GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
  214. if(item != null && (item.getItem() instanceof ItemPaintballPistolRed || item.getItem() instanceof ItemPaintballPistolBlue))
  215. {
  216. GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, minecraft.renderEngine.getTexture("/PaintballPics/pistolsight.png"));
  217. }
  218. if(item != null && (item.getItem() instanceof ItemPaintballSniperRed || item.getItem() instanceof ItemPaintballSniperBlue))
  219. {
  220. GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, minecraft.renderEngine.getTexture("/PaintballPics/snipersight.png"));
  221. }
  222. Tessellator tessellator = Tessellator.instance;
  223. tessellator.startDrawingQuads();
  224. tessellator.addVertexWithUV(i / 2 - 2 * j, j, -90D, 0.0D, 1.0D);
  225. tessellator.addVertexWithUV(i / 2 + 2 * j, j, -90D, 1.0D, 1.0D);
  226. tessellator.addVertexWithUV(i / 2 + 2 * j, 0.0D, -90D, 1.0D, 0.0D);
  227. tessellator.addVertexWithUV(i / 2 - 2 * j, 0.0D, -90D, 0.0D, 0.0D);
  228. tessellator.draw();
  229. GL11.glDepthMask(true);
  230. GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
  231. GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
  232. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  233. }
  234. if(item == null)
  235. {
  236. newZoom = 1.0F;
  237. zoomOverlay = false;
  238. }
  239. return true;
  240. }
  241.  
  242. private void tick(Minecraft minecraft)
  243. {
  244. if(shootTime > 0)
  245. {
  246. shootTime--;
  247. }
  248. Item item = null;
  249. ItemStack itemstack = minecraft.thePlayer.inventory.getCurrentItem();
  250. if(itemstack != null)
  251. {
  252. item = itemstack.getItem();
  253. }
  254. if(item != null && (!(item instanceof ItemPaintballPistolRed || item instanceof ItemPaintballPistolBlue || item instanceof ItemPaintballSniperRed || item instanceof ItemPaintballSniperBlue)))
  255. {
  256. newZoom = 1.0F;
  257. zoomOverlay = false;
  258. }
  259. float f = newZoom - playerZoom;
  260. playerZoom += f / 3F;
  261. if(playerZoom < 1.1F)
  262. {
  263. playerZoom = 1.0F;
  264. }
  265. try
  266. {
  267. ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "cameraZoom", Float.valueOf(playerZoom));
  268. }
  269. catch(NoSuchFieldException nosuchfieldexception)
  270. {
  271. try
  272. {
  273. ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "E", Float.valueOf(playerZoom));
  274. }
  275. catch(NoSuchFieldException nosuchfieldexception1)
  276. {
  277. System.out.println("I forgot to update obfuscated reflection D:");
  278. throw new RuntimeException(nosuchfieldexception1);
  279. }
  280. }
  281. }
  282.  
  283. public String Version()
  284. {
  285. return "1.7.3";
  286. }
  287.  
  288. public static int RedBaseSides;
  289. public static int RedBaseBottom;
  290. public static int BlueBaseSides;
  291. public static int BlueBaseBottom;
  292. public static int shootTime;
  293. public static float playerZoom = 1.0F;
  294. public static float newZoom = 1.0F;
  295. public static boolean zoomOverlay = false;
  296. private long lastTime;
  297. private static mod_Paintball instance;
  298. public String path = null;
  299. }
Add Comment
Please, Sign In to add comment