Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 11.97 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 Item RedHelmet = (new ItemArmor(252, 1, 5, 0)).setItemName("Red Helmet");
  10.      public static final Item RedPlate = (new ItemArmor(253, 1, 5, 1)).setItemName("Red Plate");
  11.      public static final Item RedLegs = (new ItemArmor(254, 1, 5, 2)).setItemName("Red Legs");
  12.      public static final Item RedBoots = (new ItemArmor(255, 1, 5, 3)).setItemName("Red Boots");
  13.      public static final Item RedPellets = (new Item(250)).setItemName("Red Pellets");
  14.      public static final Item BlueHelmet = (new ItemArmor(256, 1, 6, 0)).setItemName("Blue Helmet");
  15.      public static final Item BluePlate = (new ItemArmor(257, 1, 6, 1)).setItemName("Blue Plate");
  16.      public static final Item BlueLegs = (new ItemArmor(258, 1, 6, 2)).setItemName("Blue Legs");
  17.      public static final Item BlueBoots = (new ItemArmor(259, 1, 6, 3)).setItemName("Blue Boots");
  18.      public static final Item BluePellets = (new Item(251)).setItemName("Blue Pellets");
  19.      public static final Item PaintballShotgunRed = (new ItemPaintballShotgunRed(244)).setItemName("Paintball Shotgun (R)");
  20.      public static final Item PaintballShotgunBlue = (new ItemPaintballShotgunBlue(245)).setItemName("Paintball Shotgun (B)");
  21.      public static final Item PaintballGunRed = (new ItemPaintballGunRed(246)).setItemName("Paintball Gun (R)");
  22.      public static final Item PaintballGunBlue = (new ItemPaintballGunBlue(247)).setItemName("Paintball Gun (B)");
  23.      public static final Item PaintballSniperRed = (new ItemPaintballSniperRed(248)).setItemName("Paintball Sniper (R)");
  24.      public static final Item PaintballSniperBlue = (new ItemPaintballSniperBlue(249)).setItemName("Paintball Sniper (B)");
  25.      
  26.      public static final Achievement Paintball = new Achievement(3450, "Paintball", 10, 2, PaintballGunBlue, null).registerAchievement();
  27.      
  28. public mod_Paintball()
  29. {
  30.   ModLoader.AddArmor("red");
  31.   ModLoader.AddArmor("blue");
  32.  
  33.   ModLoader.RegisterEntityID(EntityRedPellets.class,"RedPellets",ModLoader.getUniqueEntityId());
  34.   ModLoader.RegisterEntityID(EntityBluePellets.class,"BluePellets",ModLoader.getUniqueEntityId());
  35.   ModLoader.RegisterEntityID(EntityRedSniper.class,"RedSniper",ModLoader.getUniqueEntityId());
  36.   ModLoader.RegisterEntityID(EntityBlueSniper.class,"BlueSniper",ModLoader.getUniqueEntityId());
  37.   ModLoader.RegisterEntityID(EntityRedShotgun.class,"RedShotgun",ModLoader.getUniqueEntityId());
  38.   ModLoader.RegisterEntityID(EntityBlueShotgun.class,"BlueShotgun",ModLoader.getUniqueEntityId());
  39.  
  40.   ModLoader.AddAchievementDesc(Paintball, "Paintballin'", "Shoot your friends!");
  41.    
  42.   RedHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redhelmet.png");
  43.   RedPlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redplate.png");
  44.   RedLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redlegs.png");
  45.   RedBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redboots.png");
  46.   RedPellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redpellets.png");
  47.   BlueHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluehelmet.png");
  48.   BluePlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueplate.png");
  49.   BlueLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluelegs.png");
  50.   BlueBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueboots.png");
  51.   BluePellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluepellets.png");
  52.   PaintballGunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunred.png");
  53.   PaintballGunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunblue.png");  
  54.   PaintballSniperRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperred.png");
  55.   PaintballSniperBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperblue.png");
  56.   PaintballShotgunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunred.png");
  57.   PaintballShotgunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunblue.png");
  58.  
  59.   ModLoader.AddName(RedHelmet, "Red Helmet");
  60.   ModLoader.AddName(RedPlate, "Red Chest");
  61.   ModLoader.AddName(RedLegs, "Red Legs");
  62.   ModLoader.AddName(RedBoots, "Red Boots");
  63.   ModLoader.AddName(RedPellets, "Red Pellets");
  64.   ModLoader.AddName(BlueHelmet, "Blue Helmet");
  65.   ModLoader.AddName(BluePlate, "Blue Chest");
  66.   ModLoader.AddName(BlueLegs, "Blue Legs");
  67.   ModLoader.AddName(BlueBoots, "Blue Boots");
  68.   ModLoader.AddName(BluePellets, "Blue Pellets");
  69.   ModLoader.AddName(PaintballGunRed, "Paintball Gun (R)");
  70.   ModLoader.AddName(PaintballGunBlue, "Paintball Gun (B)");
  71.   ModLoader.AddName(PaintballSniperRed, "Paintball Sniper (R)");
  72.   ModLoader.AddName(PaintballSniperBlue, "Paintball Sniper (B)");
  73.   ModLoader.AddName(PaintballShotgunRed, "Paintball Shotgun (R)");
  74.   ModLoader.AddName(PaintballShotgunBlue, "Paintball Shotgun (B)");
  75.  
  76.   ModLoader.AddRecipe(new ItemStack(RedHelmet, 1), new Object[] {
  77.       "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  78.   ModLoader.AddRecipe(new ItemStack(RedPlate, 1), new Object[] {
  79.       "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  80.   ModLoader.AddRecipe(new ItemStack(RedLegs, 1), new Object[] {
  81.       "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  82.   ModLoader.AddRecipe(new ItemStack(RedBoots, 1), new Object[] {
  83.       "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
  84.   ModLoader.AddRecipe(new ItemStack(RedPellets, 32), new Object[] {
  85.       " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 1)});
  86.   ModLoader.AddRecipe(new ItemStack(BlueHelmet, 1), new Object[] {
  87.       "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  88.   ModLoader.AddRecipe(new ItemStack(BluePlate, 1), new Object[] {
  89.       "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  90.   ModLoader.AddRecipe(new ItemStack(BlueLegs, 1), new Object[] {
  91.       "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  92.   ModLoader.AddRecipe(new ItemStack(BlueBoots, 1), new Object[] {
  93.       "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
  94.   ModLoader.AddRecipe(new ItemStack(BluePellets, 32), new Object[] {
  95.       " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 4)});
  96.   ModLoader.AddRecipe(new ItemStack(PaintballGunRed, 1), new Object[] {
  97.       "X  ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  98.   ModLoader.AddRecipe(new ItemStack(PaintballGunBlue, 1), new Object[] {
  99.       "X  ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  100.   ModLoader.AddRecipe(new ItemStack(PaintballSniperRed, 1), new Object[] {
  101.       "X  ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
  102.       Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  103.   ModLoader.AddRecipe(new ItemStack(PaintballSniperBlue, 1), new Object[] {
  104.       "X  ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
  105.       Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  106.   ModLoader.AddRecipe(new ItemStack(PaintballShotgunRed, 1), new Object[] {
  107.       "   ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
  108.   ModLoader.AddRecipe(new ItemStack(PaintballShotgunBlue, 1), new Object[] {
  109.       "   ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
  110.  
  111.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedPellets.class, 181);
  112.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityBluePellets.class, 182);
  113.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedSniper.class, 183);
  114.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueSniper.class, 184);
  115.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedShotgun.class, 185);
  116.   ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueShotgun.class, 186);
  117. }
  118.  
  119. public void AddRenderer(Map map)
  120.     {
  121.         map.put(EntityRedPellets.class, new RenderRedPellets());
  122.         map.put(EntityBluePellets.class, new RenderBluePellets());
  123.         map.put(EntityRedSniper.class, new RenderRedSniper());
  124.         map.put(EntityBlueSniper.class, new RenderBlueSniper());
  125.         map.put(EntityRedShotgun.class, new RenderRedShotgun());
  126.         map.put(EntityBlueShotgun.class, new RenderBlueShotgun());
  127.     }
  128.  
  129. public static int shootTime;
  130. public static float playerZoom = 1.0F;
  131. public static float newZoom = 1.0F;
  132. public static boolean zoomOverlay = false;
  133. private long lastTime;
  134.  
  135. public void OnTickInGame(Minecraft minecraft)
  136. {
  137.     long l = minecraft.theWorld.worldInfo.getWorldTime();
  138.     if(l > lastTime)
  139.     {
  140.         tick(minecraft);
  141.         lastTime = l;
  142.     }
  143.     if(zoomOverlay)
  144.     {
  145.         ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
  146.         int i = scaledresolution.getScaledWidth();
  147.         int j = scaledresolution.getScaledHeight();
  148.         GL11.glEnable(3042 /*GL_BLEND*/);
  149.         GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
  150.         GL11.glDepthMask(false);
  151.         GL11.glBlendFunc(770, 771);
  152.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  153.         GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
  154.         GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, minecraft.renderEngine.getTexture("/gui/scope.png"));
  155.         Tessellator tessellator = Tessellator.instance;
  156.         tessellator.startDrawingQuads();
  157.         tessellator.addVertexWithUV(i / 2 - 2 * j, j, -90D, 0.0D, 1.0D);
  158.         tessellator.addVertexWithUV(i / 2 + 2 * j, j, -90D, 1.0D, 1.0D);
  159.         tessellator.addVertexWithUV(i / 2 + 2 * j, 0.0D, -90D, 1.0D, 0.0D);
  160.         tessellator.addVertexWithUV(i / 2 - 2 * j, 0.0D, -90D, 0.0D, 0.0D);
  161.         tessellator.draw();
  162.         GL11.glDepthMask(true);
  163.         GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
  164.         GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
  165.         GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  166.     }
  167. }
  168.  
  169. private void tick(Minecraft minecraft)
  170. {
  171.     if(shootTime > 0)
  172.     {
  173.         shootTime--;
  174.     }
  175.     Item item = null;
  176.     ItemStack itemstack = minecraft.thePlayer.inventory.getCurrentItem();
  177.     if(itemstack != null)
  178.     {
  179.         item = itemstack.getItem();
  180.     }
  181.     if(item != null && (!(item instanceof ItemPaintballSniperBlue)))
  182.     {
  183.         newZoom = 1.0F;
  184.         zoomOverlay = false;
  185.     }
  186.     float f = newZoom - playerZoom;
  187.     playerZoom += f / 3F;
  188.     if(playerZoom < 1.1F)
  189.     {
  190.         playerZoom = 1.0F;
  191.     }
  192.     try
  193.     {
  194.         ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "cameraZoom", Float.valueOf(playerZoom));
  195.     }
  196.     catch(NoSuchFieldException nosuchfieldexception)
  197.     {
  198.         try
  199.         {
  200.             ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "E", Float.valueOf(playerZoom));
  201.         }
  202.         catch(NoSuchFieldException nosuchfieldexception1)
  203.         {
  204.             System.out.println("I forgot to update obfuscated reflection D:");
  205.             throw new RuntimeException(nosuchfieldexception1);
  206.         }
  207.     }
  208. }
  209.  
  210. public String Version()
  211.       {
  212.       return "1.7.3";
  213.       }
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement