mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-16 09:34:46 +00:00
Removed "render ticks" tick type. Instead, animations and frames can define a tick speed measured in milliseconds. Animations/frames using MC tick type will be 50ms (1000ms/20), and render ticks 20ms.
This commit is contained in:
1 parent
de909472b3
commit
799631eece
11 files changed
+97
-95
No files matched your search
@@ -3,6 +3,7 @@ package noppes.npcs.controllers.data;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -12,6 +13,7 @@ import noppes.npcs.DataDisplay;
|
||||
import noppes.npcs.Server;
|
||||
import noppes.npcs.api.handler.data.IAnimation;
|
||||
import noppes.npcs.api.handler.data.IAnimationData;
|
||||
import noppes.npcs.client.ClientCacheHandler;
|
||||
import noppes.npcs.constants.EnumAnimationPart;
|
||||
import noppes.npcs.constants.EnumPacketClient;
|
||||
import noppes.npcs.controllers.PlayerDataController;
|
||||
@@ -154,27 +156,33 @@ public class AnimationData implements IAnimationData {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
|
||||
this.animation = (Animation) animation;
|
||||
} else {
|
||||
Animation newAnim = new Animation();
|
||||
newAnim.readFromNBT(((Animation) animation).writeToNBT());
|
||||
if (this.isActive() && !newAnim.frames.isEmpty()) {
|
||||
Frame frame = (Frame) this.animation.currentFrame();
|
||||
if (frame != null) {
|
||||
Frame firstFrame = newAnim.frames.get(0);
|
||||
for (Map.Entry<EnumAnimationPart, FramePart> entry : frame.frameParts.entrySet()) {
|
||||
if (firstFrame.frameParts.containsKey(entry.getKey())) {
|
||||
FramePart prevFramePart = entry.getValue();
|
||||
FramePart newFramePart = firstFrame.frameParts.get(entry.getKey());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
newFramePart.prevPivots[i] = prevFramePart.prevPivots[i];
|
||||
newFramePart.prevRotations[i] = prevFramePart.prevRotations[i];
|
||||
}
|
||||
this.clientSetAnimation(animation);
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void clientSetAnimation(IAnimation animation) {
|
||||
Animation newAnim = new Animation();
|
||||
newAnim.readFromNBT(((Animation) animation).writeToNBT());
|
||||
if (this.isActive() && !newAnim.frames.isEmpty()) {
|
||||
Frame frame = (Frame) this.animation.currentFrame();
|
||||
if (frame != null) {
|
||||
Frame firstFrame = newAnim.frames.get(0);
|
||||
for (Map.Entry<EnumAnimationPart, FramePart> entry : frame.frameParts.entrySet()) {
|
||||
if (firstFrame.frameParts.containsKey(entry.getKey())) {
|
||||
FramePart prevFramePart = entry.getValue();
|
||||
FramePart newFramePart = firstFrame.frameParts.get(entry.getKey());
|
||||
for (int i = 0; i < 3; i++) {
|
||||
newFramePart.prevPivots[i] = prevFramePart.prevPivots[i];
|
||||
newFramePart.prevRotations[i] = prevFramePart.prevRotations[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.animation = newAnim;
|
||||
newAnim.parent = this;
|
||||
}
|
||||
this.animation = newAnim;
|
||||
newAnim.parent = this;
|
||||
ClientCacheHandler.playingAnimations.add(newAnim);
|
||||
}
|
||||
|
||||
public IAnimation getAnimation() {
|
||||
|
||||
Reference in new issue
Block a user