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;
|
2018-08-18 23:40:28 -04:00
|
|
|
import com.minelittlepony.avatar.texture.TextureData;
|
|
|
|
import com.minelittlepony.avatar.texture.TextureType;
|
2018-07-27 14:27:32 +02:00
|
|
|
import com.minelittlepony.gui.Button;
|
2018-08-08 14:54:38 +02:00
|
|
|
import com.minelittlepony.gui.IconicButton;
|
2015-08-01 18:36:33 -04:00
|
|
|
import com.mojang.authlib.GameProfile;
|
|
|
|
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
2015-08-12 20:03:54 -04:00
|
|
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
2018-07-27 19:42:37 +02:00
|
|
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
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;
|
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-27 14:27:32 +02:00
|
|
|
private Button btnModeWet;
|
|
|
|
private Button btnModeDry;
|
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-07-08 11:56:18 +02:00
|
|
|
"minelp:textures/cubemap/sugarcubecorner_%d.png",
|
2018-07-05 22:49:28 -04:00
|
|
|
"minelp:textures/cubemap/quillsandsofas_%d.png"
|
|
|
|
};
|
|
|
|
|
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();
|
|
|
|
|
2018-08-08 14:54:38 +02:00
|
|
|
addButton(btnModeWet = new IconicButton(width - 25, 137, sender -> {
|
2018-07-27 19:42:37 +02:00
|
|
|
setWet(true);
|
2018-08-08 14:54:38 +02:00
|
|
|
}).setIcon(new ItemStack(Items.WATER_BUCKET))).setEnabled(!isWet).setTooltip("minelp.mode.wet");
|
2018-07-28 09:26:40 +02:00
|
|
|
|
2018-08-08 14:54:38 +02:00
|
|
|
addButton(btnModeDry = new IconicButton(width - 25, 118, sender -> {
|
2018-07-27 19:42:37 +02:00
|
|
|
setWet(false);
|
2018-08-08 14:54:38 +02:00
|
|
|
}).setIcon(new ItemStack(Items.BUCKET))).setEnabled(isWet).setTooltip("minelp.mode.dry");
|
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-07-27 19:42:37 +02:00
|
|
|
if (wet == isWet) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mc.getSoundHandler().playSound(PositionedSoundRecord.getMasterRecord(SoundEvents.BLOCK_BREWING_STAND_BREW, 1));
|
|
|
|
|
2018-07-27 14:27:32 +02:00
|
|
|
isWet = wet;
|
|
|
|
localPlayer.releaseTextures();
|
2018-07-01 17:33:30 +02:00
|
|
|
|
|
|
|
btnModeDry.enabled = isWet;
|
|
|
|
btnModeWet.enabled = !isWet;
|
|
|
|
|
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-18 23:40:28 -04:00
|
|
|
protected void onSetLocalSkin(TextureType type) {
|
2016-11-24 23:40:19 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
2018-08-18 23:40:28 -04:00
|
|
|
if (type == TextureType.SKIN) {
|
|
|
|
ponyManager.removePony(localPlayer.getLocal(TextureType.SKIN).getTexture());
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-08-18 23:40:28 -04:00
|
|
|
protected void onSetRemoteSkin(TextureType type, TextureData texture) {
|
2016-12-21 01:20:02 -05:00
|
|
|
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
2018-08-18 23:40:28 -04:00
|
|
|
if (type == TextureType.SKIN) {
|
|
|
|
ponyManager.removePony(texture.getLocation());
|
2017-06-16 01:41:36 -04:00
|
|
|
}
|
2015-08-01 18:36:33 -04:00
|
|
|
}
|
|
|
|
}
|