use of cc.hyperium.mixinsimp.client.renderer.entity.IMixinRenderManager in project Hyperium by HyperiumClient.
the class DragonCompanion method renderPlayer.
@InvokeEvent
public void renderPlayer(RenderPlayerEvent event) {
if (Minecraft.getMinecraft().theWorld == null || !isPurchasedBy(event.getEntity().getUniqueID()))
return;
HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
if (packageIfReady == null || packageIfReady.getCachedSettings().getCurrentCompanion() != EnumPurchaseType.DRAGON_COMPANION)
return;
scale = .1F;
AbstractClientPlayer player = event.getEntity();
CustomDragon customDragon = dragonHashMap.computeIfAbsent(event.getEntity(), player1 -> {
EntityDragon dragon = new EntityDragon(player1.getEntityWorld());
dragon.setSilent(true);
return new CustomDragon(dragon, new AnimationState());
});
Entity entity = customDragon.dragon;
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
// Manage pos here
float partialTicks = event.getPartialTicks();
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
GlStateManager.pushMatrix();
EntityDragon entityDragon = customDragon.dragon;
AnimationState animationState = customDragon.animationState;
AnimationPoint current = animationState.getCurrent(player);
entityDragon.posX = current.x / scale;
entityDragon.posY = current.y / scale;
entityDragon.posZ = current.z / scale;
GlStateManager.translate(-((IMixinRenderManager) renderManager).getPosX(), -((IMixinRenderManager) renderManager).getPosY(), -((IMixinRenderManager) renderManager).getPosZ());
GlStateManager.translate(d0 * scale, d1 * scale, d2 * scale);
GlStateManager.scale(scale, scale, scale);
renderManager.renderEntitySimple(entity, event.getPartialTicks());
GlStateManager.popMatrix();
// render
}
Aggregations