aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/core/handler
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-12-24 17:39:23 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-12-24 17:39:23 +1000
commit530d84ed415e3cc35715e697635e9f8fb06bbd5d (patch)
treef872cbcc0c5b4a712ffcc03df8708accb50463df /src/Java/gtPlusPlus/core/handler
parent0cfe59a8a48fa4c8dfa12043489825ffa9fadd8c (diff)
downloadGT5-Unofficial-530d84ed415e3cc35715e697635e9f8fb06bbd5d.tar.gz
GT5-Unofficial-530d84ed415e3cc35715e697635e9f8fb06bbd5d.tar.bz2
GT5-Unofficial-530d84ed415e3cc35715e697635e9f8fb06bbd5d.zip
+ Added a cape handler.
+ Gave the Helium Blob a name. + Gave core items the ability to have a name on yet another constructor. - Disabled the cape handler. % Minor improvements to the portable tanks.
Diffstat (limited to 'src/Java/gtPlusPlus/core/handler')
-rw-r--r--src/Java/gtPlusPlus/core/handler/render/CapeHandler.java120
1 files changed, 120 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java
new file mode 100644
index 0000000000..9f449e3044
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/handler/render/CapeHandler.java
@@ -0,0 +1,120 @@
+package gtPlusPlus.core.handler.render;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.util.GT_Log;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.core.lib.CORE;
+
+import java.util.Collection;
+
+import net.minecraft.client.entity.AbstractClientPlayer;
+import net.minecraft.client.model.ModelBiped;
+import net.minecraft.client.renderer.entity.RenderManager;
+import net.minecraft.client.renderer.entity.RenderPlayer;
+import net.minecraft.potion.Potion;
+import net.minecraft.util.MathHelper;
+import net.minecraft.util.ResourceLocation;
+import net.minecraftforge.client.event.RenderPlayerEvent;
+
+import org.lwjgl.opengl.GL11;
+
+public class CapeHandler extends RenderPlayer {
+ private final ResourceLocation[] mCapes = {
+ new ResourceLocation(CORE.MODID+":textures/TesterCape.png"),
+ new ResourceLocation(CORE.MODID+":textures/Draknyte1.png"),
+ new ResourceLocation("gregtech:textures/GregoriusCape.png") };
+ private final Collection<String> mCapeList;
+
+ public CapeHandler(Collection<String> aCapeList) {
+ this.mCapeList = aCapeList;
+ setRenderManager(RenderManager.instance);
+ }
+
+ public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) {
+ AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer;
+ if (GT_Utility.getFullInvisibility(aPlayer)) {
+ aEvent.setCanceled(true);
+ return;
+ }
+ float aPartialTicks = aEvent.partialRenderTick;
+ if (aPlayer.isInvisible()) {
+ return;
+ }
+ if (GT_Utility.getPotion(aPlayer,
+ Integer.valueOf(Potion.invisibility.id).intValue())) {
+ return;
+ }
+ try {
+ ResourceLocation tResource = null;
+ if (aPlayer.getDisplayName().equalsIgnoreCase("XW3B")) {
+ tResource = this.mCapes[0];
+ }
+ if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) {
+ tResource = this.mCapes[0];
+ }
+ if (aPlayer.getDisplayName().equalsIgnoreCase("Draknyte1")) {
+ tResource = this.mCapes[1];
+ }
+ if (aPlayer.getDisplayName().equalsIgnoreCase("GregoriusT")) {
+ tResource = this.mCapes[2];
+ }
+ if ((tResource != null) && (!(aPlayer.getHideCape()))) {
+ bindTexture(tResource);
+ GL11.glPushMatrix();
+ GL11.glTranslatef(0.0F, 0.0F, 0.125F);
+ double d0 = aPlayer.field_71091_bM
+ + (aPlayer.field_71094_bP - aPlayer.field_71091_bM)
+ * aPartialTicks
+ - (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX)
+ * aPartialTicks);
+ double d1 = aPlayer.field_71096_bN
+ + (aPlayer.field_71095_bQ - aPlayer.field_71096_bN)
+ * aPartialTicks
+ - (aPlayer.prevPosY + (aPlayer.posY - aPlayer.prevPosY)
+ * aPartialTicks);
+ double d2 = aPlayer.field_71097_bO
+ + (aPlayer.field_71085_bR - aPlayer.field_71097_bO)
+ * aPartialTicks
+ - (aPlayer.prevPosZ + (aPlayer.posZ - aPlayer.prevPosZ)
+ * aPartialTicks);
+ float f6 = aPlayer.prevRenderYawOffset
+ + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset)
+ * aPartialTicks;
+ double d3 = MathHelper.sin(f6 * 3.141593F / 180.0F);
+ double d4 = -MathHelper.cos(f6 * 3.141593F / 180.0F);
+ float f7 = (float) d1 * 10.0F;
+ float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F;
+ float f9 = (float) (d0 * d4 - (d2 * d3)) * 100.0F;
+ if (f7 < -6.0F) {
+ f7 = -6.0F;
+ }
+ if (f7 > 32.0F) {
+ f7 = 32.0F;
+ }
+ if (f8 < 0.0F) {
+ f8 = 0.0F;
+ }
+ float f10 = aPlayer.prevCameraYaw
+ + (aPlayer.cameraYaw - aPlayer.prevCameraYaw)
+ * aPartialTicks;
+ f7 += MathHelper
+ .sin((aPlayer.prevDistanceWalkedModified + (aPlayer.distanceWalkedModified - aPlayer.prevDistanceWalkedModified)
+ * aPartialTicks) * 6.0F)
+ * 32.0F * f10;
+ if (aPlayer.isSneaking()) {
+ f7 += 25.0F;
+ }
+ GL11.glRotatef(6.0F + f8 / 2.0F + f7, 1.0F, 0.0F, 0.0F);
+ GL11.glRotatef(f9 / 2.0F, 0.0F, 0.0F, 1.0F);
+ GL11.glRotatef(-f9 / 2.0F, 0.0F, 1.0F, 0.0F);
+ GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
+ ((ModelBiped) this.mainModel).renderCloak(0.0625F);
+ GL11.glPopMatrix();
+ }
+ } catch (Throwable e) {
+ if (GT_Values.D1)
+ e.printStackTrace(GT_Log.err);
+ }
+ }
+
+}