diff options
-rw-r--r-- | src/Java/gtPlusPlus/GTplusplus.java | 10 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/lib/CORE.java | 3 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/core/proxy/ClientProxy.java | 54 | ||||
-rw-r--r-- | src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java | 104 | ||||
-rw-r--r-- | src/resources/assets/miscutils/textures/Orange.png (renamed from src/resources/assets/miscutils/textures/Draknyte1.png) | bin | 496 -> 496 bytes |
5 files changed, 159 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index 4afbde44d2..5f522215a0 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -166,8 +166,8 @@ public class GTplusplus implements ActionListener { "How much RF is a single unit of EU worth? (Most mods use 4:1 ratio)"); // Features - enableCustomAlvearyBlocks = config.getBoolean("enableCustomAlvearyBlocks", "features", false, - "Enables Custom Alveary Blocks."); + CORE.mEnableCape = config.getBoolean("enableSupporterCape", "features", true, + "Enables Custom GT++ Cape."); //Biomes CORE.DARKBIOME_ID = config.getInt("darkbiome_ID", "worldgen", 238, 1, 254, "The biome within the Dark Dimension."); @@ -199,6 +199,10 @@ public class GTplusplus implements ActionListener { public void preInit(final FMLPreInitializationEvent event) { Utils.LOG_INFO("Loading " + CORE.name + " V" + CORE.VERSION); + if(!Utils.isServer()){ + CORE.mEnableCape = true; + } + //HTTP Requests CORE.MASTER_VERSION = NetworkUtils.getContentFromURL("https://raw.githubusercontent.com/draknyte1/GTplusplus/master/Recommended.txt").toLowerCase(); CORE.USER_COUNTRY = GeoUtils.determineUsersCountry(); @@ -261,8 +265,6 @@ public class GTplusplus implements ActionListener { Utils.LOG_INFO("Verification for New Material: "+s.mName); } - // ~ - //ReflectionUtils.becauseIWorkHard(); // Utils.LOG_INFO("Activating GT OreDictionary Handler, this can take // some time."); Utils.LOG_INFO("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); diff --git a/src/Java/gtPlusPlus/core/lib/CORE.java b/src/Java/gtPlusPlus/core/lib/CORE.java index 5d88740aac..a45db02fe6 100644 --- a/src/Java/gtPlusPlus/core/lib/CORE.java +++ b/src/Java/gtPlusPlus/core/lib/CORE.java @@ -45,6 +45,9 @@ public class CORE { public static final boolean MAIN_GREGTECH_5U_EXPERIMENTAL_FORK = Meta_GT_Proxy.areWeUsingGregtech5uExperimental(); public static final int GREGTECH_API_VERSION = GregTech_API.VERSION; public static IGregtech_RecipeAdder RA; + + public static boolean mEnableCape = false; + @Deprecated public static IGregtech_RecipeAdder sRecipeAdder; public static GregtechRecipe GT_Recipe = new GregtechRecipe(); diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index d13e7f347b..1500982990 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -1,9 +1,14 @@ package gtPlusPlus.core.proxy; +import java.net.URL; +import java.util.HashSet; +import java.util.Scanner; + import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.event.*; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gtPlusPlus.GTplusplus; @@ -19,27 +24,33 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.TileEntityFirepit; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.particles.EntityParticleFXMysterious; +import gtPlusPlus.xmod.gregtech.common.render.GTPP_CapeRenderer; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.entity.RenderIronGolem; import net.minecraft.entity.Entity; -public class ClientProxy extends CommonProxy{ - - /*private final HashSet<String> mCapeList = new HashSet<String>(); - private final CapeHandler mCapeRenderer; +public class ClientProxy extends CommonProxy implements Runnable{ - ClientProxy(){ - mCapeRenderer = new CapeHandler(mCapeList); - } - */ + private final HashSet mCapeList = new HashSet(); + private final GTPP_CapeRenderer mCapeRenderer; + + public ClientProxy(){ + mCapeRenderer = new GTPP_CapeRenderer(mCapeList); + } + @SubscribeEvent + public void receiveRenderSpecialsEvent(net.minecraftforge.client.event.RenderPlayerEvent.Specials.Pre aEvent) { + mCapeRenderer.receiveRenderSpecialsEvent(aEvent); + } + @SideOnly(Side.CLIENT) public static String playerName = ""; @Override public void preInit(final FMLPreInitializationEvent e) { super.preInit(e); + onPreLoad(); //Do this weird things for textures. GTplusplus.loadTextures(); //We boot up the sneak manager. @@ -136,5 +147,32 @@ public class ClientProxy extends CommonProxy{ } + + public void onPreLoad() { + String arr$[] = { + "draknyte1", "fobius" + }; + int len$ = arr$.length; + for (int i$ = 0; i$ < len$; i$++) { + String tName = arr$[i$]; + mCapeList.add(tName.toLowerCase()); + } + (new Thread(this)).start(); + } + + public void run() { + try { + Utils.LOG_INFO("Skip: GT++ Mod: Downloading Cape List."); + @SuppressWarnings("resource") + Scanner tScanner = new Scanner(new URL("https://github.com/draknyte1/GTplusplus/blob/master/SupporterList.txt").openStream()); + while (tScanner.hasNextLine()) { + String tName = tScanner.nextLine(); + if (!this.mCapeList.contains(tName.toLowerCase())) { + this.mCapeList.add(tName.toLowerCase()); + } + } + } catch (Throwable e) { + } + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java new file mode 100644 index 0000000000..fc5ece21d3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/render/GTPP_CapeRenderer.java @@ -0,0 +1,104 @@ +package gtPlusPlus.xmod.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; + +public class GTPP_CapeRenderer + extends RenderPlayer { + private final ResourceLocation[] mCapes = {new ResourceLocation("miscutils:textures/Orange.png"), new ResourceLocation("miscutils:textures/TesterCape.png"), new ResourceLocation("miscutils:textures/TesterCape.png"), new ResourceLocation("miscutils:textures/TesterCape.png")}; + private final Collection<String> mCapeList; + + public GTPP_CapeRenderer(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("draknyte1")) { + tResource = this.mCapes[1]; + } + if (this.mCapeList.contains(aPlayer.getDisplayName().toLowerCase())) { + tResource = this.mCapes[0]; + } + if (aPlayer.getDisplayName().equalsIgnoreCase("fobius")) { + tResource = this.mCapes[1]; + } + if (aPlayer.getDisplayName().equalsIgnoreCase("doomsquirter")) { + tResource = this.mCapes[0]; + } + if (aPlayer.getDisplayName().equalsIgnoreCase("ukdunc")) { + tResource = this.mCapes[0]; + } + if (aPlayer.getDisplayName().equalsIgnoreCase("cantankerousrex")) { + tResource = this.mCapes[1]; + } + if (aPlayer.getDisplayName().equalsIgnoreCase("123_456_789")) { + tResource = this.mCapes[0]; + } + 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); + } + } + } +}
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/Draknyte1.png b/src/resources/assets/miscutils/textures/Orange.png Binary files differindex 21fc187dd3..21fc187dd3 100644 --- a/src/resources/assets/miscutils/textures/Draknyte1.png +++ b/src/resources/assets/miscutils/textures/Orange.png |