The problem childs

This commit is contained in:
Sollace 2018-08-01 12:00:27 +02:00
parent e6f5d3caa6
commit bf83ff68ae
19 changed files with 389 additions and 353 deletions

View file

@ -123,7 +123,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
return Optional.empty(); return Optional.empty();
} }
ResourceLocation skin = this.resources.getPlayerTexture(profile1, type); ResourceLocation skin = resources.getPlayerTexture(profile1, type);
if (skin != null) { if (skin != null) {
return Optional.of(skin); return Optional.of(skin);
} }
@ -156,11 +156,11 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
return Optional.empty(); return Optional.empty();
} }
if (!this.skinCache.containsKey(profile.getId())) { if (!skinCache.containsKey(profile.getId())) {
this.skinCache.put(profile.getId(), Maps.newHashMap()); skinCache.put(profile.getId(), Maps.newHashMap());
} }
skin = this.skinCache.get(profile.getId()).get(type); skin = skinCache.get(profile.getId()).get(type);
if (skin == null) { if (skin == null) {
if (loadIfAbsent && getProfileData(profile).containsKey(type)) { if (loadIfAbsent && getProfileData(profile).containsKey(type)) {
skinCache.get(profile.getId()).put(type, LOADING); skinCache.get(profile.getId()).put(type, LOADING);
@ -189,24 +189,24 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
ITextureObject texObject = new ThreadDownloadImageETag(file2, bustCache(texture.getUrl()), ITextureObject texObject = new ThreadDownloadImageETag(file2, bustCache(texture.getUrl()),
DefaultPlayerSkin.getDefaultSkinLegacy(), DefaultPlayerSkin.getDefaultSkinLegacy(),
new IImageBuffer() { new IImageBuffer() {
@Nonnull @Nonnull
@Override @Override
public BufferedImage parseUserSkin(@Nonnull BufferedImage image) { public BufferedImage parseUserSkin(@Nonnull BufferedImage image) {
BufferedImage image1 = image; BufferedImage image1 = image;
if (imagebufferdownload != null) { if (imagebufferdownload != null) {
image1 = imagebufferdownload.parseUserSkin(image); image1 = imagebufferdownload.parseUserSkin(image);
} }
return image1 == null ? image : image1; return image1 == null ? image : image1;
} }
@Override @Override
public void skinAvailable() { public void skinAvailable() {
if (imagebufferdownload != null) { if (imagebufferdownload != null) {
imagebufferdownload.skinAvailable(); imagebufferdownload.skinAvailable();
} }
callback.skinAvailable(type, skin, texture); callback.skinAvailable(type, skin, texture);
} }
}); });
// schedule texture loading on the main thread. // schedule texture loading on the main thread.
TextureLoader.loadTexture(skin, texObject); TextureLoader.loadTexture(skin, texObject);
@ -243,20 +243,20 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
if (st == null) { if (st == null) {
throw new IllegalArgumentException("class is not annotated with @ServerType"); throw new IllegalArgumentException("class is not annotated with @ServerType");
} }
this.skinServerTypes.put(st.value(), type); skinServerTypes.put(st.value(), type);
} }
public Class<? extends SkinServer> getSkinServerClass(String type) { public Class<? extends SkinServer> getSkinServerClass(String type) {
return this.skinServerTypes.get(type); return skinServerTypes.get(type);
} }
public void addSkinServer(SkinServer skinServer) { public void addSkinServer(SkinServer skinServer) {
this.skinServers.add(skinServer); skinServers.add(skinServer);
} }
@Deprecated @Deprecated
public SkinServer getGatewayServer() { public SkinServer getGatewayServer() {
return this.skinServers.get(0); return skinServers.get(0);
} }
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -279,8 +279,8 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
FileUtils.deleteDirectory(new File(LiteLoader.getAssetsDirectory(), "hd")); FileUtils.deleteDirectory(new File(LiteLoader.getAssetsDirectory(), "hd"));
TextureManager textures = Minecraft.getMinecraft().getTextureManager(); TextureManager textures = Minecraft.getMinecraft().getTextureManager();
INSTANCE.skinCache.values().stream() INSTANCE.skinCache.values().stream()
.flatMap(m -> m.values().stream()) .flatMap(m -> m.values().stream())
.forEach(textures::deleteTexture); .forEach(textures::deleteTexture);
INSTANCE.skinCache.clear(); INSTANCE.skinCache.clear();
INSTANCE.skins.invalidateAll(); INSTANCE.skins.invalidateAll();
} catch (IOException var1) { } catch (IOException var1) {
@ -319,6 +319,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
@Override @Override
public void onResourceManagerReload(IResourceManager resourceManager) { public void onResourceManagerReload(IResourceManager resourceManager) {
this.resources.onResourceManagerReload(resourceManager); resources.onResourceManagerReload(resourceManager);
} }
} }

View file

@ -96,14 +96,14 @@ public class GuiSkins extends GuiScreen {
// this.screenTitle = manager; // this.screenTitle = manager;
GameProfile profile = minecraft.getSession().getProfile(); GameProfile profile = minecraft.getSession().getProfile();
this.localPlayer = getModel(profile); localPlayer = getModel(profile);
this.remotePlayer = getModel(profile); remotePlayer = getModel(profile);
RenderManager rm = Minecraft.getMinecraft().getRenderManager(); RenderManager rm = Minecraft.getMinecraft().getRenderManager();
rm.renderEngine = minecraft.getTextureManager(); rm.renderEngine = minecraft.getTextureManager();
rm.options = minecraft.gameSettings; rm.options = minecraft.gameSettings;
rm.renderViewEntity = this.localPlayer; rm.renderViewEntity = localPlayer;
this.reloadRemoteSkin(); reloadRemoteSkin();
this.fetchingSkin = true; fetchingSkin = true;
instance = this; instance = this;
@ -127,40 +127,40 @@ public class GuiSkins extends GuiScreen {
} }
panorama.update(); panorama.update();
this.localPlayer.updateModel(); localPlayer.updateModel();
this.remotePlayer.updateModel(); remotePlayer.updateModel();
if (this.fetchingSkin && this.remotePlayer.isTextureSetupComplete()) { if (fetchingSkin && remotePlayer.isTextureSetupComplete()) {
this.fetchingSkin = false; fetchingSkin = false;
this.btnClear.enabled = true; btnClear.enabled = true;
} }
synchronized (this.skinLock) { synchronized (skinLock) {
if (this.pendingSkinFile != null) { if (pendingSkinFile != null) {
System.out.println("Set " + textureType + " " + this.pendingSkinFile); System.out.println("Set " + textureType + " " + pendingSkinFile);
this.localPlayer.setLocalTexture(this.pendingSkinFile, textureType); localPlayer.setLocalTexture(pendingSkinFile, textureType);
this.selectedSkin = this.pendingSkinFile; selectedSkin = pendingSkinFile;
this.pendingSkinFile = null; pendingSkinFile = null;
this.onSetLocalSkin(textureType); onSetLocalSkin(textureType);
this.btnUpload.enabled = true; btnUpload.enabled = true;
} }
} }
if (this.pendingRemoteSkinRefresh) { if (pendingRemoteSkinRefresh) {
this.pendingRemoteSkinRefresh = false; pendingRemoteSkinRefresh = false;
this.fetchingSkin = true; fetchingSkin = true;
this.btnClear.enabled = false; btnClear.enabled = false;
this.reloadRemoteSkin(); reloadRemoteSkin();
} }
if (this.throttledByMojang) { if (throttledByMojang) {
if (this.refreshCounter == -1) { if (refreshCounter == -1) {
this.refreshCounter = 200; refreshCounter = 200;
} else if (this.refreshCounter > 0) { } else if (refreshCounter > 0) {
--this.refreshCounter; --refreshCounter;
} else { } else {
this.refreshCounter = -1; refreshCounter = -1;
this.throttledByMojang = false; throttledByMojang = false;
this.reloadRemoteSkin(); reloadRemoteSkin();
} }
} }
@ -174,10 +174,10 @@ public class GuiSkins extends GuiScreen {
private void reloadRemoteSkin() { private void reloadRemoteSkin() {
try { try {
this.remotePlayer.reloadRemoteSkin(this::onSetRemoteSkin); remotePlayer.reloadRemoteSkin(this::onSetRemoteSkin);
} catch (Exception var2) { } catch (Exception var2) {
var2.printStackTrace(); var2.printStackTrace();
this.throttledByMojang = true; throttledByMojang = true;
} }
} }
@ -188,28 +188,28 @@ public class GuiSkins extends GuiScreen {
panorama.init(); panorama.init();
this.buttonList.clear(); buttonList.clear();
this.buttonList.add(this.btnBrowse = new GuiButton(0, 30, this.height - 36, 60, 20, "Browse...")); buttonList.add(btnBrowse = new GuiButton(0, 30, height - 36, 60, 20, "Browse..."));
this.buttonList.add(this.btnUpload = new GuiButton(1, this.width / 2 - 24, this.height / 2 - 10, 48, 20, ">>")); buttonList.add(btnUpload = new GuiButton(1, width / 2 - 24, height / 2 - 10, 48, 20, ">>"));
this.buttonList.add(this.btnClear = new GuiButton(2, this.width - 90, this.height - 36, 60, 20, "Clear")); buttonList.add(btnClear = new GuiButton(2, width - 90, height - 36, 60, 20, "Clear"));
this.buttonList.add(this.btnBack = new GuiButton(3, this.width / 2 - 50, this.height - 36, 100, 20, "Close")); buttonList.add(btnBack = new GuiButton(3, width / 2 - 50, height - 36, 100, 20, "Close"));
ItemStack skin = new ItemStack(Items.LEATHER_LEGGINGS); ItemStack skin = new ItemStack(Items.LEATHER_LEGGINGS);
Items.LEATHER_LEGGINGS.setColor(skin, 0x3c5dcb); Items.LEATHER_LEGGINGS.setColor(skin, 0x3c5dcb);
this.buttonList.add(this.btnModeSkin = new GuiItemStackButton(4, 2, 2, skin)); buttonList.add(btnModeSkin = new GuiItemStackButton(4, 2, 2, skin));
skin = new ItemStack(Items.LEATHER_LEGGINGS); skin = new ItemStack(Items.LEATHER_LEGGINGS);
Items.LEATHER_LEGGINGS.setColor(skin, 0xfff500); Items.LEATHER_LEGGINGS.setColor(skin, 0xfff500);
this.buttonList.add(this.btnModeElytra = new GuiItemStackButton(5, 2, 52, new ItemStack(Items.ELYTRA))); buttonList.add(btnModeElytra = new GuiItemStackButton(5, 2, 52, new ItemStack(Items.ELYTRA)));
this.buttonList.add(this.btnModeSkinnySkin = new GuiItemStackButton(6, 2, 21, skin)); buttonList.add(btnModeSkinnySkin = new GuiItemStackButton(6, 2, 21, skin));
this.buttonList.add(this.btnAbout = new GuiButton(-1, this.width - 25, this.height - 25, 20, 20, "?")); buttonList.add(btnAbout = new GuiButton(-1, width - 25, height - 25, 20, 20, "?"));
this.btnUpload.enabled = false; btnUpload.enabled = false;
this.btnBrowse.enabled = !this.mc.isFullScreen(); btnBrowse.enabled = !mc.isFullScreen();
this.btnModeSkin.enabled = this.thinArmType; btnModeSkin.enabled = thinArmType;
this.btnModeSkinnySkin.enabled = !this.thinArmType; btnModeSkinnySkin.enabled = !thinArmType;
this.btnModeElytra.enabled = this.textureType == SKIN; btnModeElytra.enabled = textureType == SKIN;
} }
@ -230,107 +230,107 @@ public class GuiSkins extends GuiScreen {
} }
private void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult) { private void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult) {
this.openFileThread = null; openFileThread = null;
this.btnBrowse.enabled = true; btnBrowse.enabled = true;
if (dialogResult == 0) { if (dialogResult == 0) {
this.loadLocalFile(fileDialog.getSelectedFile()); loadLocalFile(fileDialog.getSelectedFile());
} }
} }
private void loadLocalFile(File skinFile) { private void loadLocalFile(File skinFile) {
Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures); Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures);
if (!skinFile.exists()) { if (!skinFile.exists()) {
this.skinMessage = I18n.format("hdskins.error.unreadable"); skinMessage = I18n.format("hdskins.error.unreadable");
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) { } else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) {
this.skinMessage = I18n.format("hdskins.error.ext"); skinMessage = I18n.format("hdskins.error.ext");
} else { } else {
BufferedImage chosenImage; BufferedImage chosenImage;
try { try {
chosenImage = ImageIO.read(skinFile); chosenImage = ImageIO.read(skinFile);
} catch (IOException var6) { } catch (IOException var6) {
this.skinMessage = I18n.format("hdskins.error.open"); skinMessage = I18n.format("hdskins.error.open");
var6.printStackTrace(); var6.printStackTrace();
return; return;
} }
if (chosenImage == null) { if (chosenImage == null) {
this.skinMessage = I18n.format("hdskins.error.open"); skinMessage = I18n.format("hdskins.error.open");
} else if (isPowerOfTwo(chosenImage.getWidth()) } else if (isPowerOfTwo(chosenImage.getWidth())
&& (chosenImage.getWidth() == chosenImage.getHeight() * 2 && (chosenImage.getWidth() == chosenImage.getHeight() * 2
|| chosenImage.getWidth() == chosenImage.getHeight()) || chosenImage.getWidth() == chosenImage.getHeight())
&& chosenImage.getWidth() <= MAX_SKIN_DIMENSION && chosenImage.getWidth() <= MAX_SKIN_DIMENSION
&& chosenImage.getHeight() <= MAX_SKIN_DIMENSION) { && chosenImage.getHeight() <= MAX_SKIN_DIMENSION) {
synchronized (this.skinLock) { synchronized (skinLock) {
this.pendingSkinFile = skinFile; pendingSkinFile = skinFile;
} }
} else { } else {
this.skinMessage = I18n.format("hdskins.error.invalid"); skinMessage = I18n.format("hdskins.error.invalid");
} }
} }
} }
@Override @Override
protected void actionPerformed(GuiButton guiButton) { protected void actionPerformed(GuiButton guiButton) {
if (this.openFileThread == null && !this.uploadingSkin) { if (openFileThread == null && !uploadingSkin) {
if (this.uploadError != null) { if (uploadError != null) {
this.uploadError = null; uploadError = null;
} else { } else {
if (guiButton.id == this.btnBrowse.id) { if (guiButton.id == btnBrowse.id) {
this.selectedSkin = null; selectedSkin = null;
this.localPlayer.releaseTextures(); localPlayer.releaseTextures();
this.openFileThread = new ThreadOpenFilePNG(this.mc, I18n.format("hdskins.open.title"), this::onFileOpenDialogClosed); openFileThread = new ThreadOpenFilePNG(mc, I18n.format("hdskins.open.title"), this::onFileOpenDialogClosed);
this.openFileThread.start(); openFileThread.start();
guiButton.enabled = false; guiButton.enabled = false;
} }
if (guiButton.id == this.btnUpload.id) { if (guiButton.id == btnUpload.id) {
if (this.selectedSkin != null) { if (selectedSkin != null) {
this.uploadSkin(this.mc.getSession(), this.selectedSkin); uploadSkin(mc.getSession(), selectedSkin);
this.btnUpload.enabled = false; btnUpload.enabled = false;
} else { } else {
this.setUploadError(I18n.format("hdskins.error.select")); setUploadError(I18n.format("hdskins.error.select"));
} }
} }
if (guiButton.id == this.btnClear.id && this.remotePlayer.isTextureSetupComplete()) { if (guiButton.id == btnClear.id && remotePlayer.isTextureSetupComplete()) {
this.clearUploadedSkin(this.mc.getSession()); clearUploadedSkin(mc.getSession());
this.btnUpload.enabled = this.selectedSkin != null; btnUpload.enabled = selectedSkin != null;
} }
if (guiButton.id == this.btnBack.id) { if (guiButton.id == btnBack.id) {
this.mc.displayGuiScreen(new GuiMainMenu()); mc.displayGuiScreen(new GuiMainMenu());
} }
if (guiButton.id == this.btnModeSkin.id || guiButton.id == this.btnModeElytra.id || guiButton.id == this.btnModeSkinnySkin.id) { if (guiButton.id == btnModeSkin.id || guiButton.id == btnModeElytra.id || guiButton.id == btnModeSkinnySkin.id) {
ItemStack stack; ItemStack stack;
if (guiButton.id == this.btnModeSkin.id) { if (guiButton.id == btnModeSkin.id) {
this.thinArmType = false; thinArmType = false;
this.textureType = SKIN; textureType = SKIN;
stack = ItemStack.EMPTY; stack = ItemStack.EMPTY;
} else if (guiButton.id == this.btnModeSkinnySkin.id) { } else if (guiButton.id == btnModeSkinnySkin.id) {
this.thinArmType = true; thinArmType = true;
this.textureType = SKIN; textureType = SKIN;
stack = ItemStack.EMPTY; stack = ItemStack.EMPTY;
} else { } else {
this.textureType = ELYTRA; textureType = ELYTRA;
stack = new ItemStack(Items.ELYTRA); stack = new ItemStack(Items.ELYTRA);
} }
this.btnModeSkin.enabled = thinArmType; btnModeSkin.enabled = thinArmType;
this.btnModeSkinnySkin.enabled = !thinArmType; btnModeSkinnySkin.enabled = !thinArmType;
this.btnModeElytra.enabled = this.textureType == SKIN; btnModeElytra.enabled = textureType == SKIN;
guiButton.enabled = false; guiButton.enabled = false;
// clear currently selected skin // clear currently selected skin
this.selectedSkin = null; selectedSkin = null;
this.localPlayer.releaseTextures(); localPlayer.releaseTextures();
// put on or take off the elytra // put on or take off the elytra
this.localPlayer.setItemStackToSlot(EntityEquipmentSlot.CHEST, stack); localPlayer.setItemStackToSlot(EntityEquipmentSlot.CHEST, stack);
this.remotePlayer.setItemStackToSlot(EntityEquipmentSlot.CHEST, stack); remotePlayer.setItemStackToSlot(EntityEquipmentSlot.CHEST, stack);
this.localPlayer.setPreviewThinArms(thinArmType); localPlayer.setPreviewThinArms(thinArmType);
this.remotePlayer.setPreviewThinArms(thinArmType); remotePlayer.setPreviewThinArms(thinArmType);
} }
} }
@ -339,16 +339,16 @@ public class GuiSkins extends GuiScreen {
@Override @Override
protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException { protected void mouseClicked(int mouseX, int mouseY, int button) throws IOException {
if (this.uploadError != null) { if (uploadError != null) {
this.uploadError = null; uploadError = null;
} else { } else {
super.mouseClicked(mouseX, mouseY, button); super.mouseClicked(mouseX, mouseY, button);
byte top = 30; byte top = 30;
int bottom = this.height - 40; int bottom = height - 40;
int mid = this.width / 2; int mid = width / 2;
if ((mouseX > 30 && mouseX < mid - 30 || mouseX > mid + 30 && mouseX < this.width - 30) && mouseY > top && mouseY < bottom) { if ((mouseX > 30 && mouseX < mid - 30 || mouseX > mid + 30 && mouseX < width - 30) && mouseY > top && mouseY < bottom) {
this.localPlayer.swingArm(EnumHand.MAIN_HAND); localPlayer.swingArm(EnumHand.MAIN_HAND);
this.remotePlayer.swingArm(EnumHand.MAIN_HAND); remotePlayer.swingArm(EnumHand.MAIN_HAND);
} }
} }
@ -358,14 +358,14 @@ public class GuiSkins extends GuiScreen {
@Override @Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
updateCounter -= (lastMouseX - mouseX); updateCounter -= lastMouseX - mouseX;
lastMouseX = mouseX; lastMouseX = mouseX;
} }
@Override @Override
protected void keyTyped(char keyChar, int keyCode) throws IOException { protected void keyTyped(char keyChar, int keyCode) throws IOException {
if (this.openFileThread == null && !this.uploadingSkin) { if (openFileThread == null && !uploadingSkin) {
if (keyCode == Keyboard.KEY_LEFT) { if (keyCode == Keyboard.KEY_LEFT) {
updateCounter -= 5; updateCounter -= 5;
@ -394,7 +394,7 @@ public class GuiSkins extends GuiScreen {
Gui.drawRect(mid + 30, top, width - 30, bottom, Integer.MIN_VALUE); Gui.drawRect(mid + 30, top, width - 30, bottom, Integer.MIN_VALUE);
drawGradientRect(30, horizon, mid - 30, bottom, 0x80FFFFFF, 0xffffff); drawGradientRect(30, horizon, mid - 30, bottom, 0x80FFFFFF, 0xffffff);
drawGradientRect(mid + 30, horizon, this.width - 30, bottom, 0x80FFFFFF, 0xffffff); drawGradientRect(mid + 30, horizon, width - 30, bottom, 0x80FFFFFF, 0xffffff);
super.drawScreen(mouseX, mouseY, partialTick); super.drawScreen(mouseX, mouseY, partialTick);
@ -417,7 +417,7 @@ public class GuiSkins extends GuiScreen {
disableClipping(); disableClipping();
drawCenteredString(this.fontRenderer, I18n.format("hdskins.manager"), width / 2, 10, 0xffffff); drawCenteredString(fontRenderer, I18n.format("hdskins.manager"), width / 2, 10, 0xffffff);
fontRenderer.drawStringWithShadow(I18n.format("hdskins.local"), 34, 34, 0xffffff); fontRenderer.drawStringWithShadow(I18n.format("hdskins.local"), 34, 34, 0xffffff);
fontRenderer.drawStringWithShadow(I18n.format("hdskins.server"), width / 2 + 34, 34, 0xffffff); fontRenderer.drawStringWithShadow(I18n.format("hdskins.server"), width / 2 + 34, 34, 0xffffff);
@ -431,73 +431,73 @@ public class GuiSkins extends GuiScreen {
//this.drawGradientRect(30, this.height - 60, mid - 30, bottom, 1, 0xe0ffffff); //this.drawGradientRect(30, this.height - 60, mid - 30, bottom, 1, 0xe0ffffff);
//this.drawGradientRect(mid + 30, this.height - 60, this.width - 30, bottom, 0, 0xE0FFFFFF); //this.drawGradientRect(mid + 30, this.height - 60, this.width - 30, bottom, 0, 0xE0FFFFFF);
int labelwidth = (this.width / 2 - 80) / 2; int labelwidth = (width / 2 - 80) / 2;
if (!this.localPlayer.isUsingLocalTexture()) { if (!localPlayer.isUsingLocalTexture()) {
int opacity = this.fontRenderer.getStringWidth(this.skinMessage) / 2; int opacity = fontRenderer.getStringWidth(skinMessage) / 2;
Gui.drawRect(40, this.height / 2 - 12, this.width / 2 - 40, this.height / 2 + 12, 0xB0000000); Gui.drawRect(40, height / 2 - 12, width / 2 - 40, height / 2 + 12, 0xB0000000);
this.fontRenderer.drawStringWithShadow(this.skinMessage, (int) (xPos1 - opacity), this.height / 2 - 4, 0xffffff); fontRenderer.drawStringWithShadow(skinMessage, (int) (xPos1 - opacity), height / 2 - 4, 0xffffff);
} }
if (this.btnModeSkin.isMouseOver() || this.btnModeElytra.isMouseOver() || this.btnModeSkinnySkin.isMouseOver()) { if (btnModeSkin.isMouseOver() || btnModeElytra.isMouseOver() || btnModeSkinnySkin.isMouseOver()) {
int y = Math.max(mouseY, 16); int y = Math.max(mouseY, 16);
String text; String text;
if (this.btnModeSkin.isMouseOver()) { if (btnModeSkin.isMouseOver()) {
text = "hdskins.mode.skin"; text = "hdskins.mode.skin";
} else if (this.btnModeSkinnySkin.isMouseOver()) { } else if (btnModeSkinnySkin.isMouseOver()) {
text = "hdskins.mode.skinny"; text = "hdskins.mode.skinny";
} else { } else {
text = "hdskins.mode.elytra"; text = "hdskins.mode.elytra";
} }
this.drawHoveringText(I18n.format(text), mouseX, y); this.drawHoveringText(I18n.format(text), mouseX, y);
} }
if (this.btnAbout.isMouseOver()) { if (btnAbout.isMouseOver()) {
SkinServer gateway = HDSkinManager.INSTANCE.getGatewayServer(); SkinServer gateway = HDSkinManager.INSTANCE.getGatewayServer();
this.drawHoveringText(Splitter.on("\r\n").splitToList(gateway.toString()), mouseX, mouseY); this.drawHoveringText(Splitter.on("\r\n").splitToList(gateway.toString()), mouseX, mouseY);
} }
if (this.fetchingSkin) { if (fetchingSkin) {
String opacity1; String opacity1;
if (this.throttledByMojang) { if (throttledByMojang) {
opacity1 = TextFormatting.RED + I18n.format("hdskins.error.mojang"); opacity1 = TextFormatting.RED + I18n.format("hdskins.error.mojang");
String stringWidth = I18n.format("hdskins.error.mojang.wait"); String stringWidth = I18n.format("hdskins.error.mojang.wait");
int stringWidth1 = this.fontRenderer.getStringWidth(opacity1) / 2; int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
int stringWidth2 = this.fontRenderer.getStringWidth(stringWidth) / 2; int stringWidth2 = fontRenderer.getStringWidth(stringWidth) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 16, this.width - 40, this.height / 2 + 16, 0xB0000000); Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 16, width - 40, height / 2 + 16, 0xB0000000);
this.fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 10, 0xffffff); fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 10, 0xffffff);
this.fontRenderer.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), this.height / 2 + 2, 0xffffff); fontRenderer.drawStringWithShadow(stringWidth, (int) (xPos2 - stringWidth2), height / 2 + 2, 0xffffff);
} else { } else {
opacity1 = I18n.format("hdskins.fetch"); opacity1 = I18n.format("hdskins.fetch");
int stringWidth1 = this.fontRenderer.getStringWidth(opacity1) / 2; int stringWidth1 = fontRenderer.getStringWidth(opacity1) / 2;
Gui.drawRect((int) (xPos2 - labelwidth), this.height / 2 - 12, this.width - 40, this.height / 2 + 12, 0xB0000000); Gui.drawRect((int) (xPos2 - labelwidth), height / 2 - 12, width - 40, height / 2 + 12, 0xB0000000);
this.fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), this.height / 2 - 4, 0xffffff); fontRenderer.drawStringWithShadow(opacity1, (int) (xPos2 - stringWidth1), height / 2 - 4, 0xffffff);
} }
} }
if (this.uploadingSkin || this.uploadOpacity > 0.0F) { if (uploadingSkin || uploadOpacity > 0.0F) {
if (!this.uploadingSkin) { if (!uploadingSkin) {
this.uploadOpacity -= deltaTime * 0.05F; uploadOpacity -= deltaTime * 0.05F;
} else if (this.uploadOpacity < 1.0F) { } else if (uploadOpacity < 1.0F) {
this.uploadOpacity += deltaTime * 0.1F; uploadOpacity += deltaTime * 0.1F;
} }
if (this.uploadOpacity > 1.0F) { if (uploadOpacity > 1.0F) {
this.uploadOpacity = 1.0F; uploadOpacity = 1.0F;
} }
int opacity = Math.min(180, (int) (this.uploadOpacity * 180.0F)) & 255; int opacity = Math.min(180, (int) (uploadOpacity * 180.0F)) & 255;
if (this.uploadOpacity > 0.0F) { if (uploadOpacity > 0.0F) {
Gui.drawRect(0, 0, this.width, this.height, opacity << 24); Gui.drawRect(0, 0, width, height, opacity << 24);
if (this.uploadingSkin) { if (uploadingSkin) {
this.drawCenteredString(this.fontRenderer, this.skinUploadMessage, this.width / 2, this.height / 2, opacity << 24 | 0xffffff); drawCenteredString(fontRenderer, skinUploadMessage, width / 2, height / 2, opacity << 24 | 0xffffff);
} }
} }
} }
if (this.uploadError != null) { if (uploadError != null) {
Gui.drawRect(0, 0, this.width, this.height, 0xB0000000); Gui.drawRect(0, 0, width, height, 0xB0000000);
this.drawCenteredString(this.fontRenderer, I18n.format("hdskins.failed"), this.width / 2, this.height / 2 - 10, 0xFFFFFF55); drawCenteredString(fontRenderer, I18n.format("hdskins.failed"), width / 2, height / 2 - 10, 0xFFFFFF55);
this.drawCenteredString(this.fontRenderer, this.uploadError, this.width / 2, this.height / 2 + 2, 0xFFFF5555); drawCenteredString(fontRenderer, uploadError, width / 2, height / 2 + 2, 0xFFFF5555);
} }
depthMask(true); depthMask(true);
@ -519,11 +519,11 @@ public class GuiSkins extends GuiScreen {
rotate(-135.0F, 0.0F, 1.0F, 0.0F); rotate(-135.0F, 0.0F, 1.0F, 0.0F);
rotate(15.0F, 1.0F, 0.0F, 0.0F); rotate(15.0F, 1.0F, 0.0F, 0.0F);
float rot = ((updateCounter + partialTick) * 2.5F) % 360; float rot = (updateCounter + partialTick) * 2.5F % 360;
rotate(rot, 0, 1, 0); rotate(rot, 0, 1, 0);
thePlayer.rotationYawHead = ((float) Math.atan(mouseX / 20)) * 30; thePlayer.rotationYawHead = (float) Math.atan(mouseX / 20) * 30;
thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40)) * 20; thePlayer.rotationPitch = -((float) Math.atan(mouseY / 40)) * 20;
translate(0.0D, thePlayer.getYOffset(), 0.0D); translate(0.0D, thePlayer.getYOffset(), 0.0D);
@ -538,18 +538,18 @@ public class GuiSkins extends GuiScreen {
} }
private void enableClipping(int yBottom) { private void enableClipping(int yBottom) {
if (this.doubleBuffer == null) { if (doubleBuffer == null) {
this.doubleBuffer = BufferUtils.createByteBuffer(32).asDoubleBuffer(); doubleBuffer = BufferUtils.createByteBuffer(32).asDoubleBuffer();
} }
this.doubleBuffer.clear(); doubleBuffer.clear();
this.doubleBuffer.put(0.0D).put(1.0D).put(0.0D).put((-30)).flip(); doubleBuffer.put(0.0D).put(1.0D).put(0.0D).put(-30).flip();
GL11.glClipPlane(GL11.GL_CLIP_PLANE0, this.doubleBuffer); GL11.glClipPlane(GL11.GL_CLIP_PLANE0, doubleBuffer);
this.doubleBuffer.clear(); doubleBuffer.clear();
this.doubleBuffer.put(0.0D).put(-1.0D).put(0.0D).put(yBottom).flip(); doubleBuffer.put(0.0D).put(-1.0D).put(0.0D).put(yBottom).flip();
GL11.glClipPlane(GL11.GL_CLIP_PLANE1, this.doubleBuffer); GL11.glClipPlane(GL11.GL_CLIP_PLANE1, doubleBuffer);
GL11.glEnable(GL11.GL_CLIP_PLANE0); GL11.glEnable(GL11.GL_CLIP_PLANE0);
GL11.glEnable(GL11.GL_CLIP_PLANE1); GL11.glEnable(GL11.GL_CLIP_PLANE1);
} }
@ -564,47 +564,47 @@ public class GuiSkins extends GuiScreen {
} }
private void clearUploadedSkin(Session session) { private void clearUploadedSkin(Session session) {
this.uploadingSkin = true; uploadingSkin = true;
this.skinUploadMessage = I18n.format("hdskins.request"); skinUploadMessage = I18n.format("hdskins.request");
HDSkinManager.INSTANCE.getGatewayServer() HDSkinManager.INSTANCE.getGatewayServer()
.uploadSkin(session, null, this.textureType, getMetadata()) .uploadSkin(session, null, textureType, getMetadata())
.thenAccept(this::onUploadComplete) .thenAccept(this::onUploadComplete)
.exceptionally(this::onFailure); .exceptionally(this::onFailure);
} }
private void uploadSkin(Session session, @Nullable File skinFile) { private void uploadSkin(Session session, @Nullable File skinFile) {
this.uploadingSkin = true; uploadingSkin = true;
this.skinUploadMessage = I18n.format("hdskins.upload"); skinUploadMessage = I18n.format("hdskins.upload");
URI path = skinFile == null ? null : skinFile.toURI(); URI path = skinFile == null ? null : skinFile.toURI();
HDSkinManager.INSTANCE.getGatewayServer() HDSkinManager.INSTANCE.getGatewayServer()
.uploadSkin(session, path, this.textureType, getMetadata()) .uploadSkin(session, path, textureType, getMetadata())
.thenAccept(this::onUploadComplete) .thenAccept(this::onUploadComplete)
.exceptionally(this::onFailure); .exceptionally(this::onFailure);
} }
private Map<String, String> getMetadata() { private Map<String, String> getMetadata() {
return ImmutableMap.of("model", this.thinArmType ? "slim" : "default"); return ImmutableMap.of("model", thinArmType ? "slim" : "default");
} }
private void setUploadError(@Nullable String error) { private void setUploadError(@Nullable String error) {
this.uploadError = error; uploadError = error;
this.btnUpload.enabled = true; btnUpload.enabled = true;
} }
private Void onFailure(Throwable t) { private Void onFailure(Throwable t) {
t = Throwables.getRootCause(t); t = Throwables.getRootCause(t);
LogManager.getLogger().warn("Upload failed", t); LogManager.getLogger().warn("Upload failed", t);
this.setUploadError(t.toString()); setUploadError(t.toString());
this.uploadingSkin = false; uploadingSkin = false;
return null; return null;
} }
private void onUploadComplete(SkinUploadResponse response) { private void onUploadComplete(SkinUploadResponse response) {
LiteLoaderLogger.info("Upload completed with: %s", response); LiteLoaderLogger.info("Upload completed with: %s", response);
this.uploadingSkin = false; uploadingSkin = false;
this.pendingRemoteSkinRefresh = true; pendingRemoteSkinRefresh = true;
} }
static { static {

View file

@ -71,10 +71,10 @@ public class MineLittlePony {
void postInit(Minecraft minecraft) { void postInit(Minecraft minecraft) {
HDSkinManager manager = HDSkinManager.INSTANCE; HDSkinManager manager = HDSkinManager.INSTANCE;
// manager.setSkinUrl(SKIN_SERVER_URL); // manager.setSkinUrl(SKIN_SERVER_URL);
// manager.setGatewayURL(GATEWAY_URL); // manager.setGatewayURL(GATEWAY_URL);
manager.addSkinModifier(new PonySkinModifier()); manager.addSkinModifier(new PonySkinModifier());
// logger.info("Set MineLP skin server URL."); // logger.info("Set MineLP skin server URL.");
manager.addClearListener(ponyManager); manager.addClearListener(ponyManager);
manager.setPrefferedSkinsGuiClass(GuiSkinsMineLP.class); manager.setPrefferedSkinsGuiClass(GuiSkinsMineLP.class);

View file

@ -147,7 +147,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
setHead(0, 0, 0); setHead(0, 0, 0);
} }
if (isSleeping) ponySleep(); if (isSleeping) {
ponySleep();
}
animateWears(); animateWears();
@ -218,12 +220,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
/** /**
* *
* Used to set the legs rotation based on walking/crouching animations. * Used to set the legs rotation based on walking/crouching animations.
* *
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles} * Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
* *
*/ */
protected void rotateLegs(float move, float swing, float ticks, Entity entity) { protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
if (isSwimming()) { if (isSwimming()) {
rotateLegsSwimming(move, swing, ticks, entity); rotateLegsSwimming(move, swing, ticks, entity);
@ -275,8 +277,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
float forward = ROTATE_270 - ROTATE_90/3; float forward = ROTATE_270 - ROTATE_90/3;
float down = ROTATE_90; float down = ROTATE_90;
float leftX = down + MathHelper.sin((move / 3) + 2*PI/3) / 2; float leftX = down + MathHelper.sin(move / 3 + 2*PI/3) / 2;
float leftY = -forward - MathHelper.sin((move / 3) + 2*PI/3); float leftY = -forward - MathHelper.sin(move / 3 + 2*PI/3);
float rightX = down + MathHelper.sin(move / 3) / 2; float rightX = down + MathHelper.sin(move / 3) / 2;
@ -338,7 +340,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
bipedLeftArm.rotateAngleX = MathHelper.cos(baseRotation + angle) * scale; bipedLeftArm.rotateAngleX = MathHelper.cos(baseRotation + angle) * scale;
bipedRightArm.rotateAngleX = MathHelper.cos(baseRotation + PI + angle / 2) * scale; bipedRightArm.rotateAngleX = MathHelper.cos(baseRotation + PI + angle / 2) * scale;
bipedLeftLeg.rotateAngleX = MathHelper.cos(baseRotation + PI - (angle * 0.4f)) * scale; bipedLeftLeg.rotateAngleX = MathHelper.cos(baseRotation + PI - angle * 0.4f) * scale;
bipedRightLeg.rotateAngleX = MathHelper.cos(baseRotation + angle / 5) * scale; bipedRightLeg.rotateAngleX = MathHelper.cos(baseRotation + angle / 5) * scale;
bipedLeftArm.rotateAngleY = 0; bipedLeftArm.rotateAngleY = 0;
@ -349,8 +351,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
protected float getLegOutset() { protected float getLegOutset() {
if (isSleeping) return 3.6f; if (isSleeping) {
if (isCrouching()) return 1; return 3.6f;
}
if (isCrouching()) {
return 1;
}
return 5; return 5;
} }
@ -386,7 +392,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
swag -= (float)Math.pow(swing, 2); swag -= (float)Math.pow(swing, 2);
} }
float mult = 1 - swag/2; float mult = 1 - swag/2;
arm.rotateAngleX = arm.rotateAngleX * mult - (PI / 10) * swag; arm.rotateAngleX = arm.rotateAngleX * mult - PI / 10 * swag;
arm.rotateAngleZ = -reflect * (PI / 15); arm.rotateAngleZ = -reflect * (PI / 15);
if (isSneak) { if (isSneak) {
arm.rotationPointX -= reflect * 2; arm.rotationPointX -= reflect * 2;
@ -395,7 +401,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
arm.rotateAngleY = 0; arm.rotateAngleY = 0;
break; break;
case BLOCK: case BLOCK:
arm.rotateAngleX = (arm.rotateAngleX / 2 - 0.9424779F) - 0.3F; arm.rotateAngleX = arm.rotateAngleX / 2 - 0.9424779F - 0.3F;
arm.rotateAngleY = reflect * PI / 9; arm.rotateAngleY = reflect * PI / 9;
arm.rotationPointX += reflect; arm.rotationPointX += reflect;
arm.rotationPointZ += 3; arm.rotationPointZ += 3;
@ -411,7 +417,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
protected void aimBow(ModelRenderer arm, float ticks) { protected void aimBow(ModelRenderer arm, float ticks) {
arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX + (MathHelper.sin(ticks * 0.067F) * 0.05F); arm.rotateAngleX = ROTATE_270 + bipedHead.rotateAngleX + MathHelper.sin(ticks * 0.067F) * 0.05F;
arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F; arm.rotateAngleY = bipedHead.rotateAngleY - 0.06F;
arm.rotateAngleZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; arm.rotateAngleZ = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
if (isSneak) { if (isSneak) {
@ -457,7 +463,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
* @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}. * @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}.
*/ */
protected void swingArms(float ticks) { protected void swingArms(float ticks) {
if (isSleeping) return; if (isSleeping) {
return;
}
float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
float sin = MathHelper.sin(ticks * 0.067F) * 0.05F; float sin = MathHelper.sin(ticks * 0.067F) * 0.05F;
@ -516,6 +524,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
AbstractPonyRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8); AbstractPonyRenderer.shiftRotationPoint(bipedLeftLeg, 0, 2, -8);
} }
@Override
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
boxList.clear(); boxList.clear();
@ -529,16 +538,16 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
bipedHead = new PonyRenderer(this, 0, 0) bipedHead = new PonyRenderer(this, 0, 0)
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch) .box(-4, -4, -4, 8, 8, 8, stretch)
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch) .tex(12, 16).box(-4, -6, 1, 2, 2, 2, stretch)
.flip().box( 2, -6, 1, 2, 2, 2, stretch); .flip().box( 2, -6, 1, 2, 2, 2, stretch);
bipedHeadwear = new PonyRenderer(this, 32, 0) bipedHeadwear = new PonyRenderer(this, 32, 0)
.offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch + 0.5F); .box(-4, -4, -4, 8, 8, 8, stretch + 0.5F);
snout = new PonySnout(this); snout = new PonySnout(this);
snout.init(yOffset, stretch); snout.init(yOffset, stretch);
@ -559,40 +568,40 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
bipedBody = new PonyRenderer(this, 16, 16) bipedBody = new PonyRenderer(this, 16, 16)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, 4, -2, 8, 8, 4, stretch); .box(-4, 4, -2, 8, 8, 4, stretch);
bipedBodyWear.addBox(-4, 4, -2, 8, 8, 4, stretch + 0.25F); bipedBodyWear.addBox(-4, 4, -2, 8, 8, 4, stretch + 0.25F);
bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); bipedBodyWear.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
upperTorso = new PlaneRenderer(this, 24, 0); upperTorso = new PlaneRenderer(this, 24, 0);
upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) upperTorso.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(24, 0) .addEastPlane( 4, -4, -4, 8, 8, stretch) .tex(24, 0) .addEastPlane( 4, -4, -4, 8, 8, stretch)
.tex(4, 0) .addEastPlane( 4, -4, 4, 8, 4, stretch) .tex(4, 0) .addEastPlane( 4, -4, 4, 8, 4, stretch)
.tex(56, 0) .addBottomPlane(-4, 4, -4, 8, 8, stretch) .tex(56, 0) .addBottomPlane(-4, 4, -4, 8, 8, stretch)
.tex(36, 16) .addBackPlane(-4, -4, 8, 8, 4, stretch) .tex(36, 16) .addBackPlane(-4, -4, 8, 8, 4, stretch)
.addBackPlane(-4, 0, 8, 8, 4, stretch) .addBackPlane(-4, 0, 8, 8, 4, stretch)
.addBottomPlane(-4, 4, 4, 8, 4, stretch) .addBottomPlane(-4, 4, 4, 8, 4, stretch)
.flipZ().tex(32, 20).addTopPlane(-4, -4, -4, 8, 12, stretch) .flipZ().tex(32, 20).addTopPlane(-4, -4, -4, 8, 12, stretch)
.tex(24, 0).addWestPlane(-4, -4, -4, 8, 8, stretch) .tex(24, 0).addWestPlane(-4, -4, -4, 8, 8, stretch)
.tex(4, 0) .addWestPlane(-4, -4, 4, 8, 4, stretch) .tex(4, 0) .addWestPlane(-4, -4, 4, 8, 4, stretch)
// Tail stub // Tail stub
.child(0) .child(0)
.tex(32, 0).addTopPlane(-1, 2, 2, 2, 6, stretch) .tex(32, 0).addTopPlane(-1, 2, 2, 2, 6, stretch)
.addBottomPlane(-1, 4, 2, 2, 6, stretch) .addBottomPlane(-1, 4, 2, 2, 6, stretch)
.addEastPlane( 1, 2, 2, 2, 6, stretch) .addEastPlane( 1, 2, 2, 2, 6, stretch)
.addBackPlane(-1, 2, 8, 2, 2, stretch) .addBackPlane(-1, 2, 8, 2, 2, stretch)
.flipZ().addWestPlane(-1, 2, 2, 2, 6, stretch) .flipZ().addWestPlane(-1, 2, 2, 2, 6, stretch)
.rotate(0.5F, 0, 0); .rotate(0.5F, 0, 0);
neck = new PlaneRenderer(this, 0, 16) neck = new PlaneRenderer(this, 0, 16)
.at(NECK_CENTRE_X, NECK_CENTRE_Y, NECK_CENTRE_Z) .at(NECK_CENTRE_X, NECK_CENTRE_Y, NECK_CENTRE_Z)
.rotate(NECK_ROT_X, 0, 0).around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .rotate(NECK_ROT_X, 0, 0).around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addFrontPlane(0, 0, 0, 4, 4, stretch) .addFrontPlane(0, 0, 0, 4, 4, stretch)
.addBackPlane(0, 0, 4, 4, 4, stretch) .addBackPlane(0, 0, 4, 4, 4, stretch)
.addEastPlane(4, 0, 0, 4, 4, stretch) .addEastPlane(4, 0, 0, 4, 4, stretch)
.addWestPlane(0, 0, 0, 4, 4, stretch); .addWestPlane(0, 0, 0, 4, 4, stretch);
} }
protected void preInitLegs() { protected void preInitLegs() {
@ -800,12 +809,12 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
/** /**
* *
* Called to render the head. * Called to render the head.
* *
* Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles} * Takes the same parameters as {@link AbstractPonyModel.setRotationAndAngles}
* *
*/ */
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
bipedBody.render(scale); bipedBody.render(scale);
if (textureHeight == 64) { if (textureHeight == 64) {
@ -817,7 +826,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
} }
protected void renderLegs(float scale) { protected void renderLegs(float scale) {
if (!isSneak) bipedBody.postRender(scale); if (!isSneak) {
bipedBody.postRender(scale);
}
bipedLeftArm.render(scale); bipedLeftArm.render(scale);
bipedRightArm.render(scale); bipedRightArm.render(scale);
@ -834,7 +845,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
@Override @Override
public void transform(BodyPart part) { public void transform(BodyPart part) {
if (isRiding) translate(0, -0.4F, -0.2F); if (isRiding) {
translate(0, -0.4F, -0.2F);
}
if (isSleeping) { if (isSleeping) {
rotate(90, 1, 0, 0); rotate(90, 1, 0, 0);
@ -876,7 +889,9 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
ModelRenderer result; ModelRenderer result;
do { do {
result = boxList.get(randomI); result = boxList.get(randomI);
if (!result.cubeList.isEmpty()) return result; if (!result.cubeList.isEmpty()) {
return result;
}
index = (index + 1) % boxList.size(); index = (index + 1) % boxList.size();
} while (index != randomI); } while (index != randomI);

View file

@ -52,6 +52,7 @@ public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
super.renderLegs(scale); super.renderLegs(scale);
} }
@Override
public <T extends ModelBiped & IModel> void synchroniseLegs(T mainModel) { public <T extends ModelBiped & IModel> void synchroniseLegs(T mainModel) {
copyModelAngles(mainModel.bipedRightArm, bipedRightArm); copyModelAngles(mainModel.bipedRightArm, bipedRightArm);
copyModelAngles(mainModel.bipedLeftArm, bipedLeftArm); copyModelAngles(mainModel.bipedLeftArm, bipedLeftArm);
@ -63,8 +64,8 @@ public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
protected void initHead(float yOffset, float stretch) { protected void initHead(float yOffset, float stretch) {
super.initHead(yOffset, stretch * 1.1F); super.initHead(yOffset, stretch * 1.1F);
((PonyRenderer)bipedHead).child() ((PonyRenderer)bipedHead).child()
.tex(0, 4).box(2, -6, 1, 2, 2, 2, stretch * 0.5F) .tex(0, 4).box(2, -6, 1, 2, 2, 2, stretch * 0.5F)
.box(-4, -6, 1, 2, 2, 2, stretch * 0.5F); .box(-4, -6, 1, 2, 2, 2, stretch * 0.5F);
} }
@Override @Override
@ -73,10 +74,10 @@ public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
flankGuard = new PonyRenderer(this, 0, 0) flankGuard = new PonyRenderer(this, 0, 0)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, 4, 6, 8, 8, 8, stretch); .box(-4, 4, 6, 8, 8, 8, stretch);
saddle = new PonyRenderer(this, 16, 8) saddle = new PonyRenderer(this, 16, 8)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, 4, -2, 8, 8, 16, stretch); .box(-4, 4, -2, 8, 8, 16, stretch);
} }
@Override @Override
@ -100,6 +101,7 @@ public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
snout.isHidden = true; snout.isHidden = true;
} }
@Override
public void showFeet(boolean show) { public void showFeet(boolean show) {
bipedRightArm.showModel = show; bipedRightArm.showModel = show;
bipedLeftArm.showModel = show; bipedLeftArm.showModel = show;
@ -107,15 +109,18 @@ public class ModelPonyArmor extends AbstractPonyModel implements IModelArmor {
bipedLeftLeg.showModel = show; bipedLeftLeg.showModel = show;
} }
@Override
public void showLegs(boolean isPony) { public void showLegs(boolean isPony) {
bipedBody.showModel = true; bipedBody.showModel = true;
} }
@Override
public void showSaddle(boolean isPony) { public void showSaddle(boolean isPony) {
flankGuard.showModel = !isPony; flankGuard.showModel = !isPony;
saddle.showModel = isPony; saddle.showModel = isPony;
} }
@Override
public void showHead(boolean show) { public void showHead(boolean show) {
bipedHead.showModel = show; bipedHead.showModel = show;
} }

View file

@ -28,8 +28,8 @@ public class ModelPonyHead extends ModelHumanoidHead implements ICapitated {
snout.init(0, 0); snout.init(0, 0);
ears = new PonyRenderer(this, 0, 0).offset(0, -3, 2).around(0, 0, -2) ears = new PonyRenderer(this, 0, 0).offset(0, -3, 2).around(0, 0, -2)
.tex(12, 16).box(-4, -6, 1, 2, 2, 2, 0) .tex(12, 16).box(-4, -6, 1, 2, 2, 2, 0)
.flip().box( 2, -6, 1, 2, 2, 2, 0); .flip().box( 2, -6, 1, 2, 2, 2, 0);
skeletonHead.addChild(ears); skeletonHead.addChild(ears);
} }

View file

@ -29,17 +29,17 @@ public class ModelWing {
float x = right ? -6 : 4; float x = right ? -6 : 4;
folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z) folded.around(HEAD_RP_X, WING_FOLDED_RP_Y + y, WING_FOLDED_RP_Z)
.box(x, 5, 2, 2, 6, 2, scale) .box(x, 5, 2, 2, 6, 2, scale)
.box(x, 5, 4, 2, 8, 2, scale) .box(x, 5, 4, 2, 8, 2, scale)
.box(x, 5, 6, 2, 6, 2, scale) .box(x, 5, 6, 2, 6, 2, scale)
.rotateAngleX = ROTATE_90; .rotateAngleX = ROTATE_90;
} }
private void addFeathers(boolean right, boolean l, float rotationPointY, float scale) { private void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
float r = right ? -1 : 1; float r = right ? -1 : 1;
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + rotationPointY, LEFT_WING_EXT_RP_Z) extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + rotationPointY, LEFT_WING_EXT_RP_Z)
.rotateAngleY = r * 3; .rotateAngleY = r * 3;
addFeather(0, l, 6, 0, 8, scale + 0.1F); addFeather(0, l, 6, 0, 8, scale + 0.1F);
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F; addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F;
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F; addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;

View file

@ -55,7 +55,7 @@ public class PonyElytra extends ModelBase {
float velY = 1; float velY = 1;
if (entity.motionY < 0) { if (entity.motionY < 0) {
Vec3d motion = (new Vec3d(entity.motionX, entity.motionY, entity.motionZ)).normalize(); Vec3d motion = new Vec3d(entity.motionX, entity.motionY, entity.motionZ).normalize();
velY = 1 - (float) Math.pow(-motion.y, 1.5); velY = 1 - (float) Math.pow(-motion.y, 1.5);
} }

View file

@ -40,22 +40,22 @@ public class PonySnout {
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
mare.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) mare.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(10, 14) .addBackPlane(-2, 2, -5, 4, 2, stretch) .tex(10, 14) .addBackPlane(-2, 2, -5, 4, 2, stretch)
.tex(11, 13) .addBackPlane(-1, 1, -5, 2, 1, stretch) .tex(11, 13) .addBackPlane(-1, 1, -5, 2, 1, stretch)
.tex(9, 14) .addTopPlane(-2, 2, -5, 1, 1, stretch) .tex(9, 14) .addTopPlane(-2, 2, -5, 1, 1, stretch)
.tex(14, 14) .addTopPlane( 1, 2, -5, 1, 1, stretch) .tex(14, 14) .addTopPlane( 1, 2, -5, 1, 1, stretch)
.tex(11, 12) .addTopPlane(-1, 1, -5, 2, 1, stretch) .tex(11, 12) .addTopPlane(-1, 1, -5, 2, 1, stretch)
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch) .tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
.tex(9, 14) .addWestPlane(-2, 2, -5, 2, 1, stretch) .tex(9, 14) .addWestPlane(-2, 2, -5, 2, 1, stretch)
.tex(14, 14) .addEastPlane( 2, 2, -5, 2, 1, stretch) .tex(14, 14) .addEastPlane( 2, 2, -5, 2, 1, stretch)
.tex(11, 12) .addWestPlane(-1, 1, -5, 1, 1, stretch) .tex(11, 12) .addWestPlane(-1, 1, -5, 1, 1, stretch)
.tex(12, 12) .addEastPlane( 1, 1, -5, 1, 1, stretch); .tex(12, 12) .addEastPlane( 1, 1, -5, 1, 1, stretch);
stallion.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) stallion.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.tex(10, 13) .addBackPlane(-2, 1, -5, 4, 3, stretch) .tex(10, 13) .addBackPlane(-2, 1, -5, 4, 3, stretch)
.tex(10, 13) .addTopPlane(-2, 1, -5, 4, 1, stretch) .tex(10, 13) .addTopPlane(-2, 1, -5, 4, 1, stretch)
.tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch) .tex(18, 7).addBottomPlane(-2, 4, -5, 4, 1, stretch)
.tex(10, 13) .addWestPlane(-2, 1, -5, 3, 1, stretch) .tex(10, 13) .addWestPlane(-2, 1, -5, 3, 1, stretch)
.tex(13, 13) .addEastPlane( 2, 1, -5, 3, 1, stretch); .tex(13, 13) .addEastPlane( 2, 1, -5, 3, 1, stretch);
} }
public void setGender(PonyGender gender) { public void setGender(PonyGender gender) {

View file

@ -92,13 +92,13 @@ public class PonyTail extends PlaneRenderer implements IModelPart {
super(model); super(model);
this.index = index; this.index = index;
offsetY = ((float)index)/4 + 0.063f; offsetY = (float)index/4 + 0.063f;
init(yOffset, stretch); init(yOffset, stretch);
} }
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
int texX = (index % 2) * 4; int texX = index % 2 * 4;
around(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z); around(TAIL_RP_X, TAIL_RP_Y + yOffset, TAIL_RP_Z);
@ -107,10 +107,10 @@ public class PonyTail extends PlaneRenderer implements IModelPart {
} }
tex(36, texX).addEastPlane( 2, 0, 2, 4, 4, stretch) tex(36, texX).addEastPlane( 2, 0, 2, 4, 4, stretch)
.addWestPlane(-2, 0, 2, 4, 4, stretch); .addWestPlane(-2, 0, 2, 4, 4, stretch);
tex(32, texX).addBackPlane(-2, 0, 2, 4, 4, stretch) tex(32, texX).addBackPlane(-2, 0, 2, 4, 4, stretch)
.addFrontPlane(-2, 0, 6, 4, 4, stretch); .addFrontPlane(-2, 0, 6, 4, 4, stretch);
tex(32, 0).addBottomPlane(-2, 4, 2, 4, 4, stretch); tex(32, 0).addBottomPlane(-2, 4, 2, 4, 4, stretch);
} }
@Override @Override

View file

@ -39,37 +39,37 @@ public class SaddleBags implements IModelPart {
strap.offset(-x, y + 0.2F, z + 3).around(0, 4, 4) strap.offset(-x, y + 0.2F, z + 3).around(0, 4, 4)
.tex(56, 31).addTopPlane(0, 0, 0, 8, 1, stretch) .tex(56, 31).addTopPlane(0, 0, 0, 8, 1, stretch)
.addTopPlane(0, 0, 1, 8, 1, stretch) .addTopPlane(0, 0, 1, 8, 1, stretch)
.addBackPlane(0, 0, 2, 8, 1, stretch) .addBackPlane(0, 0, 2, 8, 1, stretch)
.addFrontPlane(0, 0, 0, 8, 1, stretch) .addFrontPlane(0, 0, 0, 8, 1, stretch)
.child(0).offset(0, -3, -0.305F).tex(56, 31) .child(0).offset(0, -3, -0.305F).tex(56, 31)
.addWestPlane(4.0002F, 0, 0, 1, 3, stretch) // 0.0001 is there .addWestPlane(4.0002F, 0, 0, 1, 3, stretch) // 0.0001 is there
.addWestPlane(4.0002F, -1, 0, 1, 3, stretch) // otherwise straps .addWestPlane(4.0002F, -1, 0, 1, 3, stretch) // otherwise straps
.addWestPlane(-4.0002F, 0, 0, 1, 3, stretch) // clip into the body .addWestPlane(-4.0002F, 0, 0, 1, 3, stretch) // clip into the body
.addWestPlane(-4.0002F, -1, 0, 1, 3, stretch) .addWestPlane(-4.0002F, -1, 0, 1, 3, stretch)
.rotateAngleX = ROTATE_270; .rotateAngleX = ROTATE_270;
leftBag.offset(x, y, z).around(0, 4, 4) leftBag.offset(x, y, z).around(0, 4, 4)
.tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch) .tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch)
.tex(59, 25).addBackPlane(0, 0, 8, 3, 6, stretch) .tex(59, 25).addBackPlane(0, 0, 8, 3, 6, stretch)
.tex(56, 19).addWestPlane(3, 0, 0, 6, 8, stretch) .tex(56, 19).addWestPlane(3, 0, 0, 6, 8, stretch)
.addWestPlane(0, 0, 0, 6, 8, stretch) .addWestPlane(0, 0, 0, 6, 8, stretch)
.child(0).offset(z, y, -x).tex(56, 16) .child(0).offset(z, y, -x).tex(56, 16)
.addTopPlane(0, 0, -3, 8, 3, stretch) .addTopPlane(0, 0, -3, 8, 3, stretch)
.tex(56, 22).flipZ().addBottomPlane(0, 6, -3, 8, 3, stretch) .tex(56, 22).flipZ().addBottomPlane(0, 6, -3, 8, 3, stretch)
.rotateAngleY = ROTATE_270; .rotateAngleY = ROTATE_270;
x += 3; x += 3;
rightBag.offset(-x, y, z).around(0, 4, 4) rightBag.offset(-x, y, z).around(0, 4, 4)
.tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch) .tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch)
.tex(59, 25).addBackPlane(0, 0, 8, 3, 6, stretch) .tex(59, 25).addBackPlane(0, 0, 8, 3, 6, stretch)
.tex(56, 19).addWestPlane(3, 0, 0, 6, 8, stretch) .tex(56, 19).addWestPlane(3, 0, 0, 6, 8, stretch)
.addWestPlane(0, 0, 0, 6, 8, stretch) .addWestPlane(0, 0, 0, 6, 8, stretch)
.child(0).offset(z, y, x).tex(56, 16) .child(0).offset(z, y, x).tex(56, 16)
.flipZ().addTopPlane(0, 0, -3, 8, 3, stretch) .flipZ().addTopPlane(0, 0, -3, 8, 3, stretch)
.tex(56, 22).flipZ().addBottomPlane(0, 6, -3, 8, 3, stretch) .tex(56, 22).flipZ().addBottomPlane(0, 6, -3, 8, 3, stretch)
.rotateAngleY = ROTATE_270; .rotateAngleY = ROTATE_270;
} }

View file

@ -31,14 +31,14 @@ public class SeaponyTail implements IModelPart {
@Override @Override
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
tailBase.rotate(TAIL_ROTX, 0, 0).around(-2, 14, 8) tailBase.rotate(TAIL_ROTX, 0, 0).around(-2, 14, 8)
.box( 0, 0, 0, 4, 6, 4, stretch).flip(); .box( 0, 0, 0, 4, 6, 4, stretch).flip();
tailTip.rotate(0, 0, 0).around(1, 5, 1) tailTip.rotate(0, 0, 0).around(1, 5, 1)
.box(0, 0, 0, 2, 6, 1, stretch); .box(0, 0, 0, 2, 6, 1, stretch);
tailFins.offset(1, 0, 4).rotate(-TAIL_ROTX, 0, 0) tailFins.offset(1, 0, 4).rotate(-TAIL_ROTX, 0, 0)
.addTopPlane(-8, 0, 0, 8, 8, stretch) .addTopPlane(-8, 0, 0, 8, 8, stretch)
.flip().addTopPlane( 0, 0, 0, 8, 8, stretch); .flip().addTopPlane( 0, 0, 0, 8, 8, stretch);
} }
@Override @Override

View file

@ -24,14 +24,14 @@ public class UnicornHorn {
glow = new HornGlowRenderer(pony, 0, 3); glow = new HornGlowRenderer(pony, 0, 3);
horn.offset(HORN_X + x, HORN_Y + y, HORN_Z + z) horn.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(0, 0, 0, 1, 4, 1, stretch) .box(0, 0, 0, 1, 4, 1, stretch)
.rotateAngleX = 0.5F; .rotateAngleX = 0.5F;
glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z) glow.offset(HORN_X + x, HORN_Y + y, HORN_Z + z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.setAlpha(0.4f).box(0, 0, 0, 1, 4, 1, stretch + 0.5F) .setAlpha(0.4f).box(0, 0, 0, 1, 4, 1, stretch + 0.5F)
.setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F); .setAlpha(0.2f).box(0, 0, 0, 1, 3, 1, stretch + 0.8F);
} }
public void render(float scale) { public void render(float scale) {

View file

@ -33,13 +33,13 @@ public class ModelZebra extends ModelEarthPony {
bipedHead.addChild(bristles); bipedHead.addChild(bristles);
bristles.offset(-1, -1, -3) bristles.offset(-1, -1, -3)
.box(0, -10, 2, 2, 6, 2, stretch) .box(0, -10, 2, 2, 6, 2, stretch)
.box(0, -10, 4, 2, 8, 2, stretch) .box(0, -10, 4, 2, 8, 2, stretch)
.box(0, -8, 6, 2, 6, 2, stretch) .box(0, -8, 6, 2, 6, 2, stretch)
.rotateAngleX = 0.3F; .rotateAngleX = 0.3F;
bristles.child(0).offset(-1.01F, 2, -7) //0.01 to prevent z-fighting bristles.child(0).offset(-1.01F, 2, -7) //0.01 to prevent z-fighting
.box(0, -10, 4, 2, 8, 2, stretch) .box(0, -10, 4, 2, 8, 2, stretch)
.box(0, -8, 6, 2, 6, 2, stretch) .box(0, -8, 6, 2, 6, 2, stretch)
.rotateAngleX = -1F; .rotateAngleX = -1F;
} }
} }

View file

@ -48,7 +48,7 @@ public class ModelIllagerPony extends ModelAlicorn {
bipedLeftArm.rotateAngleX -= sin; bipedLeftArm.rotateAngleX -= sin;
} else if (pose == IllagerArmPose.SPELLCASTING) { } else if (pose == IllagerArmPose.SPELLCASTING) {
// waving arms! // waving arms!
// this.bipedRightArm.rotationPointZ = 0; // this.bipedRightArm.rotationPointZ = 0;
arm.rotateAngleX = (float) (-.75F * Math.PI); arm.rotateAngleX = (float) (-.75F * Math.PI);
arm.rotateAngleZ = mult * MathHelper.cos(ticks * 0.6662F) / 4; arm.rotateAngleZ = mult * MathHelper.cos(ticks * 0.6662F) / 4;
arm.rotateAngleY = mult * 1.1F; arm.rotateAngleY = mult * 1.1F;

View file

@ -41,7 +41,7 @@ public class ModelSeapony extends ModelUnicorn {
leftFin = new PlaneRenderer(this, 56, 16) leftFin = new PlaneRenderer(this, 56, 16)
.rotate(0, FIN_ROTY, 0).around(3, -6, 3) .rotate(0, FIN_ROTY, 0).around(3, -6, 3)
.flipZ().addEastPlane(0, 0, 0, 12, 8, stretch); .flipZ().addEastPlane(0, 0, 0, 12, 8, stretch);
rightFin = new PlaneRenderer(this, 56, 16) rightFin = new PlaneRenderer(this, 56, 16)
.rotate(0, -FIN_ROTY, 0).around(-3, -6, 3) .rotate(0, -FIN_ROTY, 0).around(-3, -6, 3)

View file

@ -42,24 +42,33 @@ public class ModelSkeletonPony extends ModelMobPony {
super.setLivingAnimations(entity, move, swing, ticks); super.setLivingAnimations(entity, move, swing, ticks);
} }
@Override
protected float getLegOutset() { protected float getLegOutset() {
if (isSleeping()) return 2.6f; if (isSleeping()) {
if (isCrouching()) return 0; return 2.6f;
}
if (isCrouching()) {
return 0;
}
return 4; return 4;
} }
@Override
protected int getArmWidth() { protected int getArmWidth() {
return 2; return 2;
} }
@Override
protected int getArmDepth() { protected int getArmDepth() {
return 2; return 2;
} }
@Override
protected float getLegRotationX() { protected float getLegRotationX() {
return 3; return 3;
} }
@Override
protected float getArmRotationY() { protected float getArmRotationY() {
return 8; return 8;
} }

View file

@ -70,12 +70,12 @@ public class ModelVillagerPony extends ModelAlicorn {
saddlebags.init(yOffset, stretch); saddlebags.init(yOffset, stretch);
apron = new PlaneRenderer(this, 56, 16) apron = new PlaneRenderer(this, 56, 16)
.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) .offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addBackPlane(-4, -4, -9, 8, 10, stretch); .addBackPlane(-4, -4, -9, 8, 10, stretch);
trinket = new PlaneRenderer(this, 0, 3) trinket = new PlaneRenderer(this, 0, 3)
.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) .offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.addBackPlane(-2, -4, -9, 4, 5, stretch); .addBackPlane(-2, -4, -9, 4, 5, stretch);
} }
} }

View file

@ -26,8 +26,9 @@ public class ModelWitchPony extends ModelZebra {
super(false); super(false);
} }
@Override
public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) { public void setLivingAnimations(EntityLivingBase entity, float move, float swing, float ticks) {
EntityWitch witch = ((EntityWitch) entity); EntityWitch witch = (EntityWitch) entity;
leftArmPose = ArmPose.EMPTY; leftArmPose = ArmPose.EMPTY;
rightArmPose = witch.getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM; rightArmPose = witch.getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
@ -48,8 +49,12 @@ public class ModelWitchPony extends ModelZebra {
if (rightArmPose != ArmPose.EMPTY) { if (rightArmPose != ArmPose.EMPTY) {
float rot = (float)(Math.tan(ticks / 7) + Math.sin(ticks / 3)); float rot = (float)(Math.tan(ticks / 7) + Math.sin(ticks / 3));
if (rot > 1) rot = 1; if (rot > 1) {
if (rot < -1) rot = -1; rot = 1;
}
if (rot < -1) {
rot = -1;
}
float legDrinkingAngle = -1 * PI/3 + rot; float legDrinkingAngle = -1 * PI/3 + rot;
@ -60,7 +65,9 @@ public class ModelWitchPony extends ModelZebra {
bipedRightArm.offsetZ = 0.1f; bipedRightArm.offsetZ = 0.1f;
bipedRightArmwear.offsetZ = 0.1f; bipedRightArmwear.offsetZ = 0.1f;
if (rot > 0) rot = 0; if (rot > 0) {
rot = 0;
}
bipedHead.rotateAngleX = -rot / 2; bipedHead.rotateAngleX = -rot / 2;
bipedHeadwear.rotateAngleX = -rot / 2; bipedHeadwear.rotateAngleX = -rot / 2;
@ -88,15 +95,15 @@ public class ModelWitchPony extends ModelZebra {
super.init(yOffset, stretch); super.init(yOffset, stretch);
witchHat = new PonyRenderer(this).size(64, 128); witchHat = new PonyRenderer(this).size(64, 128);
witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch) .tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch)
.child(0).around(1.75F, -4, 2) .child(0).around(1.75F, -4, 2)
.tex(0, 76).box(-5, -5, -7, 7, 4, 7, stretch) .tex(0, 76).box(-5, -5, -7, 7, 4, 7, stretch)
.rotate(-0.05235988F, 0, 0.02617994F) .rotate(-0.05235988F, 0, 0.02617994F)
.child(0).around(1.75F, -4, 2) .child(0).around(1.75F, -4, 2)
.tex(0, 87).box(-5, -4, -7, 4, 4, 4, stretch) .tex(0, 87).box(-5, -4, -7, 4, 4, 4, stretch)
.rotate(-0.10471976F, 0, 0.05235988F) .rotate(-0.10471976F, 0, 0.05235988F)
.child(0).around(1.75F, -2, 2) .child(0).around(1.75F, -2, 2)
.tex(0, 95).box(-5, -2, -7, 1, 2, 1, stretch) .tex(0, 95).box(-5, -2, -7, 1, 2, 1, stretch)
.rotate(-0.20943952F, 0, 0.10471976F); .rotate(-0.20943952F, 0, 0.10471976F);
} }
} }