Skip to content

Commit

Permalink
some more wearables rendering fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Thutmose committed Jun 29, 2020
1 parent d7ed23e commit 245a7f1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 28 deletions.
5 changes: 5 additions & 0 deletions src/main/java/pokecube/mobs/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff,
if (slot != EnumWearable.HAT) return;
if (this.model == null)
this.model = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/megatiara.x3d"));
if (!this.model.isLoaded() || !this.model.isValid()) return;
final float dx = -0.0f, dy = 0.25f, dz = -0.25f;
mat.rotate(Vector3f.XP.rotationDegrees(-90));
mat.translate(dx, dy, dz);
Expand Down Expand Up @@ -101,6 +102,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff,
if (slot != EnumWearable.ANKLE) return;
if (this.model == null)
this.model = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/megaankletzinnia.x3d"));
if (!this.model.isLoaded() || !this.model.isValid()) return;
float s, dx, dy, dz;
dx = 0.f;
dy = .06f;
Expand Down Expand Up @@ -147,6 +149,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff,
if (slot != EnumWearable.NECK) return;
if (this.model == null)
this.model = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/megapendant.x3d"));
if (!this.model.isLoaded() || !this.model.isValid()) return;
float dx, dy, dz;
dx = 0;
dy = -.0f;
Expand Down Expand Up @@ -192,6 +195,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff,
if (slot != EnumWearable.EAR) return;
if (this.model == null)
this.model = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/megaearring.x3d"));
if (!this.model.isLoaded() || !this.model.isValid()) return;
final Minecraft minecraft = Minecraft.getInstance();
float dx, dy, dz;
dx = 0.0f;
Expand Down Expand Up @@ -239,6 +243,7 @@ public void renderWearable(final MatrixStack mat, final IRenderTypeBuffer buff,
if (slot != EnumWearable.EYE) return;
if (this.model == null)
this.model = new X3dModel(new ResourceLocation(PokecubeMod.ID, "models/worn/megaglasses.x3d"));
if (!this.model.isLoaded() || !this.model.isValid()) return;

final float dx = -0.0f, dy = 0.0f, dz = -0.25f;
mat.rotate(Vector3f.XP.rotationDegrees(90));
Expand Down
1 change: 0 additions & 1 deletion src/main/java/thut/bling/client/render/Eye.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ public static void renderEye(final MatrixStack mat, final IRenderTypeBuffer buff
final ItemStack stack, final IModel model, final ResourceLocation[] textures, final int brightness,
final int overlay)
{
if (!model.isLoaded() || !model.isValid()) return;
// TODO eye by model instead of texture.
mat.push();
mat.translate(-0.26, -0.175, -0.251);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/thut/wearables/client/render/slots/Arm.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void render(final MatrixStack mat, final IRenderTypeBuffer buff, f
float[] offsetArr;
final boolean sneak = wearer.isCrouching();
mat.push();
if (wearer.isCrouching()) mat.translate(0.0F, 0.23125F, 0.01F);

boolean render = false;
// Right side
if (index == 0) switch (slot)
Expand Down
27 changes: 9 additions & 18 deletions src/main/java/thut/wearables/client/render/slots/Body.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,19 @@ public static void render(final MatrixStack mat, final IRenderTypeBuffer buff, f
{
case BACK:
if (ThutWearables.config.renderBlacklist.contains(7)) break;
if (wearer.isCrouching())
{
mat.translate(0.0F, 0.23125F, 0.0F);
if ((offsetArr = ThutWearables.config.renderOffsetsSneak.get(7)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
}
if (wearer.isCrouching() && (offsetArr = ThutWearables.config.renderOffsetsSneak.get(7)) != null) mat
.translate(offsetArr[0], offsetArr[1], offsetArr[2]);

theModel.bipedBody.translateRotate(mat);
if ((offsetArr = ThutWearables.config.renderOffsets.get(7)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
render = true;
break;
case NECK:
if (ThutWearables.config.renderBlacklist.contains(6)) break;
if (wearer.isCrouching())
{
mat.translate(0.0F, 0.23125F, 0.0F);
if ((offsetArr = ThutWearables.config.renderOffsetsSneak.get(6)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
}
if (wearer.isCrouching() && (offsetArr = ThutWearables.config.renderOffsetsSneak.get(6)) != null) mat
.translate(offsetArr[0], offsetArr[1], offsetArr[2]);

theModel.bipedBody.translateRotate(mat);
if ((offsetArr = ThutWearables.config.renderOffsets.get(6)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
Expand All @@ -59,12 +53,9 @@ public static void render(final MatrixStack mat, final IRenderTypeBuffer buff, f
case WAIST:
if (ThutWearables.config.renderBlacklist.contains(8)) break;
theModel.bipedBody.translateRotate(mat);
if (wearer.isCrouching())
{
mat.translate(0.0F, 0.13125F, -0.105F);
if ((offsetArr = ThutWearables.config.renderOffsetsSneak.get(8)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
}
if (wearer.isCrouching() && (offsetArr = ThutWearables.config.renderOffsetsSneak.get(8)) != null) mat
.translate(offsetArr[0], offsetArr[1], offsetArr[2]);

if ((offsetArr = ThutWearables.config.renderOffsets.get(8)) != null) mat.translate(offsetArr[0],
offsetArr[1], offsetArr[2]);
render = true;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/thut/wearables/client/render/slots/Head.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static void render(final MatrixStack mat, final IRenderTypeBuffer buff, f
float[] offsetArr;

mat.push();
if (wearer.isCrouching()) if ((offsetArr = ThutWearables.config.renderOffsetsSneak.get(9)) != null) mat
.translate(offsetArr[0], offsetArr[1], offsetArr[2]);
if (wearer.isCrouching() && (offsetArr = ThutWearables.config.renderOffsetsSneak.get(9)) != null) mat.translate(
offsetArr[0], offsetArr[1], offsetArr[2]);
if (wearer.isChild())
{
final float af = 2.0F;
Expand Down
8 changes: 2 additions & 6 deletions src/main/java/thut/wearables/client/render/slots/Leg.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,8 @@ public static void render(final MatrixStack mat, final IRenderTypeBuffer buff, f

mat.push();

if (wearer.isCrouching())
{
mat.translate(0.0F, 0.23125F, 0.01F);
if ((offsetArr = ThutWearables.config.renderOffsetsSneak.get(4 + index)) != null) mat.translate(
offsetArr[0], offsetArr[1], offsetArr[2]);
}
if (wearer.isCrouching() && (offsetArr = ThutWearables.config.renderOffsetsSneak.get(4 + index)) != null) mat
.translate(offsetArr[0], offsetArr[1], offsetArr[2]);

if (index == 0) theModel.bipedRightLeg.translateRotate(mat);
else theModel.bipedLeftLeg.translateRotate(mat);
Expand Down

0 comments on commit 245a7f1

Please sign in to comment.