This repository has been archived by the owner on Feb 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made the Android Hud choppy fix on this branch as well. Started integrating TextureMap with MO's particles. New blood and smoke custom animated particles. Fixed Weapon recoil value spillage from previously fired weapon.
- Loading branch information
1 parent
935bd3e
commit 9c24dee
Showing
57 changed files
with
521 additions
and
335 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
102 changes: 102 additions & 0 deletions
102
src/main/java/matteroverdrive/client/data/TextureAtlasSpriteParticle.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
package matteroverdrive.client.data; | ||
|
||
import net.minecraft.client.renderer.texture.TextureAtlasSprite; | ||
|
||
/** | ||
* Created by Simeon on 2/20/2016. | ||
*/ | ||
public class TextureAtlasSpriteParticle extends TextureAtlasSprite | ||
{ | ||
private int frameSize; | ||
private int speed; | ||
private int animationCounter; | ||
private int tickCount; | ||
private int frameCountPerRow; | ||
private float frameSizeDeltaWidth; | ||
private float frameSizeDeltaHeight; | ||
|
||
public TextureAtlasSpriteParticle(String spriteName,int frameSize,int speed) | ||
{ | ||
super(spriteName); | ||
this.frameSize = frameSize; | ||
this.speed = speed; | ||
} | ||
|
||
public TextureAtlasSpriteParticle copy() | ||
{ | ||
TextureAtlasSpriteParticle sprite = new TextureAtlasSpriteParticle(this.getIconName(),frameSize,speed); | ||
sprite.copyFrom(this); | ||
sprite.calculate(); | ||
return sprite; | ||
} | ||
|
||
private void calculate() | ||
{ | ||
frameCountPerRow = getIconWidth() / frameSize; | ||
frameSizeDeltaWidth = (super.getMaxU() - super.getMinU()) / (float) frameCountPerRow; | ||
frameSizeDeltaHeight = (super.getMaxV() - super.getMinV()) / (float) frameCountPerRow; | ||
} | ||
|
||
public void updateParticleAnimation() | ||
{ | ||
++this.tickCount; | ||
if (tickCount >= speed) | ||
{ | ||
tickCount = 0; | ||
if (animationCounter < (frameCountPerRow*frameCountPerRow)-1) | ||
{ | ||
animationCounter++; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Returns the minimum U coordinate to use when rendering with this icon. | ||
*/ | ||
public float getMinU() | ||
{ | ||
if (frameCountPerRow > 0) | ||
{ | ||
return super.getMinU() + ((animationCounter % frameCountPerRow) * frameSizeDeltaWidth); | ||
} | ||
return super.getMinU(); | ||
} | ||
|
||
/** | ||
* Returns the maximum U coordinate to use when rendering with this icon. | ||
*/ | ||
public float getMaxU() | ||
{ | ||
if (frameCountPerRow > 0) | ||
{ | ||
return super.getMinU() + ((animationCounter % frameCountPerRow) + 1) * frameSizeDeltaWidth; | ||
} | ||
return super.getMaxU(); | ||
} | ||
|
||
/** | ||
* Returns the minimum V coordinate to use when rendering with this icon. | ||
*/ | ||
public float getMinV() | ||
{ | ||
if (frameCountPerRow > 0) | ||
{ | ||
float vOffset = ((float) Math.floor((animationCounter) / frameCountPerRow) * frameSizeDeltaHeight); | ||
return super.getMinV() + vOffset; | ||
} | ||
return super.getMinV(); | ||
} | ||
|
||
/** | ||
* Returns the maximum V coordinate to use when rendering with this icon. | ||
*/ | ||
public float getMaxV() | ||
{ | ||
if (frameCountPerRow > 0) | ||
{ | ||
float vOffset = (((float) Math.floor((animationCounter) / frameCountPerRow) + 1) * frameSizeDeltaHeight); | ||
return super.getMinV() + vOffset; | ||
} | ||
return super.getMaxV(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.