Skip to content

Commit

Permalink
Merge pull request #26 from KosmX/annotations
Browse files Browse the repository at this point in the history
Annotations: Internal and Environment(Client)
  • Loading branch information
KosmX authored Oct 26, 2022
2 parents 8e83a4e + 1b7163d commit 8670fb2
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import dev.kosmx.playerAnim.api.layered.IAnimation;
import dev.kosmx.playerAnim.core.util.Pair;
import dev.kosmx.playerAnim.core.util.Vec3f;
import org.jetbrains.annotations.ApiStatus;

/**
* Tool to easily play animation to the player.
* internal, do not use
*/
@ApiStatus.Internal
public class AnimationProcessor {
private final IAnimation animation;
private float tickDelta = 0f;
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enabled_platforms=fabric,forge

archives_base_name=player-animation-lib
#Major: API break, Minor: non-breaking but significant, Patch: minor bugfix/change + MC implementation fix
mod_version=0.4.0-test1
mod_version=0.4.0-test2
maven_group=dev.kosmx.player-anim


Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package dev.kosmx.playerAnim.impl;

import dev.architectury.injectables.annotations.ExpectPlatform;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

import java.util.concurrent.atomic.AtomicBoolean;

/**
* Helper Utility class
*/
@ApiStatus.Internal
public final class Helper {

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import dev.kosmx.playerAnim.api.IPlayer;
import dev.kosmx.playerAnim.impl.animation.AnimationApplier;
import org.jetbrains.annotations.ApiStatus;


@ApiStatus.Internal
public interface IAnimatedPlayer extends IPlayer {
AnimationApplier getAnimation();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import dev.kosmx.playerAnim.core.impl.AnimationProcessor;
import dev.kosmx.playerAnim.core.util.SetableSupplier;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface IMutableModel {

void setEmoteSupplier(SetableSupplier<AnimationProcessor> emoteSupplier);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.kosmx.playerAnim.impl;

import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface IPlayerModel {
void playerAnimator_prepForFirstPersonRender();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package dev.kosmx.playerAnim.impl;

import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public interface IUpperPartHelper {
boolean isUpperPart();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import dev.kosmx.playerAnim.core.util.Pair;
import dev.kosmx.playerAnim.core.util.Vec3f;
import net.minecraft.client.model.geom.ModelPart;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public class AnimationApplier extends AnimationProcessor {
public AnimationApplier(IAnimation animation) {
super(animation);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.core.Direction;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public class BendHelper implements IBendHelper {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.core.Direction;

import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.Nullable;

@ApiStatus.Internal
public interface IBendHelper {

IBendHelper INSTANCE = Helper.isBendEnabled() ? new BendHelper() : new DummyBendable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
import dev.kosmx.playerAnim.api.IPlayer;
import dev.kosmx.playerAnim.api.layered.AnimationStack;
import dev.kosmx.playerAnim.core.impl.event.Event;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.player.AbstractClientPlayer;

@Environment(EnvType.CLIENT)
public final class PlayerAnimationAccess {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import dev.kosmx.playerAnim.core.data.KeyframeAnimation;
import dev.kosmx.playerAnim.core.data.gson.AnimationSerializing;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.ResourceManager;
Expand Down Expand Up @@ -35,6 +37,7 @@
* <br><br>
* Extra animations can be added by ResourcePack(s) or other mods
*/
@Environment(EnvType.CLIENT)
public final class PlayerAnimationRegistry {

private static final HashMap<ResourceLocation, KeyframeAnimation> animations = new HashMap<>();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.resources.ResourceManager;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@ApiStatus.Internal
public class FabricClientInitializer implements ClientModInitializer {
public static final Logger LOGGER = LoggerFactory.getLogger("player-animator");

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package dev.kosmx.playerAnim.impl.fabric;

import net.fabricmc.loader.api.FabricLoader;
import org.jetbrains.annotations.ApiStatus;

@ApiStatus.Internal
public class HelperImpl {
public static boolean isBendyLibPresent() {
return FabricLoader.getInstance().isModLoaded("bendy-lib");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import dev.kosmx.playerAnim.impl.Helper;
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
import org.jetbrains.annotations.ApiStatus;
import org.spongepowered.asm.mixin.Mixins;

@ApiStatus.Internal
public class PreLaunchEntry implements PreLaunchEntrypoint {
@Override
public void onPreLaunch() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"format_version": "1.8.0",
"animations": {
"animation.model.rodHand": {
"loop": true,
"bones": {
"right_arm": {
"rotation": {
"vector": [-70, 0, 0]
},
"position": {
"vector": [0, -2, -1]
}
}
}
}
},
"geckolib_format_version": 2
}

0 comments on commit 8670fb2

Please sign in to comment.