Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.util.Map;
- import net.minecraft.client.Minecraft;
- import org.lwjgl.opengl.GL11;
- public class mod_Paintball extends BaseModMp
- {
- public static final Item RedHelmet = (new ItemArmor(252, 1, 5, 0)).setItemName("Red Helmet");
- public static final Item RedPlate = (new ItemArmor(253, 1, 5, 1)).setItemName("Red Plate");
- public static final Item RedLegs = (new ItemArmor(254, 1, 5, 2)).setItemName("Red Legs");
- public static final Item RedBoots = (new ItemArmor(255, 1, 5, 3)).setItemName("Red Boots");
- public static final Item RedPellets = (new Item(250)).setItemName("Red Pellets");
- public static final Item BlueHelmet = (new ItemArmor(256, 1, 6, 0)).setItemName("Blue Helmet");
- public static final Item BluePlate = (new ItemArmor(257, 1, 6, 1)).setItemName("Blue Plate");
- public static final Item BlueLegs = (new ItemArmor(258, 1, 6, 2)).setItemName("Blue Legs");
- public static final Item BlueBoots = (new ItemArmor(259, 1, 6, 3)).setItemName("Blue Boots");
- public static final Item BluePellets = (new Item(251)).setItemName("Blue Pellets");
- public static final Item PaintballShotgunRed = (new ItemPaintballShotgunRed(244)).setItemName("Paintball Shotgun (R)");
- public static final Item PaintballShotgunBlue = (new ItemPaintballShotgunBlue(245)).setItemName("Paintball Shotgun (B)");
- public static final Item PaintballGunRed = (new ItemPaintballGunRed(246)).setItemName("Paintball Gun (R)");
- public static final Item PaintballGunBlue = (new ItemPaintballGunBlue(247)).setItemName("Paintball Gun (B)");
- public static final Item PaintballSniperRed = (new ItemPaintballSniperRed(248)).setItemName("Paintball Sniper (R)");
- public static final Item PaintballSniperBlue = (new ItemPaintballSniperBlue(249)).setItemName("Paintball Sniper (B)");
- public static final Achievement Paintball = new Achievement(3450, "Paintball", 10, 2, PaintballGunBlue, null).registerAchievement();
- public mod_Paintball()
- {
- ModLoader.AddArmor("red");
- ModLoader.AddArmor("blue");
- ModLoader.RegisterEntityID(EntityRedPellets.class,"RedPellets",ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityBluePellets.class,"BluePellets",ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityRedSniper.class,"RedSniper",ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityBlueSniper.class,"BlueSniper",ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityRedShotgun.class,"RedShotgun",ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityBlueShotgun.class,"BlueShotgun",ModLoader.getUniqueEntityId());
- ModLoader.AddAchievementDesc(Paintball, "Paintballin'", "Shoot your friends!");
- RedHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redhelmet.png");
- RedPlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redplate.png");
- RedLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redlegs.png");
- RedBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redboots.png");
- RedPellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/redpellets.png");
- BlueHelmet.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluehelmet.png");
- BluePlate.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueplate.png");
- BlueLegs.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluelegs.png");
- BlueBoots.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/blueboots.png");
- BluePellets.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/bluepellets.png");
- PaintballGunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunred.png");
- PaintballGunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballgunblue.png");
- PaintballSniperRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperred.png");
- PaintballSniperBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballsniperblue.png");
- PaintballShotgunRed.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunred.png");
- PaintballShotgunBlue.iconIndex = ModLoader.addOverride("/gui/items.png", "/PaintballPics/paintballshotgunblue.png");
- ModLoader.AddName(RedHelmet, "Red Helmet");
- ModLoader.AddName(RedPlate, "Red Chest");
- ModLoader.AddName(RedLegs, "Red Legs");
- ModLoader.AddName(RedBoots, "Red Boots");
- ModLoader.AddName(RedPellets, "Red Pellets");
- ModLoader.AddName(BlueHelmet, "Blue Helmet");
- ModLoader.AddName(BluePlate, "Blue Chest");
- ModLoader.AddName(BlueLegs, "Blue Legs");
- ModLoader.AddName(BlueBoots, "Blue Boots");
- ModLoader.AddName(BluePellets, "Blue Pellets");
- ModLoader.AddName(PaintballGunRed, "Paintball Gun (R)");
- ModLoader.AddName(PaintballGunBlue, "Paintball Gun (B)");
- ModLoader.AddName(PaintballSniperRed, "Paintball Sniper (R)");
- ModLoader.AddName(PaintballSniperBlue, "Paintball Sniper (B)");
- ModLoader.AddName(PaintballShotgunRed, "Paintball Shotgun (R)");
- ModLoader.AddName(PaintballShotgunBlue, "Paintball Shotgun (B)");
- ModLoader.AddRecipe(new ItemStack(RedHelmet, 1), new Object[] {
- "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
- ModLoader.AddRecipe(new ItemStack(RedPlate, 1), new Object[] {
- "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
- ModLoader.AddRecipe(new ItemStack(RedLegs, 1), new Object[] {
- "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
- ModLoader.AddRecipe(new ItemStack(RedBoots, 1), new Object[] {
- "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 14)});
- ModLoader.AddRecipe(new ItemStack(RedPellets, 32), new Object[] {
- " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 1)});
- ModLoader.AddRecipe(new ItemStack(BlueHelmet, 1), new Object[] {
- "XXX", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
- ModLoader.AddRecipe(new ItemStack(BluePlate, 1), new Object[] {
- "X X", "XXX", "XXX", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
- ModLoader.AddRecipe(new ItemStack(BlueLegs, 1), new Object[] {
- "XXX", "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
- ModLoader.AddRecipe(new ItemStack(BlueBoots, 1), new Object[] {
- "X X", "X X", Character.valueOf('X'), new ItemStack(Block.cloth, 2, 11)});
- ModLoader.AddRecipe(new ItemStack(BluePellets, 32), new Object[] {
- " X ", "XYX", " X ", Character.valueOf('X'), Block.glass, Character.valueOf('Y'), new ItemStack(Item.dyePowder, 2, 4)});
- ModLoader.AddRecipe(new ItemStack(PaintballGunRed, 1), new Object[] {
- "X ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
- ModLoader.AddRecipe(new ItemStack(PaintballGunBlue, 1), new Object[] {
- "X ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
- ModLoader.AddRecipe(new ItemStack(PaintballSniperRed, 1), new Object[] {
- "X ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
- Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
- ModLoader.AddRecipe(new ItemStack(PaintballSniperBlue, 1), new Object[] {
- "X ", " XY", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Y'),
- Block.glass, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
- ModLoader.AddRecipe(new ItemStack(PaintballShotgunRed, 1), new Object[] {
- " ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 1)});
- ModLoader.AddRecipe(new ItemStack(PaintballShotgunBlue, 1), new Object[] {
- " ", " X ", "QZX", Character.valueOf('X'), Item.ingotIron, Character.valueOf('Z'), Item.stick, Character.valueOf('Q'), new ItemStack(Item.dyePowder, 2, 4)});
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedPellets.class, 181);
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityBluePellets.class, 182);
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedSniper.class, 183);
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueSniper.class, 184);
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityRedShotgun.class, 185);
- ModLoaderMp.RegisterNetClientHandlerEntity(EntityBlueShotgun.class, 186);
- }
- public void AddRenderer(Map map)
- {
- map.put(EntityRedPellets.class, new RenderRedPellets());
- map.put(EntityBluePellets.class, new RenderBluePellets());
- map.put(EntityRedSniper.class, new RenderRedSniper());
- map.put(EntityBlueSniper.class, new RenderBlueSniper());
- map.put(EntityRedShotgun.class, new RenderRedShotgun());
- map.put(EntityBlueShotgun.class, new RenderBlueShotgun());
- }
- public static int shootTime;
- public static float playerZoom = 1.0F;
- public static float newZoom = 1.0F;
- public static boolean zoomOverlay = false;
- private long lastTime;
- public void OnTickInGame(Minecraft minecraft)
- {
- long l = minecraft.theWorld.worldInfo.getWorldTime();
- if(l > lastTime)
- {
- tick(minecraft);
- lastTime = l;
- }
- if(zoomOverlay)
- {
- ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
- int i = scaledresolution.getScaledWidth();
- int j = scaledresolution.getScaledHeight();
- GL11.glEnable(3042 /*GL_BLEND*/);
- GL11.glDisable(2929 /*GL_DEPTH_TEST*/);
- GL11.glDepthMask(false);
- GL11.glBlendFunc(770, 771);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- GL11.glDisable(3008 /*GL_ALPHA_TEST*/);
- GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/, minecraft.renderEngine.getTexture("/gui/scope.png"));
- Tessellator tessellator = Tessellator.instance;
- tessellator.startDrawingQuads();
- tessellator.addVertexWithUV(i / 2 - 2 * j, j, -90D, 0.0D, 1.0D);
- tessellator.addVertexWithUV(i / 2 + 2 * j, j, -90D, 1.0D, 1.0D);
- tessellator.addVertexWithUV(i / 2 + 2 * j, 0.0D, -90D, 1.0D, 0.0D);
- tessellator.addVertexWithUV(i / 2 - 2 * j, 0.0D, -90D, 0.0D, 0.0D);
- tessellator.draw();
- GL11.glDepthMask(true);
- GL11.glEnable(2929 /*GL_DEPTH_TEST*/);
- GL11.glEnable(3008 /*GL_ALPHA_TEST*/);
- GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
- }
- }
- private void tick(Minecraft minecraft)
- {
- if(shootTime > 0)
- {
- shootTime--;
- }
- Item item = null;
- ItemStack itemstack = minecraft.thePlayer.inventory.getCurrentItem();
- if(itemstack != null)
- {
- item = itemstack.getItem();
- }
- if(item != null && (!(item instanceof ItemPaintballSniperBlue)))
- {
- newZoom = 1.0F;
- zoomOverlay = false;
- }
- float f = newZoom - playerZoom;
- playerZoom += f / 3F;
- if(playerZoom < 1.1F)
- {
- playerZoom = 1.0F;
- }
- try
- {
- ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "cameraZoom", Float.valueOf(playerZoom));
- }
- catch(NoSuchFieldException nosuchfieldexception)
- {
- try
- {
- ModLoader.setPrivateValue(net.minecraft.src.EntityRenderer.class, minecraft.entityRenderer, "E", Float.valueOf(playerZoom));
- }
- catch(NoSuchFieldException nosuchfieldexception1)
- {
- System.out.println("I forgot to update obfuscated reflection D:");
- throw new RuntimeException(nosuchfieldexception1);
- }
- }
- }
- public String Version()
- {
- return "1.7.3";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement