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;
|
2018-10-20 16:03:53 +02:00
|
|
|
import com.minelittlepony.gui.IconicToggle;
|
2018-10-20 16:57:49 +02:00
|
|
|
import com.minelittlepony.gui.Style;
|
2018-12-09 23:18:17 +02:00
|
|
|
import com.minelittlepony.pony.data.PonyManager;
|
2015-08-01 18:36:33 -04:00
|
|
|
import com.mojang.authlib.GameProfile;
|
2018-08-18 23:44:32 -04:00
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
|
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
2015-08-01 18:36:33 -04:00
|
|
|
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
2015-08-12 20:03:54 -04:00
|
|
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
2018-09-06 13:44:41 +02:00
|
|
|
import com.voxelmodpack.hdskins.server.SkinServer;
|
|
|
|
|
2018-07-01 17:33:30 +02:00
|
|
|
import net.minecraft.init.Items;
|
2018-07-27 19:42:37 +02:00
|
|
|
import net.minecraft.init.SoundEvents;
|
2018-07-01 17:33:30 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
2018-08-18 23:44:32 -04:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-08-01 18:36:33 -04:00
|
|
|
|
2018-08-19 17:55:38 -04:00
|
|
|
import java.util.List;
|
|
|
|
|
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 boolean isWet = false;
|
|
|
|
|
2018-07-05 22:49:28 -04:00
|
|
|
private static final String[] panoramas = new String[] {
|
2018-10-12 09:51:15 +02:00
|
|
|
"minelittlepony:textures/cubemap/sugarcubecorner_%d.png",
|
2018-10-12 10:24:24 +02:00
|
|
|
"minelittlepony:textures/cubemap/quillsandsofas_%d.png",
|
|
|
|
"minelittlepony:textures/cubemap/sweetappleacres_%d.png"
|
2018-07-05 22:49:28 -04:00
|
|
|
};
|
|
|
|
|
2018-08-19 17:55:38 -04:00
|
|
|
public GuiSkinsMineLP(List<SkinServer> servers) {
|
|
|
|
super(servers);
|
|
|
|
}
|
|
|
|
|
2015-08-01 18:36:33 -04:00
|
|
|
@Override
|
2015-08-12 20:03:54 -04:00
|
|
|
protected EntityPlayerModel getModel(GameProfile profile) {
|
2018-08-21 21:18:20 +02:00
|
|
|
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();
|
|
|
|
|
2018-10-20 16:57:49 +02:00
|
|
|
addButton(new IconicToggle(width - 25, 142, 2, sender -> setWet(sender.getValue() == 1))
|
|
|
|
.setStyle(new Style().setIcon(new ItemStack(Items.WATER_BUCKET)).setTooltip("minelp.mode.wet"), 1)
|
|
|
|
.setStyle(new Style().setIcon(new ItemStack(Items.BUCKET)).setTooltip("minelp.mode.dry"), 0)
|
|
|
|
.setValue(isWet ? 1 : 0)
|
2018-10-20 16:03:53 +02:00
|
|
|
.setTooltipOffset(0, 10));
|
2018-07-01 17:33:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void initPanorama() {
|
2018-07-05 22:49:28 -04:00
|
|
|
int i = (int)Math.floor(Math.random() * panoramas.length);
|
|
|
|
|
|
|
|
panorama.setSource(panoramas[i]);
|
2018-07-01 17:33:30 +02:00
|
|
|
}
|
|
|
|
|
2018-07-27 14:27:32 +02:00
|
|
|
protected void setWet(boolean wet) {
|
2018-08-22 21:55:30 +02:00
|
|
|
playSound(SoundEvents.BLOCK_BREWING_STAND_BREW);
|
2018-07-27 19:42:37 +02:00
|
|
|
|
2018-07-27 14:27:32 +02:00
|
|
|
isWet = wet;
|
|
|
|
localPlayer.releaseTextures();
|
2018-07-01 17:33:30 +02:00
|
|
|
|
2018-07-27 14:27:32 +02:00
|
|
|
((EntityPonyModel)localPlayer).setWet(isWet);
|
|
|
|
((EntityPonyModel)remotePlayer).setWet(isWet);
|
2018-07-01 17:33:30 +02:00
|
|
|
}
|
|
|
|
|
2015-08-01 18:36:33 -04:00
|
|
|
@Override
|
2018-08-21 21:18:20 +02:00
|
|
|
public void onSetLocalSkin(Type type) {
|
|
|
|
super.onSetLocalSkin(type);
|
2018-08-22 21:55:30 +02:00
|
|
|
|
2016-11-24 23:40:19 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
2018-08-22 21:55:30 +02:00
|
|
|
if (type == Type.SKIN) {
|
2018-08-18 23:44:32 -04:00
|
|
|
ponyManager.removePony(localPlayer.getLocal(Type.SKIN).getTexture());
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-08-21 21:18:20 +02:00
|
|
|
public void onSetRemoteSkin(Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
|
|
|
super.onSetRemoteSkin(type, location, profileTexture);
|
|
|
|
|
2016-12-21 01:20:02 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
2018-08-22 21:55:30 +02:00
|
|
|
if (type == Type.SKIN) {
|
2018-08-21 21:18:20 +02:00
|
|
|
ponyManager.removePony(location);
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
}
|