Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
- import java.lang.reflect.Field;
- import java.lang.reflect.Modifier;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.List;
- import net.minecraft.client.Minecraft;
- import paulscode.sound.SoundSystem;
- import java.util.Random;
- import java.awt.event.MouseListener;
- import java.io.File;
- import java.io.FileInputStream;
- import java.io.FileOutputStream;
- import java.util.ArrayList;
- import java.util.Map;
- import org.lwjgl.input.Keyboard;
- import org.lwjgl.input.Mouse;
- import java.util.HashMap;
- import java.util.Iterator;
- import java.util.Map;
- import java.util.Set;
- public class mod_ParticleMan extends BaseMod
- implements Runnable {
- public static String modName = "Particle Man";
- public static Minecraft mc;
- public static World worldRef;
- public static World lastWorld;
- public static EntityPlayer player;
- public static int timeout;
- public static String msg;
- public static int color;
- public static int defaultColor = 0xffffff;
- public static boolean ingui;
- public static List fxLayers[];
- public String Version() {
- return "Version 1.0 for MC b1.8.1";
- }
- public void run() {
- try {
- while(true) {
- if(mc == null) {
- mc = ModLoader.getMinecraftInstance();
- }
- if(mc == null) {
- Thread.sleep(5000L);
- } else {
- if(mc.thePlayer == null) {
- Thread.sleep(5000L);
- } else {
- if (lastWorld != worldRef) {
- //worldSaver = null;
- lastWorld = worldRef;
- getFXLayers();
- }
- worldRef = mc.theWorld;
- player = mc.thePlayer;
- Thread.sleep(5000L);
- }
- }
- }
- } catch(Throwable throwable) {
- throwable.printStackTrace();
- }
- }
- public mod_ParticleMan() {
- //fireGlove = (new DominationRod(22501, 0)).setIconIndex(ModLoader.addOverride("/gui/items.png", "/dominationrod/item.png")).setItemName("dominationrod");
- (new Thread(this)).start();
- ModLoader.SetInGUIHook(this, true, false);
- ModLoader.SetInGameHook(this, true, false);
- }
- public void AddRenderer(Map var1) {
- //effRainID = ModLoader.addOverride("/gui/items.png", "/item/raindrop.png");
- }
- public void ModsLoaded() {
- mc = ModLoader.getMinecraftInstance();
- //this.rotEffRenderer = new RotatingEffectRenderer(mc.theWorld, mc.renderEngine);
- //mc.entityRenderer = new EntityRendererProxyWeather(mc);
- }
- public static void displayMessage(String s, int i) {
- msg = s;
- timeout = 85;
- color = i;
- }
- public static void dM(String s) {
- displayMessage(s, defaultColor);
- }
- public static void dM(float f) {
- displayMessage((new StringBuilder()).append(f).toString(), defaultColor);
- }
- public static void displayMessage(String s) {
- displayMessage(s, defaultColor);
- }
- public boolean OnTickInGame(Minecraft var1) {
- if(!ingui) {
- //playerLastTick = System.currentTimeMillis();
- this.OSDHook(var1, false);
- }
- ingui = false;
- return true;
- }
- public boolean OnTickInGUI(Minecraft var1, GuiScreen gui) {
- if (ModLoader.getMinecraftInstance().thePlayer != null) {
- //long ticksRan = System.currentTimeMillis();
- if (!(gui instanceof GuiContainer) && !(gui instanceof GuiChat)) {
- ingui = true;
- //lastTickRun = 0;
- }
- //System.out.println(gui);
- //playerTick(mc.thePlayer);
- }
- return true;
- }
- public static void OSDHook(Minecraft minecraft, boolean flag) {
- if (worldRef == null) {
- worldRef = ModLoader.getMinecraftInstance().theWorld;
- }
- if (player == null) {
- player = ModLoader.getMinecraftInstance().thePlayer;
- }
- if (worldRef == null || player == null) {
- return;
- }
- tryPowers();
- if(timeout > 0 && msg != null) {
- //ScaledResolution scaledresolution = new ScaledResolution(minecraft.gameSettings, minecraft.displayWidth, minecraft.displayHeight);
- minecraft.fontRenderer.drawStringWithShadow(msg, 3, 85, 0xffffff);
- timeout--;
- }
- }
- public static void getFXLayers() {
- //fxLayers
- Field field = null;
- try {
- field = (EffectRenderer.class).getDeclaredField("b");
- field.setAccessible(true);
- fxLayers = (List[])field.get(ModLoader.getMinecraftInstance().effectRenderer);
- } catch (Exception ex) {
- try {
- field = (EffectRenderer.class).getDeclaredField("fxLayers");
- field.setAccessible(true);
- fxLayers = (List[])field.get(ModLoader.getMinecraftInstance().effectRenderer);
- } catch (Exception ex2) {
- ex2.printStackTrace();
- }
- }
- }
- public static void tryPowers() {
- if (Mouse.isButtonDown(0)) {
- //System.out.println("0");
- }
- //if (Mouse.isButtonDown(1)) {
- gatherParticles();
- //}
- if (Mouse.isButtonDown(2)) {
- //System.out.println("2");
- }
- }
- public static void gatherParticles() {
- //Particles
- if (fxLayers != null) {
- for (int layer = 0; layer < 4; layer++) {
- for(int i = 0; i < fxLayers[layer].size(); i++) {
- Entity entity1 = (Entity)fxLayers[layer].get(i);
- //if (player.canEntityBeSeen(entity1)) {
- if ((entity1 instanceof EntityFlameFX)) {
- //((EntityFX)entity1).particleAge-=2;
- //if (((EntityFX)entity1).particleAge < 0) {
- if (((EntityFX)entity1).particleAge % 2 == 0) {
- ((EntityFX)entity1).particleAge -= 1;
- ((EntityFX)entity1).renderDistanceWeight = 10D;
- }
- } else if (((EntityFX)entity1).particleAge % 2 == 0) {
- //((EntityFX)entity1).particleAge+=1;
- }
- //rustle!
- if (entity1.onGround) {
- //entity1.onGround = false;
- //entity1.motionY += entity1.rand.nextDouble() * entity1.motionX;
- }
- if (entity1.motionX < 0.01F && entity1.motionZ < 0.01F) {
- //entity1.motionY += entity1.rand.nextDouble() * 0.05;
- }
- //entity1.motionX += entity1.rand.nextDouble() * 0.03;
- //entity1.motionZ += entity1.rand.nextDouble() * 0.03;
- //entity1.motionY += entity1.rand.nextDouble() * 0.04;
- //if (canPushEntity(entity1)) {
- //if (!(entity1 instanceof EntityFlameFX)) {
- moveEnt(entity1, player);
- //}
- }
- }
- }
- }
- public static void moveEnt(Entity ent, Entity center) {
- float look = 0F;
- //int height = 10;
- double dist = 2F;
- double gatherX = center.posX + ((double)(-Math.sin((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
- double gatherY = center.posY - 0D;
- double gatherZ = center.posZ + ((double)(Math.cos((center.rotationYaw+look) / 180.0F * 3.1415927F) * Math.cos(center.rotationPitch / 180.0F * 3.1415927F)) * dist);
- double entDist = ent.getDistanceToEntity(center);
- double vecX = gatherX - ent.posX;
- double vecY = gatherY - ent.posY;// + (double)(tNode.nextNode.bodyPiece.height / 2.0F) - (tNode.bodyPiece.posY + (double)(tNode.bodyPiece.height / 2.0F));
- double vecZ = gatherZ - ent.posZ;
- float f = (float)((Math.atan2(vecZ, vecX) * 180D) / 3.1415927410125732D);
- float angle;
- for(angle = f; angle < -180F; angle += 360F) { }
- for(; angle >= 180F; angle -= 360F) { }
- //vecX = center.posX - ent.posX;
- //vecY = center.posY - ent.posY;// + (double)(tNode.nextNode.bodyPiece.height / 2.0F) - (tNode.bodyPiece.posY + (double)(tNode.bodyPiece.height / 2.0F));
- //vecZ = center.posZ - ent.posZ;
- //mod_MovePlus.displayMessage(new StringBuilder().append("vecX: " + vecX).toString());
- //tNode.bodyPiece.vecX = vecX;//tNode.bodyPiece.posX - tNode.nextNode.bodyPiece.posX;
- //tNode.bodyPiece.vecY = vecY;//tNode.bodyPiece.posY - tNode.nextNode.bodyPiece.posY;
- //tNode.bodyPiece.vecZ = vecZ;//tNode.bodyPiece.posZ - tNode.nextNode.bodyPiece.posZ;
- double var9 = (double)MathHelper.sqrt_double(vecX * vecX + vecY * vecY + vecZ * vecZ);
- //double speed = 0.2D * (Math.sqrt(dist)/10.0F);
- double speed = 0.01D;
- double newspeed = speed;// * (Math.sqrt(entDist)/1.0F);
- //tNode.bodyPiece.posX += vecX / var9 * newspeed;
- //tNode.bodyPiece.posY += vecY / var9 * newspeed;
- //tNode.bodyPiece.posZ += vecZ / var9 * newspeed;
- //tNode.bodyPiece.setPosition(tNode.bodyPiece.posX, tNode.bodyPiece.posY, tNode.bodyPiece.posZ);
- angle = angle - 10;
- float f3 = (float)Math.cos(-angle * 0.01745329F - 3.141593F);
- float f4 = (float)Math.sin(-angle * 0.01745329F - 3.141593F);
- ent.motionX += -f3 * speed;//vecX / var9 * newspeed;
- //ent.motionY += vecY / var9 * newspeed;
- ent.motionZ += f4 * speed;// / var9 * newspeed;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment