Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //To make custom particles see this badly colored tutorial: http://coros.us/mods/wiki-modding?a=Custom_Particle_Textures
- //spawning the leafs is just a matter of scanning around the player and looking for leaf blocks then spawning them like in the tutorial, not too complicated
- //As for the more complicated manipulation of the particles....
- //How I get access to the active particles in minecraft, call this in your tick if fxLayers = null
- public static List fxLayers[];
- 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();
- }
- }
- }
- //Main wind methods, using a strength and direction of the wind
- public void wind() {
- if (fxLayers != null && weatherMan.wind.strength >= 0.10) {
- for (int layer = 0; layer < 4; layer++) {
- for(int i = 0; i < fxLayers[layer].size(); i++) {
- Entity entity1 = (Entity)fxLayers[layer].get(i);
- if ((worldRef.getHeightValue((int)(entity1.posX+0.5F), (int)(entity1.posZ+0.5F))-1 < (int)entity1.posY+1) || (entity1 instanceof c_w_EntityTexFX)) {
- if ((entity1 instanceof EntityFlameFX)) {
- ((EntityFX)entity1).particleAge+=2;
- } 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;
- }
- applyWindForce(entity1);
- }
- }
- }
- }
- }
- public static void applyWindForce(Entity ent) {
- applyWindForce(ent, 1D);
- }
- public static void applyWindForce(Entity ent, double multiplier) {
- double speed = weatherMan.wind.strength * 0.1D / getWeight(ent);
- speed *= multiplier;
- if ((ent.onGround && weatherMan.wind.strength < 0.7) && speed < 0.3) {
- speed = 0D;
- }
- ent.motionX += speed*(double)(-MathHelper.sin(weatherMan.wind.direction / 180.0F * 3.1415927F) * MathHelper.cos(weatherMan.wind.yDirection / 180.0F * 3.1415927F));
- ent.motionZ += speed*(double)(MathHelper.cos(weatherMan.wind.direction / 180.0F * 3.1415927F) * MathHelper.cos(weatherMan.wind.yDirection / 180.0F * 3.1415927F));
- ent.motionY += weatherMan.wind.yStrength*0.1D*(double)(-MathHelper.sin((weatherMan.wind.yDirection) / 180.0F * 3.1415927F));
- }
Advertisement
Add Comment
Please, Sign In to add comment