Top Hat cosmetic
This commit is contained in:
parent
be99610b41
commit
7941ed0bd7
BIN
desktopRuntime/resources/assets/eagler/gui/hat.png
Normal file
BIN
desktopRuntime/resources/assets/eagler/gui/hat.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 850 B |
Binary file not shown.
59205
javascript/classes.js
59205
javascript/classes.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
28
src/main/java/dev/resent/cosmetic/CosmeticBase.java
Normal file
28
src/main/java/dev/resent/cosmetic/CosmeticBase.java
Normal file
|
@ -0,0 +1,28 @@
|
|||
package dev.resent.cosmetic;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||
|
||||
public abstract class CosmeticBase implements LayerRenderer<AbstractClientPlayer>{
|
||||
|
||||
protected final RenderPlayer playerRenderer;
|
||||
public CosmeticBase(RenderPlayer playerRenderer){
|
||||
this.playerRenderer = playerRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRenderLayer(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
|
||||
if(player.hasPlayerInfo() && !player.isInvisible()){
|
||||
render(player, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale);
|
||||
|
||||
@Override
|
||||
public boolean shouldCombineTextures() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
15
src/main/java/dev/resent/cosmetic/CosmeticController.java
Normal file
15
src/main/java/dev/resent/cosmetic/CosmeticController.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package dev.resent.cosmetic;
|
||||
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
|
||||
public class CosmeticController {
|
||||
|
||||
public static boolean renderTopHat(AbstractClientPlayer player){
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float[] getTopHatColor(AbstractClientPlayer player){
|
||||
return new float[]{1, 0, 0};
|
||||
}
|
||||
|
||||
}
|
15
src/main/java/dev/resent/cosmetic/CosmeticModelBase.java
Normal file
15
src/main/java/dev/resent/cosmetic/CosmeticModelBase.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package dev.resent.cosmetic;
|
||||
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
|
||||
public class CosmeticModelBase extends ModelBase{
|
||||
|
||||
protected final ModelBiped playerModel;
|
||||
|
||||
public CosmeticModelBase(RenderPlayer player){
|
||||
this.playerModel = player.getMainModel();
|
||||
}
|
||||
|
||||
}
|
73
src/main/java/dev/resent/cosmetic/impl/TopHat.java
Normal file
73
src/main/java/dev/resent/cosmetic/impl/TopHat.java
Normal file
|
@ -0,0 +1,73 @@
|
|||
package dev.resent.cosmetic.impl;
|
||||
|
||||
import dev.resent.cosmetic.CosmeticBase;
|
||||
import dev.resent.cosmetic.CosmeticController;
|
||||
import dev.resent.cosmetic.CosmeticModelBase;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class TopHat extends CosmeticBase{
|
||||
|
||||
private final ModelTopHat modelTopHat;
|
||||
private static final ResourceLocation hat = new ResourceLocation("eagler:gui/hat.png");
|
||||
|
||||
public TopHat(RenderPlayer renderPlayer){
|
||||
super(renderPlayer);
|
||||
modelTopHat = new ModelTopHat(renderPlayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(AbstractClientPlayer player, float limbSwing, float limbSwingAmount, float partialTicks,
|
||||
float ageInTicks, float HeadYaw, float headPitch, float scale) {
|
||||
if(CosmeticController.renderTopHat(player)){
|
||||
GlStateManager.pushMatrix();
|
||||
playerRenderer.bindTexture(hat);
|
||||
|
||||
if(player.isSneaking()){
|
||||
GlStateManager.translate(0, 0.225D, 0);
|
||||
}
|
||||
|
||||
float[] color = CosmeticController.getTopHatColor(player);
|
||||
GlStateManager.color(color[0], color[1], color[2]);
|
||||
modelTopHat.render(player, limbSwing, limbSwingAmount, ageInTicks, HeadYaw, headPitch, scale);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
private class ModelTopHat extends CosmeticModelBase {
|
||||
|
||||
private ModelRenderer rim;
|
||||
private ModelRenderer tip;
|
||||
|
||||
public ModelTopHat(RenderPlayer player){
|
||||
super(player);
|
||||
rim = new ModelRenderer(playerModel, 0, 0);
|
||||
rim.addBox(-5.5F, -9F, -5.5F, 11, 2, 11);
|
||||
tip = new ModelRenderer(playerModel, 0, 13);
|
||||
tip.addBox(-3.5f, -17, -3.5f, 7, 8, 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entityIn, float limbSwing, float limbSwingAmount, float ageInTicks, float headYaw, float headPitch, float scale) {
|
||||
|
||||
rim.rotateAngleX = playerModel.bipedHead.rotateAngleX;
|
||||
rim.rotateAngleY = playerModel.bipedHead.rotateAngleY;
|
||||
rim.rotationPointX = 0.0f;
|
||||
rim.rotationPointY = 0.0f;
|
||||
rim.render(scale);
|
||||
|
||||
tip.rotateAngleX = playerModel.bipedHead.rotateAngleX;
|
||||
tip.rotateAngleY = playerModel.bipedHead.rotateAngleY;
|
||||
tip.rotationPointX = 0.0f;
|
||||
tip.rotationPointY = 0.0f;
|
||||
tip.render(scale);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package dev.resent.module.base;
|
|||
import dev.resent.Resent;
|
||||
import dev.resent.event.impl.Event;
|
||||
import dev.resent.setting.Setting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.minecraft.client.renderer.entity;
|
||||
|
||||
import dev.resent.cosmetic.impl.TopHat;
|
||||
import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
|
@ -57,6 +58,7 @@ public class RenderPlayer extends RendererLivingEntity<AbstractClientPlayer> {
|
|||
this.addLayer(new LayerDeadmau5Head(this));
|
||||
this.addLayer(new LayerCape(this));
|
||||
this.addLayer(new LayerCustomHead(this.getMainModel().bipedHead));
|
||||
this.addLayer(new TopHat(this));
|
||||
}
|
||||
|
||||
public ModelBiped getMainModel() {
|
||||
|
|
|
@ -11,6 +11,7 @@ import dev.resent.module.base.RenderModule;
|
|||
import dev.resent.setting.BooleanSetting;
|
||||
import dev.resent.setting.ModeSetting;
|
||||
import dev.resent.setting.Setting;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
|
Loading…
Reference in New Issue
Block a user