Implemented toggle settings for halo and dev glow.

This commit is contained in:
bconlon 2020-07-11 12:55:09 -07:00
parent 7a3e7ad21c
commit b4d97e9011
11 changed files with 271 additions and 27 deletions

View file

@ -2,19 +2,22 @@ package com.legacy.aether.client;
import java.util.List;
import com.legacy.aether.client.gui.GuiCustomizationScreen;
import com.legacy.aether.client.gui.GuiEnterAether;
import com.legacy.aether.client.gui.button.GuiCustomizationScreenButton;
import com.legacy.aether.client.gui.button.GuiGlowButton;
import com.legacy.aether.client.gui.button.GuiHaloButton;
import com.legacy.aether.client.gui.menu.AetherMainMenu;
import com.legacy.aether.client.gui.menu.GuiMenuToggleButton;
import com.legacy.aether.player.perks.AetherRankings;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiDownloadTerrain;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiContainerCreative;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
@ -226,6 +229,17 @@ public class AetherClientEvents {
{
Minecraft.getMinecraft().displayGuiScreen(new AetherMainMenu());
}
if (event.gui.getClass() == GuiOptions.class)
{
if (Minecraft.getMinecraft().thePlayer != null)
{
if (AetherRankings.isRankedPlayer(Minecraft.getMinecraft().thePlayer.getUniqueID()))
{
event.buttonList.add(new GuiCustomizationScreenButton(545, event.gui.width / 2 - 155, event.gui.height / 6 + 48 - 6, 150, 20, I18n.format("gui.options.perk_customization")));
}
}
}
}
@SubscribeEvent
@ -266,6 +280,11 @@ public class AetherClientEvents {
if ((clazz == GuiInventory.class || clazz == GuiContainerCreative.class) && event.button.id == 18067) {
AetherNetwork.sendToServer(new PacketOpenContainer(AetherGuiHandler.accessories));
}
if (event.button.getClass() == GuiCustomizationScreenButton.class)
{
Minecraft.getMinecraft().displayGuiScreen(new GuiCustomizationScreen(event.gui));
}
}
@SubscribeEvent

View file

@ -0,0 +1,89 @@
package com.legacy.aether.client.gui;
import com.legacy.aether.client.gui.button.GuiGlowButton;
import com.legacy.aether.client.gui.button.GuiHaloButton;
import com.legacy.aether.network.AetherNetwork;
import com.legacy.aether.network.packets.PacketPerkChanged;
import com.legacy.aether.player.PlayerAether;
import com.legacy.aether.player.perks.AetherRankings;
import com.legacy.aether.player.perks.util.EnumAetherPerkType;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
@SideOnly(Side.CLIENT)
public class GuiCustomizationScreen extends GuiScreen
{
private final GuiScreen parentScreen;
private String title;
public GuiCustomizationScreen(GuiScreen parentScreenIn)
{
this.parentScreen = parentScreenIn;
}
@Override
public void initGui()
{
int i = 0;
this.title = I18n.format("gui.options.perk_customization.title");
this.buttonList.add(new GuiHaloButton(this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1)));
++i;
if (AetherRankings.isDeveloper(Minecraft.getMinecraft().thePlayer.getUniqueID()))
{
this.buttonList.add(new GuiGlowButton(this.width / 2 - 155 + i % 2 * 160, this.height / 6 + 24 * (i >> 1)));
++i;
}
if (i % 2 == 1)
{
++i;
}
this.buttonList.add(new GuiButton(200, this.width / 2 - 100, this.height / 6 + 24 * (i >> 1), I18n.format("gui.done")));
}
@Override
protected void actionPerformed(GuiButton button)
{
if (button.enabled)
{
if (button.id == 200)
{
this.mc.gameSettings.saveOptions();
this.mc.displayGuiScreen(this.parentScreen);
}
else if (button.id == 201)
{
PlayerAether player = PlayerAether.get(mc.thePlayer);
boolean enableHalo = !player.shouldRenderHalo;
player.shouldRenderHalo = enableHalo;
AetherNetwork.sendToServer(new PacketPerkChanged(player.getEntity().getEntityId(), EnumAetherPerkType.Halo, player.shouldRenderHalo));
}
else if (button.id == 202)
{
PlayerAether player = PlayerAether.get(mc.thePlayer);
boolean enableGlow = !player.shouldRenderGlow;
player.shouldRenderGlow = enableGlow;
AetherNetwork.sendToServer(new PacketPerkChanged(player.getEntity().getEntityId(), EnumAetherPerkType.Glow, player.shouldRenderGlow));
}
}
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
this.drawDefaultBackground();
this.drawCenteredString(this.fontRendererObj, this.title, this.width / 2, 20, 16777215);
super.drawScreen(mouseX, mouseY, partialTicks);
}
}

View file

@ -0,0 +1,11 @@
package com.legacy.aether.client.gui.button;
import net.minecraft.client.gui.GuiButton;
public class GuiCustomizationScreenButton extends GuiButton
{
public GuiCustomizationScreenButton(int p_i1021_1_, int p_i1021_2_, int p_i1021_3_, int p_i1021_4_, int p_i1021_5_, String p_i1021_6_)
{
super(p_i1021_1_, p_i1021_2_, p_i1021_3_, p_i1021_4_, p_i1021_5_, p_i1021_6_);
}
}

View file

@ -0,0 +1,30 @@
package com.legacy.aether.client.gui.button;
import com.legacy.aether.player.PlayerAether;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
public class GuiGlowButton extends GuiButton
{
public GuiGlowButton(int xPos, int yPos)
{
super(202, xPos, yPos, 150, 20, I18n.format("gui.button.glow"));
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
PlayerAether player = PlayerAether.get(mc.thePlayer);
if (player.shouldRenderGlow)
{
this.displayString = I18n.format("gui.button.glow") + " " + I18n.format("options.on");
}
else
{
this.displayString = I18n.format("gui.button.glow") + " " + I18n.format("options.off");
}
super.drawButton(mc, mouseX, mouseY);
}
}

View file

@ -0,0 +1,30 @@
package com.legacy.aether.client.gui.button;
import com.legacy.aether.player.PlayerAether;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
public class GuiHaloButton extends GuiButton
{
public GuiHaloButton(int xPos, int yPos)
{
super(201, xPos, yPos, 150, 20, I18n.format("gui.button.halo"));
}
public void drawButton(Minecraft mc, int mouseX, int mouseY)
{
PlayerAether player = PlayerAether.get(mc.thePlayer);
if (player.shouldRenderHalo)
{
this.displayString = I18n.format("gui.button.halo") + " " + I18n.format("options.on");
}
else
{
this.displayString = I18n.format("gui.button.halo") + " " + I18n.format("options.off");
}
super.drawButton(mc, mouseX, mouseY);
}
}

View file

@ -54,7 +54,7 @@ public class PlayerAetherRenderer {
this.mc = Minecraft.getMinecraft();
this.modelHalo = new ModelHalo();
this.modelGlow = new ModelBiped(0.005F);
this.modelGlow = new ModelBiped(0.7F);
this.modelMisc = new ModelBiped(1.0F);
this.modelWings = new ModelAetherWings(1.0F);
}
@ -347,7 +347,7 @@ public class PlayerAetherRenderer {
}
}
if (AetherRankings.isRankedPlayer(player.getUniqueID()) && PlayerAether.get(player).shouldRenderHalo) {
if (AetherRankings.isRankedPlayer(player.getUniqueID()) && PlayerAether.get(player).shouldRenderHalo && !player.isInvisible()) {
float f9 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * partialTicks - (player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks);
GL11.glPushMatrix();
@ -364,7 +364,7 @@ public class PlayerAetherRenderer {
GL11.glPopMatrix();
}
if (player.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837")) {
if (player.getUniqueID().toString().equals("cf51ef47-04a8-439a-aa41-47d871b0b837") || AetherRankings.isDeveloper(player.getUniqueID()) && playerAether.shouldRenderGlow && !player.isInvisible()) {
this.mc.getTextureManager().bindTexture(((AbstractClientPlayer) player).getLocationSkin());
GL11.glPushMatrix();

View file

@ -12,7 +12,7 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
public int entityID;
public boolean renderHalo;
public boolean renderHalo, renderGlow;
public DonatorMoaSkin moaSkin;
@ -29,6 +29,9 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
if (type == EnumAetherPerkType.Halo) {
this.renderHalo = info;
}
else if (type == EnumAetherPerkType.Glow) {
this.renderGlow = info;
}
}
public PacketPerkChanged(int entityID, EnumAetherPerkType type, DonatorMoaSkin moa) {
@ -44,6 +47,8 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
if (this.perkType == EnumAetherPerkType.Halo) {
this.renderHalo = buf.readBoolean();
} else if (this.perkType == EnumAetherPerkType.Glow) {
this.renderGlow = buf.readBoolean();
} else if (this.perkType == EnumAetherPerkType.Moa) {
this.moaSkin = DonatorMoaSkin.readMoaSkin(buf);
}
@ -56,6 +61,8 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
if (this.perkType == EnumAetherPerkType.Halo) {
buf.writeBoolean(this.renderHalo);
} else if (this.perkType == EnumAetherPerkType.Glow) {
buf.writeBoolean(this.renderGlow);
} else if (this.perkType == EnumAetherPerkType.Moa) {
this.moaSkin.writeMoaSkin(buf);
}
@ -73,6 +80,8 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
instance.shouldRenderHalo = message.renderHalo;
} else if (message.perkType == EnumAetherPerkType.Moa) {
instance.donatorMoaSkin = message.moaSkin;
} else if (message.perkType == EnumAetherPerkType.Glow) {
instance.shouldRenderGlow = message.renderGlow;
}
}
}
@ -90,9 +99,9 @@ public class PacketPerkChanged extends AetherPacket<PacketPerkChanged> {
instance.shouldRenderHalo = message.renderHalo;
} else if (message.perkType == EnumAetherPerkType.Moa) {
instance.donatorMoaSkin = message.moaSkin;
} else if (message.perkType == EnumAetherPerkType.Glow) {
instance.shouldRenderGlow = message.renderGlow;
}
AetherNetwork.sendToAll(message);
}
}
}

View file

@ -7,6 +7,10 @@ import java.util.UUID;
import com.legacy.aether.Aether;
import com.legacy.aether.entities.passive.mountable.EntityParachute;
import com.legacy.aether.items.ItemsAether;
import com.legacy.aether.network.AetherNetwork;
import com.legacy.aether.network.packets.PacketPerkChanged;
import com.legacy.aether.player.perks.AetherRankings;
import com.legacy.aether.player.perks.util.EnumAetherPerkType;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -62,7 +66,7 @@ public class PlayerAether implements IPlayerAether {
public DonatorMoaSkin donatorMoaSkin = new DonatorMoaSkin();
public boolean shouldRenderHalo;
public boolean shouldRenderHalo, shouldRenderGlow;
private boolean isJumping;
@ -89,6 +93,8 @@ public class PlayerAether implements IPlayerAether {
private ChunkCoordinates bedLocation;
public PlayerAether() {
this.shouldRenderHalo = true;
this.shouldRenderGlow = false;
this.abilities.addAll(Arrays.<IAetherAbility>asList(new AbilityAccessories(this), new AbilityArmor(this), new AbilityFlight(this), new AbilityRepulsion(this)));
}
@ -104,6 +110,12 @@ public class PlayerAether implements IPlayerAether {
@Override
public void onUpdate() {
if (!this.player.worldObj.isRemote)
{
AetherNetwork.sendToAll(new PacketPerkChanged(this.getEntity().getEntityId(), EnumAetherPerkType.Halo, this.shouldRenderHalo));
AetherNetwork.sendToAll(new PacketPerkChanged(this.getEntity().getEntityId(), EnumAetherPerkType.Glow, this.shouldRenderGlow));
}
for (int i = 0; i < this.getAbilities().size(); ++i) {
IAetherAbility ability = this.getAbilities().get(i);
@ -349,6 +361,16 @@ public class PlayerAether implements IPlayerAether {
public void saveNBTData(NBTTagCompound compound) {
NBTTagCompound aetherTag = new NBTTagCompound();
if (AetherRankings.isRankedPlayer(this.player.getUniqueID()))
{
aetherTag.setBoolean("halo", this.shouldRenderHalo);
}
if (AetherRankings.isDeveloper(this.player.getUniqueID()))
{
aetherTag.setBoolean("glow", this.shouldRenderGlow);
}
aetherTag.setInteger("shardCount", this.shardCount);
aetherTag.setTag("accessories", this.getAccessoryInventory().writeToNBT(aetherTag));
@ -366,6 +388,16 @@ public class PlayerAether implements IPlayerAether {
public void loadNBTData(NBTTagCompound compound) {
NBTTagCompound aetherTag = compound.getCompoundTag("aetherI");
if (aetherTag.hasKey("halo"))
{
this.shouldRenderHalo = aetherTag.getBoolean("halo");
}
if (aetherTag.hasKey("glow"))
{
this.shouldRenderGlow = aetherTag.getBoolean("glow");
}
this.updateShardCount(aetherTag.getInteger("shardCount"));
this.getAccessoryInventory().readFromNBT(aetherTag.getTagList("accessories", 10));
this.setBedLocation(new ChunkCoordinates(aetherTag.getInteger("bedX"), aetherTag.getInteger("bedY"), aetherTag.getInteger("bedZ")));

View file

@ -8,13 +8,6 @@ public class AetherRankings {
public static HashMap<String, UUID> ranks = new HashMap<String, UUID>();
public static void initialization() {
//Developer
addDeveloperRank("6a0e8505-1556-4ee9-bec0-6af32f05888d"); // 115kino
addDeveloperRank("1d680bb6-2a9a-4f25-bf2f-a1af74361d69"); // Bailey Schaefer (KingPhygieBoo)
//Retired Developer
addRetiredRank("6e8be0ba-e4bb-46af-aea8-2c1f5eec5bc2"); // Brendan Freeman
addRetiredRank("5f112332-0993-4f52-a5ab-9a55dc3173cb"); // JorgeQ
//Gilded Games
addGGRank("13655ac1-584d-4785-b227-650308195121"); // Brandon Pearce
@ -22,6 +15,10 @@ public class AetherRankings {
addGGRank("6fb2f965-6b57-46de-9ef3-0ef4c9b9bdc6"); // Hugo Payn
addGGRank("dc4cf9b2-f601-4eb4-9436-2924836b9f42"); // Jaryt Bustard
addGGRank("c0643897-c500-4f61-a62a-8051801562a9"); // Christian Peterson
addGGRank("58a5d694-a8a6-4605-ab33-d6904107ad5f"); // bconlon
addGGRank("353a859b-ba16-4e6a-8f63-9a8c79ab0071"); // quek_guy
addGGRank("c3e6871e-8e60-490a-8a8d-2bbe35ad1604"); // Raptor__
addGGRank("78c7f290-62aa-4afa-9d9a-f8e6b2f85206"); // NAPPUS
//Retired Gilded Games
addRetiredGGRank("4bfb28a3-005d-4fc9-9238-a55c6c17b575"); // Jon Lachney
@ -29,12 +26,13 @@ public class AetherRankings {
addRetiredGGRank("b5ee3d5d-2ad7-4642-b9d4-6b041ad600a4"); // Emile van Krieken
addRetiredGGRank("ffb94179-dd54-400d-9ece-834720cd7be9"); // Collin Soares
//Celebrities
addCelebrityRank("0e305085-6ef0-4e46-a7b0-18e78827c44b"); // Mr360Games
addCelebrityRank("5f820c39-5883-4392-b174-3125ac05e38c"); // CaptainSparklez
addCelebrityRank("8d945389-6105-4a8d-8be7-088da387d173"); // ClashJTM
addCelebrityRank("20073cb8-a092-47e2-9a60-bca856e62faf"); // ChimneySwift
addCelebrityRank("0c063bfd-3521-413d-a766-50be1d71f00e"); // AntVenom
//Modding Legacy
addDeveloperRank("6a0e8505-1556-4ee9-bec0-6af32f05888d"); // 115kino
addDeveloperRank("1d680bb6-2a9a-4f25-bf2f-a1af74361d69"); // Bailey Schaefer (KingPhygieBoo)
//Retired Modding Legacy
addRetiredRank("6e8be0ba-e4bb-46af-aea8-2c1f5eec5bc2"); // Brendan Freeman
addRetiredRank("5f112332-0993-4f52-a5ab-9a55dc3173cb"); // JorgeQ
//Tester
addTesterRank("cf51ef47-04a8-439a-aa41-47d871b0b837"); // Kito
@ -50,6 +48,13 @@ public class AetherRankings {
addContributor("4f0e8dd5-caf4-4d88-bfa4-1b0f1e13779f"); // Indianajaune
addContributor("6c249311-f939-4e66-9f31-49b753bfb14b"); // InsomniaKitten
addContributor("2b5187c9-dc5d-480e-ab6f-e884e92fce45"); // ItzDennisz
//Celebrities
addCelebrityRank("0e305085-6ef0-4e46-a7b0-18e78827c44b"); // Mr360Games
addCelebrityRank("5f820c39-5883-4392-b174-3125ac05e38c"); // CaptainSparklez
addCelebrityRank("8d945389-6105-4a8d-8be7-088da387d173"); // ClashJTM
addCelebrityRank("20073cb8-a092-47e2-9a60-bca856e62faf"); // ChimneySwift
addCelebrityRank("0c063bfd-3521-413d-a766-50be1d71f00e"); // AntVenom
}
public static UUID getUUID(String string) {
@ -76,6 +81,20 @@ public class AetherRankings {
return false;
}
public static boolean isDeveloper(UUID uuid)
{
if (ranks.get("Aether Legacy Developer-" + uuid.toString()) != null) {
return true;
} else if (ranks.get("Retired Developer-" + uuid.toString()) != null) {
return true; }
else if (ranks.get("Gilded Games-" + uuid.toString()) != null) {
return true; }
else if (ranks.get("Retired Gilded Games-" + uuid.toString()) != null) {
return true; }
return false;
}
public static void addCelebrityRank(String uuid) {
ranks.put("Celeberity-" + uuid, getUUID(uuid));
}

View file

@ -1,7 +1,7 @@
package com.legacy.aether.player.perks.util;
public enum EnumAetherPerkType {
Information(0), Halo(1), Moa(2);
Information(0), Halo(1), Moa(2), Glow(3);
private int perkID;
@ -14,6 +14,6 @@ public enum EnumAetherPerkType {
}
public static EnumAetherPerkType getPerkByID(int id) {
return id == 0 ? Information : id == 1 ? Halo : Moa;
return id == 0 ? Information : id == 1 ? Halo : id == 2 ? Moa : Glow;
}
}

View file

@ -413,4 +413,9 @@ gui.treasure_chest.silver=Silver Treasure Chest
gui.treasure_chest.gold=Gold Treasure Chest
gui.treasure_chest.platinum=Platinum Treasure Chest
gui.skyroot_bed.respawn_point=Respawn point set
gui.skyroot_bed.respawn_point=Respawn point set
gui.options.perk_customization=Perk Customization...
gui.options.perk_customization.title=Perk Customization
gui.button.halo=Halo:
gui.button.glow=Developer Glow: