mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 13:57:59 +01:00
Strip out the default/slim constants
This commit is contained in:
parent
664f8ac6a4
commit
61de5ca0a4
6 changed files with 39 additions and 11 deletions
|
@ -320,7 +320,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
|||
metadata = new HashMap<>();
|
||||
} else if (metadata.containsKey("model")) {
|
||||
// try to reset the model.
|
||||
metadata.put("model", metadata.get("model").contains("slim") ? "slim" : "default");
|
||||
metadata.put("model", VanillaModels.of(metadata.get("model")));
|
||||
}
|
||||
|
||||
for (ISkinParser parser : skinParsers) {
|
||||
|
|
22
src/hdskins/java/com/voxelmodpack/hdskins/VanillaModels.java
Normal file
22
src/hdskins/java/com/voxelmodpack/hdskins/VanillaModels.java
Normal file
|
@ -0,0 +1,22 @@
|
|||
package com.voxelmodpack.hdskins;
|
||||
|
||||
public class VanillaModels {
|
||||
public static final String SLIM = "slim";
|
||||
public static final String DEFAULT = "default";
|
||||
|
||||
public static String of(String model) {
|
||||
return model != null && model.contains(SLIM) ? SLIM : DEFAULT;
|
||||
}
|
||||
|
||||
public static String nonNull(String model) {
|
||||
return model == null ? DEFAULT : SLIM;
|
||||
}
|
||||
|
||||
public static boolean isSlim(String model) {
|
||||
return SLIM.equals(model);
|
||||
}
|
||||
|
||||
public static boolean isFat(String model) {
|
||||
return DEFAULT.equals(model);
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import com.voxelmodpack.hdskins.HDSkinManager;
|
|||
import com.voxelmodpack.hdskins.SkinChooser;
|
||||
import com.voxelmodpack.hdskins.SkinUploader;
|
||||
import com.voxelmodpack.hdskins.SkinUploader.ISkinUploadHandler;
|
||||
import com.voxelmodpack.hdskins.VanillaModels;
|
||||
import com.voxelmodpack.hdskins.server.SkinServer;
|
||||
import com.voxelmodpack.hdskins.upload.GLWindow;
|
||||
import com.voxelmodpack.hdskins.util.CallableFutures;
|
||||
|
@ -173,15 +174,15 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
addButton(new Button(width / 2 - 50, height - 25, 100, 20, "hdskins.options.close", sender ->
|
||||
mc.displayGuiScreen(new GuiMainMenu())));
|
||||
|
||||
addButton(btnModeSteve = new FeatureSwitch(width - 25, 32, sender -> switchSkinMode("default")))
|
||||
addButton(btnModeSteve = new FeatureSwitch(width - 25, 32, sender -> switchSkinMode(VanillaModels.DEFAULT)))
|
||||
.setIcon(new ItemStack(Items.LEATHER_LEGGINGS), 0x3c5dcb)
|
||||
.setEnabled("slim".equals(uploader.getMetadataField("model")))
|
||||
.setEnabled(VanillaModels.isSlim(uploader.getMetadataField("model")))
|
||||
.setTooltip("hdskins.mode.steve")
|
||||
.setTooltipOffset(0, 10);
|
||||
|
||||
addButton(btnModeAlex = new FeatureSwitch(width - 25, 51, sender -> switchSkinMode("slim")))
|
||||
addButton(btnModeAlex = new FeatureSwitch(width - 25, 51, sender -> switchSkinMode(VanillaModels.SLIM)))
|
||||
.setIcon(new ItemStack(Items.LEATHER_LEGGINGS), 0xfff500)
|
||||
.setEnabled("default".equals(uploader.getMetadataField("model")))
|
||||
.setEnabled(VanillaModels.isFat(uploader.getMetadataField("model")))
|
||||
.setTooltip("hdskins.mode.alex")
|
||||
.setTooltipOffset(0, 10);
|
||||
|
||||
|
@ -248,7 +249,7 @@ public class GuiSkins extends GameGui implements ISkinUploadHandler {
|
|||
protected void switchSkinMode(String model) {
|
||||
playSound(SoundEvents.BLOCK_BREWING_STAND_BREW);
|
||||
|
||||
boolean thinArmType = "slim".equals(model);
|
||||
boolean thinArmType = VanillaModels.isSlim(model);
|
||||
|
||||
btnModeSteve.enabled = thinArmType;
|
||||
btnModeAlex.enabled = !thinArmType;
|
||||
|
|
|
@ -4,6 +4,8 @@ import net.minecraft.client.renderer.IImageBuffer;
|
|||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.voxelmodpack.hdskins.VanillaModels;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class PreviewTexture extends ThreadDownloadImageData {
|
||||
|
@ -17,7 +19,7 @@ public class PreviewTexture extends ThreadDownloadImageData {
|
|||
public PreviewTexture(@Nullable String model, String url, ResourceLocation fallbackTexture, @Nullable IImageBuffer imageBuffer) {
|
||||
super(null, url, fallbackTexture, imageBuffer);
|
||||
|
||||
this.model = model == null ? "default" : model;
|
||||
this.model = VanillaModels.nonNull(model);
|
||||
this.fileUrl = url;
|
||||
}
|
||||
|
||||
|
@ -40,6 +42,6 @@ public class PreviewTexture extends ThreadDownloadImageData {
|
|||
}
|
||||
|
||||
public boolean usesThinArms() {
|
||||
return "slim".equals(model);
|
||||
return VanillaModels.isSlim(model);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.minelittlepony;
|
|||
import com.mojang.authlib.GameProfile;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
import com.voxelmodpack.hdskins.ISkinParser;
|
||||
import com.voxelmodpack.hdskins.VanillaModels;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -13,7 +15,7 @@ public class PonySkinParser implements ISkinParser {
|
|||
public void parse(GameProfile profile, MinecraftProfileTexture.Type type, ResourceLocation resource,
|
||||
Map<String, String> metadata) {
|
||||
if (type == MinecraftProfileTexture.Type.SKIN) {
|
||||
boolean slim = "slim".equals(metadata.get("model"));
|
||||
boolean slim = VanillaModels.isSlim(metadata.get("model"));
|
||||
// TODO use proper model metadata system
|
||||
|
||||
metadata.put("model", MineLittlePony.getInstance().getManager()
|
||||
|
|
|
@ -7,12 +7,13 @@ import com.minelittlepony.render.player.RenderSeaponyPlayer;
|
|||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
||||
import com.minelittlepony.model.ModelWrapper;
|
||||
import com.voxelmodpack.hdskins.VanillaModels;
|
||||
|
||||
public enum PlayerModels {
|
||||
/**
|
||||
* The default non-pony model. This is typically handled my the vanilla renderer.
|
||||
*/
|
||||
DEFAULT("default", "slim", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
||||
DEFAULT(VanillaModels.DEFAULT, VanillaModels.SLIM, () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
||||
EARTH("earthpony", () -> PMAPI.earthpony, () -> PMAPI.earthponySmall),
|
||||
PEGASUS("pegasus", () -> PMAPI.pegasus, () -> PMAPI.pegasusSmall),
|
||||
BATPONY("batpony", () -> PMAPI.bat, () -> PMAPI.batSmall),
|
||||
|
@ -32,7 +33,7 @@ public enum PlayerModels {
|
|||
private final String normalKey, slimKey;
|
||||
|
||||
PlayerModels(String key, ModelResolver normal, ModelResolver slim) {
|
||||
this(key, "slim" + key, normal, slim);
|
||||
this(key, VanillaModels.SLIM + key, normal, slim);
|
||||
}
|
||||
|
||||
PlayerModels(String normalKey, String slimKey, ModelResolver normal, ModelResolver slim) {
|
||||
|
|
Loading…
Reference in a new issue