version 0.1.8
This commit is contained in:
parent
5a6877e2db
commit
8ba15348ea
|
|
@ -173,6 +173,7 @@ tasks.named('jar', Jar).configure {
|
|||
])
|
||||
}
|
||||
|
||||
archiveFileName = "${mod_id}-${mod_version}-origin.jar"
|
||||
finalizedBy 'reobfJar'
|
||||
}
|
||||
|
||||
|
|
@ -251,8 +252,12 @@ publishing {
|
|||
gradle.buildFinished {
|
||||
def javadocJar = file("build/libs/${mod_id}-${mod_version}-javadoc.jar")
|
||||
def sourcesJar = file("build/libs/${mod_id}-${mod_version}-sources.jar")
|
||||
def allJarsJar = file("build/libs/${mod_id}-${mod_version}-all.jar")
|
||||
if (javadocJar.exists()) ant.delete(file: javadocJar)
|
||||
if (sourcesJar.exists()) ant.delete(file: sourcesJar)
|
||||
if (allJarsJar.exists()) {
|
||||
ant.move(file: allJarsJar, tofile: file("build/libs/${mod_id}-${mod_version}.jar"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ mapping_version=2023.09.03-1.20.1
|
|||
mod_id=sccore
|
||||
mod_name=SnowyCrescentCore
|
||||
mod_license=GNU AGPL 3.0
|
||||
mod_version=1.20.1-0.1.7.1
|
||||
mod_version=1.20.1-0.1.8
|
||||
mod_group_id=com.linearpast
|
||||
mod_authors=LostInLinearPast
|
||||
mod_description=A lib about capability and player animator.
|
||||
|
|
|
|||
|
|
@ -66,22 +66,35 @@ public class AnimJson {
|
|||
GenericAnimationData animation = GenericAnimationData.create(new ResourceLocation(json.get(Key).getAsString()));
|
||||
if(json.has(Name)) animation.withName(json.get(Name).getAsString());
|
||||
if(json.has(LyingType)) animation.withLyingType(AnimationData.LyingType.valueOf(json.get(LyingType).getAsString()));
|
||||
JsonObject camOffset = json.get(CamPosOffset).getAsJsonObject();
|
||||
animation.withHeightModifier(json.get(HeightModifier).getAsFloat())
|
||||
.withCamComputePriority(json.get(Priority).getAsInt())
|
||||
.setCamPosOffset(new Vec3(
|
||||
camOffset.get("x").getAsDouble(),
|
||||
camOffset.get("y").getAsDouble(),
|
||||
camOffset.get("z").getAsDouble()
|
||||
))
|
||||
.withCamPosOffsetRelative(camOffset.get(Relative).getAsBoolean())
|
||||
.withCamPitch(json.get(CamPitch).getAsFloat())
|
||||
.withCamRoll(json.get(CamRoll).getAsFloat())
|
||||
.withCamYaw(json.get(CamYaw).getAsFloat());
|
||||
if(json.has(HeightModifier)) animation.withHeightModifier(json.get(HeightModifier).getAsFloat());
|
||||
if(json.has(Priority)) animation.withCamComputePriority(json.get(Priority).getAsInt());
|
||||
if(json.has(CamPitch)) animation.withCamPitch(json.get(CamPitch).getAsFloat());
|
||||
if(json.has(CamRoll)) animation.withCamRoll(json.get(CamRoll).getAsFloat());
|
||||
if(json.has(CamYaw)) animation.withCamYaw(json.get(CamYaw).getAsFloat());
|
||||
if(json.has(CamPosOffset)) {
|
||||
JsonObject camOffset = json.get(CamPosOffset).getAsJsonObject();
|
||||
Vec3 vec3 = Vec3.ZERO;
|
||||
if(camOffset.has("x")) vec3 = vec3.add(camOffset.get("x").getAsDouble(), 0, 0);
|
||||
if(camOffset.has("y")) vec3 = vec3.add(0, camOffset.get("y").getAsDouble(), 0);
|
||||
if(camOffset.has("z")) vec3 = vec3.add(0, 0, camOffset.get("z").getAsDouble());
|
||||
if(!vec3.equals(Vec3.ZERO)) animation.setCamPosOffset(vec3);
|
||||
if(camOffset.has(Relative)) animation.withCamPosOffsetRelative(camOffset.get(Relative).getAsBoolean());
|
||||
}
|
||||
if(json.has(WithRide)){
|
||||
Ride ride = Ride.create();
|
||||
JsonObject withRide = json.get(WithRide).getAsJsonObject();
|
||||
JsonObject offsetJson = withRide.get(Offset).getAsJsonObject();
|
||||
if(withRide.has(ExistTick)) ride.setExistTick(withRide.get(ExistTick).getAsInt());
|
||||
if(withRide.has(XRot)) ride.setXRot(withRide.get(XRot).getAsFloat());
|
||||
if(withRide.has(YRot)) ride.setYRot(withRide.get(YRot).getAsFloat());
|
||||
if(withRide.has(Offset)) {
|
||||
JsonObject offsetJson = withRide.get(Offset).getAsJsonObject();
|
||||
Vec3 offset = new Vec3(
|
||||
offsetJson.get("x").getAsDouble(),
|
||||
offsetJson.get("y").getAsDouble(),
|
||||
offsetJson.get("z").getAsDouble()
|
||||
);
|
||||
ride.withOffset(offset);
|
||||
}
|
||||
if(withRide.has(ComponentsAnimation)){
|
||||
JsonArray elements = withRide.get(ComponentsAnimation).getAsJsonArray();
|
||||
for (JsonElement element : elements) {
|
||||
|
|
@ -90,14 +103,6 @@ public class AnimJson {
|
|||
ride.addComponentAnimation(componentKey);
|
||||
}
|
||||
}
|
||||
Vec3 offset = new Vec3(
|
||||
offsetJson.get("x").getAsDouble(),
|
||||
offsetJson.get("y").getAsDouble(),
|
||||
offsetJson.get("z").getAsDouble()
|
||||
);
|
||||
ride.withOffset(offset).withExistTick(withRide.get(ExistTick).getAsInt())
|
||||
.withXRot(withRide.get(XRot).getAsFloat())
|
||||
.withYRot(withRide.get(YRot).getAsFloat());
|
||||
animation.withRide(ride);
|
||||
}
|
||||
return animation;
|
||||
|
|
|
|||
|
|
@ -59,21 +59,34 @@ public class RawAnimJson {
|
|||
JsonObject json = originElement.getAsJsonObject();
|
||||
RawAnimationData animation = RawAnimationData.create(new ResourceLocation(json.get(Key).getAsString()));
|
||||
if(json.has(LyingType)) animation.withLyingType(AnimationData.LyingType.valueOf(json.get(LyingType).getAsString()));
|
||||
JsonObject camOffset = json.get(CamPosOffset).getAsJsonObject();
|
||||
animation.withCamComputePriority(json.get(Priority).getAsInt())
|
||||
.setCamPosOffset(new Vec3(
|
||||
camOffset.get("x").getAsDouble(),
|
||||
camOffset.get("y").getAsDouble(),
|
||||
camOffset.get("z").getAsDouble()
|
||||
))
|
||||
.withCamPosOffsetRelative(camOffset.get(Relative).getAsBoolean())
|
||||
.withCamPitch(json.get(CamPitch).getAsFloat())
|
||||
.withCamRoll(json.get(CamRoll).getAsFloat())
|
||||
.withCamYaw(json.get(CamYaw).getAsFloat());
|
||||
if(json.has(Priority)) animation.withCamComputePriority(json.get(Priority).getAsInt());
|
||||
if(json.has(CamPitch)) animation.withCamPitch(json.get(CamPitch).getAsFloat());
|
||||
if(json.has(CamRoll)) animation.withCamRoll(json.get(CamRoll).getAsFloat());
|
||||
if(json.has(CamYaw)) animation.withCamYaw(json.get(CamYaw).getAsFloat());
|
||||
if(json.has(CamPosOffset)) {
|
||||
JsonObject camOffset = json.get(CamPosOffset).getAsJsonObject();
|
||||
Vec3 vec3 = Vec3.ZERO;
|
||||
if(camOffset.has("x")) vec3 = vec3.add(camOffset.get("x").getAsDouble(), 0, 0);
|
||||
if(camOffset.has("y")) vec3 = vec3.add(0, camOffset.get("y").getAsDouble(), 0);
|
||||
if(camOffset.has("z")) vec3 = vec3.add(0, 0, camOffset.get("z").getAsDouble());
|
||||
if(!vec3.equals(Vec3.ZERO)) animation.setCamPosOffset(vec3);
|
||||
if(camOffset.has(Relative)) animation.withCamPosOffsetRelative(camOffset.get(Relative).getAsBoolean());
|
||||
}
|
||||
if(json.has(WithRide)){
|
||||
Ride ride = Ride.create();
|
||||
JsonObject withRide = json.get(WithRide).getAsJsonObject();
|
||||
JsonObject offsetJson = withRide.get(Offset).getAsJsonObject();
|
||||
if(withRide.has(ExistTick)) ride.setExistTick(withRide.get(ExistTick).getAsInt());
|
||||
if(withRide.has(XRot)) ride.setXRot(withRide.get(XRot).getAsFloat());
|
||||
if(withRide.has(YRot)) ride.setYRot(withRide.get(YRot).getAsFloat());
|
||||
if(withRide.has(Offset)) {
|
||||
JsonObject offsetJson = withRide.get(Offset).getAsJsonObject();
|
||||
Vec3 offset = new Vec3(
|
||||
offsetJson.get("x").getAsDouble(),
|
||||
offsetJson.get("y").getAsDouble(),
|
||||
offsetJson.get("z").getAsDouble()
|
||||
);
|
||||
ride.withOffset(offset);
|
||||
}
|
||||
if(withRide.has(ComponentsAnimation)){
|
||||
JsonArray elements = withRide.get(ComponentsAnimation).getAsJsonArray();
|
||||
for (JsonElement element : elements) {
|
||||
|
|
@ -82,14 +95,6 @@ public class RawAnimJson {
|
|||
ride.addComponentAnimation(componentKey);
|
||||
}
|
||||
}
|
||||
Vec3 offset = new Vec3(
|
||||
offsetJson.get("x").getAsDouble(),
|
||||
offsetJson.get("y").getAsDouble(),
|
||||
offsetJson.get("z").getAsDouble()
|
||||
);
|
||||
ride.withOffset(offset).withExistTick(withRide.get(ExistTick).getAsInt())
|
||||
.withXRot(withRide.get(XRot).getAsFloat())
|
||||
.withYRot(withRide.get(YRot).getAsFloat());
|
||||
animation.withRide(ride);
|
||||
}
|
||||
return animation;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ import net.minecraft.client.Minecraft;
|
|||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.FriendlyByteBuf;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.network.NetworkEvent;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
|
@ -26,12 +29,17 @@ public record AnimationClearPacket(@Nullable ResourceLocation layer) {
|
|||
NetworkEvent.Context context = supplier.get();
|
||||
context.enqueueWork(() -> {
|
||||
context.setPacketHandled(true);
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if(player == null) return;
|
||||
List<ResourceLocation> layers = new ArrayList<>();
|
||||
if(layer != null) layers.add(layer);
|
||||
else layers.addAll(AnimationRegistry.getLayers().keySet());
|
||||
layers.forEach(layer -> AnimationUtils.playAnimation(player, layer, null));
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> this::handle);
|
||||
});
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void handle(){
|
||||
LocalPlayer player = Minecraft.getInstance().player;
|
||||
if(player == null) return;
|
||||
List<ResourceLocation> layers = new ArrayList<>();
|
||||
if(layer != null) layers.add(layer);
|
||||
else layers.addAll(AnimationRegistry.getLayers().keySet());
|
||||
layers.forEach(layer -> AnimationUtils.playAnimation(player, layer, null));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ package com.linearpast.sccore.mixin;
|
|||
|
||||
import com.linearpast.sccore.SnowyCrescentCore;
|
||||
import com.linearpast.sccore.animation.service.AnimationService;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.LoadingModList;
|
||||
import net.minecraftforge.fml.loading.moddiscovery.ModInfo;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
|
||||
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
|
||||
|
|
@ -23,11 +24,13 @@ public class SCCoreMixinPlugin implements IMixinConfigPlugin {
|
|||
|
||||
@Override
|
||||
public boolean shouldApplyMixin(String targetClassName, String mixinClassName) {
|
||||
if (targetClassName.startsWith("runData\\.")) {
|
||||
if (targetClassName.startsWith("runData.")) {
|
||||
return "runData".equals(System.getProperty("gradle.task"));
|
||||
}
|
||||
if (mixinClassName.startsWith("com\\.linearpast\\." + SnowyCrescentCore.MODID + "\\.mixin\\.animation")) {
|
||||
return ModList.get().isLoaded(AnimationService.AnimModId);
|
||||
if (mixinClassName.startsWith("com.linearpast." + SnowyCrescentCore.MODID + ".mixin.animation.")) {
|
||||
return LoadingModList.get().getMods().stream().map(ModInfo::getModId).anyMatch(
|
||||
s -> s.equals(AnimationService.AnimModId)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user