Reenable GregTech Capes

This commit is contained in:
Blood-Asp 2016-09-29 16:21:33 +02:00
parent c0f1fce859
commit d665022f4f
2 changed files with 73 additions and 41 deletions

View file

@ -32,6 +32,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import org.lwjgl.opengl.GL11;
import java.net.URL;
import java.util.*;
// Referenced classes of package gregtech.common:
@ -49,6 +50,8 @@ public class GT_Client extends GT_Proxy
});
}
private final HashSet mCapeList = new HashSet();
private final GT_CapeRenderer mCapeRenderer;
private final List mPosR;
private final List mPosG;
private final List mPosB;
@ -67,7 +70,9 @@ public class GT_Client extends GT_Proxy
private final List mMoltenNegA = Arrays.asList(new Object[0]);
private long mAnimationTick;
private boolean mAnimationDirection;
public GT_Client() {
mCapeRenderer = new GT_CapeRenderer(mCapeList);
mAnimationTick = 0L;
mAnimationDirection = false;
mPosR = Arrays.asList(new Materials[]{
@ -157,6 +162,26 @@ public class GT_Client extends GT_Proxy
public void onPreLoad() {
super.onPreLoad();
String arr$[] = {
"renadi", "hanakocz", "MysteryDump", "Flaver4", "x_Fame", "Peluche321", "Goshen_Ithilien", "manf", "Bimgo", "leagris",
"IAmMinecrafter02", "Cerous", "Devilin_Pixy", "Bkarlsson87", "BadAlchemy", "CaballoCraft", "melanclock", "Resursator", "demanzke", "AndrewAmmerlaan",
"Deathlycraft", "Jirajha", "Axlegear", "kei_kouma", "Dracion", "dungi", "Dorfschwein", "Zero Tw0", "mattiagraz85", "sebastiank30",
"Plem", "invultri", "grillo126", "malcanteth", "Malevolence_", "Nicholas_Manuel", "Sirbab", "kehaan", "bpgames123", "semig0d",
"9000bowser", "Sovereignty89", "Kris1432", "xander_cage_", "samuraijp", "bsaa", "SpwnX", "tworf", "Kadah", "kanni",
"Stute", "Hegik", "Onlyme", "t3hero", "Hotchi", "jagoly", "Nullav", "BH5432", "Sibmer", "inceee",
"foxxx0", "Hartok", "TMSama", "Shlnen", "Carsso", "zessirb", "meep310", "Seldron", "yttr1um", "hohounk",
"freebug", "Sylphio", "jmarler", "Saberawr", "r00teniy", "Neonbeta", "yinscape", "voooon24", "Quintine", "peach774",
"lepthymo", "bildeman", "Kremnari", "Aerosalo", "OndraSter", "oscares91", "mr10movie", "Daxx367x2", "EGERTRONx", "aka13_404",
"Abouttabs", "Johnstaal", "djshiny99", "megatronp", "DZCreeper", "Kane_Hart", "Truculent", "vidplace7", "simon6689", "MomoNasty",
"UnknownXLV", "goreacraft", "Fluttermine", "Daddy_Cecil", "MrMaleficus", "TigersFangs", "cublikefoot", "chainman564", "NikitaBuker", "Misha999777",
"25FiveDetail", "AntiCivilBoy", "michaelbrady", "xXxIceFirexXx", "Speedynutty68", "GarretSidzaka", "HallowCharm977", "mastermind1919", "The_Hypersonic", "diamondguy2798",
"zF4ll3nPr3d4t0r", "CrafterOfMines57", "XxELIT3xSNIP3RxX", "SuterusuKusanagi", "xavier0014", "adamros", "alexbegt"
};
int len$ = arr$.length;
for (int i$ = 0; i$ < len$; i$++) {
String tName = arr$[i$];
mCapeList.add(tName.toLowerCase());
}
(new Thread(this)).start();
}
@ -196,28 +221,32 @@ public class GT_Client extends GT_Proxy
}
public void run() {
//skip - dead code, rly, txt files on server is now empty
try {
GT_Log.out.println("Skip: GT_Mod: Downloading Cape List.");
/*@*//*SuppressWarnings("resource")*/
//Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
//while (tScanner.hasNextLine()) {
//String tName = tScanner.nextLine();
//if (!this.mCapeList.contains(tName.toLowerCase())) {
//this.mCapeList.add(tName.toLowerCase());
//}
//}
@SuppressWarnings("resource")
Scanner tScanner = new Scanner(new URL("http://gregtech.overminddl1.com/com/gregoriust/gregtech/supporterlist.txt").openStream());
while (tScanner.hasNextLine()) {
String tName = tScanner.nextLine();
if (!this.mCapeList.contains(tName.toLowerCase())) {
this.mCapeList.add(tName.toLowerCase());
}
}
} catch (Throwable e) {
}
try {
/**try {
GT_Log.out.println("Skip: GT_Mod: Downloading News.");
/*@*//*SuppressWarnings("resource")*/
//Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
//while (tScanner.hasNextLine()) {
//this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
//}
} catch (Throwable e) {
@SuppressWarnings("resource")
Scanner tScanner = new Scanner(new URL("http://files.minecraftforge.net/maven/com/gregoriust/gregtech/message.txt").openStream());
while (tScanner.hasNextLine()) {
this.mMessage = (this.mMessage + tScanner.nextLine() + " ");
}
} catch (Throwable e) {
}**/
}
@SubscribeEvent
public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) {
mCapeRenderer.receiveRenderSpecialsEvent(aEvent);
}
@SubscribeEvent
@ -235,7 +264,6 @@ public class GT_Client extends GT_Proxy
for (Iterator i$ = tList.iterator(); i$.hasNext(); GT_Utility.sPlayedSoundMap.remove(tKey)) {
tKey = (GT_PlayedSound) i$.next();
}
//wut, every tick? baaad, not need (and other) -> dead code
/*if ((this.isFirstClientPlayerTick) && (aEvent.player == GT_Values.GT.getThePlayer())) {
this.isFirstClientPlayerTick = false;
GT_FluidStack.fixAllThoseFuckingFluidIDs();

View file

@ -1,8 +1,17 @@
package gregtech.common.render;
import gregtech.api.enums.GT_Values;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
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;
import java.util.Collection;
@ -10,16 +19,13 @@ public class GT_CapeRenderer
extends RenderPlayer {
private final ResourceLocation[] mCapes = {new ResourceLocation("gregtech:textures/BrainTechCape.png"), new ResourceLocation("gregtech:textures/GregTechCape.png"), new ResourceLocation("gregtech:textures/MrBrainCape.png"), new ResourceLocation("gregtech:textures/GregoriusCape.png")};
private final Collection<String> mCapeList;
private static final float glf0 = 0.0F;
private static final float glf1 = 1.0F;
public GT_CapeRenderer(Collection<String> aCapeList) {
this.mCapeList = aCapeList;
setRenderManager(RenderManager.instance);
}
//always off in BMPL
/*public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) {
public void receiveRenderSpecialsEvent(RenderPlayerEvent.Specials.Pre aEvent) {
AbstractClientPlayer aPlayer = (AbstractClientPlayer) aEvent.entityPlayer;
if (GT_Utility.getFullInvisibility(aPlayer)) {
aEvent.setCanceled(true);
@ -49,36 +55,34 @@ public class GT_CapeRenderer
if ((tResource != null) && (!aPlayer.getHideCape())) {
bindTexture(tResource);
GL11.glPushMatrix();
GL11.glTranslatef(glf0, glf0, 0.125F);
float var1f = (float) (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks);
float d0 = (float) aPlayer.field_71091_bM + var1f;
float d1 = (float) aPlayer.field_71096_bN + var1f;
float d2 = (float) aPlayer.field_71097_bO + var1f;
float f6 = (float) (aPlayer.prevRenderYawOffset + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks);
float var2f = f6 * 3.141593F / 180.0F;
float d3 = MathHelper.sin(var2f);
float d4 = -MathHelper.cos(var2f);
float f7 = d1 * 10.0F;
float f8 = (d0 * d3 + d2 * d4) * 100.0F;
float f9 = (d0 * d4 - d2 * d3) * 100.0F;
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 < glf0) {
f8 = glf0;
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, glf1, glf0, glf0);
GL11.glRotatef(f9 / 2.0F, glf0, glf0, glf1);
GL11.glRotatef(-f9 / 2.0F, glf0, glf1, glf0);
GL11.glRotatef(180.0F, glf0, glf1, glf0);
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();
}
@ -87,5 +91,5 @@ public class GT_CapeRenderer
e.printStackTrace(GT_Log.err);
}
}
}*/
}
}