Skip to content

Commit

Permalink
fix mannequin crash, fix borderless imperial panels
Browse files Browse the repository at this point in the history
  • Loading branch information
parzivail committed Dec 6, 2023
1 parent 8a13624 commit 623a498
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
6 changes: 3 additions & 3 deletions projects/pswg/src/main/java/com/parzivail/pswg/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ public void onInitializeClient()
ModelRegistry.registerConnected(SwgBlocks.Panel.BlackImperialPanelSectional, true, true, true, null, Resources.id("block/black_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.BlackImperialPanelSectional1, true, true, true, null, Resources.id("block/black_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.BlackImperialPanelSectional2, true, true, true, null, Resources.id("block/black_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional, true, true, true, null, Resources.id("block/gray_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional1, true, true, true, null, Resources.id("block/gray_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional2, true, true, true, null, Resources.id("block/gray_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional, true, true, true, null, Resources.id("block/gray_imperial_panel_borderless"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional1, true, true, true, null, Resources.id("block/gray_imperial_panel_borderless"));
ModelRegistry.registerConnected(SwgBlocks.Panel.GrayImperialPanelSectional2, true, true, true, null, Resources.id("block/gray_imperial_panel_borderless"));
ModelRegistry.registerConnected(SwgBlocks.Panel.LightGrayImperialPanelSectional, true, true, true, null, Resources.id("block/light_gray_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.LightGrayImperialPanelSectional1, true, true, true, null, Resources.id("block/light_gray_imperial_panel_blank"));
ModelRegistry.registerConnected(SwgBlocks.Panel.LightGrayImperialPanelSectional2, true, true, true, null, Resources.id("block/light_gray_imperial_panel_blank"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,14 @@ public void render(LivingEntity livingEntity, float f, float tickDelta, MatrixSt

var speciesStr = mannequin.getSpecies();
var species = SwgSpeciesRegistry.deserialize(speciesStr);
var renderer = renderers.get(species.getModel().toString());

if (renderer instanceof PlayerSpeciesModelRenderer perwm)
if (species != null)
{
model = (BipedEntityModel)perwm.getModel();
var renderer = renderers.get(species.getModel().toString());

if (renderer instanceof PlayerSpeciesModelRenderer perwm)
{
model = (BipedEntityModel)perwm.getModel();
}
}
}

Expand All @@ -132,9 +135,14 @@ public void render(LivingEntity livingEntity, float f, float tickDelta, MatrixSt
return;

matrixStack.push();

this.model.sneaking = false;
this.model.handSwingProgress = this.getHandSwingProgress(livingEntity, tickDelta);
this.model.riding = livingEntity.hasVehicle();
this.model.child = livingEntity.isBaby();

this.model.setAngles(livingEntity, 0, 0, 0, 0, 0);

float bodyYaw = MathHelper.lerpAngleDegrees(tickDelta, livingEntity.prevBodyYaw, livingEntity.bodyYaw);
float headYaw = MathHelper.lerpAngleDegrees(tickDelta, livingEntity.prevHeadYaw, livingEntity.headYaw);
float headYawDelta = headYaw - bodyYaw;
Expand Down Expand Up @@ -230,7 +238,8 @@ public Identifier getTexture(LivingEntity mannequin)
{
var speciesStr = mannequinEntity.getSpecies();
var species = SwgSpeciesRegistry.deserialize(speciesStr);
return SwgSpeciesRenderer.getTexture(mannequin, species);
if (species != null)
return SwgSpeciesRenderer.getTexture(mannequin, species);
}
return TEXTURE;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public void renderWithOverrides(SwgSpecies species, Identifier texture, Abstract
overrideSpecies = species;
overrideTexture = texture;

this.model.sneaking = false;
this.model.setAngles(abstractClientPlayerEntity, 0, 0, 0, 0, 0);

this.render(abstractClientPlayerEntity, yaw, tickDelta, matrixStack, vertexConsumerProvider, i);

overrideSpecies = null;
Expand Down

0 comments on commit 623a498

Please sign in to comment.