Update HDSkins
|
@ -21,6 +21,6 @@ org.gradle.daemon=false
|
|||
|
||||
# Dependencies
|
||||
modmenu_version=7.1.0
|
||||
kirin_version=1.15.1
|
||||
hd_skins_version=6.9.3-beta.2
|
||||
kirin_version=1.15.2
|
||||
hd_skins_version=6.10.0+1.20
|
||||
mson_version=1.8.1
|
||||
|
|
|
@ -6,7 +6,9 @@ import com.minelittlepony.api.pony.IPony;
|
|||
import com.minelittlepony.api.pony.IPonyManager;
|
||||
import com.minelittlepony.client.IPreviewModel;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.hdskins.client.dummy.*;
|
||||
import com.minelittlepony.hdskins.client.VanillaModels;
|
||||
import com.minelittlepony.hdskins.client.gui.player.*;
|
||||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -33,12 +35,12 @@ class DummyPony extends DummyPlayer implements IPreviewModel, IPonyManager.Force
|
|||
@Override
|
||||
public String getModel() {
|
||||
if (getTextures().getPosture().getActiveSkinType() == MineLPHDSkins.seaponySkinType) {
|
||||
return getTextures().usesThinSkin() ? "slimseapony" : "seapony";
|
||||
return VanillaModels.isSlim(getTextures().getSkinVariant()) ? "slimseapony" : "seapony";
|
||||
}
|
||||
return IPony.getManager()
|
||||
.getPony(this)
|
||||
.metadata()
|
||||
.getRace()
|
||||
.getModelId(getTextures().usesThinSkin());
|
||||
.getModelId(VanillaModels.isSlim(getTextures().getSkinVariant()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,24 +3,21 @@ package com.minelittlepony.client.hdskins;
|
|||
import com.minelittlepony.api.pony.IPony;
|
||||
import com.minelittlepony.client.GuiPonySettings;
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.common.client.gui.dimension.Bounds;
|
||||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.client.gui.sprite.TextureSprite;
|
||||
import com.minelittlepony.hdskins.client.dummy.PlayerPreview;
|
||||
import com.minelittlepony.hdskins.client.gui.DualCarouselWidget;
|
||||
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
||||
import com.minelittlepony.hdskins.server.SkinServerList;
|
||||
import com.minelittlepony.hdskins.profile.SkinType;
|
||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
/**
|
||||
* Skin uploading GUI. Usually displayed over the main menu.
|
||||
*/
|
||||
class GuiSkinsMineLP extends GuiSkins {
|
||||
|
||||
private static final String[] PANORAMAS = new String[] {
|
||||
"minelittlepony:textures/cubemap/sugarcubecorner",
|
||||
"minelittlepony:textures/cubemap/quillsandsofas",
|
||||
|
@ -29,14 +26,24 @@ class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
public GuiSkinsMineLP(Screen parent, SkinServerList servers) {
|
||||
super(parent, servers);
|
||||
chooser.addSkinChangedEventListener(type -> {
|
||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||
if (type == SkinType.SKIN) {
|
||||
IPony.getManager().removePony(previewer.getLocal().getSkins().get(SkinType.SKIN).getId());
|
||||
}
|
||||
});
|
||||
uploader.addSkinLoadedEventListener((type, location, profileTexture) -> {
|
||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
||||
if (type == SkinType.SKIN) {
|
||||
IPony.getManager().removePony(location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
protected void initServerPreviewButtons(Bounds area) {
|
||||
if (!(parent instanceof GuiPonySettings)) {
|
||||
addButton(new Button(width - 25, height - 90, 20, 20))
|
||||
addButton(new Button(area.right() - 20, area.bottom() + 5, 20, 20))
|
||||
.onClick(sender -> client.setScreen(new GuiPonySettings(this)))
|
||||
.getStyle()
|
||||
.setIcon(new TextureSprite()
|
||||
|
@ -45,21 +52,15 @@ class GuiSkinsMineLP extends GuiSkins {
|
|||
.setTextureSize(16, 16)
|
||||
.setSize(16, 16))
|
||||
.setTooltip("minelp.options.title", 0, 10);
|
||||
super.initServerPreviewButtons(new Bounds(area.top, area.left, area.width - 25, area.height));
|
||||
} else {
|
||||
super.initServerPreviewButtons(area);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
||||
if (modifiers == (GLFW.GLFW_MOD_ALT | GLFW.GLFW_MOD_CONTROL) && keyCode == GLFW.GLFW_KEY_R) {
|
||||
client.reloadResources();
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlayerPreview createPreviewer() {
|
||||
return new PonyPreview();
|
||||
public DualCarouselWidget createPreviewer() {
|
||||
return new PonifiedDualCarouselWidget(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,24 +69,4 @@ class GuiSkinsMineLP extends GuiSkins {
|
|||
|
||||
return new Identifier(PANORAMAS[i]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetLocalSkin(SkinType type) {
|
||||
super.onSetLocalSkin(type);
|
||||
|
||||
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||
if (type == SkinType.SKIN) {
|
||||
previewer.getLocal().ifPresent(local -> IPony.getManager().removePony(local.getTextures().get(SkinType.SKIN).getId()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetRemoteSkin(SkinType type, Identifier location, MinecraftProfileTexture profileTexture) {
|
||||
super.onSetRemoteSkin(type, location, profileTexture);
|
||||
|
||||
MineLittlePony.logger.debug("Invalidating old remote skin, checking updated remote skin");
|
||||
if (type == SkinType.SKIN) {
|
||||
IPony.getManager().removePony(location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import com.minelittlepony.api.pony.*;
|
||||
import com.minelittlepony.common.client.gui.ITextContext;
|
||||
import com.minelittlepony.common.client.gui.dimension.Bounds;
|
||||
import com.minelittlepony.hdskins.client.gui.Carousel;
|
||||
import com.minelittlepony.hdskins.client.gui.player.DummyPlayer;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class LegendOverlayWidget implements Carousel.Element, ITextContext {
|
||||
private static final Bounds LEGEND_BLOCK_BOUNDS = new Bounds(0, 0, 10, 10);
|
||||
|
||||
@Override
|
||||
public void render(DummyPlayer player, DrawContext context, int mouseX, int mouseY) {
|
||||
IPonyData data = IPony.getManager().getPony(player).metadata();
|
||||
int[] index = new int[1];
|
||||
data.getTriggerPixels().forEach((key, value) -> {
|
||||
context.getMatrices().push();
|
||||
int i = index[0]++;
|
||||
int x = 0;//frame.left;
|
||||
int y = 0/*frame.top*/ + (i * 10 + 20);
|
||||
context.getMatrices().translate(x, y, 1);
|
||||
drawLegendBlock(context, 0, 0, 0, mouseX - x, mouseY - y, key, value);
|
||||
context.getMatrices().pop();
|
||||
});
|
||||
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().draw();
|
||||
}
|
||||
|
||||
private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) {
|
||||
context.fill(0, 0, LEGEND_BLOCK_BOUNDS.width, LEGEND_BLOCK_BOUNDS.height, 0xFF003333);
|
||||
context.fill(1, 1, LEGEND_BLOCK_BOUNDS.width - 1, LEGEND_BLOCK_BOUNDS.height - 1, value.getColorCode() | 0xFF000000);
|
||||
|
||||
char symbol = value.name().charAt(0);
|
||||
if (symbol == '[') {
|
||||
symbol = key.charAt(0);
|
||||
}
|
||||
|
||||
context.drawTextWithShadow(getFont(), Text.literal(String.valueOf(symbol).toUpperCase()), 2, 1, 0xFFFFFFFF);
|
||||
|
||||
if (LEGEND_BLOCK_BOUNDS.contains(mouseX, mouseY)) {
|
||||
List<Text> lines = value.getOptions().stream().map(option -> {
|
||||
boolean selected = value.matches(option);
|
||||
return Text.literal((selected ? "* " : " ") + option.name()).styled(s -> {
|
||||
int color = option.getChannelAdjustedColorCode();
|
||||
return (color == 0 ? s : s.withColor(color)).withItalic(selected);
|
||||
});
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
lines.add(0, Text.of(key.toUpperCase() + ": " + value.getHexValue()));
|
||||
if (lines.size() == 1) {
|
||||
lines.add(Text.literal(value.name()).styled(s -> {
|
||||
int color = value.getChannelAdjustedColorCode();
|
||||
return color == 0 ? s : s.withColor(value.getColorCode());
|
||||
}));
|
||||
}
|
||||
context.drawTooltip(getFont(), lines, 2, 10);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,9 +9,9 @@ import com.minelittlepony.common.client.gui.ScrollContainer;
|
|||
import com.minelittlepony.common.client.gui.element.Button;
|
||||
import com.minelittlepony.common.event.ClientReadyCallback;
|
||||
import com.minelittlepony.hdskins.client.*;
|
||||
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.client.dummy.PlayerSkins.PlayerSkin;
|
||||
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
||||
import com.minelittlepony.hdskins.client.gui.player.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins.PlayerSkin;
|
||||
import com.minelittlepony.hdskins.profile.SkinType;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.api.pony.meta.*;
|
||||
import com.minelittlepony.client.render.entity.SeaponyRenderer;
|
||||
import com.minelittlepony.hdskins.client.gui.DualCarouselWidget;
|
||||
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
||||
import com.minelittlepony.hdskins.client.gui.player.DummyPlayer;
|
||||
import com.minelittlepony.hdskins.client.gui.player.skins.PlayerSkins;
|
||||
import com.minelittlepony.hdskins.client.resources.NativeImageFilters;
|
||||
import com.minelittlepony.hdskins.client.resources.TextureLoader;
|
||||
import com.minelittlepony.hdskins.profile.SkinType;
|
||||
|
||||
class PonifiedDualCarouselWidget extends DualCarouselWidget {
|
||||
|
||||
public PonifiedDualCarouselWidget(GuiSkins screen) {
|
||||
super(screen);
|
||||
local.addElement(new LegendOverlayWidget());
|
||||
remote.addElement(new LegendOverlayWidget());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DummyPlayer createEntity(ClientWorld world, PlayerSkins<?> textures) {
|
||||
return new DummyPony(world, textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getDefaultSkin(SkinType type, String modelVariant) {
|
||||
if (type == MineLPHDSkins.seaponySkinType) {
|
||||
return NativeImageFilters.GREYSCALE.load(SeaponyRenderer.SEAPONY, SeaponyRenderer.SEAPONY, getExclusion());
|
||||
}
|
||||
|
||||
Wearable wearable = MineLPHDSkins.wearableTypes.getOrDefault(type, Wearable.NONE);
|
||||
|
||||
if (wearable != Wearable.NONE) {
|
||||
return NativeImageFilters.GREYSCALE.load(wearable.getDefaultTexture(), wearable.getDefaultTexture(), getExclusion());
|
||||
}
|
||||
|
||||
return super.getDefaultSkin(type, modelVariant);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureLoader.Exclusion getExclusion() {
|
||||
return TriggerPixel::isTriggerPixelCoord;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
package com.minelittlepony.client.hdskins;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.minelittlepony.api.pony.*;
|
||||
import com.minelittlepony.api.pony.meta.*;
|
||||
import com.minelittlepony.client.render.entity.SeaponyRenderer;
|
||||
import com.minelittlepony.common.client.gui.dimension.Bounds;
|
||||
import com.minelittlepony.hdskins.client.dummy.*;
|
||||
import com.minelittlepony.hdskins.client.resources.DefaultSkinGenerator;
|
||||
import com.minelittlepony.hdskins.client.resources.TextureLoader;
|
||||
import com.minelittlepony.hdskins.profile.SkinType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
class PonyPreview extends PlayerPreview {
|
||||
private static final Bounds LEGEND_BLOCK_BOUNDS = new Bounds(0, 0, 10, 10);
|
||||
|
||||
@Override
|
||||
protected DummyPlayer createEntity(ClientWorld world, PlayerSkins<?> textures) {
|
||||
return new DummyPony(world, textures);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getDefaultSkin(SkinType type, boolean slim) {
|
||||
if (type == MineLPHDSkins.seaponySkinType) {
|
||||
return DefaultSkinGenerator.generateGreyScale(SeaponyRenderer.SEAPONY, SeaponyRenderer.SEAPONY, getExclusion());
|
||||
}
|
||||
|
||||
Wearable wearable = MineLPHDSkins.wearableTypes.getOrDefault(type, Wearable.NONE);
|
||||
|
||||
if (wearable != Wearable.NONE) {
|
||||
return DefaultSkinGenerator.generateGreyScale(wearable.getDefaultTexture(), wearable.getDefaultTexture(), getExclusion());
|
||||
}
|
||||
|
||||
return super.getDefaultSkin(type, slim);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TextureLoader.Exclusion getExclusion() {
|
||||
return TriggerPixel::isTriggerPixelCoord;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderWorldAndPlayer(Optional<DummyPlayer> thePlayer,
|
||||
Bounds frame,
|
||||
int horizon, int mouseX, int mouseY, int ticks, float partialTick, float scale,
|
||||
DrawContext context, @Nullable Consumer<DummyPlayer> postAction) {
|
||||
super.renderWorldAndPlayer(thePlayer, frame, horizon, mouseX, mouseY, ticks, partialTick, scale, context, postAction);
|
||||
thePlayer.ifPresent(p -> {
|
||||
IPonyData data = IPony.getManager().getPony(p).metadata();
|
||||
int[] index = new int[1];
|
||||
data.getTriggerPixels().forEach((key, value) -> {
|
||||
context.getMatrices().push();
|
||||
int i = index[0]++;
|
||||
int x = frame.left;
|
||||
int y = frame.top + (i * 10 + 20);
|
||||
context.getMatrices().translate(x, y, 1);
|
||||
drawLegendBlock(context, 0, 0, 0, mouseX - x, mouseY - y, key, value);
|
||||
context.getMatrices().pop();
|
||||
});
|
||||
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().draw();
|
||||
});
|
||||
}
|
||||
|
||||
private void drawLegendBlock(DrawContext context, int index, int x, int y, int mouseX, int mouseY, String key, TriggerPixelType<?> value) {
|
||||
context.fill(0, 0, LEGEND_BLOCK_BOUNDS.width, LEGEND_BLOCK_BOUNDS.height, 0xFF003333);
|
||||
context.fill(1, 1, LEGEND_BLOCK_BOUNDS.width - 1, LEGEND_BLOCK_BOUNDS.height - 1, value.getColorCode() | 0xFF000000);
|
||||
|
||||
char symbol = value.name().charAt(0);
|
||||
if (symbol == '[') {
|
||||
symbol = key.charAt(0);
|
||||
}
|
||||
|
||||
context.drawTextWithShadow(getFont(), Text.literal(String.valueOf(symbol).toUpperCase()), 2, 1, 0xFFFFFFFF);
|
||||
|
||||
if (LEGEND_BLOCK_BOUNDS.contains(mouseX, mouseY)) {
|
||||
List<Text> lines = value.getOptions().stream().map(option -> {
|
||||
boolean selected = value.matches(option);
|
||||
return Text.literal((selected ? "* " : " ") + option.name()).styled(s -> {
|
||||
int color = option.getChannelAdjustedColorCode();
|
||||
return (color == 0 ? s : s.withColor(color)).withItalic(selected);
|
||||
});
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
lines.add(0, Text.of(key.toUpperCase() + ": " + value.getHexValue()));
|
||||
if (lines.size() == 1) {
|
||||
lines.add(Text.literal(value.name()).styled(s -> {
|
||||
int color = value.getChannelAdjustedColorCode();
|
||||
return color == 0 ? s : s.withColor(value.getColorCode());
|
||||
}));
|
||||
}
|
||||
context.drawTooltip(getFont(), lines, 2, 10);
|
||||
}
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 4.7 KiB |