303

Untitled

303
Mar 18th, 2011
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.21 KB | None | 0 0
  1. package net.minecraft.src;
  2.  
  3. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  4. // Jad home page: http://www.kpdus.com/jad.html
  5. // Decompiler options: packimports(3) braces deadcode
  6.  
  7.  
  8. import java.io.FileInputStream;
  9. import java.io.PrintStream;
  10. import java.net.URI;
  11. import java.net.URL;
  12. import java.security.CodeSource;
  13. import java.security.ProtectionDomain;
  14. import java.util.*;
  15.  
  16. import org.lwjgl.input.Keyboard;
  17. import java.lang.reflect.Method;
  18. import net.minecraft.client.Minecraft;
  19.  
  20. public class mod_PortalGun extends BaseMod {
  21.    
  22.     public static int PortalBlueBottomID = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalBlueBottom.png");
  23.     public static int PortalBlueTopID = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalBlueTop.png");
  24.     public static int PortalBlueRound = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalBlueRound.png");
  25.     public static int PortalOrangeBottomID = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalOrangeBottom.png");
  26.     public static int PortalOrangeTopID = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalOrangeTop.png");
  27.     public static int PortalOrangeRound = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalOrangeRound.png");
  28.     public static int PortalWeightedCube = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalWeightedCube.png");
  29.     public static int PortalCompanionCube = ModLoader.addOverride("/terrain.png", "/portalgun/Block_PortalCompanionCube.png");
  30.  
  31.     public static int PortalRenderNum;
  32.     public static int portalblockID = 104;
  33.     public static int portalcubeID = 105;
  34.     public static final Item PortalGunBlue = (new ItemPortalGunBlue(ModLoader.getUniqueEntityId())).setIconIndex(ModLoader.addOverride("/gui/items.png", "/portalgun/Item_PortalGunBlue.png")).setFull3D().setItemName("PortalGunBlue");
  35.     public static final Item PortalGunOrange = (new ItemPortalGunOrange(ModLoader.getUniqueEntityId())).setIconIndex(ModLoader.addOverride("/gui/items.png", "/portalgun/Item_PortalGunOrange.png")).setFull3D().setItemName("PortalGunOrange");
  36.     public static final Item PortalGunCore = (new ItemPortalGunCore(ModLoader.getUniqueEntityId())).setIconIndex(ModLoader.addOverride("/gui/items.png", "/portalgun/Item_PortalGunCore.png")).setFull3D().setItemName("PortalGunCore");
  37.     public static final Item KneeReplacement = (new ItemArmor(ModLoader.getUniqueEntityId(), -1, ModLoader.AddArmor("kneereplacement"), 3)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/portalgun/Item_AdvancedKneeReplacement.png")).setFull3D().setItemName("KneeReplacement");
  38.     public static final Item PortalHeelSpring = (new ItemPortalHeelSpring(ModLoader.getUniqueEntityId())).setIconIndex(ModLoader.addOverride("/gui/items.png", "/portalgun/Item_PortalHeelSpring.png")).setFull3D().setItemName("HeelSpring");
  39.     public static Block PortalMod;
  40.     public static Block PortalCube;
  41.     //public static int unportalbleID[];
  42.      
  43.     public mod_PortalGun()
  44.     {
  45.         try {
  46.             java.lang.reflect.Method m = ModLoader.class.getDeclaredMethod("SetInGameHook", BaseMod.class, boolean.class, boolean.class);
  47.             m.invoke(null, this, true, false);
  48.         } catch (Throwable e) {}
  49.         ModLoader.SetInGameHook(this,true,true);
  50.         ModLoader.RegisterBlock(PortalMod);
  51.         ModLoader.RegisterBlock(PortalCube, ItemPortalCube.class);
  52.         ModLoader.AddName(PortalMod, "Portal, DO NOT PLACE");
  53.         ModLoader.AddName(KneeReplacement, "Advanced Knee Replacement");
  54.         ModLoader.AddName(PortalHeelSpring, "Heel Spring");
  55.         ModLoader.AddName(PortalGunBlue, "Portal Gun");
  56.         ModLoader.AddName(PortalGunOrange, "Portal Gun");
  57.         ModLoader.AddName(PortalGunCore, "Mysterious Substance");
  58.         PortalRenderNum = ModLoader.getUniqueBlockModelID(this, true);
  59.     }
  60.    
  61.     private static void initBlocks()
  62.     {
  63.         PortalMod = (new BlockPortalMod(portalblockID, PortalBlueRound)).setLightValue(0.75F).setHardness(100F).setBlockName("PortalMod");
  64.         PortalCube = new BlockPortalCube();
  65.     }
  66.  
  67.     private static int portalgunswapKey = Keyboard.KEY_G;
  68.     private static int portalgunrebootKey = Keyboard.KEY_R;
  69.    
  70.     private static boolean portalgunswapKeyDown = false;
  71.     private static boolean portalgunrebootKeyDown = false;
  72.    
  73.     public void AddRecipes(CraftingManager craftingmanager)
  74.     {
  75.         craftingmanager.addRecipe(new ItemStack(PortalGunBlue, 1),
  76.                     new Object[] { "X##", "DC#", "#X#", Character.valueOf('#'), Item.ingotIron, Character.valueOf('X'), Block.obsidian, Character.valueOf('D'), Item.diamond, Character.valueOf('C'), PortalGunCore});
  77.         craftingmanager.addRecipe(new ItemStack(PortalGunCore, 1),
  78.                     new Object[] { "#X", Character.valueOf('#'), new ItemStack(Item.dyePowder, 1, 4), Character.valueOf('X'), Item.redstone});
  79.         craftingmanager.addRecipe(new ItemStack(PortalHeelSpring, 1),
  80.                     new Object[] { "#D#", " X ", " X ", Character.valueOf('#'), Item.ingotIron, Character.valueOf('X'), Block.obsidian, Character.valueOf('D'), Item.diamond});
  81.         craftingmanager.addRecipe(new ItemStack(KneeReplacement, 1),
  82.                     new Object[] { "##", Character.valueOf('#'), PortalHeelSpring});
  83.         craftingmanager.addRecipe(new ItemStack(PortalHeelSpring, 2),
  84.                     new Object[] { "#", Character.valueOf('#'), KneeReplacement});
  85.  
  86.         craftingmanager.addRecipe(new ItemStack(Block.dirt, 64),
  87.                     new Object[] { "#", Character.valueOf('#'), new ItemStack(Block.dirt, 1)});
  88.         craftingmanager.addRecipe(new ItemStack(PortalCube, 1, 0),
  89.                     new Object[] { "##", Character.valueOf('#'), new ItemStack(Block.dirt, 1)});
  90.         craftingmanager.addRecipe(new ItemStack(new ItemPortalCube(PortalCube.blockID - 256), 2, 2),
  91.                     new Object[] { "#", "#", Character.valueOf('#'), new ItemStack(Block.dirt, 1)});//
  92.     }      
  93.    
  94.     public void AddRenderer(Map map)
  95.     {
  96.         map.put(EntityPortalBallBlue.class, new RenderPortalBallBlue());
  97.         map.put(EntityPortalBallOrange.class, new RenderPortalBallOrange());
  98.     }
  99.    
  100.     public boolean renderPortal(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block)
  101.     {
  102.         Tessellator tessellator = Tessellator.instance;
  103.         int l = PortalBlueRound;
  104.         int l1 = PortalBlueBottomID;
  105.         int l2 = PortalBlueTopID;
  106.         int l3 = PortalOrangeRound;
  107.         int l4 = PortalOrangeBottomID;
  108.         int l5 = PortalOrangeTopID;
  109.         float f = block.getBlockBrightness(iblockaccess, i, j, k);
  110.         tessellator.setColorOpaque_F(f, f, f);
  111.         int i1 = (l & 0xf) << 4;
  112.         int j1 = l & 0xf0;
  113.        
  114.         int i2 = (l1 & 0xf) << 4;
  115.         int j2 = l1 & 0xf0;
  116.        
  117.         int i3 = (l2 & 0xf) << 4;
  118.         int j3 = l2 & 0xf0;
  119.        
  120.         int i4 = (l3 & 0xf) << 4;
  121.         int j4 = l3 & 0xf0;
  122.        
  123.         int i5 = (l4 & 0xf) << 4;
  124.         int j5 = l4 & 0xf0;
  125.        
  126.         int i6 = (l5 & 0xf) << 4;
  127.         int j6 = l5 & 0xf0;
  128.        
  129.         double d = (float)i2 / 256F;
  130.         double d1 = ((float)i2 + 15.99F) / 256F;
  131.         double d2 = (float)j2 / 256F;
  132.         double d3 = ((float)j2 + 15.99F) / 256F;
  133.  
  134.         double d4 = (float)i1 / 256F;
  135.         double d5 = ((float)i1 + 15.99F) / 256F;
  136.         double d6 = (float)j1 / 256F;
  137.         double d7 = ((float)j1 + 15.99F) / 256F;
  138.        
  139.         double d8 = (float)i3 / 256F;
  140.         double d9 = ((float)i3 + 15.99F) / 256F;
  141.         double d10 = (float)j3 / 256F;
  142.         double d11 = ((float)j3 + 15.99F) / 256F;
  143.        
  144.         double d12 = (float)i4 / 256F;
  145.         double d13 = ((float)i4 + 15.99F) / 256F;
  146.         double d14 = (float)j4 / 256F;
  147.         double d15 = ((float)j4 + 15.99F) / 256F;
  148.        
  149.         double d16 = (float)i5 / 256F;
  150.         double d17 = ((float)i5 + 15.99F) / 256F;
  151.         double d18 = (float)j5 / 256F;
  152.         double d19 = ((float)j5 + 15.99F) / 256F;
  153.        
  154.         double d20 = (float)i6 / 256F;
  155.         double d21 = ((float)i6 + 15.99F) / 256F;
  156.         double d22 = (float)j6 / 256F;
  157.         double d23 = ((float)j6 + 15.99F) / 256F;
  158.  
  159.         int k1 = iblockaccess.getBlockMetadata(i, j, k);
  160.         float f1 = 0.0F;
  161.         float f2 = 0.025F;
  162.         float f3 = i + 1;
  163.         float f4 = i + 1;
  164.         float f5 = i + 0;
  165.         float f6 = i + 0;
  166.         float f7 = k + 0;
  167.         float f8 = k + 1;
  168.         float f9 = k + 1;
  169.         float f10 = k + 0;
  170.         float f11 = (float)j + f2;
  171.         float f12 = (float)j + f2;
  172.         float f13 = (float)j + f2;
  173.         float f14 = (float)j + f2;
  174.         float f15 = 0.975F;
  175.         float f16 = (float)j + f15;
  176.         float f17 = (float)j + f15;
  177.         float f18 = (float)j + f15;
  178.         float f19 = (float)j + f15;
  179.         if(k1 == 2)
  180.         {
  181.             tessellator.addVertexWithUV(f6, f14, f10, d4, d6);
  182.             tessellator.addVertexWithUV(f5, f13, f9, d4, d7);
  183.             tessellator.addVertexWithUV(f4, f12, f8, d5, d7);
  184.             tessellator.addVertexWithUV(f3, f11, f7, d5, d6);
  185.         }
  186.         else if(k1 == 6)
  187.         {
  188.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d, d2);
  189.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d, d3);
  190.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d1, d3);
  191.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d1, d2);
  192.         }
  193.         else if(k1 == 5)
  194.         {
  195.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d1, d3);
  196.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d1, d2);
  197.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d, d2);
  198.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d, d3);
  199.         }
  200.         else if(k1 == 4)
  201.         {
  202.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)k + f2, d1, d3);
  203.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)k + f2, d1, d2);
  204.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)k + f2, d, d2);
  205.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)k + f2, d, d3);
  206.         }
  207.         else if(k1 == 3)
  208.         {
  209.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d, d2);
  210.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d, d3);
  211.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d1, d3);
  212.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d1, d2);
  213.         }
  214.         else if(k1 == 7)
  215.         {
  216.             int k2 = iblockaccess.getBlockMetadata(i, j-1, k);
  217.             if(k2 == 6)
  218.             {
  219.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d8, d10);
  220.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d8, d11);
  221.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d9, d11);
  222.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d9, d10);
  223.             }
  224.             else if(k2 == 5)
  225.             {
  226.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d9, d11);
  227.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d9, d10);
  228.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d8, d10);
  229.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d8, d11);
  230.             }
  231.             else if(k2 == 4)
  232.             {
  233.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)k + f2, d9, d11);
  234.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)k + f2, d9, d10);
  235.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)k + f2, d8, d10);
  236.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)k + f2, d8, d11);
  237.             }
  238.             else if(k2 == 3)
  239.             {
  240.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d8, d10);
  241.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d8, d11);
  242.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d9, d11);
  243.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d9, d10);
  244.             }
  245.         }
  246.         else if(k1 == 1)
  247.         {
  248.             tessellator.addVertexWithUV(f3, f16, f7, d5, d6);
  249.             tessellator.addVertexWithUV(f4, f17, f8, d5, d7);
  250.             tessellator.addVertexWithUV(f5, f18, f9, d4, d7);
  251.             tessellator.addVertexWithUV(f6, f19, f10, d4, d6);
  252.         }
  253.         else if(k1 == 11)
  254.         {
  255.             tessellator.addVertexWithUV(f6, f14, f10, d12, d14);
  256.             tessellator.addVertexWithUV(f5, f13, f9, d12, d15);
  257.             tessellator.addVertexWithUV(f4, f12, f8, d13, d15);
  258.             tessellator.addVertexWithUV(f3, f11, f7, d13, d14);
  259.         }
  260.         else if(k1 == 15)
  261.         {
  262.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d16, d18);
  263.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d16, d19);
  264.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d17, d19);
  265.             tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d17, d18);
  266.         }
  267.         else if(k1 == 14)
  268.         {
  269.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d17, d19);
  270.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d17, d18);
  271.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d16, d18);
  272.             tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d16, d19);
  273.         }
  274.         else if(k1 == 13)
  275.         {
  276.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)k + f2, d17, d19);
  277.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)k + f2, d17, d18);
  278.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)k + f2, d16, d18);
  279.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)k + f2, d16, d19);
  280.         }
  281.         else if(k1 == 12)
  282.         {
  283.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d16, d18);
  284.             tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d16, d19);
  285.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d17, d19);
  286.             tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d17, d18);
  287.         }
  288.         else if(k1 == 8)
  289.         {
  290.             int k2 = iblockaccess.getBlockMetadata(i, j-1, k);
  291.             if(k2 == 15)
  292.             {
  293.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d20, d22);
  294.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d20, d23);
  295.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d21, d23);
  296.                 tessellator.addVertexWithUV((float)i + f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d21, d22);
  297.             }
  298.             else if(k2 == 14)
  299.             {
  300.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 1) + f1, d21, d23);
  301.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 1) + f1, d21, d22);
  302.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 1) + f1, (float)(k + 0) - f1, d20, d22);
  303.                 tessellator.addVertexWithUV((float)(i + 1) - f2, (float)(j + 0) - f1, (float)(k + 0) - f1, d20, d23);
  304.             }
  305.             else if(k2 == 13)
  306.             {
  307.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)k + f2, d21, d23);
  308.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)k + f2, d21, d22);
  309.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)k + f2, d20, d22);
  310.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)k + f2, d20, d23);
  311.             }
  312.             else if(k2 == 12)
  313.             {
  314.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d20, d22);
  315.                 tessellator.addVertexWithUV((float)(i + 1) + f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d20, d23);
  316.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 0) - f1, (float)(k + 1) - f2, d21, d23);
  317.                 tessellator.addVertexWithUV((float)(i + 0) - f1, (float)(j + 1) + f1, (float)(k + 1) - f2, d21, d22);
  318.             }
  319.         }
  320.         else if(k1 == 10)
  321.         {
  322.             tessellator.addVertexWithUV(f3, f16, f7, d13, d14);
  323.             tessellator.addVertexWithUV(f4, f17, f8, d13, d15);
  324.             tessellator.addVertexWithUV(f5, f18, f9, d12, d15);
  325.             tessellator.addVertexWithUV(f6, f19, f10, d12, d14);
  326.         }
  327.         return true;
  328.     }
  329.    
  330.     public boolean RenderWorldBlock(RenderBlocks renderblocks, IBlockAccess iblockaccess, int i, int j, int k, Block block, int l)
  331.     {
  332.         if(l == PortalRenderNum)
  333.         {
  334.             return renderPortal(renderblocks, iblockaccess, i, j, k, block);
  335.         }
  336.         else
  337.         {
  338.             return false;
  339.         }
  340.     }
  341.    
  342.     public void OnTickInGame(Minecraft minecraft)
  343.     {
  344.         PortalGunTick(minecraft);
  345.     }
  346.    
  347.     public void PortalGunTick(Minecraft minecraft)
  348.     {
  349.         if(minecraft.currentScreen == null && !Keyboard.isKeyDown(portalgunswapKey) && portalgunswapKeyDown)
  350.         {
  351.             ItemStack itemstack = minecraft.thePlayer.inventory.getCurrentItem();
  352.             if(itemstack != null && itemstack.itemID == PortalGunBlue.shiftedIndex)
  353.             {
  354.                 minecraft.thePlayer.inventory.mainInventory[minecraft.thePlayer.inventory.currentItem] = new ItemStack(PortalGunOrange, 1);
  355.             }
  356.            
  357.             else if(itemstack != null && itemstack.itemID == PortalGunOrange.shiftedIndex)
  358.             {
  359.                 minecraft.thePlayer.inventory.mainInventory[minecraft.thePlayer.inventory.currentItem] = new ItemStack(PortalGunBlue, 1);
  360.             }
  361.         }
  362.         portalgunswapKeyDown = Keyboard.isKeyDown(portalgunswapKey);
  363.         if(minecraft.currentScreen == null && !Keyboard.isKeyDown(portalgunrebootKey) && portalgunrebootKeyDown)
  364.         {
  365.             ItemStack itemstack1 = minecraft.thePlayer.inventory.getCurrentItem();
  366.             if(itemstack1 != null)
  367.             {
  368.                 if(itemstack1.itemID == PortalGunBlue.shiftedIndex || itemstack1.itemID == PortalGunOrange.shiftedIndex)
  369.                 {
  370.                     if(minecraft.theWorld.getBlockId(BlockPortalMod.BluePortalCoordX, BlockPortalMod.BluePortalCoordY, BlockPortalMod.BluePortalCoordZ) == portalblockID)
  371.                     {
  372.                         minecraft.theWorld.setBlockWithNotify(BlockPortalMod.BluePortalCoordX, BlockPortalMod.BluePortalCoordY, BlockPortalMod.BluePortalCoordZ, 0);
  373.                         minecraft.theWorld.playSoundEffect((float)BlockPortalMod.BluePortalCoordX + 0.5F, (float)BlockPortalMod.BluePortalCoordY + 0.5F, (float)BlockPortalMod.BluePortalCoordZ + 0.5F, "portalgun.portal_close", 1.0F, 1.0F);
  374.                     }
  375.                     if(minecraft.theWorld.getBlockId(BlockPortalMod.OrangePortalCoordX, BlockPortalMod.OrangePortalCoordY, BlockPortalMod.OrangePortalCoordZ) == portalblockID)
  376.                     {
  377.                         minecraft.theWorld.setBlockWithNotify(BlockPortalMod.OrangePortalCoordX, BlockPortalMod.OrangePortalCoordY, BlockPortalMod.OrangePortalCoordZ, 0);
  378.                         minecraft.theWorld.playSoundEffect((float)BlockPortalMod.OrangePortalCoordX + 0.5F, (float)BlockPortalMod.OrangePortalCoordY + 0.5F, (float)BlockPortalMod.OrangePortalCoordZ + 0.5F, "portalgun.portal_close", 1.0F, 1.0F);
  379.                     }
  380.                     minecraft.theWorld.playSoundAtEntity(minecraft.thePlayer, "portalgun.portalgun_powerup", 1.0F, 1.0F);
  381.                 }
  382.             }
  383.         }
  384.         portalgunrebootKeyDown = Keyboard.isKeyDown(portalgunrebootKey);
  385.         ItemStack itemstack2 = minecraft.thePlayer.inventory.armorItemInSlot(0);
  386.         if(itemstack2 != null && itemstack2.itemID == KneeReplacement.shiftedIndex)
  387.         {
  388.             minecraft.thePlayer.fallDistance = -1;
  389.         }
  390.     }
  391.    
  392.     public String Version()
  393.     {
  394.         return "1.3_01v3";
  395.     }
  396.  
  397.     private static void loadProperties()
  398.     {
  399.         Properties properties = new Properties();
  400.         try
  401.         {
  402.             String s = (mod_PortalGun.class).getProtectionDomain().getCodeSource().getLocation().toURI().getPath();
  403.             s = s.substring(0, s.lastIndexOf('/') + 1);
  404.             s = (new StringBuilder()).append(s).append("mod_PortalGun.properties").toString();
  405.             properties.load(new FileInputStream(s));
  406.             String s1 = properties.getProperty("portalgunswapKey");
  407.             int i = Keyboard.getKeyIndex(s1.trim().toUpperCase());
  408.             if(i == 0)
  409.             {
  410.                 System.out.println((new StringBuilder()).append("Error binding portal gun swap key. Bad key name: ").append(s1.trim()).toString());
  411.             } else
  412.             {
  413.                 portalgunswapKey = i;
  414.             }
  415.             s1 = properties.getProperty("portalgunrebootKey");
  416.             int j = Keyboard.getKeyIndex(s1.trim().toUpperCase());
  417.             if(j == 0)
  418.             {
  419.                 System.out.println((new StringBuilder()).append("Error binding portal gun reboot key. Bad key name: ").append(s1.trim()).toString());
  420.             } else
  421.             {
  422.                 portalgunrebootKey = j;
  423.             }
  424.             s1 = properties.getProperty("portalblockID");
  425.             portalblockID = Integer.parseInt(s1.trim());
  426.             s1 = properties.getProperty("portalcubeID");
  427.             portalcubeID = Integer.parseInt(s1.trim());
  428.             /*s1 = properties.getProperty("unportalbleID");
  429.             String[] split = s1.split(", *");
  430.             int[] unportalbleID = new int[split.length];
  431.             for(int i1=0; i1<split.length; i1++)
  432.             {
  433.                 unportalbleID[i1]=Integer.parseInt(split[i1]);
  434.             }
  435.             System.out.println(mod_PortalGun.unportalbleID.length);
  436.             System.out.println(mod_PortalGun.unportalbleID[0]);
  437.             System.out.println("unportalbles");
  438.             System.out.println(s1);
  439.             System.out.println("unportalbleID");
  440.             System.out.println(unportalbleID[0]);
  441.             System.out.println(unportalbleID[1]);
  442.             System.out.println(unportalbleID[2]);*/
  443.         }
  444.         catch(Exception exception)
  445.         {
  446.             System.out.println("Error loading properties.");
  447.             exception.printStackTrace();
  448.         }
  449.     }
  450.    
  451.     static
  452.     {
  453.         loadProperties();
  454.         initBlocks();
  455.     }
  456.  
  457. }
Advertisement
Add Comment
Please, Sign In to add comment