mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-04-01 01:05:27 +02:00
Seaponies cano now have a dedicated texture separate from the normal skin
This commit is contained in:
parent
97f71ffa24
commit
728e2b1a39
8 changed files with 80 additions and 70 deletions
|
@ -0,0 +1,5 @@
|
||||||
|
package com.minelittlepony.client;
|
||||||
|
|
||||||
|
public interface IPreviewModel {
|
||||||
|
|
||||||
|
}
|
|
@ -1,8 +1,11 @@
|
||||||
package com.minelittlepony.client;
|
package com.minelittlepony.client;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
|
import com.minelittlepony.client.render.EquineRenderManager;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.texture.PlayerSkinProvider;
|
import net.minecraft.client.texture.PlayerSkinProvider;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
@ -25,4 +28,8 @@ public class SkinsProxy {
|
||||||
|
|
||||||
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
return skins.loadSkin(texture, MinecraftProfileTexture.Type.SKIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) {
|
||||||
|
return manager.getPony(player).getTexture();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,29 +1,37 @@
|
||||||
package com.minelittlepony.client.hdskins;
|
package com.minelittlepony.client.hdskins;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.IPreviewModel;
|
||||||
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
|
import com.minelittlepony.client.model.entity.race.PlayerModels;
|
||||||
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
||||||
import com.minelittlepony.hdskins.client.dummy.TextureProxy;
|
import com.minelittlepony.hdskins.client.dummy.TextureProxy;
|
||||||
import com.minelittlepony.hdskins.profile.SkinType;
|
|
||||||
import com.minelittlepony.hdskins.client.resources.LocalTexture;
|
|
||||||
import com.minelittlepony.model.IRotatedSwimmer;
|
import com.minelittlepony.model.IRotatedSwimmer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dummy model used for the skin uploading screen.
|
* Dummy model used for the skin uploading screen.
|
||||||
*/
|
*/
|
||||||
class DummyPony extends DummyPlayer implements IRotatedSwimmer {
|
class DummyPony extends DummyPlayer implements IRotatedSwimmer, IPreviewModel {
|
||||||
|
|
||||||
public boolean wet = false;
|
|
||||||
|
|
||||||
public DummyPony(TextureProxy textures) {
|
public DummyPony(TextureProxy textures) {
|
||||||
super(textures);
|
super(textures);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWet(boolean wet) {
|
public void setWet(boolean wet) {
|
||||||
this.wet = wet;
|
}
|
||||||
|
|
||||||
LocalTexture skin = getTextures().get(SkinType.SKIN);
|
@Override
|
||||||
|
public boolean isSubmergedInWater() {
|
||||||
|
return getTextures().getSkinType() == MineLPHDSkins.seaponySkinType || super.isSubmergedInWater();
|
||||||
|
}
|
||||||
|
|
||||||
if (wet != (skin.getId() == PonyPreview.NO_SKIN_SEAPONY)) {
|
@Override
|
||||||
skin.clearLocal();
|
public String getModel() {
|
||||||
|
if (getTextures().getSkinType() == MineLPHDSkins.seaponySkinType) {
|
||||||
|
return getTextures().usesThinSkin() ? "slimseapony" : "seapony";
|
||||||
}
|
}
|
||||||
|
return PlayerModels.forRace(MineLittlePony.getInstance().getManager()
|
||||||
|
.getPony(this)
|
||||||
|
.getRace(false))
|
||||||
|
.getId(super.getModel().contains("slim"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,13 @@ package com.minelittlepony.client.hdskins;
|
||||||
|
|
||||||
import com.minelittlepony.api.pony.IPonyManager;
|
import com.minelittlepony.api.pony.IPonyManager;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.common.client.gui.element.Cycler;
|
|
||||||
import com.minelittlepony.common.client.gui.style.Style;
|
|
||||||
import com.minelittlepony.hdskins.client.dummy.PlayerPreview;
|
import com.minelittlepony.hdskins.client.dummy.PlayerPreview;
|
||||||
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
||||||
import com.minelittlepony.hdskins.server.SkinServerList;
|
import com.minelittlepony.hdskins.server.SkinServerList;
|
||||||
import com.minelittlepony.hdskins.profile.SkinType;
|
import com.minelittlepony.hdskins.profile.SkinType;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
|
||||||
import net.minecraft.item.Items;
|
|
||||||
import net.minecraft.sound.SoundEvents;
|
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,8 +18,6 @@ class GuiSkinsMineLP extends GuiSkins {
|
||||||
|
|
||||||
private IPonyManager ponyManager = MineLittlePony.getInstance().getManager();
|
private IPonyManager ponyManager = MineLittlePony.getInstance().getManager();
|
||||||
|
|
||||||
private boolean isWet = false;
|
|
||||||
|
|
||||||
private static final String[] panoramas = new String[] {
|
private static final String[] panoramas = new String[] {
|
||||||
"minelittlepony:textures/cubemap/sugarcubecorner",
|
"minelittlepony:textures/cubemap/sugarcubecorner",
|
||||||
"minelittlepony:textures/cubemap/quillsandsofas",
|
"minelittlepony:textures/cubemap/quillsandsofas",
|
||||||
|
@ -40,19 +33,6 @@ class GuiSkinsMineLP extends GuiSkins {
|
||||||
return new PonyPreview();
|
return new PonyPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void init() {
|
|
||||||
super.init();
|
|
||||||
|
|
||||||
addButton(new Cycler(width - 25, 142, 20, 20))
|
|
||||||
.setStyles(
|
|
||||||
new Style().setIcon(new ItemStack(Items.BUCKET)).setTooltip("minelp.mode.dry", 0, 10),
|
|
||||||
new Style().setIcon(new ItemStack(Items.WATER_BUCKET)).setTooltip("minelp.mode.wet", 0, 10)
|
|
||||||
)
|
|
||||||
.onChange(this::setWet)
|
|
||||||
.setValue(isWet ? 1 : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Identifier getBackground() {
|
protected Identifier getBackground() {
|
||||||
int i = (int)Math.floor(Math.random() * panoramas.length);
|
int i = (int)Math.floor(Math.random() * panoramas.length);
|
||||||
|
@ -60,19 +40,6 @@ class GuiSkinsMineLP extends GuiSkins {
|
||||||
return new Identifier(panoramas[i]);
|
return new Identifier(panoramas[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int setWet(int wet) {
|
|
||||||
playSound(SoundEvents.BLOCK_BREWING_STAND_BREW);
|
|
||||||
|
|
||||||
isWet = wet == 1;
|
|
||||||
|
|
||||||
previewer.getLocal().getTextures().release();;
|
|
||||||
|
|
||||||
if (previewer instanceof PonyPreview) {
|
|
||||||
((PonyPreview)previewer).setWet(isWet);
|
|
||||||
}
|
|
||||||
return wet;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSetLocalSkin(SkinType type) {
|
public void onSetLocalSkin(SkinType type) {
|
||||||
super.onSetLocalSkin(type);
|
super.onSetLocalSkin(type);
|
||||||
|
|
|
@ -2,17 +2,25 @@ package com.minelittlepony.client.hdskins;
|
||||||
|
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.SkinsProxy;
|
import com.minelittlepony.client.SkinsProxy;
|
||||||
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
import com.minelittlepony.common.event.ClientReadyCallback;
|
import com.minelittlepony.common.event.ClientReadyCallback;
|
||||||
import com.minelittlepony.hdskins.client.SkinCacheClearCallback;
|
import com.minelittlepony.hdskins.client.SkinCacheClearCallback;
|
||||||
|
import com.minelittlepony.hdskins.client.ducks.ClientPlayerInfo;
|
||||||
|
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
||||||
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
import com.minelittlepony.hdskins.client.gui.GuiSkins;
|
||||||
|
import com.minelittlepony.hdskins.client.resources.LocalTexture;
|
||||||
|
import com.minelittlepony.hdskins.mixin.client.MixinClientPlayer;
|
||||||
import com.minelittlepony.hdskins.profile.SkinType;
|
import com.minelittlepony.hdskins.profile.SkinType;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import com.minelittlepony.client.pony.PonyManager;
|
import com.minelittlepony.client.pony.PonyManager;
|
||||||
|
import com.minelittlepony.client.render.EquineRenderManager;
|
||||||
import com.minelittlepony.hdskins.client.HDSkins;
|
import com.minelittlepony.hdskins.client.HDSkins;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -20,10 +28,15 @@ import com.minelittlepony.hdskins.client.HDSkins;
|
||||||
*/
|
*/
|
||||||
public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
||||||
|
|
||||||
|
static SkinType seaponySkinType;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
SkinsProxy.instance = this;
|
SkinsProxy.instance = this;
|
||||||
|
|
||||||
|
seaponySkinType = SkinType.register(new Identifier("minelp", "seapony"), Items.COD_BUCKET.getDefaultStack());
|
||||||
|
|
||||||
ClientReadyCallback.EVENT.register(client -> {
|
ClientReadyCallback.EVENT.register(client -> {
|
||||||
// Clear ponies when skins are cleared
|
// Clear ponies when skins are cleared
|
||||||
PonyManager ponyManager = (PonyManager) MineLittlePony.getInstance().getManager();
|
PonyManager ponyManager = (PonyManager) MineLittlePony.getInstance().getManager();
|
||||||
|
@ -34,6 +47,23 @@ public class MineLPHDSkins extends SkinsProxy implements ClientModInitializer {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getSeaponySkin(EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager, AbstractClientPlayerEntity player) {
|
||||||
|
if (player instanceof DummyPlayer) {
|
||||||
|
LocalTexture tex = ((DummyPlayer)player).getTextures().get(seaponySkinType);
|
||||||
|
Identifier id = tex.getId();
|
||||||
|
return id == null ? tex.getDefault() : id;
|
||||||
|
} else {
|
||||||
|
ClientPlayerInfo info = (ClientPlayerInfo)((MixinClientPlayer)player).getBackingClientData();
|
||||||
|
Identifier tex = info.getSkins().getSkin(seaponySkinType);
|
||||||
|
if (tex != null) {
|
||||||
|
return tex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.getSeaponySkin(manager, player);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Identifier getSkinTexture(GameProfile profile) {
|
public Identifier getSkinTexture(GameProfile profile) {
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,6 @@ package com.minelittlepony.client.hdskins;
|
||||||
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import com.minelittlepony.api.pony.IPony;
|
|
||||||
import com.minelittlepony.api.pony.meta.Race;
|
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
|
||||||
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
import com.minelittlepony.hdskins.client.dummy.DummyPlayer;
|
||||||
import com.minelittlepony.hdskins.client.dummy.PlayerPreview;
|
import com.minelittlepony.hdskins.client.dummy.PlayerPreview;
|
||||||
import com.minelittlepony.hdskins.profile.SkinType;
|
import com.minelittlepony.hdskins.profile.SkinType;
|
||||||
|
@ -26,9 +23,10 @@ class PonyPreview extends PlayerPreview {
|
||||||
@Override
|
@Override
|
||||||
public Identifier getBlankSteveSkin(SkinType type) {
|
public Identifier getBlankSteveSkin(SkinType type) {
|
||||||
if (type == SkinType.SKIN) {
|
if (type == SkinType.SKIN) {
|
||||||
// Initialization order means this method might be called before class members have been initialized.
|
return NO_SKIN_STEVE_PONY;
|
||||||
// This is something that needs to be fixed in HDSkins
|
}
|
||||||
return localPony != null && localPony.wet ? NO_SKIN_SEAPONY : NO_SKIN_STEVE_PONY;
|
if (type == MineLPHDSkins.seaponySkinType) {
|
||||||
|
return NO_SKIN_SEAPONY;
|
||||||
}
|
}
|
||||||
return super.getBlankSteveSkin(type);
|
return super.getBlankSteveSkin(type);
|
||||||
}
|
}
|
||||||
|
@ -36,38 +34,22 @@ class PonyPreview extends PlayerPreview {
|
||||||
@Override
|
@Override
|
||||||
public Identifier getBlankAlexSkin(SkinType type) {
|
public Identifier getBlankAlexSkin(SkinType type) {
|
||||||
if (type == SkinType.SKIN) {
|
if (type == SkinType.SKIN) {
|
||||||
return localPony != null && localPony.wet ? NO_SKIN_SEAPONY : NO_SKIN_ALEX_PONY;
|
return NO_SKIN_ALEX_PONY;
|
||||||
|
}
|
||||||
|
if (type == MineLPHDSkins.seaponySkinType) {
|
||||||
|
return NO_SKIN_SEAPONY;
|
||||||
}
|
}
|
||||||
return getBlankSteveSkin(type);
|
return getBlankSteveSkin(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected DummyPlayer ponify(DummyPlayer human, DummyPlayer pony) {
|
|
||||||
Identifier loc = human.getTextures().get(SkinType.SKIN).getId();
|
|
||||||
|
|
||||||
if (loc == null) {
|
|
||||||
return pony;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
|
||||||
|
|
||||||
Race race = thePony.getRace(true);
|
|
||||||
|
|
||||||
if (race.isHuman()) {
|
|
||||||
return human;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pony;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DummyPlayer getRemote() {
|
public DummyPlayer getRemote() {
|
||||||
return ponify(super.getRemote(), remotePony);
|
return remotePony;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DummyPlayer getLocal() {
|
public DummyPlayer getLocal() {
|
||||||
return ponify(super.getLocal(), localPony);
|
return localPony;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.client.mixin;
|
package com.minelittlepony.client.mixin;
|
||||||
|
|
||||||
|
import com.minelittlepony.client.IPreviewModel;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.entity.race.PlayerModels;
|
import com.minelittlepony.client.model.entity.race.PlayerModels;
|
||||||
|
|
||||||
|
@ -18,6 +19,9 @@ abstract class MixinEntityRenderDispatcher {
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getModel()Ljava/lang/String;"))
|
target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getModel()Ljava/lang/String;"))
|
||||||
private String getPlayerModel(AbstractClientPlayerEntity player, Entity entity) {
|
private String getPlayerModel(AbstractClientPlayerEntity player, Entity entity) {
|
||||||
|
if (player instanceof IPreviewModel) {
|
||||||
|
return player.getModel();
|
||||||
|
}
|
||||||
return PlayerModels.forRace(MineLittlePony.getInstance().getManager()
|
return PlayerModels.forRace(MineLittlePony.getInstance().getManager()
|
||||||
.getPony(player)
|
.getPony(player)
|
||||||
.getRace(false))
|
.getRace(false))
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.minelittlepony.client.render.entity;
|
||||||
|
|
||||||
import com.minelittlepony.api.pony.IPony;
|
import com.minelittlepony.api.pony.IPony;
|
||||||
import com.minelittlepony.api.pony.meta.Race;
|
import com.minelittlepony.api.pony.meta.Race;
|
||||||
|
import com.minelittlepony.client.SkinsProxy;
|
||||||
import com.minelittlepony.client.model.ClientPonyModel;
|
import com.minelittlepony.client.model.ClientPonyModel;
|
||||||
import com.minelittlepony.client.model.ModelType;
|
import com.minelittlepony.client.model.ModelType;
|
||||||
import com.minelittlepony.client.model.ModelWrapper;
|
import com.minelittlepony.client.model.ModelWrapper;
|
||||||
|
@ -11,6 +12,7 @@ import com.minelittlepony.util.MathUtil;
|
||||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||||
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
import net.minecraft.client.render.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
|
public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
|
||||||
|
|
||||||
|
@ -24,6 +26,11 @@ public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
|
||||||
seapony = this.manager.getModelWrapper();
|
seapony = this.manager.getModelWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getTexture(AbstractClientPlayerEntity player) {
|
||||||
|
return SkinsProxy.instance.getSeaponySkin(manager, player);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPony getEntityPony(AbstractClientPlayerEntity player) {
|
public IPony getEntityPony(AbstractClientPlayerEntity player) {
|
||||||
IPony pony = super.getEntityPony(player);
|
IPony pony = super.getEntityPony(player);
|
||||||
|
|
Loading…
Add table
Reference in a new issue