├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── common ├── src │ └── main │ │ ├── resources │ │ ├── geckolib.png │ │ └── geckolib.mixins.json │ │ └── java │ │ └── software │ │ └── bernie │ │ └── geckolib │ │ ├── cache │ │ ├── model │ │ │ ├── package-info.java │ │ │ ├── cuboid │ │ │ │ ├── package-info.java │ │ │ │ └── CuboidGeoBone.java │ │ │ └── GeoVertex.java │ │ ├── texture │ │ │ └── package-info.java │ │ ├── animation │ │ │ ├── package-info.java │ │ │ ├── keyframeevent │ │ │ │ ├── package-info.java │ │ │ │ ├── SoundKeyframeData.java │ │ │ │ ├── CustomInstructionKeyframeData.java │ │ │ │ ├── KeyFrameData.java │ │ │ │ └── ParticleKeyframeData.java │ │ │ └── BoneAnimation.java │ │ ├── package-info.java │ │ └── AnimatableIdCache.java │ │ ├── loading │ │ ├── json │ │ │ ├── package-info.java │ │ │ ├── raw │ │ │ │ ├── package-info.java │ │ │ │ ├── LocatorValue.java │ │ │ │ ├── Model.java │ │ │ │ ├── UVUnion.java │ │ │ │ ├── LocatorClass.java │ │ │ │ ├── MinecraftGeometry.java │ │ │ │ ├── TextureMesh.java │ │ │ │ ├── PolyMesh.java │ │ │ │ ├── Cube.java │ │ │ │ ├── UVFaces.java │ │ │ │ └── PolysUnion.java │ │ │ ├── typeadapter │ │ │ │ └── package-info.java │ │ │ └── ModelFormatVersion.java │ │ ├── math │ │ │ ├── package-info.java │ │ │ ├── value │ │ │ │ ├── package-info.java │ │ │ │ ├── Constant.java │ │ │ │ ├── VariableAssignment.java │ │ │ │ ├── Group.java │ │ │ │ ├── BooleanNegate.java │ │ │ │ ├── Negative.java │ │ │ │ ├── CompoundValue.java │ │ │ │ ├── Ternary.java │ │ │ │ ├── Calculation.java │ │ │ │ └── Variable.java │ │ │ └── function │ │ │ │ ├── package-info.java │ │ │ │ ├── limit │ │ │ │ ├── package-info.java │ │ │ │ ├── MinFunction.java │ │ │ │ ├── MaxFunction.java │ │ │ │ └── ClampFunction.java │ │ │ │ ├── misc │ │ │ │ ├── package-info.java │ │ │ │ ├── ToDegFunction.java │ │ │ │ ├── ToRadFunction.java │ │ │ │ └── PiFunction.java │ │ │ │ ├── random │ │ │ │ └── package-info.java │ │ │ │ ├── round │ │ │ │ ├── package-info.java │ │ │ │ ├── RoundFunction.java │ │ │ │ ├── CeilFunction.java │ │ │ │ ├── FloorFunction.java │ │ │ │ ├── TruncateFunction.java │ │ │ │ ├── HermiteBlendFunction.java │ │ │ │ ├── LerpFunction.java │ │ │ │ └── LerpRotFunction.java │ │ │ │ └── generic │ │ │ │ ├── package-info.java │ │ │ │ ├── SqrtFunction.java │ │ │ │ ├── LogFunction.java │ │ │ │ ├── AbsFunction.java │ │ │ │ ├── ExpFunction.java │ │ │ │ ├── SinFunction.java │ │ │ │ ├── ASinFunction.java │ │ │ │ ├── CosFunction.java │ │ │ │ ├── ATanFunction.java │ │ │ │ ├── ACosFunction.java │ │ │ │ ├── PowFunction.java │ │ │ │ ├── ModFunction.java │ │ │ │ └── ATan2Function.java │ │ ├── object │ │ │ ├── package-info.java │ │ │ ├── BoneStructure.java │ │ │ ├── BakedAnimations.java │ │ │ └── GeometryTree.java │ │ └── package-info.java │ │ ├── renderer │ │ ├── base │ │ │ └── package-info.java │ │ ├── layer │ │ │ ├── package-info.java │ │ │ └── GeoRenderLayersContainer.java │ │ ├── internal │ │ │ ├── package-info.java │ │ │ ├── PerBoneRender.java │ │ │ ├── BoneSnapshots.java │ │ │ └── AnimationVariables.java │ │ ├── specialty │ │ │ └── package-info.java │ │ ├── texture │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── animation │ │ ├── state │ │ │ ├── package-info.java │ │ │ ├── EasingState.java │ │ │ └── KeyFrameEvent.java │ │ ├── object │ │ │ ├── package-info.java │ │ │ └── PlayState.java │ │ ├── keyframehandler │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── animatable │ │ ├── client │ │ │ └── package-info.java │ │ ├── manager │ │ │ └── package-info.java │ │ ├── instance │ │ │ ├── package-info.java │ │ │ ├── InstancedAnimatableInstanceCache.java │ │ │ └── SingletonAnimatableInstanceCache.java │ │ ├── stateless │ │ │ ├── package-info.java │ │ │ ├── StatelessGeoObject.java │ │ │ ├── StatelessAnimationController.java │ │ │ ├── StatelessGeoEntity.java │ │ │ └── StatelessGeoBlockEntity.java │ │ └── package-info.java │ │ ├── constant │ │ ├── dataticket │ │ │ ├── package-info.java │ │ │ └── DataTicket.java │ │ └── package-info.java │ │ ├── network │ │ ├── packet │ │ │ ├── entity │ │ │ │ └── package-info.java │ │ │ ├── singleton │ │ │ │ ├── package-info.java │ │ │ │ ├── StatelessSingletonStopAnimPacket.java │ │ │ │ └── StatelessSingletonPlayAnimPacket.java │ │ │ ├── blockentity │ │ │ │ ├── package-info.java │ │ │ │ ├── BlockEntityAnimTriggerPacket.java │ │ │ │ ├── StatelessBlockEntityStopAnimPacket.java │ │ │ │ ├── StatelessBlockEntityPlayAnimPacket.java │ │ │ │ ├── StopTriggeredBlockEntityAnimPacket.java │ │ │ │ └── BlockEntityDataSyncPacket.java │ │ │ └── MultiloaderPacket.java │ │ └── package-info.java │ │ ├── event │ │ └── package-info.java │ │ ├── package-info.java │ │ ├── model │ │ └── package-info.java │ │ ├── object │ │ ├── package-info.java │ │ ├── CompoundException.java │ │ └── DeferredCache.java │ │ ├── service │ │ ├── package-info.java │ │ └── GeckoLibPlatform.java │ │ ├── util │ │ ├── package-info.java │ │ └── MiscUtil.java │ │ ├── GeckoLibServices.java │ │ └── mixin │ │ ├── client │ │ ├── SpecialModelRenderersMixin.java │ │ └── SpecialModelWrapperMixin.java │ │ └── common │ │ ├── LivingEntityMixin.java │ │ └── SynchronizedRemoteSlotMixin.java └── build.gradle.kts ├── fabric └── src │ └── main │ ├── resources │ ├── META-INF │ │ └── services │ │ │ ├── software.bernie.geckolib.service.GeckoLibEvents │ │ │ ├── software.bernie.geckolib.service.GeckoLibPlatform │ │ │ ├── software.bernie.geckolib.service.GeckoLibClient │ │ │ └── software.bernie.geckolib.service.GeckoLibNetworking │ └── fabric.mod.json │ └── java │ └── software │ └── bernie │ └── geckolib │ ├── event │ ├── item │ │ ├── package-info.java │ │ └── CompileItemRenderLayersEvent.java │ ├── armor │ │ └── package-info.java │ ├── block │ │ └── package-info.java │ ├── entity │ │ └── package-info.java │ ├── object │ │ ├── package-info.java │ │ └── CompileObjectRenderLayersEvent.java │ └── replacedentity │ │ └── package-info.java │ ├── platform │ ├── package-info.java │ └── GeckoLibFabric.java │ ├── GeckoLib.java │ └── GeckoLibClient.java ├── forge └── src │ └── main │ ├── resources │ ├── META-INF │ │ ├── services │ │ │ ├── software.bernie.geckolib.service.GeckoLibClient │ │ │ ├── software.bernie.geckolib.service.GeckoLibEvents │ │ │ ├── software.bernie.geckolib.service.GeckoLibPlatform │ │ │ └── software.bernie.geckolib.service.GeckoLibNetworking │ │ └── mods.toml │ └── pack.mcmeta │ └── java │ └── software │ └── bernie │ └── geckolib │ ├── event │ ├── item │ │ ├── package-info.java │ │ ├── CompileItemRenderLayersEvent.java │ │ └── CompileItemRenderStateEvent.java │ ├── armor │ │ ├── package-info.java │ │ ├── CompileArmorRenderLayersEvent.java │ │ └── CompileArmorRenderStateEvent.java │ ├── block │ │ ├── package-info.java │ │ ├── CompileBlockRenderLayersEvent.java │ │ └── CompileBlockRenderStateEvent.java │ ├── entity │ │ ├── package-info.java │ │ ├── CompileEntityRenderLayersEvent.java │ │ └── CompileEntityRenderStateEvent.java │ ├── object │ │ ├── package-info.java │ │ ├── CompileObjectRenderLayersEvent.java │ │ └── CompileObjectRenderStateEvent.java │ └── replacedentity │ │ ├── package-info.java │ │ └── CompileReplacedEntityRenderLayersEvent.java │ ├── platform │ └── package-info.java │ ├── GeckoLibClient.java │ └── GeckoLib.java ├── neoforge └── src │ └── main │ ├── resources │ └── META-INF │ │ ├── services │ │ ├── software.bernie.geckolib.service.GeckoLibEvents │ │ ├── software.bernie.geckolib.service.GeckoLibPlatform │ │ ├── software.bernie.geckolib.service.GeckoLibClient │ │ └── software.bernie.geckolib.service.GeckoLibNetworking │ │ └── neoforge.mods.toml │ └── java │ └── software │ └── bernie │ └── geckolib │ ├── event │ ├── armor │ │ ├── package-info.java │ │ └── CompileArmorRenderLayersEvent.java │ ├── block │ │ ├── package-info.java │ │ ├── CompileBlockRenderLayersEvent.java │ │ └── CompileBlockRenderStateEvent.java │ ├── entity │ │ ├── package-info.java │ │ ├── CompileEntityRenderLayersEvent.java │ │ └── CompileEntityRenderStateEvent.java │ ├── item │ │ ├── package-info.java │ │ ├── CompileItemRenderLayersEvent.java │ │ └── CompileItemRenderStateEvent.java │ ├── object │ │ ├── package-info.java │ │ ├── CompileObjectRenderLayersEvent.java │ │ └── CompileObjectRenderStateEvent.java │ └── replacedentity │ │ ├── package-info.java │ │ └── CompileReplacedEntityRenderLayersEvent.java │ ├── platform │ └── package-info.java │ ├── GeckoLibClient.java │ └── GeckoLib.java ├── .gitattributes ├── changelog.md ├── gradle.properties ├── .gitignore ├── .github └── FUNDING.yml ├── LICENSE └── settings.gradle.kts /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bernie-g/geckolib/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /common/src/main/resources/geckolib.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bernie-g/geckolib/HEAD/common/src/main/resources/geckolib.png -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibEvents: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.event.GeckoLibEventsFabric -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibPlatform: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibFabric -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibClient: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibClientForge -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibEvents: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.event.GeckoLibEventsForge -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibPlatform: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibForge -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibClient: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibClientFabric -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibEvents: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.event.GeckoLibEventsNeoForge -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibPlatform: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibNeoForge -------------------------------------------------------------------------------- /fabric/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibNetworking: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.network.GeckoLibNetworkingFabric -------------------------------------------------------------------------------- /forge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibNetworking: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.network.GeckoLibNetworkingForge -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibClient: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.platform.GeckoLibClientNeoForge -------------------------------------------------------------------------------- /forge/src/main/resources/pack.mcmeta: -------------------------------------------------------------------------------- 1 | { 2 | "pack": { 3 | "description": "GeckoLib resources", 4 | "pack_format": 26 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /neoforge/src/main/resources/META-INF/services/software.bernie.geckolib.service.GeckoLibNetworking: -------------------------------------------------------------------------------- 1 | software.bernie.geckolib.network.GeckoLibNetworkingNeoForge -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/item/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.item; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/model/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.cache.model; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/texture/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.cache.texture; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/json/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.json; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/renderer/base/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.renderer.base; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/armor/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.armor; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/block/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.block; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.entity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/object/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.object; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/item/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/armor/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.armor; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/block/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.block; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.entity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/item/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.item; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/object/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.object; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animation/state/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animation.state; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/animation/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.cache.animation; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/object/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.object; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/renderer/layer/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.renderer.layer; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/armor/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/block/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/object/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animatable/client/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animatable/manager/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.manager; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animation/object/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animation.object; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/json/raw/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.json.raw; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/value/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.value; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/renderer/internal/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.renderer.internal; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/renderer/specialty/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.renderer.specialty; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/renderer/texture/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.renderer.texture; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/event/replacedentity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.client; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animatable/instance/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.instance; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animatable/stateless/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animatable.stateless; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/constant/dataticket/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.constant.dataticket; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/event/replacedentity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.replacedentity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/network/packet/entity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.network.packet.entity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/event/replacedentity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.event.replacedentity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animation/keyframehandler/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.animation.keyframehandler; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/json/typeadapter/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.json.typeadapter; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/network/packet/singleton/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.network.packet.singleton; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/limit/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function.limit; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/misc/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function.misc; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/random/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function.random; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/round/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function.round; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/network/packet/blockentity/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.network.packet.blockentity; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/animation/keyframeevent/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.cache.animation.keyframeevent; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/loading/math/function/generic/package-info.java: -------------------------------------------------------------------------------- 1 | @NullMarked 2 | package software.bernie.geckolib.loading.math.function.generic; 3 | 4 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /fabric/src/main/java/software/bernie/geckolib/platform/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Fabric-specific platform functionality 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.platform; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /forge/src/main/java/software/bernie/geckolib/platform/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Forge-specific platform functionality 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.animatable.client; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /neoforge/src/main/java/software/bernie/geckolib/platform/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * NeoForge-specific platform functionality 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.platform; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/event/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes relating to GeckoLib's event hooks and callbacks 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.event; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/network/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes relating to GeckoLib's networking functionality 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.network; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * GeckoLib's root package, containing only the root-level classes for project-wide functionality 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes relating to various cached objects and their associated data records. 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.cache; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/model/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains the various {@link software.bernie.geckolib.model.GeoModel} implementations 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.model; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/animation/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes relating to animations, their handling, and other related objects 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.animation; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/cache/model/cuboid/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * GeckoLib model objects specifically for cuboid-based rendering 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.cache.model.cuboid; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/object/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains miscellaneous object classes that don't belong anywhere else; 3 | * usually utility classes or types 4 | */ 5 | @NullMarked 6 | package software.bernie.geckolib.object; 7 | 8 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains GeckoLib's service interfaces 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.service; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/constant/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains classes storing constant fields or providing constant factory methods not generic enough for a util class 3 | */ 4 | @NullMarked 5 | package software.bernie.geckolib.constant; 6 | 7 | import org.jspecify.annotations.NullMarked; -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /common/src/main/java/software/bernie/geckolib/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Contains GeckoLib's various utility classes 3 | *
4 | * All classes in this package should be static final helper classes
5 | */
6 | @NullMarked
7 | package software.bernie.geckolib.util;
8 |
9 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/animatable/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains classes for creating and managing {@link software.bernie.geckolib.animatable.GeoAnimatable} instances and objects
3 | */
4 | @NullMarked
5 | package software.bernie.geckolib.animatable;
6 |
7 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 | *.bat text eol=crlf
3 | *.patch text eol=lf
4 | *.java text eol=lf
5 | *.gradle text eol=crlf
6 | *.png binary
7 | *.gif binary
8 | *.exe binary
9 | *.dll binary
10 | *.jar binary
11 | *.lzma binary
12 | *.zip binary
13 | *.pyd binary
14 | *.cfg text eol=lf
15 | *.jks binary
16 | *.ogg binary
--------------------------------------------------------------------------------
/changelog.md:
--------------------------------------------------------------------------------
1 | ## GeckoLib v5.4-alpha-2
2 |
3 | ## Changes:
4 | ### Internal:
5 | * Moved GeckoLib's nullability annotations to the [JSpecify](https://jspecify.dev) spec
6 | * Cleaned up more Javadocs
7 | * Renamed RawAnimation#additionalTicks to RawAnimation#waitTicks
8 | * Removed `bind_pose_rotation` legacy support from the Bone format
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains classes relating to the loading stage of GeckoLib.
3 | * Objects here may be used outside of loading, but are rarely interacted with by end-users.
4 | */
5 | @NullMarked
6 | package software.bernie.geckolib.loading;
7 |
8 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/renderer/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Contains classes related to the actual rendering functionality of GeckoLib.
3 | *
4 | * Rendering-tangential functionality such as animating is not kept here
5 | */
6 | @NullMarked
7 | package software.bernie.geckolib.renderer;
8 |
9 | import org.jspecify.annotations.NullMarked;
--------------------------------------------------------------------------------
/fabric/src/main/java/software/bernie/geckolib/GeckoLib.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import net.fabricmc.api.ModInitializer;
4 | import software.bernie.geckolib.service.GeckoLibNetworking;
5 |
6 | /**
7 | * Main GeckoLib entrypoint
8 | */
9 | public final class GeckoLib implements ModInitializer {
10 | @Override
11 | public void onInitialize() {
12 | GeckoLibConstants.init();
13 | GeckoLibNetworking.init();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Environment Settings
2 | org.gradle.jvmargs=-Xmx3G
3 | org.gradle.daemon=false
4 |
5 | # Project Settings
6 | modId=geckolib
7 | modDisplayName=GeckoLib 5
8 | group=software.bernie.geckolib
9 | modLicense=MIT
10 | modAuthors=Tslat, Gecko
11 | modContributors=Eliot, AzureDoom, DerToaster, Witixin
12 | modDescription=GeckoLib is an animation engine for Minecraft Mods, with support for complex 3D keyframe-based animations, 30+ easings, concurrent animation support, sound and particle keyframes, event keyframes, and more.
13 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # eclipse
2 | bin
3 | *.launch
4 | .settings
5 | .metadata
6 | .classpath
7 | .project
8 | mcmodsrepo
9 |
10 | # idea
11 | out
12 | *.ipr
13 | *.iws
14 | *.iml
15 | .idea
16 | caches
17 | daemon
18 | wrapper
19 | native
20 |
21 | # gradle
22 | build
23 | .gradle
24 | logs
25 | # other
26 | eclipse
27 | run
28 | runs/
29 | key.properties
30 |
31 | # Files from Forge MDK
32 | forge*changelog.txt
33 | build.bat
34 | *.bat
35 |
36 | # allow gradlew
37 | !core/gradle/wrapper
38 | !core/gradlew.bat
39 | !gradle/wrapper
40 | !gradlew.bat
41 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/object/BoneStructure.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.object;
2 |
3 | import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
4 | import software.bernie.geckolib.loading.json.raw.Bone;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * Container class for holding a {@link Bone} structure. Used at startup in deserialization
10 | */
11 | public record BoneStructure(Bone self, Map
9 | * Implementation of {@link StatelessAnimatable#playAnimation(RawAnimation)} and {@link StatelessAnimatable#stopAnimation(String)} is left up
10 | * to the implementers of this interface, as well as any additional handling required
11 | */
12 | public non-sealed interface StatelessGeoObject extends StatelessAnimatable, GeoAnimatable {}
13 |
--------------------------------------------------------------------------------
/forge/src/main/java/software/bernie/geckolib/GeckoLibClient.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import net.minecraftforge.api.distmarker.Dist;
4 | import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
5 | import net.minecraftforge.eventbus.api.listener.SubscribeEvent;
6 | import net.minecraftforge.fml.common.Mod;
7 | import software.bernie.geckolib.cache.GeckoLibResources;
8 |
9 | @Mod.EventBusSubscriber(value = Dist.CLIENT, modid = GeckoLibConstants.MODID)
10 | public class GeckoLibClient {
11 | @SubscribeEvent
12 | public static void registerReloadListeners(final RegisterClientReloadListenersEvent ev) {
13 | ev.registerReloadListener(GeckoLibResources::reload);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/neoforge/src/main/java/software/bernie/geckolib/GeckoLibClient.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import net.neoforged.api.distmarker.Dist;
4 | import net.neoforged.bus.api.SubscribeEvent;
5 | import net.neoforged.fml.common.EventBusSubscriber;
6 | import net.neoforged.neoforge.client.event.AddClientReloadListenersEvent;
7 | import software.bernie.geckolib.cache.GeckoLibResources;
8 |
9 | /**
10 | * Main GeckoLib client entrypoint
11 | */
12 | @EventBusSubscriber(value = Dist.CLIENT, modid = GeckoLibConstants.MODID)
13 | public final class GeckoLibClient {
14 | @SubscribeEvent
15 | public static void registerReloadListeners(final AddClientReloadListenersEvent ev) {
16 | ev.addListener(GeckoLibResources.RELOAD_LISTENER_ID, GeckoLibResources::reload);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/object/BakedAnimations.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.object;
2 |
3 | import org.jspecify.annotations.Nullable;
4 | import software.bernie.geckolib.cache.animation.Animation;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * Container object that holds a deserialized map of {@link Animation Animations}
10 | *
11 | * Kept as a unique object so that it can be registered as a {@link com.google.gson.JsonDeserializer deserializer} for {@link com.google.gson.Gson Gson}
12 | */
13 | public record BakedAnimations(Map
10 | * Contract:
11 | *
16 | * This method is side-agnostic, so make sure you call out to client proxies as needed
17 | *
18 | * The player may be null if the packet is being sent before the player loads in
19 | */
20 | void receiveMessage(@Nullable Player sender, Consumer
12 | * Contract:
13 | *
12 | * Contract:
13 | *
12 | * Contract:
13 | *
12 | * Use this event to add render layers to the renderer as needed
13 | *
14 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
15 | *
16 | * @see GeoRenderEvent
17 | * @see CompileRenderLayers
18 | */
19 | public class CompileItemRenderLayersEvent
11 | * Contract:
12 | *
11 | * Contract:
12 | *
11 | * Contract:
12 | *
12 | * Contract:
13 | * void registerPacket(CustomPacketPayload.Type packetType) {
23 | ClientPlayNetworking.registerGlobalReceiver(packetType, (packet, context) -> packet.receiveMessage(context.player(), context.client()::execute));
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/GeckoLibServices.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import software.bernie.geckolib.service.GeckoLibEvents;
4 | import software.bernie.geckolib.service.GeckoLibNetworking;
5 | import software.bernie.geckolib.service.GeckoLibPlatform;
6 | import software.bernie.geckolib.service.GeckoLibClient;
7 |
8 | import java.util.ServiceLoader;
9 |
10 | public final class GeckoLibServices {
11 | public static final GeckoLibPlatform PLATFORM = load(GeckoLibPlatform.class);
12 | public static final GeckoLibNetworking NETWORK = load(GeckoLibNetworking.class);
13 |
14 | public static class Client {
15 | public static final GeckoLibEvents EVENTS = load(GeckoLibEvents.class);
16 | public static final GeckoLibClient ITEM_RENDERING = load(GeckoLibClient.class);
17 | }
18 |
19 | private static
11 | * Contract:
12 | *
11 | * Contract:
12 | *
11 | * Contract:
12 | *
11 | * Contract:
12 | *
12 | * Typically you would submit an instance of this to {@link GeoRenderLayer#addPerBoneRender}
13 | */
14 | @FunctionalInterface
15 | public interface PerBoneRender
11 | * Contract:
12 | *
11 | * Contract:
12 | *
13 | * Use this event to add render layers to the renderer as needed
14 | *
15 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
16 | *
17 | * @see GeoRenderEvent
18 | * @see CompileRenderLayers
19 | */
20 | public record CompileItemRenderLayersEvent
11 | * Contract:
12 | *
12 | * Contract:
13 | *
12 | * Use this event to add render layers to the renderer as needed
13 | *
14 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
15 | *
16 | * @see GeoRenderEvent
17 | * @see CompileRenderLayers
18 | */
19 | public class CompileObjectRenderLayersEvent
12 | * Contract:
13 | *
12 | * Contract:
13 | *
12 | * Contract:
13 | *
12 | * Contract:
13 | *
12 | * Contract:
13 | *
11 | * Contract:
12 | *
11 | * Contract:
12 | *
11 | * Contract:
12 | *
13 | * Use this event to add render layers to the renderer as needed
14 | *
15 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
16 | *
17 | * @see GeoRenderEvent
18 | * @see CompileRenderLayers
19 | */
20 | public record CompileObjectRenderLayersEvent
11 | * Contract:
12 | *
12 | * This is where you access scale/rotation/translation values for bones for a render pass
13 | */
14 | @FunctionalInterface
15 | public interface BoneSnapshots {
16 | /**
17 | * Get a {@link GeoBone}'s {@link BoneSnapshot} by the bone's name, if the bone exists
18 | *
19 | * @param boneName The name of the bone to get the snapshot for
20 | */
21 | Optional
9 | * You should NOT be instantiating this directly unless you know what you are doing.
10 | * Use {@link software.bernie.geckolib.util.GeckoLibUtil#createInstanceCache GeckoLibUtil.createInstanceCache} instead
11 | */
12 | public class InstancedAnimatableInstanceCache extends AnimatableInstanceCache {
13 | protected AnimatableManager> manager;
14 |
15 | public InstancedAnimatableInstanceCache(GeoAnimatable animatable) {
16 | super(animatable);
17 | }
18 |
19 | /**
20 | * Gets the {@link AnimatableManager} instance from this cache
21 | *
22 | * Because this cache subclass expects a 1:1 relationship of cache to animatable, only one {@code AnimatableManager} instance is used
23 | */
24 | @Override
25 | public AnimatableManager> getManagerForId(long uniqueId) {
26 | if (this.manager == null)
27 | this.manager = new AnimatableManager<>(this.animatable);
28 |
29 | return this.manager;
30 | }
31 | }
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/renderer/internal/AnimationVariables.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.renderer.internal;
2 |
3 | import com.google.common.base.Supplier;
4 | import com.google.common.base.Suppliers;
5 | import it.unimi.dsi.fastutil.objects.Reference2DoubleMap;
6 | import it.unimi.dsi.fastutil.objects.Reference2DoubleOpenHashMap;
7 | import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
8 | import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
9 | import software.bernie.geckolib.animatable.GeoAnimatable;
10 | import software.bernie.geckolib.animation.AnimationController;
11 | import software.bernie.geckolib.loading.math.value.Variable;
12 |
13 | /**
14 | * Container object for holding compiled {@link Variable} values for an upcoming render pass
15 | */
16 | public record AnimationVariables
11 | * Responsible for holding the various {@link Keyframe Keyframes} for the bone's animation transformations
12 | *
13 | * @param boneName The name of the bone as listed in the {@code animation.json}
14 | * @param rotationKeyFrames The deserialized rotation {@code Keyframe} stack
15 | * @param positionKeyFrames The deserialized position {@code Keyframe} stack
16 | * @param scaleKeyFrames The deserialized scale {@code Keyframe} stack
17 | */
18 | public record BoneAnimation(String boneName, KeyframeStack rotationKeyFrames, KeyframeStack positionKeyFrames, KeyframeStack scaleKeyFrames) {
19 | /**
20 | * Extract and collect all {@link Variable}s used in this bone animation
21 | */
22 | public Set
14 | * Use this event to add render layers to the renderer as needed
15 | *
16 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
17 | *
18 | * @see GeoRenderEvent
19 | * @see CompileRenderLayers
20 | */
21 | public class CompileEntityRenderLayersEvent
12 | * Contract:
13 | *
11 | * Contract:
12 | *
15 | * Use this event to add render layers to the renderer as needed
16 | *
17 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
18 | *
19 | * @see GeoRenderEvent
20 | * @see CompileRenderLayers
21 | */
22 | public class CompileArmorRenderLayersEvent
15 | * Use this event to add render layers to the renderer as needed
16 | *
17 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
18 | *
19 | * @see GeoRenderEvent
20 | * @see CompileRenderLayers
21 | */
22 | public record CompileEntityRenderLayersEvent
16 | * Use this event to add render layers to the renderer as needed
17 | *
18 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
19 | *
20 | * @see GeoRenderEvent
21 | * @see CompileRenderLayers
22 | */
23 | public record CompileArmorRenderLayersEvent
15 | * Use this event to add render layers to the renderer as needed
16 | *
17 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
18 | *
19 | * @see GeoRenderEvent
20 | * @see GeoRenderEvent.Armor.CompileRenderLayers
21 | */
22 | public class CompileBlockRenderLayersEvent
14 | * Use this event to add render layers to the renderer as needed
15 | *
16 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
17 | *
18 | * @see GeoRenderEvent
19 | * @see CompileRenderLayers
20 | */
21 | public class CompileReplacedEntityRenderLayersEvent
13 | * Contract:
14 | *
12 | * Contract:
13 | *
41 | * This is mostly just used for storing the animatable ID on ItemStacks
42 | */
43 |
12 | * Contract:
13 | *
16 | * Use this event to add render layers to the renderer as needed
17 | *
18 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
19 | *
20 | * @see GeoRenderEvent
21 | * @see Armor.CompileRenderLayers
22 | */
23 | public record CompileBlockRenderLayersEvent
12 | * Contract:
13 | *
15 | * Use this event to add render layers to the renderer as needed
16 | *
17 | * NOTE: Some methods on this event are not overridden in this class. Check {@link GeoRenderEvent}
18 | *
19 | * @see GeoRenderEvent
20 | * @see CompileRenderLayers
21 | */
22 | public record CompileReplacedEntityRenderLayersEvent
12 | * Contract:
13 | *
20 | * We temporarily reinstate it here so that the game syncs changes to this specific component
21 | */
22 | @WrapOperation(method = "equipmentHasChanged", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;matches(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z"))
23 | public boolean geckolib$allowLazyStackIdParity(ItemStack remoteStack, ItemStack localStack, Operation
26 | * This will be used to handle the {@link AnimationTest} at each render pass
27 | */
28 | public void setCurrentAnimation(@Nullable RawAnimation animation) {
29 | this.currentAnim = animation;
30 | }
31 |
32 | @ApiStatus.Internal
33 | protected static PlayState overrideStateHandler(AnimationTest
20 | * We temporarily reinstate it here so that the game syncs changes to this specific component
21 | */
22 | @WrapOperation(method = "matches", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;matches(Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/item/ItemStack;)Z"))
23 | public boolean geckolib$allowLazyStackIdParity(ItemStack remoteStack, ItemStack localStack, Operation
12 | * You should NOT be instantiating this directly unless you know what you are doing.
13 | * Use {@link software.bernie.geckolib.util.GeckoLibUtil#createInstanceCache GeckoLibUtil.createInstanceCache} instead
14 | */
15 | public class SingletonAnimatableInstanceCache extends AnimatableInstanceCache {
16 | protected final Long2ObjectMap
26 | * This subclass assumes that all animatable instances will be sharing this cache instance, and so differentiates data by ids
27 | */
28 | @SuppressWarnings("unchecked")
29 | @Override
30 | public
12 | * An immutable double value
13 | */
14 | public record Constant(double value) implements MathValue {
15 | @Override
16 | public double get(ControllerState controllerState) {
17 | return this.value;
18 | }
19 |
20 | @Override
21 | public boolean isMutable() {
22 | return false;
23 | }
24 |
25 | @Override
26 | public String toString() {
27 | return String.valueOf(this.value);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: geckolib
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
14 |
--------------------------------------------------------------------------------
/common/src/main/resources/geckolib.mixins.json:
--------------------------------------------------------------------------------
1 | {
2 | "required": true,
3 | "package": "software.bernie.geckolib.mixin",
4 | "compatibilityLevel": "JAVA_17",
5 | "refmap": "geckolib.refmap.json",
6 | "minVersion": "0.8",
7 | "injectors": {
8 | "defaultRequire": 1
9 | },
10 | "mixins": [
11 | "common.AbstractContainerMenuMixin",
12 | "common.HashedStackMixin",
13 | "common.ItemStackMixin",
14 | "common.LivingEntityMixin",
15 | "common.SynchronizedRemoteSlotMixin"
16 | ],
17 | "client": [
18 | "client.BlockEntityRenderStateMixin",
19 | "client.EntityRendererMixin",
20 | "client.EntityRenderStateMixin",
21 | "client.HumanoidArmorLayerMixin",
22 | "client.SpecialModelRenderersMixin",
23 | "client.SpecialModelWrapperMixin",
24 | "client.TextureManagerMixin"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/neoforge/src/main/java/software/bernie/geckolib/GeckoLib.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import net.minecraft.core.registries.Registries;
4 | import net.neoforged.bus.api.IEventBus;
5 | import net.neoforged.fml.common.Mod;
6 | import net.neoforged.neoforge.registries.DeferredRegister;
7 | import software.bernie.geckolib.network.GeckoLibNetworkingNeoForge;
8 |
9 | @Mod(GeckoLibConstants.MODID)
10 | public final class GeckoLib {
11 | public static final DeferredRegister.DataComponents DATA_COMPONENTS_REGISTER = DeferredRegister.createDataComponents(Registries.DATA_COMPONENT_TYPE, GeckoLibConstants.MODID);
12 |
13 | public GeckoLib(IEventBus modBus) {
14 | GeckoLibNetworkingNeoForge.init(modBus);
15 | DATA_COMPONENTS_REGISTER.register(modBus);
16 | GeckoLibConstants.init();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/cache/animation/keyframeevent/SoundKeyframeData.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.cache.animation.keyframeevent;
2 |
3 | import software.bernie.geckolib.cache.animation.Keyframe;
4 |
5 | import java.util.Objects;
6 |
7 | /**
8 | * Sound {@link Keyframe} instruction holder
9 | */
10 | public class SoundKeyframeData extends KeyFrameData {
11 | private final String sound;
12 |
13 | public SoundKeyframeData(double time, String sound) {
14 | super(time);
15 |
16 | this.sound = sound;
17 | }
18 |
19 | /**
20 | * Gets the sound data given by the {@link Keyframe} instruction from the {@code animation.json}
21 | */
22 | public String getSound() {
23 | return this.sound;
24 | }
25 |
26 | @Override
27 | public int hashCode() {
28 | return Objects.hash(getTime(), this.sound);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/animation/object/PlayState.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.animation.object;
2 |
3 | import software.bernie.geckolib.animation.AnimationController;
4 |
5 | /**
6 | * State enum to define whether an {@link AnimationController} should continue or stop
7 | *
8 | *
9 | *
15 | */
16 | public enum PlayState {
17 | CONTINUE,
18 | PAUSE,
19 | STOP
20 | }
21 |
--------------------------------------------------------------------------------
/forge/src/main/resources/META-INF/mods.toml:
--------------------------------------------------------------------------------
1 | modLoader="javafml"
2 | loaderVersion="${forge_loader_range}"
3 | issueTrackerURL="https://github.com/bernie-g/geckolib/issues"
4 | license="${mod_license}"
5 |
6 | [[mods]]
7 | modId="${mod_id}"
8 | version="${version}"
9 | displayName="${mod_display_name}"
10 | displayURL="http://geckolib.com/"
11 | logoFile="geckolib.png"
12 | authors="${mod_authors}"
13 | credits="${mod_contributors}"
14 | description='''
15 | ${mod_description}
16 | '''
17 |
18 | [[dependencies.geckolib]]
19 | modId="forge"
20 | mandatory=true
21 | versionRange="${forge_version_range}"
22 | ordering="NONE"
23 | side="BOTH"
24 | [[dependencies.geckolib]]
25 | modId="minecraft"
26 | mandatory=true
27 | versionRange="${minecraft_version_range}"
28 | ordering="NONE"
29 | side="BOTH"
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/cache/model/GeoVertex.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.cache.model;
2 |
3 | /**
4 | * Vertex data holder
5 | *
6 | * @param posX The x-coordinate position of the vertex
7 | * @param posY The y-coordinate position of the vertex
8 | * @param posZ The z-coordinate position of the vertex
9 | * @param texU The texture U coordinate
10 | * @param texV The texture V coordinate
11 | */
12 | public record GeoVertex(float posX, float posY, float posZ, float texU, float texV) {
13 | public GeoVertex(double x, double y, double z) {
14 | this((float)x, (float)y, (float)z, 0, 0);
15 | }
16 |
17 | /**
18 | * Create a copy of this vertex with new UV coordinates
19 | */
20 | public GeoVertex withUVs(float texU, float texV) {
21 | return new GeoVertex(this.posX, this.posY, this.posZ, texU, texV);
22 | }
23 | }
--------------------------------------------------------------------------------
/forge/src/main/java/software/bernie/geckolib/GeckoLib.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib;
2 |
3 | import net.minecraft.core.component.DataComponentType;
4 | import net.minecraft.core.registries.BuiltInRegistries;
5 | import net.minecraftforge.fml.common.Mod;
6 | import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
7 | import net.minecraftforge.registries.DeferredRegister;
8 | import software.bernie.geckolib.network.GeckoLibNetworkingForge;
9 |
10 | @Mod(GeckoLibConstants.MODID)
11 | public final class GeckoLib {
12 | public static final DeferredRegister
11 | * State Description
12 | * {@link #CONTINUE} Play the currently playing animation
13 | * {@link #PAUSE} Pause the currently playing animation, freezing its position in the timeline
14 | * {@link #STOP} Stop the currently playing animation, resetting the animation time to 0
14 | * Assigns a variable to the given value, then returns 0
15 | */
16 | public record VariableAssignment(Variable variable, MathValue value) implements MathValue {
17 | @Override
18 | public double get(ControllerState controllerState) {
19 | this.variable.set(this.value.get(controllerState));
20 |
21 | return 0;
22 | }
23 |
24 | @Override
25 | public Set
14 | * An unaltered return of the stored MathValue
15 | */
16 | public record Group(MathValue contents) implements MathValue {
17 | @Override
18 | public double get(ControllerState controllerState) {
19 | return this.contents.get(controllerState);
20 | }
21 |
22 | @Override
23 | public boolean isMutable() {
24 | return this.contents.isMutable();
25 | }
26 |
27 | @Override
28 | public Set
14 | * Returns 1 if the contained value is equal to 0, otherwise returns 0
15 | */
16 | public record BooleanNegate(MathValue value) implements MathValue {
17 | @Override
18 | public double get(ControllerState controllerState) {
19 | return this.value.get(controllerState) == 0 ? 1 : 0;
20 | }
21 |
22 | @Override
23 | public boolean isMutable() {
24 | return this.value.isMutable();
25 | }
26 |
27 | @Override
28 | public Set
13 | * Returns the square root of the input value
14 | */
15 | public final class SqrtFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public SqrtFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.sqrt";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.sqrt(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/misc/ToDegFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.misc;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Converts the input value to degrees
14 | */
15 | public final class ToDegFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public ToDegFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.to_deg";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.toDegrees(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/misc/ToRadFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.misc;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Converts the input value to radians
14 | */
15 | public final class ToRadFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public ToRadFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.to_rad";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.toRadians(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/value/Negative.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.value;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 |
6 | import java.util.Set;
7 |
8 | /**
9 | * {@link MathValue} value supplier
10 | *
11 | *
14 | * Negated equivalent of the stored value; returning a positive number if the stored value is negative, or a negative value if the stored value is positive
15 | */
16 | public record Negative(MathValue value) implements MathValue {
17 | @Override
18 | public double get(ControllerState controllerState) {
19 | return -this.value.get(controllerState);
20 | }
21 |
22 | @Override
23 | public boolean isMutable() {
24 | return this.value.isMutable();
25 | }
26 |
27 | @Override
28 | public Set
13 | * Returns the closest integer value to the input value
14 | */
15 | public final class RoundFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public RoundFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.round";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.round(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/LogFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the log value (euler base) of the input value
14 | */
15 | public final class LogFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public LogFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.ln";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.log((float)this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/AbsFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the absolute (non-negative) equivalent of the input value
14 | */
15 | public final class AbsFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public AbsFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.abs";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.abs(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/ExpFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns euler's number raised to the power of the input value
14 | */
15 | public final class ExpFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public ExpFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.exp";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.exp((float)this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/json/raw/MinecraftGeometry.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.json.raw;
2 |
3 | import com.google.gson.JsonArray;
4 | import com.google.gson.JsonDeserializer;
5 | import com.google.gson.JsonObject;
6 | import com.google.gson.JsonParseException;
7 | import net.minecraft.util.GsonHelper;
8 | import org.jspecify.annotations.Nullable;
9 | import software.bernie.geckolib.util.JsonUtil;
10 |
11 | /**
12 | * Container class for generic geometry information, only used in deserialization at startup
13 | */
14 | public record MinecraftGeometry(Bone[] bones, @Nullable String cape, @Nullable ModelProperties modelProperties) {
15 | public static JsonDeserializer
13 | * Returns the smallest value that is greater than or equal to the input value and is equal to an integer
14 | */
15 | public final class CeilFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public CeilFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.ceil";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.ceil(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/round/FloorFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.round;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the largest value that is less than or equal to the input value and is equal to an integer
14 | */
15 | public final class FloorFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public FloorFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.floor";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return Math.floor(this.value.get(controllerState));
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/forge/src/main/java/software/bernie/geckolib/event/item/CompileItemRenderLayersEvent.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.event.item;
2 |
3 | import net.minecraft.world.item.Item;
4 | import net.minecraftforge.eventbus.api.bus.EventBus;
5 | import net.minecraftforge.eventbus.api.event.RecordEvent;
6 | import software.bernie.geckolib.animatable.GeoAnimatable;
7 | import software.bernie.geckolib.event.GeoRenderEvent;
8 | import software.bernie.geckolib.renderer.GeoItemRenderer;
9 |
10 | /**
11 | * One-time event for a {@link GeoItemRenderer} called on first initialisation
12 | *
13 | * Returns the closest value that is equal to the input value or closer to zero, and is equal to an integer
14 | */
15 | public final class TruncateFunction extends MathFunction {
16 | private final MathValue value;
17 |
18 | public TruncateFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.value = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.trunc";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | return (long)this.value.get(controllerState);
32 | }
33 |
34 | @Override
35 | public int getMinArgs() {
36 | return 1;
37 | }
38 |
39 | @Override
40 | public MathValue[] getArgs() {
41 | return new MathValue[] {this.value};
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/misc/PiFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.misc;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 | import software.bernie.geckolib.loading.math.value.Constant;
7 |
8 | /**
9 | * {@link MathFunction} value supplier
10 | *
11 | *
14 | * Returns PI
15 | */
16 | public final class PiFunction extends MathFunction {
17 | public PiFunction(MathValue... values) {
18 | super(values);
19 | }
20 |
21 | @Override
22 | public String getName() {
23 | return "math.pi";
24 | }
25 |
26 | @Override
27 | public double compute(ControllerState controllerState) {
28 | return Math.PI;
29 | }
30 |
31 | @Override
32 | public boolean isMutable(MathValue... values) {
33 | return false;
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 0;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {new Constant(Math.PI)};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/neoforge/src/main/java/software/bernie/geckolib/event/object/CompileObjectRenderLayersEvent.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.event.object;
2 |
3 | import net.neoforged.bus.api.Event;
4 | import software.bernie.geckolib.animatable.GeoAnimatable;
5 | import software.bernie.geckolib.event.GeoRenderEvent;
6 | import software.bernie.geckolib.renderer.GeoObjectRenderer;
7 | import software.bernie.geckolib.renderer.base.GeoRenderState;
8 |
9 | /**
10 | * One-time event for a {@link GeoObjectRenderer} called on first initialisation
11 | *
14 | * Returns the sine of the input value angle, with the input angle converted to radians
15 | */
16 | public final class SinFunction extends MathFunction {
17 | private final MathValue value;
18 |
19 | public SinFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "math.sin";
28 | }
29 |
30 | @Override
31 | public double compute(ControllerState controllerState) {
32 | return Math.sin(this.value.get(controllerState) * Mth.DEG_TO_RAD);
33 | }
34 |
35 | @Override
36 | public int getMinArgs() {
37 | return 1;
38 | }
39 |
40 | @Override
41 | public MathValue[] getArgs() {
42 | return new MathValue[] {this.value};
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/ASinFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import net.minecraft.util.Mth;
4 | import software.bernie.geckolib.animation.state.ControllerState;
5 | import software.bernie.geckolib.loading.math.MathValue;
6 | import software.bernie.geckolib.loading.math.function.MathFunction;
7 |
8 | /**
9 | * {@link MathFunction} value supplier
10 | *
11 | *
14 | * Returns the arc-sine of the input value angle, with the input angle converted to radians
15 | */
16 | public final class ASinFunction extends MathFunction {
17 | private final MathValue value;
18 |
19 | public ASinFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "math.asin";
28 | }
29 |
30 | @Override
31 | public double compute(ControllerState controllerState) {
32 | return Math.asin(this.value.get(controllerState) * Mth.DEG_TO_RAD);
33 | }
34 |
35 | @Override
36 | public int getMinArgs() {
37 | return 1;
38 | }
39 |
40 | @Override
41 | public MathValue[] getArgs() {
42 | return new MathValue[] {this.value};
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/CosFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import net.minecraft.util.Mth;
4 | import software.bernie.geckolib.animation.state.ControllerState;
5 | import software.bernie.geckolib.loading.math.MathValue;
6 | import software.bernie.geckolib.loading.math.function.MathFunction;
7 |
8 | /**
9 | * {@link MathFunction} value supplier
10 | *
11 | *
14 | * Returns the cosine of the input value angle, with the input angle converted to radians
15 | */
16 | public final class CosFunction extends MathFunction {
17 | private final MathValue value;
18 |
19 | public CosFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "math.cos";
28 | }
29 |
30 | @Override
31 | public double compute(ControllerState controllerState) {
32 | return Mth.cos((float)this.value.get(controllerState) * Mth.DEG_TO_RAD);
33 | }
34 |
35 | @Override
36 | public int getMinArgs() {
37 | return 1;
38 | }
39 |
40 | @Override
41 | public MathValue[] getArgs() {
42 | return new MathValue[] {this.value};
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/ATanFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import net.minecraft.util.Mth;
4 | import software.bernie.geckolib.animation.state.ControllerState;
5 | import software.bernie.geckolib.loading.math.MathValue;
6 | import software.bernie.geckolib.loading.math.function.MathFunction;
7 |
8 | /**
9 | * {@link MathFunction} value supplier
10 | *
11 | *
14 | * Returns the arc-tangent of the input value angle, with the input angle converted to radians
15 | */
16 | public final class ATanFunction extends MathFunction {
17 | private final MathValue value;
18 |
19 | public ATanFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "math.atan";
28 | }
29 |
30 | @Override
31 | public double compute(ControllerState controllerState) {
32 | return Math.atan(this.value.get(controllerState) * Mth.DEG_TO_RAD);
33 | }
34 |
35 | @Override
36 | public int getMinArgs() {
37 | return 1;
38 | }
39 |
40 | @Override
41 | public MathValue[] getArgs() {
42 | return new MathValue[] {this.value};
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/ACosFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import net.minecraft.util.Mth;
4 | import software.bernie.geckolib.animation.state.ControllerState;
5 | import software.bernie.geckolib.loading.math.MathValue;
6 | import software.bernie.geckolib.loading.math.function.MathFunction;
7 |
8 | /**
9 | * {@link MathFunction} value supplier
10 | *
11 | *
14 | * Returns the arc-cosine of the input value angle, with the input angle converted to radians
15 | */
16 | public final class ACosFunction extends MathFunction {
17 | private final MathValue value;
18 |
19 | public ACosFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | }
24 |
25 | @Override
26 | public String getName() {
27 | return "math.acos";
28 | }
29 |
30 | @Override
31 | public double compute(ControllerState controllerState) {
32 | return Math.acos((float)this.value.get(controllerState) * Mth.DEG_TO_RAD);
33 | }
34 |
35 | @Override
36 | public int getMinArgs() {
37 | return 1;
38 | }
39 |
40 | @Override
41 | public MathValue[] getArgs() {
42 | return new MathValue[] {this.value};
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/limit/MinFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.limit;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the lesser of the two input values
14 | */
15 | public final class MinFunction extends MathFunction {
16 | private final MathValue valueA;
17 | private final MathValue valueB;
18 |
19 | public MinFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.valueA = values[0];
23 | this.valueB = values[1];
24 | }
25 |
26 | @Override
27 | public String getName() {
28 | return "math.min";
29 | }
30 |
31 | @Override
32 | public double compute(ControllerState controllerState) {
33 | return Math.min(this.valueA.get(controllerState), this.valueB.get(controllerState));
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 2;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {this.valueA, this.valueB};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/limit/MaxFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.limit;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the greater of the two input values
14 | */
15 | public final class MaxFunction extends MathFunction {
16 | private final MathValue valueA;
17 | private final MathValue valueB;
18 |
19 | public MaxFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.valueA = values[0];
23 | this.valueB = values[1];
24 | }
25 |
26 | @Override
27 | public String getName() {
28 | return "math.max";
29 | }
30 |
31 | @Override
32 | public double compute(ControllerState controllerState) {
33 | return Math.max(this.valueA.get(controllerState), this.valueB.get(controllerState));
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 2;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {this.valueA, this.valueB};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/generic/PowFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.generic;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the input value raised to the power of the second input value
14 | */
15 | public final class PowFunction extends MathFunction {
16 | private final MathValue value;
17 | private final MathValue power;
18 |
19 | public PowFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | this.power = values[1];
24 | }
25 |
26 | @Override
27 | public String getName() {
28 | return "math.pow";
29 | }
30 |
31 | @Override
32 | public double compute(ControllerState controllerState) {
33 | return Math.pow(this.value.get(controllerState), this.power.get(controllerState));
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 2;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {this.value, this.power};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/forge/src/main/java/software/bernie/geckolib/event/object/CompileObjectRenderLayersEvent.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.event.object;
2 |
3 | import net.minecraftforge.eventbus.api.bus.EventBus;
4 | import net.minecraftforge.eventbus.api.event.RecordEvent;
5 | import software.bernie.geckolib.animatable.GeoAnimatable;
6 | import software.bernie.geckolib.event.GeoRenderEvent;
7 | import software.bernie.geckolib.renderer.GeoObjectRenderer;
8 | import software.bernie.geckolib.renderer.base.GeoRenderState;
9 |
10 | /**
11 | * One-time event for a {@link GeoObjectRenderer} called on first initialisation
12 | *
13 | * Returns the remainder value of the input value when modulo'd by the modulus value
14 | */
15 | public final class ModFunction extends MathFunction {
16 | private final MathValue value;
17 | private final MathValue modulus;
18 |
19 | public ModFunction(MathValue... values) {
20 | super(values);
21 |
22 | this.value = values[0];
23 | this.modulus = values[1];
24 | }
25 |
26 | @Override
27 | public String getName() {
28 | return "math.mod";
29 | }
30 |
31 | @Override
32 | public double compute(ControllerState controllerState) {
33 | return this.value.get(controllerState) % this.modulus.get(controllerState);
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 2;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {this.value, this.modulus};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/renderer/internal/BoneSnapshots.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.renderer.internal;
2 |
3 | import software.bernie.geckolib.animation.state.BoneSnapshot;
4 | import software.bernie.geckolib.cache.model.GeoBone;
5 |
6 | import java.util.Optional;
7 | import java.util.function.Consumer;
8 |
9 | /**
10 | * Getter interface for {@link BoneSnapshot}s at render time.
11 | *
25 | * If it exists, run the given action.
26 | */
27 | default void ifPresent(String boneName, Consumer
14 | * Returns the arc-tangent theta of the input rectangular coordinate values (y,x), with the output converted to degrees
15 | */
16 | public final class ATan2Function extends MathFunction {
17 | private final MathValue y;
18 | private final MathValue x;
19 |
20 | public ATan2Function(MathValue... values) {
21 | super(values);
22 |
23 | this.y = values[0];
24 | this.x = values[1];
25 | }
26 |
27 | @Override
28 | public String getName() {
29 | return "math.atan2";
30 | }
31 |
32 | @Override
33 | public double compute(ControllerState controllerState) {
34 | return Math.atan2(this.y.get(controllerState), this.x.get(controllerState)) * Mth.RAD_TO_DEG;
35 | }
36 |
37 | @Override
38 | public int getMinArgs() {
39 | return 2;
40 | }
41 |
42 | @Override
43 | public MathValue[] getArgs() {
44 | return new MathValue[] {this.y, this.x};
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/loading/math/function/round/HermiteBlendFunction.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.loading.math.function.round;
2 |
3 | import software.bernie.geckolib.animation.state.ControllerState;
4 | import software.bernie.geckolib.loading.math.MathValue;
5 | import software.bernie.geckolib.loading.math.function.MathFunction;
6 |
7 | /**
8 | * {@link MathFunction} value supplier
9 | *
10 | *
13 | * Returns the Hermite> basis {@code 3t^2 - 2t^3} curve interpolation value based on the input value
14 | */
15 | public final class HermiteBlendFunction extends MathFunction {
16 | private final MathValue valueA;
17 |
18 | public HermiteBlendFunction(MathValue... values) {
19 | super(values);
20 |
21 | this.valueA = values[0];
22 | }
23 |
24 | @Override
25 | public String getName() {
26 | return "math.hermite_blend";
27 | }
28 |
29 | @Override
30 | public double compute(ControllerState controllerState) {
31 | final double value = this.valueA.get(controllerState);
32 |
33 | return (3 * value * value) - (2 * value * value * value);
34 | }
35 |
36 | @Override
37 | public int getMinArgs() {
38 | return 1;
39 | }
40 |
41 | @Override
42 | public MathValue[] getArgs() {
43 | return new MathValue[] {this.valueA};
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/neoforge/src/main/java/software/bernie/geckolib/event/armor/CompileArmorRenderLayersEvent.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.event.armor;
2 |
3 | import net.minecraft.client.renderer.entity.state.HumanoidRenderState;
4 | import net.minecraft.world.item.Item;
5 | import net.neoforged.bus.api.Event;
6 | import software.bernie.geckolib.animatable.GeoItem;
7 | import software.bernie.geckolib.event.GeoRenderEvent;
8 | import software.bernie.geckolib.renderer.GeoArmorRenderer;
9 | import software.bernie.geckolib.renderer.GeoBlockRenderer;
10 | import software.bernie.geckolib.renderer.base.GeoRenderState;
11 |
12 | /**
13 | * One-time event for a {@link GeoBlockRenderer} called on first initialisation
14 | *
15 | * Contains a collection of sub-expressions that evaluate before returning the last expression, or 0 if no return is defined.
16 | * Sub-expressions have no bearing on the final return with exception for where they may be setting variable values
17 | */
18 | public record CompoundValue(MathValue[] subValues, Set
14 | * Returns the first value plus the difference between the first and second input values multiplied by the third input value
15 | */
16 | public final class LerpFunction extends MathFunction {
17 | private final MathValue min;
18 | private final MathValue max;
19 | private final MathValue delta;
20 |
21 | public LerpFunction(MathValue... values) {
22 | super(values);
23 |
24 | this.min = values[0];
25 | this.max = values[1];
26 | this.delta = values[2];
27 | }
28 |
29 | @Override
30 | public String getName() {
31 | return "math.lerp";
32 | }
33 |
34 | @Override
35 | public double compute(ControllerState controllerState) {
36 | return Mth.lerp(this.delta.get(controllerState), this.min.get(controllerState), this.max.get(controllerState));
37 | }
38 |
39 | @Override
40 | public int getMinArgs() {
41 | return 3;
42 | }
43 |
44 | @Override
45 | public MathValue[] getArgs() {
46 | return new MathValue[] {this.min, this.max, this.delta};
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/service/GeckoLibPlatform.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.service;
2 |
3 | import net.minecraft.core.component.DataComponentType;
4 | import net.minecraft.world.entity.Entity;
5 |
6 | import java.nio.file.Path;
7 | import java.util.function.Supplier;
8 | import java.util.function.UnaryOperator;
9 |
10 | /**
11 | * Loader-agnostic service interface for general loader-specific functions
12 | */
13 | public interface GeckoLibPlatform {
14 | /**
15 | * @return Whether the current runtime is an in-dev (non-production) environment, for running debug-only tasks
16 | */
17 | boolean isDevelopmentEnvironment();
18 |
19 | /**
20 | * @return Whether the current runtime is on the client side regardless of logical context
21 | */
22 | boolean isPhysicalClient();
23 |
24 | /**
25 | * @return The root game directory (./run)
26 | */
27 | Path getGameDir();
28 |
29 | /**
30 | * Helper method to account for Forge/NeoForge's custom fluid implementation in relation to swimming in fluids
31 | *
32 | * @return Whether the entity is in a swimmable fluid or not
33 | */
34 | default boolean isInSwimmableFluid(Entity entity) {
35 | return entity.isInWater();
36 | }
37 |
38 | /**
39 | * Register a {@link DataComponentType}
40 | *
14 | * Returns one of two stored values dependent on the result of the stored condition value.
15 | * This returns such that a non-zero result from the condition will return the true stored value, otherwise returning the false stored value
16 | */
17 | public record Ternary(MathValue condition, MathValue trueValue, MathValue falseValue, Set
14 | * Returns the first input value if is larger than the second input value and less than the third input value; or else returns the nearest of the second two input values
15 | */
16 | public final class ClampFunction extends MathFunction {
17 | private final MathValue value;
18 | private final MathValue min;
19 | private final MathValue max;
20 |
21 | public ClampFunction(MathValue... values) {
22 | super(values);
23 |
24 | this.value = values[0];
25 | this.min = values[1];
26 | this.max = values[2];
27 | }
28 |
29 | @Override
30 | public String getName() {
31 | return "math.clamp";
32 | }
33 |
34 | @Override
35 | public double compute(ControllerState controllerState) {
36 | return Mth.clamp(this.value.get(controllerState), this.min.get(controllerState), this.max.get(controllerState));
37 | }
38 |
39 | @Override
40 | public int getMinArgs() {
41 | return 3;
42 | }
43 |
44 | @Override
45 | public MathValue[] getArgs() {
46 | return new MathValue[] {this.value, this.min, this.max};
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/forge/src/main/java/software/bernie/geckolib/event/replacedentity/CompileReplacedEntityRenderLayersEvent.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.event.replacedentity;
2 |
3 | import net.minecraft.client.renderer.entity.state.EntityRenderState;
4 | import net.minecraft.world.entity.Entity;
5 | import net.minecraftforge.eventbus.api.bus.EventBus;
6 | import net.minecraftforge.eventbus.api.event.RecordEvent;
7 | import software.bernie.geckolib.animatable.GeoAnimatable;
8 | import software.bernie.geckolib.event.GeoRenderEvent;
9 | import software.bernie.geckolib.renderer.GeoReplacedEntityRenderer;
10 | import software.bernie.geckolib.renderer.base.GeoRenderState;
11 |
12 | /**
13 | * One-time event for a {@link GeoReplacedEntityRenderer} called on first initialisation
14 | *
14 | * Returns the first value plus the difference between the first and second input values multiplied by the third input value, wrapping the end result as a degrees value
15 | */
16 | public final class LerpRotFunction extends MathFunction {
17 | private final MathValue min;
18 | private final MathValue max;
19 | private final MathValue delta;
20 |
21 | public LerpRotFunction(MathValue... values) {
22 | super(values);
23 |
24 | this.min = values[0];
25 | this.max = values[1];
26 | this.delta = values[2];
27 | }
28 |
29 | @Override
30 | public String getName() {
31 | return "math.lerprotate";
32 | }
33 |
34 | @Override
35 | public double compute(ControllerState controllerState) {
36 | return MiscUtil.lerpYaw(this.delta.get(controllerState), this.min.get(controllerState), this.max.get(controllerState));
37 | }
38 |
39 | @Override
40 | public int getMinArgs() {
41 | return 3;
42 | }
43 |
44 | @Override
45 | public MathValue[] getArgs() {
46 | return new MathValue[] {this.min, this.max, this.delta};
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/common/src/main/java/software/bernie/geckolib/mixin/common/LivingEntityMixin.java:
--------------------------------------------------------------------------------
1 | package software.bernie.geckolib.mixin.common;
2 |
3 | import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
4 | import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
5 | import net.minecraft.world.entity.LivingEntity;
6 | import net.minecraft.world.item.ItemStack;
7 | import org.spongepowered.asm.mixin.Mixin;
8 | import org.spongepowered.asm.mixin.injection.At;
9 | import software.bernie.geckolib.GeckoLibConstants;
10 |
11 | /**
12 | * Injection into the equipment change handling to allow for bypassing GeckoLib ItemStack ID parity
13 | */
14 | @Mixin(LivingEntity.class)
15 | public class LivingEntityMixin {
16 | /**
17 | * In {@code ItemStackMixin#geckolib$skipGeckolibIdOnCompare}, we tell Minecraft to ignore the contents of GeckoLib
18 | * stack ids for the purposes of ItemStack parity.
19 | *