use of cc.hyperium.purchases.HyperiumPurchase in project Hyperium by HyperiumClient.
the class LayerDeadmau5HeadHandler method doRenderLayer.
public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float partialTicks, RenderPlayer playerRenderer) {
int k = 0;
try {
k = 1;
if (entitylivingbaseIn == null)
return;
if (entitylivingbaseIn.isInvisible())
return;
if (entitylivingbaseIn.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
return;
k = 2;
if (!Settings.SHOW_COSMETICS_EVERYWHERE && !(Hyperium.INSTANCE.getHandlers().getLocationHandler().isLobbyOrHousing()))
return;
k = 3;
String name = entitylivingbaseIn.getName();
if (name == null)
return;
k = 5;
if (Hyperium.INSTANCE.getCosmetics().getDeadmau5Cosmetic().isPurchasedBy(entitylivingbaseIn.getUniqueID())) {
HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(entitylivingbaseIn.getUniqueID());
if (packageIfReady == null)
return;
k = 6;
AbstractHyperiumPurchase purchase = packageIfReady.getPurchase(EnumPurchaseType.DEADMAU5_COSMETIC);
if (purchase == null)
return;
k = 7;
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
if (thePlayer != null && entitylivingbaseIn.getUniqueID() != thePlayer.getUniqueID()) {
if (!((EarsCosmetic) purchase).isEnabled()) {
k = -5;
return;
}
} else if (!Settings.EARS_STATE.equalsIgnoreCase("yes")) {
return;
}
k = 8;
ResourceLocation locationSkin = entitylivingbaseIn.getLocationSkin();
if (locationSkin != null)
playerRenderer.bindTexture(locationSkin);
k = 9;
GlStateManager.disableCull();
for (int i = 0; i < 2; ++i) {
int g = 0;
try {
GlStateManager.pushMatrix();
float f = entitylivingbaseIn.prevRotationYaw + (entitylivingbaseIn.rotationYaw - entitylivingbaseIn.prevRotationYaw) * partialTicks - (entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks);
float f1 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTicks;
g++;
GlStateManager.rotate(f, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(f1, 1.0F, 0.0F, 0.0F);
GlStateManager.translate(0.375F * (float) (i * 2 - 1), 0.0F, 0.0F);
GlStateManager.translate(0.0F, -0.375F, 0.0F);
GlStateManager.rotate(-f1, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(-f, 0.0F, 1.0F, 0.0F);
g++;
if (entitylivingbaseIn.isSneaking()) {
GlStateManager.translate(0.0F, 0.25, 0.0F);
}
float f2 = 1.3333334F;
GlStateManager.scale(f2, f2, f2);
g++;
playerRenderer.getMainModel().renderDeadmau5Head(0.0625F);
g++;
} catch (Exception e) {
Hyperium.LOGGER.error("Failed to render deadmau5 at g " + g);
e.printStackTrace();
} finally {
GlStateManager.popMatrix();
}
}
k = 10;
}
} catch (Exception e) {
e.printStackTrace();
Hyperium.LOGGER.error("Failed to render Deadmau5 at point " + k);
}
}
use of cc.hyperium.purchases.HyperiumPurchase in project Hyperium by HyperiumClient.
the class DragonHeadRenderer method onRenderPlayer.
@InvokeEvent
public void onRenderPlayer(RenderPlayerEvent event) {
if (CosmeticsUtil.shouldHide(EnumPurchaseType.DRAGON_HEAD))
return;
EntityPlayer entity = event.getEntity();
if (dragonCosmetic.isPurchasedBy(entity.getUniqueID()) && !entity.isInvisible()) {
HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
if (packageIfReady == null || packageIfReady.getCachedSettings().isDragonHeadDisabled())
return;
GlStateManager.pushMatrix();
GlStateManager.translate(event.getX(), event.getY(), event.getZ());
renderHead(event.getEntity(), event.getPartialTicks());
GlStateManager.popMatrix();
}
}
use of cc.hyperium.purchases.HyperiumPurchase 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
}
use of cc.hyperium.purchases.HyperiumPurchase in project Hyperium by HyperiumClient.
the class WingsRenderer method renderWings.
private void renderWings(EntityPlayer player, float partialTicks, double x, double y, double z) {
HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(player.getUniqueID());
if (packageIfReady == null)
return;
String s = packageIfReady.getCachedSettings().getWingsType();
ResourceLocation location = wingsCosmetic.getLocation(s);
// Wings scale as defined in the settings.
double v = packageIfReady.getCachedSettings().getWingsScale();
double scale = v / 100.0;
double rotate = CosmeticsUtil.interpolate(player.prevRenderYawOffset, player.renderYawOffset, partialTicks);
GlStateManager.pushMatrix();
// Displaces the wings by a custom value.
double customOffset = Settings.WINGS_OFFSET / 50;
GlStateManager.translate(0, customOffset, 0);
GlStateManager.translate(x, y, z);
GlStateManager.scale(-scale, -scale, scale);
GlStateManager.rotate((float) (180.0F + rotate), 0.0F, 1.0F, 0.0F);
// Height of the player.
float scaledPlayerHeight = (float) (1.85F / scale);
// Height of the wings from the feet.
float scaledHeight = (float) (1.25 / scale);
// Moves the wings to the top of the player's head then backward slightly (away from the centre).
GlStateManager.translate(0.0F, -scaledHeight, 0.0F);
GlStateManager.translate(0.0F, 0.0F, 0.15F / scale);
// Takes into account player flip cosmetic.
int rotateState = Hyperium.INSTANCE.getHandlers().getFlipHandler().get(player.getUniqueID());
if (player.isSneaking() && rotateState == 0) {
GlStateManager.translate(0.0F, 0.125 / scale, 0.0F);
} else if (player.isSneaking() && rotateState == 1) {
GlStateManager.translate(0.0F, -0.125 / scale, 0.0F);
}
// Spinning rotate mode.
if (rotateState == 2) {
// Translate to centre of the player.
float difference = scaledHeight - (scaledPlayerHeight / 2);
GlStateManager.translate(0.0F, difference, 0.0F);
// Rotate.
double l = System.currentTimeMillis() % (360 * 1.75) / 1.75;
GlStateManager.rotate((float) -l, 0.1F, 0.0F, 0.0F);
// Translate back up to the correct position.
GlStateManager.translate(0.0F, -difference, 0.0F);
} else if (rotateState == 1) {
// Flip rotate mode.
float difference = scaledPlayerHeight - scaledHeight;
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
GlStateManager.translate(0.0F, -scaledHeight + difference, 0.0F);
}
GlStateManager.color(1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(location);
for (int j = 0; j < 2; j++) {
GL11.glEnable(GL11.GL_CULL_FACE);
float f11 = System.currentTimeMillis() % 1000L / 1000.0f * 3.1415927f * 2.0F;
wing.rotateAngleX = (float) Math.toRadians(-80.0) - (float) Math.cos(f11) * 0.2F;
wing.rotateAngleY = (float) Math.toRadians(20.0) + (float) Math.sin(f11) * 0.4F;
wing.rotateAngleZ = (float) Math.toRadians(20.0);
wingTip.rotateAngleZ = -(float) (Math.sin(f11 + 2.0F) + 0.5) * 0.75F;
wing.render(0.0625F);
GlStateManager.scale(-1.0F, 1.0F, 1.0F);
if (j == 0)
GL11.glCullFace(GL11.GL_FRONT);
}
GL11.glCullFace(GL11.GL_BACK);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
use of cc.hyperium.purchases.HyperiumPurchase in project Hyperium by HyperiumClient.
the class CapesGui method pack.
@Override
protected void pack() {
reg("RESET", new GuiButton(nextId(), 1, 1, "Disable Hyperium Cape"), guiButton -> {
NettyClient client = NettyClient.getClient();
if (client != null) {
client.write(ServerCrossDataPacket.build(new JsonHolder().put("internal", true).put("set_cape", true).put("value", "default")));
}
HyperiumPurchase self = PurchaseApi.getInstance().getSelf();
if (self == null) {
GeneralChatHandler.instance().sendMessage("Unable to reset your cape: Your profile is not loaded");
return;
}
JsonHolder purchaseSettings = self.getPurchaseSettings();
if (!purchaseSettings.has("cape")) {
purchaseSettings.put("cape", new JsonHolder());
}
purchaseSettings.optJSONObject("cape").put("type", "default");
Hyperium.INSTANCE.getHandlers().getGeneralChatHandler().sendMessage("You may need to switch worlds to update your cape.");
}, guiButton -> {
});
reg("CUSTOM", new GuiButton(nextId(), 1, 22, "Custom Cape"), guiButton -> {
Desktop desktop = Desktop.getDesktop();
if (desktop != null) {
try {
desktop.browse(new URL("https://capes.hyperium.cc").toURI());
} catch (IOException | URISyntaxException e) {
e.printStackTrace();
}
}
}, guiButton -> {
});
}
Aggregations