Fix elytras

This commit is contained in:
Sollace 2024-12-13 22:52:20 +01:00
parent e7cb03aa35
commit 7fce6c94a3
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
4 changed files with 15 additions and 10 deletions

View file

@ -89,7 +89,7 @@ public class PlayerPonyRenderer
manager.updateState(entity, (PlayerPonyRenderState)state, mode);
// Rotate cape to align with the pony back
state.field_53536 += MathHelper.PI / 2;
//state.field_53536 += MathHelper.PI / 4;
}
public final PlayerPonyRenderState getAndUpdateRenderState(AbstractClientPlayerEntity entity, float tickDelta, ModelAttributes.Mode mode) {

View file

@ -19,6 +19,9 @@ import net.minecraft.entity.EquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.equipment.EquipmentModel;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.RotationAxis;
import org.jetbrains.annotations.Nullable;
public class ElytraFeature<
S extends PonyRenderState,
@ -66,12 +69,13 @@ public class ElytraFeature<
@SuppressWarnings("unchecked")
protected void preRenderCallback(S state, MatrixStack stack) {
if (state instanceof PonyRenderState ponyState && context instanceof PonyRenderContext context) {
stack.translate(0, ponyState.riderOffset, 0.125);
stack.translate(0, 0.45F, 0);
((ClientPonyModel<PonyRenderState>)context.getEquineManager().getModels().body()).transform(ponyState, BodyPart.BODY, stack);
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(80));
}
}
@Nullable
protected Identifier getElytraTexture(S state) {
if (state instanceof PlayerEntityRenderState playerState) {
SkinTextures textures = playerState.skinTextures;
@ -85,6 +89,6 @@ public class ElytraFeature<
}
}
return TEXTURE;
return null;
}
}

View file

@ -107,7 +107,6 @@ public class NativeUtil {
if (loadedTexture instanceof NativeImageBackedTexture nibt) {
NativeImage image = nibt.getImage();
if (image != null) {
System.out.println("Format of in-memory resource " + resource + " is " + image.getFormat());
consumer.accept(image::getColorArgb);
return;
}
@ -116,11 +115,9 @@ public class NativeUtil {
Resource res = mc.getResourceManager().getResource(resource).orElse(null);
if (res != null) {
try (InputStream inputStream = res.getInputStream()) {
NativeImage image = NativeImage.read(inputStream);
System.out.println("Format of stored resource " + resource + " is " + image.getFormat());
try (NativeImage image = NativeImage.read(inputStream)) {
consumer.accept(image::getColorArgb);
}
return;
}
}

View file

@ -2,12 +2,16 @@
"texture": {"u": 22, "w": 64, "h": 32},
"data": {
"left_wing": {
"pivot": [ 5, 0, 0 ],
"rotate": [0.26, 0, -0.26],
"cubes": [
{"from": [-10, 0, 0], "size": [10, 20, 2], "dilate": 1}
]
},
"right_wing": {
"mirror": true,
"pivot": [-5, 0, 0 ],
"rotate": [0.26, 0, -0.26],
"cubes": [
{"from": [ 0, 0, 0], "size": [10, 20, 2], "dilate": 1}
]