Added Quark support

This commit is contained in:
Kino 2017-03-17 21:06:32 -04:00
parent c20c8c6af4
commit 31bb71cbb2
4 changed files with 51 additions and 28 deletions

View file

@ -1,21 +1,16 @@
package com.legacy.aether.client;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.network.play.client.CPacketClientStatus;
import net.minecraft.stats.AchievementList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.GuiScreenEvent.InitGuiEvent;
import net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent;
import net.minecraftforge.client.event.RenderHandEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
@ -121,25 +116,6 @@ public class AetherClientEvents
}
}
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onGuiRender(InitGuiEvent.Post event)
{
ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());
for (int size = 0; size < event.getButtonList().size(); ++size)
{
GuiButton button = event.getButtonList().get(size);
if (Loader.isModLoaded("Baubles"))
{
if (button.id == 55)
{
button.xPosition = (resolution.getScaledWidth() / 2) - 39;
}
}
}
}
@SubscribeEvent
public void onStopPotionEffect(PotionShiftEvent event)
{

View file

@ -2,7 +2,9 @@ package com.legacy.aether.client.gui.inventory;
import java.io.IOException;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader;
@ -13,6 +15,7 @@ import com.legacy.aether.client.gui.button.GuiButtonPerks;
import com.legacy.aether.server.containers.ContainerAccessories;
import com.legacy.aether.server.player.PlayerAether;
import com.legacy.aether.server.player.perks.AetherRankings;
import com.legacy.aether.universal.AetherCompatibility;
public class GuiAccessories extends GuiInventory
{
@ -42,6 +45,37 @@ public class GuiAccessories extends GuiInventory
}
}
@Override
public void setWorldAndResolution(Minecraft mc, int width, int height)
{
super.setWorldAndResolution(mc, width, height);
for (int size = 0; size < this.buttonList.size(); ++size)
{
GuiButton button = this.buttonList.get(size);
int id = button.id;
if (id == 13211)
{
this.setButtonPosition(button, this.width / 2 + 65, this.height / 2 - 23);
}
if (Loader.isModLoaded("Baubles"))
{
if (id == 55)
{
button.xPosition = (new ScaledResolution(mc).getScaledWidth() / 2) - 39;
}
}
}
}
private void setButtonPosition(GuiButton button, int xPosition, int yPosition)
{
button.xPosition = xPosition;
button.yPosition = yPosition;
}
@Override
protected void actionPerformed(GuiButton button) throws IOException
{
@ -62,7 +96,7 @@ public class GuiAccessories extends GuiInventory
{
GL11.glColor3d(1.0D, 1.0D, 1.0D);
this.mc.renderEngine.bindTexture(Loader.isModLoaded("inventorytweaks") ? ACCESSORIES_SHIFTED : ACCESSORIES);
this.mc.renderEngine.bindTexture(AetherCompatibility.visualModsLoaded() ? ACCESSORIES_SHIFTED : ACCESSORIES);
this.drawTexturedModalRect(this.width / 2 - 88, this.height / 2 - 166 / 2, 0, 0, 176, 166);

View file

@ -8,13 +8,13 @@ import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.Loader;
import com.legacy.aether.server.containers.inventory.InventoryAccessories;
import com.legacy.aether.server.containers.slots.SlotAccessory;
import com.legacy.aether.server.containers.util.AccessoryType;
import com.legacy.aether.server.items.accessories.ItemAccessory;
import com.legacy.aether.server.player.PlayerAether;
import com.legacy.aether.universal.AetherCompatibility;
public class ContainerAccessories extends ContainerPlayer
{
@ -37,7 +37,7 @@ public class ContainerAccessories extends ContainerPlayer
{
if (slot.slotNumber == 0)
{
if (!Loader.isModLoaded("inventorytweaks"))
if (!AetherCompatibility.visualModsLoaded())
{
slot.yDisplayPosition += 34;
slot.xDisplayPosition -= 11;
@ -50,7 +50,7 @@ public class ContainerAccessories extends ContainerPlayer
}
else if (slot.slotNumber > 0 && slot.slotNumber < 5)
{
if (!Loader.isModLoaded("inventorytweaks"))
if (!AetherCompatibility.visualModsLoaded())
{
slot.yDisplayPosition -= 10;
slot.xDisplayPosition += 36;

View file

@ -0,0 +1,13 @@
package com.legacy.aether.universal;
import net.minecraftforge.fml.common.Loader;
public class AetherCompatibility
{
public static boolean visualModsLoaded()
{
return Loader.isModLoaded("inventorytweaks") || Loader.isModLoaded("quark") || Loader.isModLoaded("Quark");
}
}