Advertisement
Corosus

Untitled

Oct 23rd, 2011
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 10.06 KB | None | 0 0
  1. package net.minecraft.src;
  2. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  3.  
  4. import java.lang.reflect.Field;
  5. import java.lang.reflect.Modifier;
  6. import java.util.HashMap;
  7. import java.util.Iterator;
  8. import java.util.List;
  9. import net.minecraft.client.Minecraft;
  10. import paulscode.sound.SoundSystem;
  11. import java.util.Random;
  12. import java.awt.event.MouseListener;
  13. import java.io.File;
  14. import java.io.FileInputStream;
  15. import java.io.FileOutputStream;
  16. import java.util.ArrayList;
  17.  
  18. import java.util.Map;
  19. import org.lwjgl.input.Keyboard;
  20. import org.lwjgl.input.Mouse;
  21.  
  22. import java.util.HashMap;
  23. import java.util.Iterator;
  24. import java.util.Map;
  25. import java.util.Set;
  26.  
  27.  
  28. public class mod_ParticleMan extends BaseMod
  29.     implements Runnable {
  30.  
  31.     public static String modName = "Particle Man";
  32.     public static Minecraft mc;
  33.     public static World worldRef;
  34.     public static World lastWorld;
  35.     public static EntityPlayer player;
  36.     public static int timeout;
  37.     public static String msg;
  38.     public static int color;
  39.     public static int defaultColor = 0xffffff;
  40.    
  41.     public static boolean ingui;
  42.    
  43.     public static List fxLayers[];
  44.  
  45.     public String Version() {
  46.         return "Version 1.0 for MC b1.8.1";
  47.     }
  48.  
  49.     public void run() {
  50.         try {
  51.             while(true) {
  52.                 if(mc == null) {
  53.                     mc = ModLoader.getMinecraftInstance();
  54.                 }
  55.  
  56.                 if(mc == null) {
  57.                     Thread.sleep(5000L);
  58.                 } else {
  59.                     if(mc.thePlayer == null) {
  60.                         Thread.sleep(5000L);
  61.                     } else {
  62.                         if (lastWorld != worldRef) {
  63.                             //worldSaver = null;
  64.                             lastWorld = worldRef;
  65.                             getFXLayers();
  66.                         }
  67.                        
  68.                         worldRef = mc.theWorld;
  69.                         player = mc.thePlayer;
  70.  
  71.                         Thread.sleep(5000L);
  72.                     }
  73.                 }
  74.             }
  75.         } catch(Throwable throwable) {
  76.             throwable.printStackTrace();
  77.         }
  78.     }
  79.  
  80.     public mod_ParticleMan() {
  81.        
  82.         //fireGlove = (new DominationRod(22501, 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/item.png")).setItemName("dominationrod");
  83.        
  84.         (new Thread(this)).start();
  85.        
  86.         ModLoader.SetInGUIHook(this, true, false);
  87.         ModLoader.SetInGameHook(this, true, false);
  88.     }
  89.    
  90.     public void AddRenderer(Map var1) {
  91.        
  92.        
  93.         //effRainID = ModLoader.addOverride("/gui/items.png", "/item/raindrop.png");
  94.     }
  95.    
  96.     public void ModsLoaded() {
  97.         mc = ModLoader.getMinecraftInstance();
  98.         //this.rotEffRenderer = new RotatingEffectRenderer(mc.theWorld, mc.renderEngine);
  99.         //mc.entityRenderer = new EntityRendererProxyWeather(mc);
  100.     }
  101.  
  102.    
  103.     public static void displayMessage(String s, int i) {
  104.         msg = s;
  105.         timeout = 85;
  106.         color = i;
  107.     }
  108.     public static void dM(String s) {
  109.         displayMessage(s, defaultColor);
  110.     }
  111.     public static void dM(float f) {
  112.         displayMessage((new StringBuilder()).append(f).toString(), defaultColor);
  113.     }
  114.     public static void displayMessage(String s) {
  115.         displayMessage(s, defaultColor);
  116.     }
  117.    
  118.     public boolean OnTickInGame(Minecraft var1) {
  119.         if(!ingui) {
  120.             //playerLastTick = System.currentTimeMillis();
  121.             this.OSDHook(var1, false);
  122.         }
  123.  
  124.         ingui = false;
  125.         return true;
  126.     }
  127.     public boolean OnTickInGUI(Minecraft var1, GuiScreen gui) {
  128.         if (ModLoader.getMinecraftInstance().thePlayer != null) {
  129.             //long ticksRan = System.currentTimeMillis();
  130.             if (!(gui instanceof GuiContainer) && !(gui instanceof GuiChat)) {
  131.                 ingui = true;
  132.                 //lastTickRun = 0;
  133.             }
  134.  
  135.             //System.out.println(gui);
  136.             //playerTick(mc.thePlayer);
  137.         }
  138.  
  139.         return true;
  140.     }
  141.    
  142.     public static void OSDHook(Minecraft minecraft, boolean flag) {
  143.         if (worldRef == null) {
  144.             worldRef = ModLoader.getMinecraftInstance().theWorld;
  145.         }
  146.  
  147.         if (player == null) {
  148.             player = ModLoader.getMinecraftInstance().thePlayer;
  149.         }
  150.  
  151.         if (worldRef == null || player == null) {
  152.             return;
  153.         }
  154.  
  155.         tryPowers();
  156.  
  157.         if(timeout > 0 && msg != null) {
  158.             //ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
  159.             minecraft.fontRenderer.drawStringWithShadow(msg, 3, 85, 0xffffff);
  160.             timeout--;
  161.         }
  162.     }
  163.    
  164.     public static void getFXLayers() {
  165.        
  166.         //fxLayers
  167.        
  168.         Field field = null;
  169.         try {
  170.             field = (EffectRenderer.class).getDeclaredField("b");
  171.             field.setAccessible(true);
  172.             fxLayers = (List[])field.get(ModLoader.getMinecraftInstance().effectRenderer);
  173.         } catch (Exception ex) {
  174.             try {
  175.                 field = (EffectRenderer.class).getDeclaredField("fxLayers");
  176.                 field.setAccessible(true);
  177.                 fxLayers = (List[])field.get(ModLoader.getMinecraftInstance().effectRenderer);
  178.             } catch (Exception ex2) {
  179.                 ex2.printStackTrace();
  180.             }
  181.         }
  182.     }
  183.    
  184.     public static void tryPowers() {
  185.        
  186.         if (Mouse.isButtonDown(0)) {
  187.             //System.out.println("0");
  188.         }
  189.        
  190.         //if (Mouse.isButtonDown(1)) {
  191.             gatherParticles();
  192.         //}
  193.        
  194.         if (Mouse.isButtonDown(2)) {
  195.             //System.out.println("2");
  196.         }
  197.    
  198.     }
  199.    
  200.     public static void gatherParticles() {
  201.         //Particles
  202.         if (fxLayers != null) {
  203.        
  204.             for (int layer = 0; layer < 4; layer++) {
  205.                 for(int i = 0; i < fxLayers[layer].size(); i++) {
  206.                     Entity entity1 = (Entity)fxLayers[layer].get(i);
  207.                     //if (player.canEntityBeSeen(entity1)) {
  208.                         if ((entity1 instanceof EntityFlameFX)) {
  209.                             //((EntityFX)entity1).particleAge-=2;
  210.                             //if (((EntityFX)entity1).particleAge < 0) {
  211.                             if (((EntityFX)entity1).particleAge % 2 == 0) {
  212.                                 ((EntityFX)entity1).particleAge -= 1;
  213.                                 ((EntityFX)entity1).renderDistanceWeight = 10D;
  214.                             }
  215.                         } else if (((EntityFX)entity1).particleAge % 2 == 0) {
  216.                             //((EntityFX)entity1).particleAge+=1;
  217.                         }
  218.                        
  219.                         //rustle!
  220.                         if (entity1.onGround) {
  221.                             //entity1.onGround = false;
  222.                             //entity1.motionY += entity1.rand.nextDouble() * entity1.motionX;
  223.                         }
  224.                        
  225.                         if (entity1.motionX < 0.01F && entity1.motionZ < 0.01F) {
  226.                             //entity1.motionY += entity1.rand.nextDouble() * 0.05;
  227.                         }
  228.                        
  229.                         //entity1.motionX += entity1.rand.nextDouble() * 0.03;
  230.                         //entity1.motionZ += entity1.rand.nextDouble() * 0.03;
  231.                         //entity1.motionY += entity1.rand.nextDouble() * 0.04;
  232.                        
  233.                     //if (canPushEntity(entity1)) {
  234.                     //if (!(entity1 instanceof EntityFlameFX)) {
  235.                    
  236.                         moveEnt(entity1, player);
  237.                     //}
  238.                 }
  239.             }
  240.         }
  241.     }
  242.    
  243.     public static void moveEnt(Entity ent, Entity center) {
  244.        
  245.         float look = 0F;
  246.         //int height = 10;
  247.         double dist = 2F;
  248.         double gatherX = center.posX + ((double)(-Math.sin((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
  249.         double gatherY = center.posY - 0D;
  250.         double gatherZ = center.posZ + ((double)(Math.cos((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
  251.        
  252.        
  253.        
  254.         double entDist = ent.getDistanceToEntity(center);
  255.        
  256.         double vecX = gatherX - ent.posX;
  257.         double vecY = gatherY - ent.posY;// + (double)(tNode.nextNode.bodyPiece.height / 2.0F) - (tNode.bodyPiece.posY + (double)(tNode.bodyPiece.height / 2.0F));
  258.         double vecZ = gatherZ - ent.posZ;
  259.        
  260.         float f = (float)((Math.atan2(vecZ, vecX) * 180D) / 3.1415927410125732D);
  261.         float angle;
  262.  
  263.         for(angle = f; angle < -180F; angle += 360F) { }
  264.  
  265.         for(; angle >= 180F; angle -= 360F) { }
  266.        
  267.         //vecX = center.posX - ent.posX;
  268.         //vecY = center.posY - ent.posY;// + (double)(tNode.nextNode.bodyPiece.height / 2.0F) - (tNode.bodyPiece.posY + (double)(tNode.bodyPiece.height / 2.0F));
  269.         //vecZ = center.posZ - ent.posZ;
  270.        
  271.         //mod_MovePlus.displayMessage(new StringBuilder().append("vecX: " + vecX).toString());
  272.         //tNode.bodyPiece.vecX = vecX;//tNode.bodyPiece.posX - tNode.nextNode.bodyPiece.posX;
  273.         //tNode.bodyPiece.vecY = vecY;//tNode.bodyPiece.posY - tNode.nextNode.bodyPiece.posY;
  274.         //tNode.bodyPiece.vecZ = vecZ;//tNode.bodyPiece.posZ - tNode.nextNode.bodyPiece.posZ;
  275.         double var9 = (double)MathHelper.sqrt_double(vecX * vecX + vecY * vecY + vecZ * vecZ);
  276.         //double speed = 0.2D * (Math.sqrt(dist)/10.0F);
  277.         double speed = 0.01D;
  278.        
  279.         double newspeed = speed;// * (Math.sqrt(entDist)/1.0F);
  280.    
  281.         //tNode.bodyPiece.posX += vecX / var9 * newspeed;
  282.         //tNode.bodyPiece.posY += vecY / var9 * newspeed;
  283.         //tNode.bodyPiece.posZ += vecZ / var9 * newspeed;
  284.        
  285.         //tNode.bodyPiece.setPosition(tNode.bodyPiece.posX, tNode.bodyPiece.posY, tNode.bodyPiece.posZ);
  286.        
  287.         angle = angle - 10;
  288.         float f3 = (float)Math.cos(-angle * 0.01745329F - 3.141593F);
  289.         float f4 = (float)Math.sin(-angle * 0.01745329F - 3.141593F);
  290.        
  291.         ent.motionX += -f3 * speed;//vecX / var9 * newspeed;
  292.         //ent.motionY += vecY / var9 * newspeed;
  293.         ent.motionZ += f4 * speed;// / var9 * newspeed;
  294.     }
  295. }
  296.  
  297.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement