2016-11-16 23:45:04 -05:00
|
|
|
package com.minelittlepony.hdskins.gui;
|
2015-08-01 18:36:33 -04:00
|
|
|
|
2016-11-24 23:40:19 -05:00
|
|
|
import com.minelittlepony.MineLittlePony;
|
2016-11-16 23:45:04 -05:00
|
|
|
import com.minelittlepony.PonyManager;
|
2015-08-01 18:36:33 -04:00
|
|
|
import com.mojang.authlib.GameProfile;
|
2016-12-21 01:20:02 -05:00
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
2018-05-01 12:38:13 +02:00
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
2018-07-03 19:07:36 +02:00
|
|
|
import com.voxelmodpack.hdskins.gui.CubeMapRegistry;
|
2015-08-01 18:36:33 -04:00
|
|
|
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
2018-07-01 17:33:30 +02:00
|
|
|
import com.voxelmodpack.hdskins.gui.GuiItemStackButton;
|
2015-08-12 20:03:54 -04:00
|
|
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
2018-07-01 17:33:30 +02:00
|
|
|
|
|
|
|
import net.minecraft.client.gui.GuiButton;
|
|
|
|
import net.minecraft.client.resources.I18n;
|
|
|
|
import net.minecraft.init.Items;
|
|
|
|
import net.minecraft.item.ItemStack;
|
2017-06-16 01:41:36 -04:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-08-01 18:36:33 -04:00
|
|
|
|
2018-04-25 21:29:49 +02:00
|
|
|
/**
|
|
|
|
* Skin uploading GUI. Usually displayed over the main menu.
|
|
|
|
*/
|
2015-08-12 20:03:54 -04:00
|
|
|
public class GuiSkinsMineLP extends GuiSkins {
|
2015-08-01 18:36:33 -04:00
|
|
|
|
2018-06-10 18:54:50 +02:00
|
|
|
private PonyManager ponyManager = MineLittlePony.getInstance().getManager();
|
2016-05-18 05:48:46 -04:00
|
|
|
|
2018-07-01 17:33:30 +02:00
|
|
|
private GuiButton btnModeWet;
|
|
|
|
private GuiButton btnModeDry;
|
|
|
|
|
|
|
|
private boolean isWet = false;
|
|
|
|
|
2015-08-01 18:36:33 -04:00
|
|
|
@Override
|
2015-08-12 20:03:54 -04:00
|
|
|
protected EntityPlayerModel getModel(GameProfile profile) {
|
|
|
|
return new EntityPonyModel(profile);
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
|
2018-07-01 17:33:30 +02:00
|
|
|
@Override
|
|
|
|
public void initGui() {
|
|
|
|
super.initGui();
|
|
|
|
|
|
|
|
buttonList.add(btnModeWet = new GuiItemStackButton(7, 2, 99, new ItemStack(Items.WATER_BUCKET)));
|
|
|
|
buttonList.add(btnModeDry = new GuiItemStackButton(8, 2, 80, new ItemStack(Items.BUCKET)));
|
|
|
|
|
|
|
|
btnModeDry.enabled = isWet;
|
|
|
|
btnModeWet.enabled = !isWet;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initPanorama() {
|
2018-07-03 19:07:36 +02:00
|
|
|
panorama.setSource(CubeMapRegistry.pickResource());
|
2018-07-01 17:33:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void actionPerformed(GuiButton guiButton) {
|
|
|
|
super.actionPerformed(guiButton);
|
|
|
|
|
|
|
|
if (guiButton.id == this.btnModeDry.id) {
|
|
|
|
this.isWet = false;
|
|
|
|
this.localPlayer.releaseTextures();
|
|
|
|
} else if (guiButton.id == this.btnModeWet.id) {
|
|
|
|
this.isWet = true;
|
|
|
|
this.localPlayer.releaseTextures();
|
|
|
|
}
|
|
|
|
|
|
|
|
btnModeDry.enabled = isWet;
|
|
|
|
btnModeWet.enabled = !isWet;
|
|
|
|
|
|
|
|
((EntityPonyModel)this.localPlayer).setWet(isWet);
|
|
|
|
((EntityPonyModel)this.remotePlayer).setWet(isWet);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void drawScreen(int mouseX, int mouseY, float partialTick) {
|
|
|
|
super.drawScreen(mouseX, mouseY, partialTick);
|
|
|
|
|
|
|
|
if (btnModeDry.isMouseOver() || btnModeWet.isMouseOver()) {
|
|
|
|
int y = Math.max(mouseY, 16);
|
|
|
|
String text;
|
|
|
|
if (btnModeDry.isMouseOver()) {
|
|
|
|
text = "minelp.mode.dry";
|
|
|
|
} else {
|
|
|
|
text = "minelp.mode.wet";
|
|
|
|
}
|
|
|
|
this.drawHoveringText(I18n.format(text), mouseX, y);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2015-08-01 18:36:33 -04:00
|
|
|
@Override
|
2018-05-01 12:38:13 +02:00
|
|
|
protected void onSetLocalSkin(Type type) {
|
2016-11-24 23:40:19 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
2018-05-01 12:38:13 +02:00
|
|
|
if (type == Type.SKIN) {
|
2018-04-27 13:49:33 +02:00
|
|
|
ponyManager.removePony(localPlayer.getSkinTexture());
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-05-01 12:38:13 +02:00
|
|
|
protected void onSetRemoteSkin(Type type, ResourceLocation resource, MinecraftProfileTexture profileTexture) {
|
2016-12-21 01:20:02 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
2018-07-03 19:07:36 +02:00
|
|
|
if (ponyManager != null && resource != null && type == Type.SKIN) {
|
2018-05-01 12:38:13 +02:00
|
|
|
ponyManager.removePony(resource);
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
}
|