mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Code cleanup.
This commit is contained in:
parent
b972fda9af
commit
ef0f069e34
84 changed files with 731 additions and 2209 deletions
|
@ -1,9 +1,9 @@
|
||||||
package com.voxelmodpack.hdskins;
|
package com.voxelmodpack.hdskins;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
public class DynamicTextureImage extends DynamicTexture {
|
public class DynamicTextureImage extends DynamicTexture {
|
||||||
|
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.voxelmodpack.hdskins;
|
package com.voxelmodpack.hdskins;
|
||||||
|
|
||||||
import java.util.Map;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Map;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Profile texture with a custom hash which is not the file name.
|
* Profile texture with a custom hash which is not the file name.
|
||||||
|
|
|
@ -1,23 +1,6 @@
|
||||||
package com.voxelmodpack.hdskins;
|
package com.voxelmodpack.hdskins;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
|
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
@ -36,7 +19,6 @@ import com.mojang.util.UUIDTypeAdapter;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
||||||
import com.voxelmodpack.hdskins.resource.SkinResourceManager;
|
import com.voxelmodpack.hdskins.resource.SkinResourceManager;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
|
@ -47,12 +29,26 @@ import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public final class HDSkinManager implements IResourceManagerReloadListener {
|
public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
public static final HDSkinManager INSTANCE = new HDSkinManager();
|
public static final HDSkinManager INSTANCE = new HDSkinManager();
|
||||||
private static final ResourceLocation LOADING = new ResourceLocation("LOADING");
|
private static final ResourceLocation LOADING = new ResourceLocation("LOADING");
|
||||||
public static final String METADATA_KEY = "hdskins.metadata";
|
|
||||||
|
|
||||||
private String gatewayUrl = "skinmanager.voxelmodpack.com";
|
private String gatewayUrl = "skinmanager.voxelmodpack.com";
|
||||||
private String skinUrl = "skins.voxelmodpack.com";
|
private String skinUrl = "skins.voxelmodpack.com";
|
||||||
|
@ -65,11 +61,12 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
private SkinResourceManager resources = new SkinResourceManager();
|
private SkinResourceManager resources = new SkinResourceManager();
|
||||||
private ExecutorService executor = Executors.newCachedThreadPool();
|
private ExecutorService executor = Executors.newCachedThreadPool();
|
||||||
|
|
||||||
public HDSkinManager() {}
|
public HDSkinManager() {
|
||||||
|
}
|
||||||
|
|
||||||
public Optional<ResourceLocation> getSkinLocation(GameProfile profile1, final Type type, boolean loadIfAbsent) {
|
public Optional<ResourceLocation> getSkinLocation(GameProfile profile1, final Type type, boolean loadIfAbsent) {
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
return Optional.absent();
|
return Optional.empty();
|
||||||
|
|
||||||
ResourceLocation skin = this.resources.getPlayerTexture(profile1, type);
|
ResourceLocation skin = this.resources.getPlayerTexture(profile1, type);
|
||||||
if (skin != null)
|
if (skin != null)
|
||||||
|
@ -97,29 +94,19 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
final GameProfile profile = profile1;
|
final GameProfile profile = profile1;
|
||||||
|
|
||||||
if (!this.skinCache.containsKey(profile.getId())) {
|
if (!this.skinCache.containsKey(profile.getId())) {
|
||||||
this.skinCache.put(profile.getId(), Maps.<Type, ResourceLocation> newHashMap());
|
this.skinCache.put(profile.getId(), Maps.newHashMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
skin = this.skinCache.get(profile.getId()).get(type);
|
skin = this.skinCache.get(profile.getId()).get(type);
|
||||||
if (skin == null) {
|
if (skin == null) {
|
||||||
if (loadIfAbsent) {
|
if (loadIfAbsent) {
|
||||||
skinCache.get(profile.getId()).put(type, LOADING);
|
skinCache.get(profile.getId()).put(type, LOADING);
|
||||||
executor.submit(new Runnable() {
|
executor.submit(() -> loadTexture(profile, type, (type1, location, profileTexture) -> skinCache.get(profile.getId()).put(type1, location)));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
loadTexture(profile, type, new SkinAvailableCallback() {
|
|
||||||
@Override
|
|
||||||
public void skinAvailable(Type type, ResourceLocation location, MinecraftProfileTexture profileTexture) {
|
|
||||||
skinCache.get(profile.getId()).put(type, location);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return Optional.absent();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
return skin == LOADING ? Optional.<ResourceLocation> absent() : Optional.of(skin);
|
return skin == LOADING ? Optional.empty() : Optional.of(skin);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,11 +168,11 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Map<Type, MinecraftProfileTexture> getTexturesForProfile(GameProfile profile) {
|
private static Map<Type, MinecraftProfileTexture> getTexturesForProfile(GameProfile profile) {
|
||||||
LiteLoaderLogger.debug("Get textures for " + profile.getId(), new Object[0]);
|
LiteLoaderLogger.debug("Get textures for " + profile.getId());
|
||||||
|
|
||||||
Minecraft minecraft = Minecraft.getMinecraft();
|
Minecraft minecraft = Minecraft.getMinecraft();
|
||||||
MinecraftSessionService sessionService = minecraft.getSessionService();
|
MinecraftSessionService sessionService = minecraft.getSessionService();
|
||||||
Map<Type, MinecraftProfileTexture> textures = null;
|
Map<Type, MinecraftProfileTexture> textures;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
textures = sessionService.getTextures(profile, true);
|
textures = sessionService.getTextures(profile, true);
|
||||||
|
@ -208,10 +195,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
this.gatewayUrl = gatewayURL;
|
this.gatewayUrl = gatewayURL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSkinUrl() {
|
|
||||||
return String.format("http://%s/", skinUrl);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getGatewayUrl() {
|
public String getGatewayUrl() {
|
||||||
return String.format("http://%s/", gatewayUrl);
|
return String.format("http://%s/", gatewayUrl);
|
||||||
}
|
}
|
||||||
|
@ -254,7 +237,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void clearSkinCache() {
|
public static void clearSkinCache() {
|
||||||
LiteLoaderLogger.info("Clearing local player skin cache", new Object[0]);
|
LiteLoaderLogger.info("Clearing local player skin cache");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileUtils.deleteDirectory(new File(LiteLoader.getAssetsDirectory(), "skins"));
|
FileUtils.deleteDirectory(new File(LiteLoader.getAssetsDirectory(), "skins"));
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.voxelmodpack.hdskins;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
|
||||||
|
|
||||||
public class HDThreadImageDownload extends SimpleTexture {
|
|
||||||
|
|
||||||
public HDThreadImageDownload() {
|
|
||||||
super(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,10 +1,9 @@
|
||||||
package com.voxelmodpack.hdskins;
|
package com.voxelmodpack.hdskins;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.image.ImageObserver;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
|
||||||
|
|
||||||
public class ImageBufferDownloadHD implements IImageBuffer {
|
public class ImageBufferDownloadHD implements IImageBuffer {
|
||||||
|
|
||||||
|
@ -13,6 +12,7 @@ public class ImageBufferDownloadHD implements IImageBuffer {
|
||||||
private BufferedImage image;
|
private BufferedImage image;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("SuspiciousNameCombination")
|
||||||
public BufferedImage parseUserSkin(BufferedImage downloadedImage) {
|
public BufferedImage parseUserSkin(BufferedImage downloadedImage) {
|
||||||
if (downloadedImage == null) {
|
if (downloadedImage == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -25,7 +25,7 @@ public class ImageBufferDownloadHD implements IImageBuffer {
|
||||||
scale = imageWidth / 64;
|
scale = imageWidth / 64;
|
||||||
image = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
|
image = new BufferedImage(imageWidth, imageWidth, BufferedImage.TYPE_INT_ARGB);
|
||||||
graphics = image.getGraphics();
|
graphics = image.getGraphics();
|
||||||
graphics.drawImage(downloadedImage, 0, 0, (ImageObserver) null);
|
graphics.drawImage(downloadedImage, 0, 0, null);
|
||||||
|
|
||||||
// copy layers
|
// copy layers
|
||||||
// leg
|
// leg
|
||||||
|
@ -58,5 +58,6 @@ public class ImageBufferDownloadHD implements IImageBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void skinAvailable() {}
|
public void skinAvailable() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,21 @@
|
||||||
package com.voxelmodpack.hdskins;
|
package com.voxelmodpack.hdskins;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class PreviewTexture extends ThreadDownloadImageData {
|
public class PreviewTexture extends ThreadDownloadImageData {
|
||||||
|
|
||||||
private boolean uploaded;
|
private boolean uploaded;
|
||||||
|
|
||||||
public PreviewTexture(String url, ResourceLocation fallbackTexture, IImageBuffer imageBuffer) {
|
public PreviewTexture(String url, ResourceLocation fallbackTexture, IImageBuffer imageBuffer) {
|
||||||
super((File) null, url, fallbackTexture, imageBuffer);
|
super(null, url, fallbackTexture, imageBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTextureUploaded() {
|
public boolean isTextureUploaded() {
|
||||||
return uploaded && this.getGlTextureId() > -1;
|
return uploaded && this.getGlTextureId() > -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteGlTexture() {
|
public void deleteGlTexture() {
|
||||||
super.deleteGlTexture();
|
super.deleteGlTexture();
|
||||||
|
|
|
@ -9,11 +9,6 @@ public class TextureLoader {
|
||||||
private static Minecraft mc = Minecraft.getMinecraft();
|
private static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
|
||||||
public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) {
|
public static void loadTexture(final ResourceLocation textureLocation, final ITextureObject textureObj) {
|
||||||
mc.addScheduledTask(new Runnable() {
|
mc.addScheduledTask((Runnable) () -> mc.getTextureManager().loadTexture(textureLocation, textureObj));
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mc.getTextureManager().loadTexture(textureLocation, textureObj);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
package com.voxelmodpack.hdskins.gui;
|
package com.voxelmodpack.hdskins.gui;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
|
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
|
||||||
import com.voxelmodpack.hdskins.PreviewTexture;
|
import com.voxelmodpack.hdskins.PreviewTexture;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
import net.minecraft.client.renderer.texture.TextureManager;
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
|
@ -22,7 +15,11 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class EntityPlayerModel extends EntityLivingBase {
|
public class EntityPlayerModel extends EntityLivingBase {
|
||||||
public static final ResourceLocation NOSKIN = new ResourceLocation("hdskins", "textures/mob/noskin.png");
|
public static final ResourceLocation NOSKIN = new ResourceLocation("hdskins", "textures/mob/noskin.png");
|
||||||
|
@ -37,7 +34,7 @@ public class EntityPlayerModel extends EntityLivingBase {
|
||||||
protected boolean hasLocalTexture = false;
|
protected boolean hasLocalTexture = false;
|
||||||
|
|
||||||
public EntityPlayerModel(GameProfile profile) {
|
public EntityPlayerModel(GameProfile profile) {
|
||||||
super((World) null);
|
super(null);
|
||||||
this.profile = profile;
|
this.profile = profile;
|
||||||
this.textureManager = Minecraft.getMinecraft().getTextureManager();
|
this.textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||||
this.remoteSkinResource = new ResourceLocation("skins/preview_" + this.profile.getName() + ".png");
|
this.remoteSkinResource = new ResourceLocation("skins/preview_" + this.profile.getName() + ".png");
|
||||||
|
@ -79,10 +76,6 @@ public class EntityPlayerModel extends EntityLivingBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean usingRemoteSkin() {
|
|
||||||
return this.remoteSkin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isUsingLocalTexture() {
|
public boolean isUsingLocalTexture() {
|
||||||
return !this.remoteSkin && this.hasLocalTexture;
|
return !this.remoteSkin && this.hasLocalTexture;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +86,7 @@ public class EntityPlayerModel extends EntityLivingBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isTextureSetupComplete() {
|
public boolean isTextureSetupComplete() {
|
||||||
return this.remoteSkin && this.remoteSkinTexture != null ? this.remoteSkinTexture.isTextureUploaded() : false;
|
return (this.remoteSkin && this.remoteSkinTexture != null) && this.remoteSkinTexture.isTextureUploaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseTextures() {
|
public void releaseTextures() {
|
||||||
|
|
|
@ -11,35 +11,37 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public abstract class FileDropListener implements DropTargetListener {
|
public interface FileDropListener extends DropTargetListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragEnter(DropTargetDragEvent dtde) {}
|
default void dragEnter(DropTargetDragEvent dtde) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragOver(DropTargetDragEvent dtde) {}
|
default void dragOver(DropTargetDragEvent dtde) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropActionChanged(DropTargetDragEvent dtde) {}
|
default void dropActionChanged(DropTargetDragEvent dtde) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragExit(DropTargetEvent dte) {}
|
default void dragExit(DropTargetEvent dte) {
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void drop(DropTargetDropEvent dtde) {
|
default void drop(DropTargetDropEvent dtde) {
|
||||||
dtde.acceptDrop(DnDConstants.ACTION_LINK);
|
dtde.acceptDrop(DnDConstants.ACTION_LINK);
|
||||||
try {
|
try {
|
||||||
onDrop((List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
|
onDrop((List<File>) dtde.getTransferable().getTransferData(DataFlavor.javaFileListFlavor));
|
||||||
dtde.getDropTargetContext().dropComplete(true);
|
dtde.getDropTargetContext().dropComplete(true);
|
||||||
} catch (UnsupportedFlavorException e) {
|
} catch (UnsupportedFlavorException | IOException e) {
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void onDrop(List<File> files);
|
void onDrop(List<File> files);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
package com.voxelmodpack.hdskins.gui;
|
package com.voxelmodpack.hdskins.gui;
|
||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.exceptions.AuthenticationException;
|
import com.mojang.authlib.exceptions.AuthenticationException;
|
||||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import com.voxelmodpack.hdskins.mod.LiteModHDSkinsMod;
|
|
||||||
import com.voxelmodpack.hdskins.upload.IUploadCompleteCallback;
|
import com.voxelmodpack.hdskins.upload.IUploadCompleteCallback;
|
||||||
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
|
import com.voxelmodpack.hdskins.upload.ThreadMultipartPostUpload;
|
||||||
import com.voxelmodpack.hdskins.upload.awt.IOpenFileCallback;
|
import com.voxelmodpack.hdskins.upload.awt.IOpenFileCallback;
|
||||||
import com.voxelmodpack.hdskins.upload.awt.ThreadOpenFilePNG;
|
import com.voxelmodpack.hdskins.upload.awt.ThreadOpenFilePNG;
|
||||||
import com.voxelmodpack.voxelmenu.IPanoramaRenderer;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.Gui;
|
import net.minecraft.client.gui.Gui;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
@ -30,14 +27,19 @@ import net.minecraft.util.Session;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang3.JavaVersion;
|
|
||||||
import org.apache.commons.lang3.SystemUtils;
|
|
||||||
import org.lwjgl.BufferUtils;
|
import org.lwjgl.BufferUtils;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.lwjgl.util.glu.GLU;
|
import org.lwjgl.util.glu.GLU;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JFileChooser;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
import javax.swing.UIManager;
|
||||||
|
import javax.swing.WindowConstants;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Window.Type;
|
import java.awt.Window.Type;
|
||||||
import java.awt.dnd.DropTarget;
|
import java.awt.dnd.DropTarget;
|
||||||
|
@ -45,17 +47,15 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.DoubleBuffer;
|
import java.nio.DoubleBuffer;
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpenFileCallback, IPanoramaRenderer {
|
public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpenFileCallback {
|
||||||
private static final int MAX_SKIN_DIMENSION = 8192;
|
private static final int MAX_SKIN_DIMENSION = 8192;
|
||||||
private static final String skinServerId = "7853dfddc358333843ad55a2c7485c4aa0380a51";
|
private static final String skinServerId = "7853dfddc358333843ad55a2c7485c4aa0380a51";
|
||||||
private int updateCounter = 0;
|
private int updateCounter = 0;
|
||||||
private ResourceLocation viewportTexture;
|
private ResourceLocation viewportTexture;
|
||||||
private IPanoramaRenderer panoramaRenderer;
|
|
||||||
private static final ResourceLocation[] cubemapTextures = {
|
private static final ResourceLocation[] cubemapTextures = {
|
||||||
new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_0.png"),
|
new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_0.png"),
|
||||||
new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_1.png"),
|
new ResourceLocation("hdskins", "textures/cubemaps/cubemap0_1.png"),
|
||||||
|
@ -70,7 +70,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
protected EntityPlayerModel localPlayer;
|
protected EntityPlayerModel localPlayer;
|
||||||
protected EntityPlayerModel remotePlayer;
|
protected EntityPlayerModel remotePlayer;
|
||||||
protected DoubleBuffer doubleBuffer;
|
protected DoubleBuffer doubleBuffer;
|
||||||
private String screenTitle;
|
// private String screenTitle;
|
||||||
private String uploadError;
|
private String uploadError;
|
||||||
private volatile String skinMessage = I18n.format("hdskins.choose");
|
private volatile String skinMessage = I18n.format("hdskins.choose");
|
||||||
private String skinUploadMessage = I18n.format("hdskins.request");
|
private String skinUploadMessage = I18n.format("hdskins.request");
|
||||||
|
@ -81,7 +81,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
private int refreshCounter = -1;
|
private int refreshCounter = -1;
|
||||||
private ThreadOpenFilePNG openFileThread;
|
private ThreadOpenFilePNG openFileThread;
|
||||||
private ThreadMultipartPostUpload threadSkinUpload;
|
private ThreadMultipartPostUpload threadSkinUpload;
|
||||||
private Object skinLock = new Object();
|
private final Object skinLock = new Object();
|
||||||
private File pendingSkinFile;
|
private File pendingSkinFile;
|
||||||
private File selectedSkin;
|
private File selectedSkin;
|
||||||
private BufferedImage pendingSkinImage;
|
private BufferedImage pendingSkinImage;
|
||||||
|
@ -90,7 +90,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
private JFrame fileDrop;
|
private JFrame fileDrop;
|
||||||
|
|
||||||
// translations
|
// translations
|
||||||
private final String manager = I18n.format("hdskins.manager");
|
private final String screenTitle = I18n.format("hdskins.manager");
|
||||||
private final String unreadable = I18n.format("hdskins.error.unreadable");
|
private final String unreadable = I18n.format("hdskins.error.unreadable");
|
||||||
private final String ext = I18n.format("hdskins.error.ext");
|
private final String ext = I18n.format("hdskins.error.ext");
|
||||||
private final String open = I18n.format("hdskins.error.open");
|
private final String open = I18n.format("hdskins.error.open");
|
||||||
|
@ -108,7 +108,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
|
|
||||||
public GuiSkins() {
|
public GuiSkins() {
|
||||||
Minecraft minecraft = Minecraft.getMinecraft();
|
Minecraft minecraft = Minecraft.getMinecraft();
|
||||||
this.screenTitle = manager;
|
// this.screenTitle = manager;
|
||||||
GameProfile profile = minecraft.getSession().getProfile();
|
GameProfile profile = minecraft.getSession().getProfile();
|
||||||
this.localPlayer = getModel(profile);
|
this.localPlayer = getModel(profile);
|
||||||
this.remotePlayer = getModel(profile);
|
this.remotePlayer = getModel(profile);
|
||||||
|
@ -118,7 +118,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
rm.renderViewEntity = this.localPlayer;
|
rm.renderViewEntity = this.localPlayer;
|
||||||
this.reloadRemoteSkin();
|
this.reloadRemoteSkin();
|
||||||
this.fetchingSkin = true;
|
this.fetchingSkin = true;
|
||||||
this.panoramaRenderer = LiteModHDSkinsMod.getPanoramaRenderer(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EntityPlayerModel getModel(GameProfile profile) {
|
protected EntityPlayerModel getModel(GameProfile profile) {
|
||||||
|
@ -128,7 +127,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
@Override
|
@Override
|
||||||
public void updateScreen() {
|
public void updateScreen() {
|
||||||
++this.updateCounter;
|
++this.updateCounter;
|
||||||
this.panoramaRenderer.updatePanorama();
|
|
||||||
this.localPlayer.updateModel();
|
this.localPlayer.updateModel();
|
||||||
this.remotePlayer.updateModel();
|
this.remotePlayer.updateModel();
|
||||||
if (this.fetchingSkin && this.remotePlayer.isTextureSetupComplete()) {
|
if (this.fetchingSkin && this.remotePlayer.isTextureSetupComplete()) {
|
||||||
|
@ -185,29 +183,10 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updatePanorama() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getUpdateCounter() {
|
|
||||||
return this.updateCounter;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setWorldAndResolution(Minecraft par1Minecraft, int par2, int par3) {
|
|
||||||
super.setWorldAndResolution(par1Minecraft, par2, par3);
|
|
||||||
this.panoramaRenderer.setPanoramaResolution(par1Minecraft, par2, par3);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setPanoramaResolution(Minecraft minecraft, int width, int height) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
enableDnd();
|
enableDnd();
|
||||||
this.panoramaRenderer.initPanoramaRenderer();
|
this.initPanoramaRenderer();
|
||||||
this.buttonList.clear();
|
this.buttonList.clear();
|
||||||
this.buttonList.add(this.btnBrowse = new GuiButton(0, 30, this.height - 36, 60, 20, "Browse..."));
|
this.buttonList.add(this.btnBrowse = new GuiButton(0, 30, this.height - 36, 60, 20, "Browse..."));
|
||||||
this.buttonList.add(this.btnUpload = new GuiButton(1, this.width / 2 - 24, this.height / 2 - 10, 48, 20, ">>"));
|
this.buttonList.add(this.btnUpload = new GuiButton(1, this.width / 2 - 24, this.height / 2 - 10, 48, 20, ">>"));
|
||||||
|
@ -221,8 +200,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
* @wbp.parser.entryPoint
|
* @wbp.parser.entryPoint
|
||||||
*/
|
*/
|
||||||
private void enableDnd() {
|
private void enableDnd() {
|
||||||
if (!SystemUtils.isJavaVersionAtLeast(JavaVersion.JAVA_1_7))
|
|
||||||
return;
|
|
||||||
if (fileDrop != null) {
|
if (fileDrop != null) {
|
||||||
fileDrop.setVisible(true);
|
fileDrop.setVisible(true);
|
||||||
return;
|
return;
|
||||||
|
@ -247,22 +224,13 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
DropTarget dt = new DropTarget();
|
DropTarget dt = new DropTarget();
|
||||||
fileDrop.setDropTarget(dt);
|
fileDrop.setDropTarget(dt);
|
||||||
try {
|
try {
|
||||||
dt.addDropTargetListener(new FileDropListener() {
|
dt.addDropTargetListener((FileDropListener) files -> files.stream().findFirst().ifPresent(this::loadLocalFile));
|
||||||
@Override
|
|
||||||
public void onDrop(List<File> files) {
|
|
||||||
File skin = Iterables.getFirst(files, null);
|
|
||||||
if (skin != null) {
|
|
||||||
loadLocalFile(skin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
fileDrop.setVisible(true);
|
fileDrop.setVisible(true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initPanoramaRenderer() {
|
public void initPanoramaRenderer() {
|
||||||
this.viewportTexture = this.mc.getTextureManager().getDynamicTextureLocation("skinpanorama", new DynamicTexture(256, 256));
|
this.viewportTexture = this.mc.getTextureManager().getDynamicTextureLocation("skinpanorama", new DynamicTexture(256, 256));
|
||||||
}
|
}
|
||||||
|
@ -286,12 +254,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadLocalFile(File skinFile) {
|
private void loadLocalFile(File skinFile) {
|
||||||
Minecraft.getMinecraft().addScheduledTask(new Runnable() {
|
Minecraft.getMinecraft().addScheduledTask(localPlayer::releaseTextures);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
localPlayer.releaseTextures();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!skinFile.exists()) {
|
if (!skinFile.exists()) {
|
||||||
this.skinMessage = unreadable;
|
this.skinMessage = unreadable;
|
||||||
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) {
|
} else if (!FilenameUtils.isExtension(skinFile.getName(), new String[]{"png", "PNG"})) {
|
||||||
|
@ -492,8 +455,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
disableBlend();
|
disableBlend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void renderPanorama(float partialTicks) {
|
||||||
public boolean renderPanorama(int mouseX, int mouseY, float partialTicks) {
|
|
||||||
viewport(0, 0, 256, 256);
|
viewport(0, 0, 256, 256);
|
||||||
this.renderCubeMapTexture(partialTicks);
|
this.renderCubeMapTexture(partialTicks);
|
||||||
disableTexture2D();
|
disableTexture2D();
|
||||||
|
@ -518,7 +480,6 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
vb.pos(this.width, 0.0D, this.zLevel).tex(0.5F + uSample, 0.5F - vSample).endVertex();
|
vb.pos(this.width, 0.0D, this.zLevel).tex(0.5F + uSample, 0.5F - vSample).endVertex();
|
||||||
vb.pos(0.0D, 0.0D, this.zLevel).tex(0.5F + uSample, 0.5F + vSample).endVertex();
|
vb.pos(0.0D, 0.0D, this.zLevel).tex(0.5F + uSample, 0.5F + vSample).endVertex();
|
||||||
tessellator.draw();
|
tessellator.draw();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -528,7 +489,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
|
|
||||||
disableFog();
|
disableFog();
|
||||||
this.mc.entityRenderer.disableLightmap();
|
this.mc.entityRenderer.disableLightmap();
|
||||||
this.panoramaRenderer.renderPanorama(mouseX, mouseY, partialTick);
|
this.renderPanorama(partialTick);
|
||||||
|
|
||||||
int top = 30;
|
int top = 30;
|
||||||
int bottom = this.height - 40;
|
int bottom = this.height - 40;
|
||||||
|
@ -554,10 +515,10 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
float scale = this.height * 0.25F;
|
float scale = this.height * 0.25F;
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(this.localPlayer.getSkinTexture());
|
mc.getTextureManager().bindTexture(this.localPlayer.getSkinTexture());
|
||||||
this.renderPlayerModel(this.localPlayer, xPos1, yPos, scale, xPos1 - mouseX, yPos - scale * 1.8F - mouseY, partialTick);
|
this.renderPlayerModel(this.localPlayer, xPos1, yPos, scale, yPos - scale * 1.8F - mouseY, partialTick);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(this.remotePlayer.getSkinTexture());
|
mc.getTextureManager().bindTexture(this.remotePlayer.getSkinTexture());
|
||||||
this.renderPlayerModel(this.remotePlayer, xPos2, yPos, scale, xPos2 - mouseX, yPos - scale * 1.8F - mouseY, partialTick);
|
this.renderPlayerModel(this.remotePlayer, xPos2, yPos, scale, yPos - scale * 1.8F - mouseY, partialTick);
|
||||||
|
|
||||||
this.disableClipping();
|
this.disableClipping();
|
||||||
|
|
||||||
|
@ -615,7 +576,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
|
|
||||||
int opacity = Math.min(180, (int) (this.uploadOpacity * 180.0F)) & 255;
|
int opacity = Math.min(180, (int) (this.uploadOpacity * 180.0F)) & 255;
|
||||||
if (this.uploadOpacity > 0.0F) {
|
if (this.uploadOpacity > 0.0F) {
|
||||||
Gui.drawRect(0, 0, this.width, this.height, opacity << 24 | 0);
|
Gui.drawRect(0, 0, this.width, this.height, opacity << 24);
|
||||||
if (this.uploadingSkin) {
|
if (this.uploadingSkin) {
|
||||||
this.drawCenteredString(this.fontRendererObj, this.skinUploadMessage, this.width / 2, this.height / 2, opacity << 24 | 0xffffff);
|
this.drawCenteredString(this.fontRendererObj, this.skinUploadMessage, this.width / 2, this.height / 2, opacity << 24 | 0xffffff);
|
||||||
}
|
}
|
||||||
|
@ -632,7 +593,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
enableDepth();
|
enableDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseX, float mouseY, float partialTick) {
|
public void renderPlayerModel(EntityPlayerModel thePlayer, float xPosition, float yPosition, float scale, float mouseY, float partialTick) {
|
||||||
enableColorMaterial();
|
enableColorMaterial();
|
||||||
pushMatrix();
|
pushMatrix();
|
||||||
translate(xPosition, yPosition, 300.0F);
|
translate(xPosition, yPosition, 300.0F);
|
||||||
|
@ -684,37 +645,41 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
return number != 0 && (number & number - 1) == 0;
|
return number != 0 && (number & number - 1) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean clearUploadedSkin(Session session) {
|
private void clearUploadedSkin(Session session) {
|
||||||
if (!this.registerServerConnection(session, skinServerId)) {
|
if (this.registerServerConnection(session, skinServerId)) {
|
||||||
return false;
|
Map<String, ?> sourceData = getClearData(session);
|
||||||
|
this.uploadError = null;
|
||||||
|
this.uploadingSkin = true;
|
||||||
|
this.skinUploadMessage = request;
|
||||||
|
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this);
|
||||||
|
this.threadSkinUpload.start();
|
||||||
}
|
}
|
||||||
HashMap<String, Object> sourceData = Maps.newHashMap();
|
|
||||||
sourceData.put("user", session.getUsername());
|
|
||||||
sourceData.put("uuid", session.getPlayerID());
|
|
||||||
sourceData.put("clear", "1");
|
|
||||||
this.uploadError = null;
|
|
||||||
this.uploadingSkin = true;
|
|
||||||
this.skinUploadMessage = request;
|
|
||||||
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this);
|
|
||||||
this.threadSkinUpload.start();
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean uploadSkin(Session session, File skinFile) {
|
private void uploadSkin(Session session, File skinFile) {
|
||||||
if (!this.registerServerConnection(session, skinServerId)) {
|
if (this.registerServerConnection(session, skinServerId)) {
|
||||||
return false;
|
Map<String, ?> sourceData = getUploadData(session, skinFile);
|
||||||
|
this.uploadError = null;
|
||||||
|
this.uploadingSkin = true;
|
||||||
|
this.skinUploadMessage = upload;
|
||||||
|
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this);
|
||||||
|
this.threadSkinUpload.start();
|
||||||
}
|
}
|
||||||
HashMap<String, Object> sourceData = new HashMap<String, Object>();
|
}
|
||||||
sourceData.put("user", session.getUsername());
|
|
||||||
sourceData.put("uuid", session.getPlayerID());
|
|
||||||
sourceData.put("skin", skinFile);
|
|
||||||
this.uploadError = null;
|
|
||||||
this.uploadingSkin = true;
|
|
||||||
this.skinUploadMessage = upload;
|
|
||||||
this.threadSkinUpload = new ThreadMultipartPostUpload(HDSkinManager.INSTANCE.getGatewayUrl(), sourceData, this);
|
|
||||||
this.threadSkinUpload.start();
|
|
||||||
|
|
||||||
return true;
|
private Map<String, ?> getData(Session session, String param, Object val) {
|
||||||
|
return ImmutableMap.of(
|
||||||
|
"user", session.getUsername(),
|
||||||
|
"uuid", session.getPlayerID(),
|
||||||
|
param, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, ?> getClearData(Session session) {
|
||||||
|
return getData(session, "clear", "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, ?> getUploadData(Session session, File skinFile) {
|
||||||
|
return getData(session, "file", skinFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setUploadError(String error) {
|
private void setUploadError(String error) {
|
||||||
|
@ -724,7 +689,7 @@ public class GuiSkins extends GuiScreen implements IUploadCompleteCallback, IOpe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUploadComplete(String response) {
|
public void onUploadComplete(String response) {
|
||||||
LiteLoaderLogger.info("Upload completed with: %s", new Object[]{response});
|
LiteLoaderLogger.info("Upload completed with: %s", response);
|
||||||
this.uploadingSkin = false;
|
this.uploadingSkin = false;
|
||||||
this.threadSkinUpload = null;
|
this.threadSkinUpload = null;
|
||||||
if (!response.equalsIgnoreCase("OK")) {
|
if (!response.equalsIgnoreCase("OK")) {
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.voxelmodpack.hdskins.gui;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
|
import com.mumfrey.liteloader.modconfig.ConfigPanelHost;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
|
||||||
|
@ -40,20 +39,26 @@ public class HDSkinsConfigPanel implements ConfigPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(ConfigPanelHost host, char keyChar, int keyCode) {}
|
public void keyPressed(ConfigPanelHost host, char keyChar, int keyCode) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseMoved(ConfigPanelHost host, int mouseX, int mouseY) {}
|
public void mouseMoved(ConfigPanelHost host, int mouseX, int mouseY) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {}
|
public void mouseReleased(ConfigPanelHost host, int mouseX, int mouseY, int mouseButton) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPanelHidden() {}
|
public void onPanelHidden() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPanelResize(ConfigPanelHost host) {}
|
public void onPanelResize(ConfigPanelHost host) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTick(ConfigPanelHost host) {}
|
public void onTick(ConfigPanelHost host) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
package com.voxelmodpack.hdskins.gui;
|
package com.voxelmodpack.hdskins.gui;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelPlayer;
|
import net.minecraft.client.model.ModelPlayer;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.popAttrib;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
|
|
||||||
public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLivingBase<M> {
|
public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLivingBase<M> {
|
||||||
|
|
||||||
private static final ModelPlayer FAT = new ModelPlayer(0, false);
|
private static final ModelPlayer FAT = new ModelPlayer(0, false);
|
||||||
private static final ModelPlayer THIN = new ModelPlayer(0, true);
|
//private static final ModelPlayer THIN = new ModelPlayer(0, true);
|
||||||
|
|
||||||
public RenderPlayerModel(RenderManager renderer) {
|
public RenderPlayerModel(RenderManager renderer) {
|
||||||
super(renderer, FAT, 0.0F);
|
super(renderer, FAT, 0.0F);
|
||||||
|
@ -29,18 +31,12 @@ public class RenderPlayerModel<M extends EntityPlayerModel> extends RenderLiving
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean canRenderName(M targetEntity) {
|
protected boolean canRenderName(M targetEntity) {
|
||||||
if (Minecraft.getMinecraft().player != null) {
|
return Minecraft.getMinecraft().player != null && super.canRenderName(targetEntity);
|
||||||
return super.canRenderName(targetEntity);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean setBrightness(M entitylivingbaseIn, float partialTicks, boolean p_177092_3_) {
|
protected boolean setBrightness(M entitylivingbaseIn, float partialTicks, boolean p_177092_3_) {
|
||||||
if (Minecraft.getMinecraft().world != null) {
|
return Minecraft.getMinecraft().world != null && super.setBrightness(entitylivingbaseIn, partialTicks, p_177092_3_);
|
||||||
return super.setBrightness(entitylivingbaseIn, partialTicks, p_177092_3_);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelPlayer getEntityModel(M entity) {
|
public ModelPlayer getEntityModel(M entity) {
|
||||||
|
|
|
@ -1,133 +0,0 @@
|
||||||
package com.voxelmodpack.hdskins.gui.color;
|
|
||||||
|
|
||||||
import static com.mumfrey.liteloader.gl.GL.glColor4f;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Colour picker button control, spawns a colour picker when clicked
|
|
||||||
*
|
|
||||||
* @author Adam Mummery-Smith
|
|
||||||
*/
|
|
||||||
public class GuiColorButton extends GuiControl {
|
|
||||||
/**
|
|
||||||
* Picker active colour
|
|
||||||
*/
|
|
||||||
private int colour = 0xFF000000;
|
|
||||||
|
|
||||||
private Color lineColour;
|
|
||||||
|
|
||||||
private GuiColorPicker picker;
|
|
||||||
|
|
||||||
private boolean pickerClicked = false;
|
|
||||||
private CloseListener closeListener;
|
|
||||||
|
|
||||||
public GuiColorButton(Minecraft minecraft, int id, int xPosition, int yPosition, int controlWidth, int controlHeight, Color lineColour, String name, CloseListener cl) {
|
|
||||||
super(minecraft, id, xPosition, yPosition, controlWidth, controlHeight, name);
|
|
||||||
this.lineColour = lineColour;
|
|
||||||
this.updateColour(lineColour);
|
|
||||||
this.closeListener = cl;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param lineColour2
|
|
||||||
*/
|
|
||||||
public void updateColour(Color lineColour2) {
|
|
||||||
if (lineColour2 == this.lineColour) {
|
|
||||||
this.colour = lineColour2.getRGB();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColor() {
|
|
||||||
return this.colour;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawControl(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
if (this.visible) {
|
|
||||||
|
|
||||||
if (this.displayString != null && this.displayString.length() > 0) {
|
|
||||||
this.drawString(minecraft.fontRendererObj, this.displayString, this.xPosition + this.width + 8, this.yPosition + (this.height - 8) / 2, 0xFFFFFFFF);
|
|
||||||
}
|
|
||||||
boolean mouseOver = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
|
||||||
int borderColour = mouseOver || this.picker != null ? 0xFFFFFFFF : 0xFFA0A0A0;
|
|
||||||
|
|
||||||
drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, borderColour);
|
|
||||||
|
|
||||||
int v = Math.min(Math.max((int) (((float) this.height / (float) this.width) * 1024F), 256), 1024);
|
|
||||||
|
|
||||||
minecraft.getTextureManager().bindTexture(GuiColorPicker.COLOURPICKER_CHECKER);
|
|
||||||
glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.drawTexturedModalRect(this.xPosition + 1, this.yPosition + 1, this.xPosition + this.width - 1, this.yPosition + this.height - 1, 0, 0, 1024, v);
|
|
||||||
|
|
||||||
drawRect(this.xPosition + 1, this.yPosition + 1, this.xPosition + this.width - 1, this.yPosition + this.height - 1, this.colour);
|
|
||||||
|
|
||||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void drawPicker(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
if (this.visible && this.picker != null) {
|
|
||||||
this.picker.drawButton(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if (this.picker.getDialogResult() == DialogResult.OK) {
|
|
||||||
this.closePicker(true);
|
|
||||||
} else if (this.picker.getDialogResult() == DialogResult.Cancel) {
|
|
||||||
this.closePicker(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void closePicker(boolean getColour) {
|
|
||||||
if (getColour)
|
|
||||||
this.colour = this.picker.getColour();
|
|
||||||
this.picker = null;
|
|
||||||
this.pickerClicked = false;
|
|
||||||
if (this.closeListener != null)
|
|
||||||
this.closeListener.onClose();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseReleased(int mouseX, int mouseY) {
|
|
||||||
if (this.pickerClicked && this.picker != null) {
|
|
||||||
this.picker.mouseReleased(mouseX, mouseY);
|
|
||||||
this.pickerClicked = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean mousePressed(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
boolean pressed = super.mousePressed(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if (this.picker == null) {
|
|
||||||
if (pressed) {
|
|
||||||
int xPos = Math.min(this.xPosition + this.width, GuiControl.lastScreenWidth - 233);
|
|
||||||
int yPos = Math.min(this.yPosition, GuiControl.lastScreenHeight - 175);
|
|
||||||
|
|
||||||
this.picker = new GuiColorPicker(minecraft, 1, xPos, yPos, this.colour, "Choose colour");
|
|
||||||
this.pickerClicked = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pressed;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.pickerClicked = this.picker.mousePressed(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if (pressed && !this.pickerClicked) {
|
|
||||||
this.closePicker(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.pickerClicked;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean keyTyped(char keyChar, int keyCode) {
|
|
||||||
return (this.picker != null) ? this.picker.textBoxKeyTyped(keyChar, keyCode) : false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface CloseListener {
|
|
||||||
void onClose();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,323 +0,0 @@
|
||||||
package com.voxelmodpack.hdskins.gui.color;
|
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
|
||||||
import net.minecraft.client.gui.GuiTextField;
|
|
||||||
import net.minecraft.client.resources.I18n;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
import org.lwjgl.input.Keyboard;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Colour picker flyout control, for use with the designable GUI properties
|
|
||||||
* window
|
|
||||||
*
|
|
||||||
* @author Adam Mummery-Smith
|
|
||||||
*/
|
|
||||||
public class GuiColorPicker extends GuiControl {
|
|
||||||
public static final ResourceLocation COLOURPICKER_CHECKER = new ResourceLocation("hdskins", "textures/gui/checker.png");
|
|
||||||
public static final ResourceLocation COLOURPICKER_PICKER = new ResourceLocation("hdskins", "textures/gui/picker.png");
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indices into the hsb array
|
|
||||||
*/
|
|
||||||
private static final int H = 0, S = 1, B = 2;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HSB values from Colour.RGBtoHSB, combined with opacity this is the
|
|
||||||
* authoritative version of the colour we are editing
|
|
||||||
*/
|
|
||||||
private float[] hsb;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Original and altered RGB values
|
|
||||||
*/
|
|
||||||
private int rgb;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Current opacity, stored as an offset byte in the usual position, eg. 0xFF
|
|
||||||
* << 24
|
|
||||||
*/
|
|
||||||
private int opacity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Text boxes for manual entry
|
|
||||||
*/
|
|
||||||
private GuiTextField txtRed, txtGreen, txtBlue, txtAlpha;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* OK and cancel buttons
|
|
||||||
*/
|
|
||||||
private GuiControl btnOk, btnCancel;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flags to track whether dragging a slider
|
|
||||||
*/
|
|
||||||
private boolean draggingHS, draggingB, draggingA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Slider rects
|
|
||||||
*/
|
|
||||||
private Rectangle rectHSArea, rectBArea, rectAArea;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set when the user clicks ok or cancel
|
|
||||||
*/
|
|
||||||
private DialogResult result = DialogResult.None;
|
|
||||||
|
|
||||||
private FontRenderer fontRenderer;
|
|
||||||
|
|
||||||
public GuiColorPicker(Minecraft minecraft, int controlId, int xPos, int yPos, int initialColour, String displayText) {
|
|
||||||
super(minecraft, controlId, xPos, yPos, 231, 173, displayText);
|
|
||||||
|
|
||||||
Color colour = new Color(initialColour);
|
|
||||||
this.hsb = Color.RGBtoHSB(colour.getRed(), colour.getGreen(), colour.getBlue(), null);
|
|
||||||
this.opacity = initialColour & 0xFF000000;
|
|
||||||
if (this.opacity == 0x01000000)
|
|
||||||
this.opacity = 0;
|
|
||||||
|
|
||||||
this.fontRenderer = minecraft.fontRendererObj;
|
|
||||||
this.txtRed = new GuiTextField(0, this.fontRenderer, this.xPosition + 188, this.yPosition + 10, 32, 16);
|
|
||||||
this.txtGreen = new GuiTextField(1, this.fontRenderer, this.xPosition + 188, this.yPosition + 30, 32, 16);
|
|
||||||
this.txtBlue = new GuiTextField(2, this.fontRenderer, this.xPosition + 188, this.yPosition + 50, 32, 16);
|
|
||||||
this.txtAlpha = new GuiTextField(3, this.fontRenderer, this.xPosition + 188, this.yPosition + 70, 32, 16);
|
|
||||||
|
|
||||||
this.txtRed.setMaxStringLength(3);
|
|
||||||
this.txtGreen.setMaxStringLength(3);
|
|
||||||
this.txtBlue.setMaxStringLength(3);
|
|
||||||
this.txtAlpha.setMaxStringLength(3);
|
|
||||||
|
|
||||||
this.rectHSArea = new Rectangle(this.xPosition + 10, this.yPosition + 10, 128, 128);
|
|
||||||
this.rectBArea = new Rectangle(this.xPosition + 143, this.yPosition + 10, 15, 128);
|
|
||||||
this.rectAArea = new Rectangle(this.xPosition + 163, this.yPosition + 10, 15, 128);
|
|
||||||
|
|
||||||
this.btnOk = new GuiControl(minecraft, 0, this.xPosition + 9, this.yPosition + 145, 55, 20, I18n.format("gui.ok"));
|
|
||||||
this.btnCancel = new GuiControl(minecraft, 1, this.xPosition + 70, this.yPosition + 145, 65, 20, I18n.format("gui.cancel"));
|
|
||||||
|
|
||||||
this.updateColour();
|
|
||||||
}
|
|
||||||
|
|
||||||
public DialogResult getDialogResult() {
|
|
||||||
return this.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getColour() {
|
|
||||||
int opacity = this.opacity == 0 ? 0x01000000 : this.opacity;
|
|
||||||
int rgb = opacity | (0xFFFFFF & Color.HSBtoRGB(this.hsb[H], this.hsb[S], this.hsb[B]));
|
|
||||||
return rgb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void drawControl(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
this.mouseDragged(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
// Calculate coordinates for the selectors
|
|
||||||
int hPos = this.xPosition + 10 + (int) (128F * this.hsb[H]);
|
|
||||||
int sPos = this.yPosition + 10 + (128 - (int) (128F * this.hsb[S]));
|
|
||||||
int bPos = this.yPosition + 10 + (128 - (int) (128F * this.hsb[B]));
|
|
||||||
int aPos = this.yPosition + 10 + ((256 - ((this.opacity >> 24) & 0xFF)) / 2);
|
|
||||||
|
|
||||||
// Calculate B colour
|
|
||||||
int brightness = Color.HSBtoRGB(this.hsb[H], this.hsb[S], 1.0F) | 0xFF000000;
|
|
||||||
|
|
||||||
// Draw backgrounds
|
|
||||||
drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, 0xAA000000); // Background
|
|
||||||
drawRect(this.xPosition + 9, this.yPosition + 9, this.xPosition + 139, this.yPosition + 139, 0xFFA0A0A0); // HS
|
|
||||||
// background
|
|
||||||
drawRect(this.xPosition + 142, this.yPosition + 9, this.xPosition + 159, this.yPosition + 139, 0xFFA0A0A0); // B
|
|
||||||
// background
|
|
||||||
drawRect(this.xPosition + 162, this.yPosition + 9, this.xPosition + 179, this.yPosition + 139, 0xFFA0A0A0); // A
|
|
||||||
// background
|
|
||||||
drawRect(this.xPosition + 187, this.yPosition + 105, this.xPosition + 221, this.yPosition + 139, 0xFFA0A0A0); // Preview
|
|
||||||
// background
|
|
||||||
|
|
||||||
// Draw colour picker
|
|
||||||
this.mc.getTextureManager().bindTexture(GuiColorPicker.COLOURPICKER_PICKER);
|
|
||||||
color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.drawTexturedModalRect(this.xPosition + 10, this.yPosition + 10, this.xPosition + 138, this.yPosition + 138, 0, 0, 256, 256);
|
|
||||||
this.drawCrossHair(hPos, sPos, 5, 1, 0xFF000000);
|
|
||||||
|
|
||||||
// Draw brightness bar
|
|
||||||
this.drawGradientRect(this.xPosition + 143, this.yPosition + 10, this.xPosition + 158, this.yPosition + 138, brightness, 0xFF000000);
|
|
||||||
this.drawRotText(this.fontRenderer, "Luminosity", this.xPosition + 150, this.yPosition + 74, 0xFF000000, false);
|
|
||||||
drawRect(this.xPosition + 142, bPos - 1, this.xPosition + 159, bPos + 1, 0xFFFFFFFF);
|
|
||||||
|
|
||||||
// Draw opacity bar
|
|
||||||
this.drawGradientRect(this.xPosition + 163, this.yPosition + 10, this.xPosition + 178, this.yPosition + 138, 0xFFFFFFFF, 0xFF000000);
|
|
||||||
this.drawRotText(this.fontRenderer, "Opacity", this.xPosition + 170, this.yPosition + 74, 0xFF000000, false);
|
|
||||||
drawRect(this.xPosition + 162, aPos - 1, this.xPosition + 179, aPos + 1, 0xFFFFFFFF);
|
|
||||||
|
|
||||||
// Draw preview
|
|
||||||
this.mc.getTextureManager().bindTexture(GuiColorPicker.COLOURPICKER_CHECKER);
|
|
||||||
color(1.0F, 1.0F, 1.0F, 1.0F);
|
|
||||||
this.drawTexturedModalRect(this.xPosition + 188, this.yPosition + 106, this.xPosition + 220, this.yPosition + 138, 0, 0, 1024, 1024);
|
|
||||||
drawRect(this.xPosition + 188, this.yPosition + 106, this.xPosition + 220, this.yPosition + 138, this.rgb);
|
|
||||||
|
|
||||||
// Draw text boxes
|
|
||||||
this.txtRed.drawTextBox();
|
|
||||||
this.txtGreen.drawTextBox();
|
|
||||||
this.txtBlue.drawTextBox();
|
|
||||||
this.txtAlpha.drawTextBox();
|
|
||||||
|
|
||||||
this.btnOk.drawButton(minecraft, mouseX, mouseY);
|
|
||||||
this.btnCancel.drawButton(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateCursorCounter() {
|
|
||||||
this.txtRed.updateCursorCounter();
|
|
||||||
this.txtGreen.updateCursorCounter();
|
|
||||||
this.txtBlue.updateCursorCounter();
|
|
||||||
this.txtAlpha.updateCursorCounter();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateColour() {
|
|
||||||
this.rgb = this.opacity | (0xFFFFFF & Color.HSBtoRGB(this.hsb[H], this.hsb[S], this.hsb[B]));
|
|
||||||
this.txtRed.setText(String.valueOf((this.rgb >> 16) & 0xFF));
|
|
||||||
this.txtGreen.setText(String.valueOf((this.rgb >> 8) & 0xFF));
|
|
||||||
this.txtBlue.setText(String.valueOf(this.rgb & 0xFF));
|
|
||||||
this.txtAlpha.setText(String.valueOf((this.opacity >> 24) & 0xFF));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void updateColourFromTextEntry() {
|
|
||||||
int currentRed = (this.rgb >> 16) & 0xFF;
|
|
||||||
int currentGreen = (this.rgb >> 8) & 0xFF;
|
|
||||||
int currentBlue = this.rgb & 0xFF;
|
|
||||||
int currentOpacity = (this.opacity >> 24) & 0xFF;
|
|
||||||
|
|
||||||
currentRed = (int) clamp(this.tryParseInt(this.txtRed.getText(), currentRed), 0, 255);
|
|
||||||
currentGreen = (int) clamp(this.tryParseInt(this.txtGreen.getText(), currentGreen), 0, 255);
|
|
||||||
currentBlue = (int) clamp(this.tryParseInt(this.txtBlue.getText(), currentBlue), 0, 255);
|
|
||||||
currentOpacity = (int) clamp(this.tryParseInt(this.txtAlpha.getText(), currentOpacity), 0, 255);
|
|
||||||
|
|
||||||
this.hsb = Color.RGBtoHSB(currentRed, currentGreen, currentBlue, null);
|
|
||||||
this.opacity = (currentOpacity << 24) & 0xFF000000;
|
|
||||||
this.updateColour();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected int tryParseInt(String text, int defaultValue) {
|
|
||||||
try {
|
|
||||||
return Integer.parseInt(text);
|
|
||||||
} catch (Exception ex) {
|
|
||||||
return "".equals(text) ? 0 : defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see
|
|
||||||
* net.minecraft.src.GuiButton#mouseDragged(net.minecraft.src.Minecraft,
|
|
||||||
* int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void mouseDragged(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
super.mouseDragged(minecraft, mouseX, mouseY);
|
|
||||||
|
|
||||||
if (this.draggingHS) {
|
|
||||||
this.hsb[H] = clamp(mouseX - this.xPosition - 10, 0, 128) / 128F;
|
|
||||||
this.hsb[S] = (128F - clamp(mouseY - this.yPosition - 10, 0, 128)) / 128F;
|
|
||||||
this.updateColour();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.draggingB) {
|
|
||||||
this.hsb[B] = (128F - clamp(mouseY - this.yPosition - 10, 0, 128)) / 128F;
|
|
||||||
this.updateColour();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.draggingA) {
|
|
||||||
this.opacity = (mouseY - this.yPosition < 11) ? 0xFF000000 : (((128 - (int) clamp(mouseY - this.yPosition - 10, 0, 128)) << 25) & 0xFF000000);
|
|
||||||
this.updateColour();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see
|
|
||||||
* net.minecraft.src.GuiButton#mousePressed(net.minecraft.src.Minecraft,
|
|
||||||
* int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean mousePressed(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
if (super.mousePressed(minecraft, mouseX, mouseY)) {
|
|
||||||
|
|
||||||
if (this.btnOk.mousePressed(minecraft, mouseX, mouseY))
|
|
||||||
this.result = DialogResult.OK;
|
|
||||||
|
|
||||||
if (this.btnCancel.mousePressed(minecraft, mouseX, mouseY))
|
|
||||||
this.result = DialogResult.Cancel;
|
|
||||||
|
|
||||||
if (this.rectHSArea.contains(mouseX, mouseY))
|
|
||||||
this.draggingHS = true;
|
|
||||||
|
|
||||||
if (this.rectBArea.contains(mouseX, mouseY))
|
|
||||||
this.draggingB = true;
|
|
||||||
|
|
||||||
if (this.rectAArea.contains(mouseX, mouseY))
|
|
||||||
this.draggingA = true;
|
|
||||||
|
|
||||||
this.txtRed.mouseClicked(mouseX, mouseY, 0);
|
|
||||||
this.txtGreen.mouseClicked(mouseX, mouseY, 0);
|
|
||||||
this.txtBlue.mouseClicked(mouseX, mouseY, 0);
|
|
||||||
this.txtAlpha.mouseClicked(mouseX, mouseY, 0);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else if (this.enabled) {
|
|
||||||
this.result = DialogResult.Cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
* @see net.minecraft.src.GuiButton#mouseReleased(int, int)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void mouseReleased(int mouseX, int mouseY) {
|
|
||||||
this.draggingHS = false;
|
|
||||||
this.draggingB = false;
|
|
||||||
this.draggingA = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean textBoxKeyTyped(char keyChar, int keyCode) {
|
|
||||||
this.txtRed.textboxKeyTyped(keyChar, keyCode);
|
|
||||||
this.txtGreen.textboxKeyTyped(keyChar, keyCode);
|
|
||||||
this.txtBlue.textboxKeyTyped(keyChar, keyCode);
|
|
||||||
this.txtAlpha.textboxKeyTyped(keyChar, keyCode);
|
|
||||||
this.updateColourFromTextEntry();
|
|
||||||
|
|
||||||
if (keyCode == Keyboard.KEY_TAB) {
|
|
||||||
if (this.txtRed.isFocused()) {
|
|
||||||
this.txtRed.setFocused(false);
|
|
||||||
this.txtGreen.setFocused(true);
|
|
||||||
this.txtBlue.setFocused(false);
|
|
||||||
this.txtAlpha.setFocused(false);
|
|
||||||
} else if (this.txtGreen.isFocused()) {
|
|
||||||
this.txtRed.setFocused(false);
|
|
||||||
this.txtGreen.setFocused(false);
|
|
||||||
this.txtBlue.setFocused(true);
|
|
||||||
this.txtAlpha.setFocused(false);
|
|
||||||
} else if (this.txtBlue.isFocused()) {
|
|
||||||
this.txtRed.setFocused(false);
|
|
||||||
this.txtGreen.setFocused(false);
|
|
||||||
this.txtBlue.setFocused(false);
|
|
||||||
this.txtAlpha.setFocused(true);
|
|
||||||
} else {
|
|
||||||
this.txtRed.setFocused(true);
|
|
||||||
this.txtGreen.setFocused(false);
|
|
||||||
this.txtBlue.setFocused(false);
|
|
||||||
this.txtAlpha.setFocused(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float clamp(float value, float min, float max) {
|
|
||||||
return Math.min(Math.max(value, min), max);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,631 +0,0 @@
|
||||||
package com.voxelmodpack.hdskins.gui.color;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
|
||||||
import net.minecraft.client.renderer.VertexBuffer;
|
|
||||||
import static com.mumfrey.liteloader.gl.GL.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GuiControlEx is the base class for additional controls. It includes some
|
|
||||||
* advanced drawing methods which are used by several derived classes
|
|
||||||
*
|
|
||||||
* @author Adam Mummery-Smith
|
|
||||||
*/
|
|
||||||
public class GuiControl extends GuiButton {
|
|
||||||
/**
|
|
||||||
* Used by some controls to indicate the manner in which they have handled a
|
|
||||||
* keypress
|
|
||||||
*/
|
|
||||||
public enum KeyHandledState {
|
|
||||||
/**
|
|
||||||
* The control did not handle the keypress
|
|
||||||
*/
|
|
||||||
None,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The control handled the keypress and the container should do no
|
|
||||||
* further processing
|
|
||||||
*/
|
|
||||||
Handled,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The control handled the keypress and the container should call
|
|
||||||
* actionPerformed
|
|
||||||
*/
|
|
||||||
ActionPerformed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum DialogResult {
|
|
||||||
/**
|
|
||||||
* No result (maybe the dialog was not closed yet?)
|
|
||||||
*/
|
|
||||||
None,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialog result OK (user clicked OK or pressed RETURN)
|
|
||||||
*/
|
|
||||||
OK,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialog result Cancel (user clicked Cancel or pressed ESCAPE)
|
|
||||||
*/
|
|
||||||
Cancel,
|
|
||||||
|
|
||||||
Yes,
|
|
||||||
|
|
||||||
No
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set by parent screen to enable cursor flash etc
|
|
||||||
*/
|
|
||||||
public int updateCounter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reference to the minecraft game instance
|
|
||||||
*/
|
|
||||||
protected Minecraft mc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag indicating whether an action was performed, to support GuiScreenEx's
|
|
||||||
* callback mechanism
|
|
||||||
*/
|
|
||||||
protected boolean actionPerformed;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Flag tracking whether an item was double-clicked
|
|
||||||
*/
|
|
||||||
protected boolean doubleClicked;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Scale factor which translates texture pixel coordinates to relative
|
|
||||||
* coordinates
|
|
||||||
*/
|
|
||||||
protected static float texMapScale = 0.00390625F;
|
|
||||||
|
|
||||||
protected static float guiScaleFactor;
|
|
||||||
|
|
||||||
protected static int lastScreenWidth;
|
|
||||||
protected static int lastScreenHeight;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Override from GuiButton, handle this call and forward it to DrawControl
|
|
||||||
* for neatness
|
|
||||||
*
|
|
||||||
* @param minecraft Reference to the minecraft game instance
|
|
||||||
* @param mouseX Mouse X coordinate
|
|
||||||
* @param mouseY Mouse Y coordinate
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public final void drawButton(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
this.drawControl(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw the control
|
|
||||||
*
|
|
||||||
* @param minecraft Reference to the minecraft game instance
|
|
||||||
* @param mouseX Mouse X coordinate
|
|
||||||
* @param mouseY Mouse Y coordinate
|
|
||||||
*/
|
|
||||||
protected void drawControl(Minecraft minecraft, int mouseX, int mouseY) {
|
|
||||||
super.drawButton(minecraft, mouseX, mouseY);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor, passes through to GuiButton constructor
|
|
||||||
*
|
|
||||||
* @param minecraft Minecraft game instance
|
|
||||||
* @param controlId Control's ID (used for actionPerformed)
|
|
||||||
* @param xPos Control X position (left)
|
|
||||||
* @param yPos Control Y position (top)
|
|
||||||
* @param controlWidth Control width
|
|
||||||
* @param controlHeight Control height
|
|
||||||
* @param displayText Control display text
|
|
||||||
*/
|
|
||||||
public GuiControl(Minecraft minecraft, int controlId, int xPos, int yPos, int controlWidth, int controlHeight, String displayText) {
|
|
||||||
super(controlId, xPos, yPos, controlWidth, controlHeight, displayText);
|
|
||||||
this.mc = minecraft;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GuiControl(Minecraft minecraft, int controlId, int xPos, int yPos, String displayText) {
|
|
||||||
super(controlId, xPos, yPos, displayText);
|
|
||||||
this.mc = minecraft;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* GuiControlEx returns true from mousePressed if the mouse was captured,
|
|
||||||
* NOT if an action was performed. Containers should call this function
|
|
||||||
* afterwards to determine whether an action was performed.
|
|
||||||
*
|
|
||||||
* @return True if actionPerformed should be dispatched
|
|
||||||
*/
|
|
||||||
public boolean isActionPerformed() {
|
|
||||||
return this.actionPerformed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get whether an actionPerformed was a double-click event
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isDoubleClicked(boolean resetDoubleClicked) {
|
|
||||||
boolean result = this.doubleClicked;
|
|
||||||
if (resetDoubleClicked)
|
|
||||||
this.doubleClicked = false;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a line between two points with the specified width and colour
|
|
||||||
*
|
|
||||||
* @param x1 Origin x coordinate
|
|
||||||
* @param y1 Origin y coordinate
|
|
||||||
* @param x2 End x coordinate
|
|
||||||
* @param y2 End y coordinate
|
|
||||||
* @param width Line width in pixels
|
|
||||||
* @param colour Line colour
|
|
||||||
*/
|
|
||||||
public static void drawLine(int x1, int y1, int x2, int y2, int width, int colour) {
|
|
||||||
drawArrow(x1, y1, x2, y2, 0, width, colour, false, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws an OpenGL line
|
|
||||||
*
|
|
||||||
* @param x1 Start x position
|
|
||||||
* @param y1 Start y position
|
|
||||||
* @param x2 End x position
|
|
||||||
* @param y2 End y position
|
|
||||||
* @param width Line width
|
|
||||||
* @param colour Line colour
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public static void drawNativeLine(float x1, float y1, float x2, float y2, float width, int colour) {
|
|
||||||
float f = (float) (colour >> 24 & 0xff) / 255F;
|
|
||||||
float f1 = (float) (colour >> 16 & 0xff) / 255F;
|
|
||||||
float f2 = (float) (colour >> 8 & 0xff) / 255F;
|
|
||||||
float f3 = (float) (colour & 0xff) / 255F;
|
|
||||||
|
|
||||||
glEnableBlend();
|
|
||||||
glDisableTexture2D();
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glColor4f(f1, f2, f3, f);
|
|
||||||
glLineWidth(width);
|
|
||||||
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_LINES, VF_POSITION);
|
|
||||||
buf.pos(x1, y1, 0).endVertex();
|
|
||||||
buf.pos(x2, y2, 0).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
glEnableTexture2D();
|
|
||||||
glDisableBlend();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws an arrow between two points with the specified width and colour
|
|
||||||
*
|
|
||||||
* @param x1 Origin x coordinate
|
|
||||||
* @param y1 Origin y coordinate
|
|
||||||
* @param x2 End x coordinate
|
|
||||||
* @param y2 End y coordinate
|
|
||||||
* @param width Line width in pixels
|
|
||||||
* @param arrowHeadSize Size of the arrow head
|
|
||||||
* @param colour Colour
|
|
||||||
*/
|
|
||||||
public static void drawArrow(int x1, int y1, int x2, int y2, int z, int width, int arrowHeadSize, int colour) {
|
|
||||||
drawArrow(x1, y1, x2, y2, z, width, colour, true, arrowHeadSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Internal function for drawing lines and arrows
|
|
||||||
*
|
|
||||||
* @param x1 Origin x coordinate
|
|
||||||
* @param y1 Origin y coordinate
|
|
||||||
* @param x2 End x coordinate
|
|
||||||
* @param y2 End y coordinate
|
|
||||||
* @param width Line width in pixels
|
|
||||||
* @param colour Colour
|
|
||||||
* @param arrowHead True to draw an arrow, otherwise draws a line
|
|
||||||
* @param arrowHeadSize Size of the arrow head
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public static void drawArrow(int x1, int y1, int x2, int y2, int z, int width, int colour, boolean arrowHead, int arrowHeadSize) {
|
|
||||||
// Calculate the line length and angle defined by the specified points
|
|
||||||
int length = (int) Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));
|
|
||||||
float angle = (float) Math.toDegrees(Math.atan2(y2 - y1, x2 - x1));
|
|
||||||
|
|
||||||
// Local rotation
|
|
||||||
glPushMatrix();
|
|
||||||
glTranslatef(x1, y1, 0.0f);
|
|
||||||
glRotatef(angle, 0.0f, 0.0f, 1.0f);
|
|
||||||
|
|
||||||
// Calc coordinates for the line and arrow points
|
|
||||||
x1 = 0;
|
|
||||||
x2 = length - (arrowHead ? arrowHeadSize : 0);
|
|
||||||
y1 = (int) (width * -0.5);
|
|
||||||
y2 = y1 + width;
|
|
||||||
|
|
||||||
// Calc colour components
|
|
||||||
float f = (float) (colour >> 24 & 0xff) / 255F;
|
|
||||||
float f1 = (float) (colour >> 16 & 0xff) / 255F;
|
|
||||||
float f2 = (float) (colour >> 8 & 0xff) / 255F;
|
|
||||||
float f3 = (float) (colour & 0xff) / 255F;
|
|
||||||
|
|
||||||
glEnableBlend();
|
|
||||||
glDisableTexture2D();
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glColor4f(f1, f2, f3, f);
|
|
||||||
|
|
||||||
// Draw the line
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION);
|
|
||||||
buf.pos(x1, y2, z).endVertex();
|
|
||||||
buf.pos(x2, y2, z).endVertex();
|
|
||||||
buf.pos(x2, y1, z).endVertex();
|
|
||||||
buf.pos(x1, y1, z).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
// If an arrow then draw the arrow head
|
|
||||||
if (arrowHead && arrowHeadSize > 0) {
|
|
||||||
buf.begin(GL_TRIANGLES, VF_POSITION);
|
|
||||||
buf.pos(x2, 0 - arrowHeadSize / 2, z).endVertex();
|
|
||||||
buf.pos(x2, arrowHeadSize / 2, z).endVertex();
|
|
||||||
buf.pos(length, 0, z).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
glEnableTexture2D();
|
|
||||||
glDisableBlend();
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the texmap scale factor
|
|
||||||
*
|
|
||||||
* @param textureSize
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public void setTexMapSize(int textureSize) {
|
|
||||||
texMapScale = 1F / (float) textureSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a textured rectangle at 90 degrees
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public void drawTexturedModalRectRot(int x, int y, int x2, int y2, int u, int v, int u2, int v2) {
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION_TEX);
|
|
||||||
buf.pos(x2, y2, this.zLevel).tex((float) (u) * texMapScale, (float) (v2) * texMapScale).endVertex();
|
|
||||||
buf.pos(x2, y, this.zLevel).tex((float) (u2) * texMapScale, (float) (v2) * texMapScale).endVertex();
|
|
||||||
buf.pos(x, y, this.zLevel).tex((float) (u2) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
buf.pos(x, y2, this.zLevel).tex((float) (u) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a textured rectangle at 90 degrees
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param width Width of texture to draw
|
|
||||||
* @param height Height of texture to draw
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public void drawTexturedModalRectRot(int x, int y, int u, int v, int width, int height) {
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION_TEX);
|
|
||||||
buf.pos(x + height, y + width, this.zLevel).tex((float) (u) * texMapScale, (float) (v + height) * texMapScale).endVertex();
|
|
||||||
buf.pos(x + height, y, this.zLevel).tex((float) (u + width) * texMapScale, (float) (v + height) * texMapScale).endVertex();
|
|
||||||
buf.pos(x, y, this.zLevel).tex((float) (u + width) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
buf.pos(x, y + width, this.zLevel).tex((float) (u) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a tesselated rectangle where the texture is stretched horizontally
|
|
||||||
* but vertical scaling is achieved by splitting the texture in half and
|
|
||||||
* repeating the middle pixels
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
public void drawTessellatedModalRectV(int x, int y, int x2, int y2, int u, int v, int u2, int v2) {
|
|
||||||
int tileSize = ((v2 - v) / 2);
|
|
||||||
int vMidTop = v + tileSize;
|
|
||||||
int vMidBtm = vMidTop + 1;
|
|
||||||
|
|
||||||
this.drawTexturedModalRect(x, y, x2, y + tileSize, u, v, u2, vMidTop);
|
|
||||||
this.drawTexturedModalRect(x, y + tileSize, x2, y2 - tileSize + 1, u, vMidTop, u2, vMidBtm);
|
|
||||||
this.drawTexturedModalRect(x, y2 - tileSize + 1, x2, y2, u, vMidBtm, u2, v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a tesselated rectangle where the texture is stretched vertically
|
|
||||||
* but horizontal scaling is achieved by splitting the texture in half and
|
|
||||||
* repeating the middle pixels
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
public void drawTessellatedModalRectH(int x, int y, int x2, int y2, int u, int v, int u2, int v2) {
|
|
||||||
int tileSize = ((u2 - u) / 2);
|
|
||||||
int uMidLeft = u + tileSize;
|
|
||||||
int uMidRight = uMidLeft + 1;
|
|
||||||
|
|
||||||
this.drawTexturedModalRect(x, y, x + tileSize, y2, u, v, uMidLeft, v2);
|
|
||||||
this.drawTexturedModalRect(x + tileSize, y, x2 - tileSize + 1, y2, uMidLeft, v, uMidRight, v2);
|
|
||||||
this.drawTexturedModalRect(x2 - tileSize + 1, y, x2, y2, uMidRight, v, u2, v2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a tesselated rectangle where the texture is stretched vertically
|
|
||||||
* and horizontally but the middle pixels are repeated whilst the joining
|
|
||||||
* pixels are stretched.
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
public void drawTessellatedModalBorderRect(int x, int y, int x2, int y2, int u, int v, int u2, int v2) {
|
|
||||||
this.drawTessellatedModalBorderRect(x, y, x2, y2, u, v, u2, v2, Math.min(((x2 - x) / 2) - 1, ((y2 - y) / 2) - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a tesselated rectangle where the texture is stretched vertically
|
|
||||||
* and horizontally but the middle pixels are repeated whilst the joining
|
|
||||||
* pixels are stretched. Bordersize specifies the portion of the texture
|
|
||||||
* which will remain unstretched.
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
* @param borderSize Number of pixels to leave unstretched, must be less
|
|
||||||
* than half of the width or height (whichever is smallest)
|
|
||||||
*/
|
|
||||||
public void drawTessellatedModalBorderRect(int x, int y, int x2, int y2, int u, int v, int u2, int v2, int borderSize) {
|
|
||||||
int tileSize = Math.min(((u2 - u) / 2) - 1, ((v2 - v) / 2) - 1);
|
|
||||||
|
|
||||||
int ul = u + tileSize, ur = u2 - tileSize, vt = v + tileSize, vb = v2 - tileSize;
|
|
||||||
int xl = x + borderSize, xr = x2 - borderSize, yt = y + borderSize, yb = y2 - borderSize;
|
|
||||||
|
|
||||||
this.drawTexturedModalRect(x, y, xl, yt, u, v, ul, vt);
|
|
||||||
this.drawTexturedModalRect(xl, y, xr, yt, ul, v, ur, vt);
|
|
||||||
this.drawTexturedModalRect(xr, y, x2, yt, ur, v, u2, vt);
|
|
||||||
this.drawTexturedModalRect(x, yb, xl, y2, u, vb, ul, v2);
|
|
||||||
this.drawTexturedModalRect(xl, yb, xr, y2, ul, vb, ur, v2);
|
|
||||||
this.drawTexturedModalRect(xr, yb, x2, y2, ur, vb, u2, v2);
|
|
||||||
this.drawTexturedModalRect(x, yt, xl, yb, u, vt, ul, vb);
|
|
||||||
this.drawTexturedModalRect(xr, yt, x2, yb, ur, vt, u2, vb);
|
|
||||||
this.drawTexturedModalRect(xl, yt, xr, yb, ul, vt, ur, vb);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw a string but cut it off if it's too long to fit in the specified
|
|
||||||
* width
|
|
||||||
*
|
|
||||||
* @param fontrenderer
|
|
||||||
* @param s
|
|
||||||
* @param x
|
|
||||||
* @param y
|
|
||||||
* @param width
|
|
||||||
* @param colour
|
|
||||||
*/
|
|
||||||
public static void drawStringWithEllipsis(FontRenderer fontrenderer, String s, int x, int y, int width, int colour) {
|
|
||||||
if (fontrenderer.getStringWidth(s) <= width) {
|
|
||||||
fontrenderer.drawStringWithShadow(s, x, y, colour); // func_175063_a
|
|
||||||
// drawStringWithShadow
|
|
||||||
} else if (width < 8) {
|
|
||||||
fontrenderer.drawStringWithShadow("..", x, y, colour); // func_175063_a
|
|
||||||
// drawStringWithShadow
|
|
||||||
} else {
|
|
||||||
String trimmedText = s;
|
|
||||||
|
|
||||||
while (fontrenderer.getStringWidth(trimmedText) > width - 8 && trimmedText.length() > 0)
|
|
||||||
trimmedText = trimmedText.substring(0, trimmedText.length() - 1);
|
|
||||||
|
|
||||||
fontrenderer.drawStringWithShadow(trimmedText + "...", x, y, colour); // func_175063_a
|
|
||||||
// drawStringWithShadow
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param boundingBox
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
protected void drawCrossHair(int x, int y, int size, int width, int colour) {
|
|
||||||
float alpha = (float) (colour >> 24 & 0xff) / 255F;
|
|
||||||
float red = (float) (colour >> 16 & 0xff) / 255F;
|
|
||||||
float green = (float) (colour >> 8 & 0xff) / 255F;
|
|
||||||
float blue = (float) (colour & 0xff) / 255F;
|
|
||||||
|
|
||||||
glLineWidth(GuiControl.guiScaleFactor * width);
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
|
||||||
glEnableBlend();
|
|
||||||
glDisableTexture2D();
|
|
||||||
glDisableLighting();
|
|
||||||
glColor4f(red, green, blue, alpha);
|
|
||||||
glEnableColorLogic();
|
|
||||||
glLogicOp(GL_OR_REVERSE);
|
|
||||||
|
|
||||||
// Draw the frame
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
|
|
||||||
buf.begin(GL_LINES, VF_POSITION);
|
|
||||||
buf.pos(x - size, y, 0).endVertex();
|
|
||||||
buf.pos(x + size, y, 0).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
buf.begin(GL_LINES, VF_POSITION);
|
|
||||||
buf.pos(x, y - size, 0).endVertex();
|
|
||||||
buf.pos(x, y + size, 0).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
|
|
||||||
glDisableColorLogic();
|
|
||||||
glEnableTexture2D();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void drawRotText(FontRenderer fontRenderer, String text, int xPosition, int yPosition, int colour, boolean colourOrOp) {
|
|
||||||
if (colourOrOp) {
|
|
||||||
glEnableColorLogic();
|
|
||||||
glLogicOp(GL_OR_REVERSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
int textWidth = fontRenderer.getStringWidth(text) / 2;
|
|
||||||
|
|
||||||
glPushMatrix();
|
|
||||||
glTranslatef(xPosition, yPosition, 0);
|
|
||||||
glRotatef(-90, 0, 0, 1);
|
|
||||||
glTranslatef(-textWidth, -4, 0);
|
|
||||||
|
|
||||||
fontRenderer.drawString(text, 0, 0, colour);
|
|
||||||
|
|
||||||
glPopMatrix();
|
|
||||||
|
|
||||||
if (colourOrOp) {
|
|
||||||
glDisableColorLogic();
|
|
||||||
glEnableTexture2D();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draw a tooltip at the specified location and clip to screenWidth and
|
|
||||||
* screenHeight
|
|
||||||
*
|
|
||||||
* @param fontRenderer
|
|
||||||
* @param tooltipText
|
|
||||||
* @param mouseX
|
|
||||||
* @param mouseY
|
|
||||||
* @param screenWidth
|
|
||||||
* @param screenHeight
|
|
||||||
* @param colour
|
|
||||||
* @param backgroundColour
|
|
||||||
*/
|
|
||||||
protected void drawTooltip(FontRenderer fontRenderer, String tooltipText, int mouseX, int mouseY, int screenWidth, int screenHeight, int colour, int backgroundColour) {
|
|
||||||
int textSize = fontRenderer.getStringWidth(tooltipText);
|
|
||||||
mouseX = Math.max(0, Math.min(screenWidth - textSize - 6, mouseX - 6));
|
|
||||||
mouseY = Math.max(0, Math.min(screenHeight - 16, mouseY - 18));
|
|
||||||
|
|
||||||
drawRect(mouseX, mouseY, mouseX + textSize + 6, mouseY + 16, backgroundColour);
|
|
||||||
this.drawString(fontRenderer, tooltipText, mouseX + 3, mouseY + 4, colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a textured rectangle with custom UV coordinates
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public void drawTexturedModalRect(int x, int y, int x2, int y2, int u, int v, int u2, int v2) {
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION_TEX);
|
|
||||||
buf.pos(x, y2, this.zLevel).tex((float) (u) * texMapScale, (float) (v2) * texMapScale).endVertex();
|
|
||||||
buf.pos(x2, y2, this.zLevel).tex((float) (u2) * texMapScale, (float) (v2) * texMapScale).endVertex();
|
|
||||||
buf.pos(x2, y, this.zLevel).tex((float) (u2) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
buf.pos(x, y, this.zLevel).tex((float) (u) * texMapScale, (float) (v) * texMapScale).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a textured rectangle with custom UV coordinates
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param x2 Right edge X coordinate
|
|
||||||
* @param y2 Bottom edge Y coordinate
|
|
||||||
* @param u U coordinate
|
|
||||||
* @param v V coordinate
|
|
||||||
* @param u2 Right edge U coordinate
|
|
||||||
* @param v2 Bottom edge V coordinate
|
|
||||||
*/
|
|
||||||
public void drawTexturedModalRectF(int x, int y, int x2, int y2, float u, float v, float u2, float v2) {
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION_TEX);
|
|
||||||
buf.pos(x, y2, this.zLevel).tex(u, v2).endVertex();
|
|
||||||
buf.pos(x2, y2, this.zLevel).tex(u2, v2).endVertex();
|
|
||||||
buf.pos(x2, y, this.zLevel).tex(u2, v).endVertex();
|
|
||||||
buf.pos(x, y, this.zLevel).tex(u, v).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Draws a textured rectangle with the specified texture map size
|
|
||||||
*
|
|
||||||
* @param x Left edge X coordinate
|
|
||||||
* @param y Top edge Y coordinate
|
|
||||||
* @param u Texture U coordinate
|
|
||||||
* @param v Texture V coordinate
|
|
||||||
* @param width Width
|
|
||||||
* @param height Height
|
|
||||||
* @param texMapScale Texture map scale for scaling UV coordinate
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("cast")
|
|
||||||
public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height, float texMapScale) {
|
|
||||||
Tessellator tessellator = Tessellator.getInstance();
|
|
||||||
VertexBuffer buf = tessellator.getBuffer();
|
|
||||||
buf.begin(GL_QUADS, VF_POSITION_TEX);
|
|
||||||
buf.pos(x + 0, y + height, this.zLevel).tex((float) (u + 0) * texMapScale, (float) (v + height) * texMapScale).endVertex();
|
|
||||||
buf.pos(x + width, y + height, this.zLevel).tex((float) (u + width) * texMapScale, (float) (v + height) * texMapScale).endVertex();
|
|
||||||
buf.pos(x + width, y + 0, this.zLevel).tex((float) (u + width) * texMapScale, (float) (v + 0) * texMapScale).endVertex();
|
|
||||||
buf.pos(x + 0, y + 0, this.zLevel).tex((float) (u + 0) * texMapScale, (float) (v + 0) * texMapScale).endVertex();
|
|
||||||
tessellator.draw();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setScreenSizeAndScale(int width, int height, int scaleFactor) {
|
|
||||||
GuiControl.lastScreenWidth = width;
|
|
||||||
GuiControl.lastScreenHeight = height;
|
|
||||||
GuiControl.guiScaleFactor = scaleFactor;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,17 +1,15 @@
|
||||||
package com.voxelmodpack.hdskins.mixin;
|
package com.voxelmodpack.hdskins.mixin;
|
||||||
|
|
||||||
|
import com.voxelmodpack.hdskins.gui.GuiButtonSkins;
|
||||||
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||||
|
import net.minecraft.client.gui.GuiButton;
|
||||||
|
import net.minecraft.client.gui.GuiMainMenu;
|
||||||
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.voxelmodpack.hdskins.gui.GuiButtonSkins;
|
|
||||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
|
||||||
import net.minecraft.client.gui.GuiMainMenu;
|
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
|
||||||
|
|
||||||
@Mixin(GuiMainMenu.class)
|
@Mixin(GuiMainMenu.class)
|
||||||
public class MixinGuiMainMenu extends GuiScreen {
|
public class MixinGuiMainMenu extends GuiScreen {
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.voxelmodpack.hdskins.mixin;
|
package com.voxelmodpack.hdskins.mixin;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import java.awt.image.BufferedImage;
|
import net.minecraft.client.renderer.IImageBuffer;
|
||||||
|
import net.minecraft.client.renderer.ImageBufferDownload;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||||
|
@ -11,10 +11,8 @@ import org.spongepowered.asm.mixin.injection.Surrogate;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import net.minecraft.client.renderer.IImageBuffer;
|
|
||||||
import net.minecraft.client.renderer.ImageBufferDownload;
|
|
||||||
|
|
||||||
@Mixin(ImageBufferDownload.class)
|
@Mixin(ImageBufferDownload.class)
|
||||||
public abstract class MixinImageBufferDownload implements IImageBuffer {
|
public abstract class MixinImageBufferDownload implements IImageBuffer {
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package com.voxelmodpack.hdskins.mixin;
|
package com.voxelmodpack.hdskins.mixin;
|
||||||
|
|
||||||
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
||||||
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import java.util.Optional;
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
|
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
|
||||||
|
|
||||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
@Mixin(NetworkPlayerInfo.class)
|
@Mixin(NetworkPlayerInfo.class)
|
||||||
public abstract class MixinPlayerInfo {
|
public abstract class MixinPlayerInfo {
|
||||||
|
@ -44,12 +43,10 @@ public abstract class MixinPlayerInfo {
|
||||||
private void getLocationElytra(CallbackInfoReturnable<ResourceLocation> ci) {
|
private void getLocationElytra(CallbackInfoReturnable<ResourceLocation> ci) {
|
||||||
getTextureLocation(ci, Type.ELYTRA);
|
getTextureLocation(ci, Type.ELYTRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getTextureLocation(CallbackInfoReturnable<ResourceLocation> ci, Type type) {
|
private void getTextureLocation(CallbackInfoReturnable<ResourceLocation> ci, Type type) {
|
||||||
Optional<ResourceLocation> texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), type, true);
|
Optional<ResourceLocation> texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), type, true);
|
||||||
if (texture.isPresent()) {
|
texture.ifPresent(ci::setReturnValue);
|
||||||
ci.setReturnValue(texture.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(
|
@Inject(
|
||||||
|
@ -60,12 +57,12 @@ public abstract class MixinPlayerInfo {
|
||||||
MinecraftProfileTexture data = HDSkinManager.INSTANCE.getProfileData(getGameProfile()).get(Type.SKIN);
|
MinecraftProfileTexture data = HDSkinManager.INSTANCE.getProfileData(getGameProfile()).get(Type.SKIN);
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
String type = data.getMetadata("model");
|
String type = data.getMetadata("model");
|
||||||
boolean hasSkin = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), Type.SKIN, false).isPresent();
|
if (type == null)
|
||||||
if (hasSkin) {
|
type = "default";
|
||||||
if (type == null)
|
String type1 = type;
|
||||||
type = "default";
|
Optional<ResourceLocation> texture = HDSkinManager.INSTANCE.getSkinLocation(getGameProfile(), Type.SKIN, false);
|
||||||
ci.setReturnValue(type);
|
|
||||||
}
|
texture.ifPresent((res) -> ci.setReturnValue(type1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package com.voxelmodpack.hdskins.mixin;
|
package com.voxelmodpack.hdskins.mixin;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.tileentity.TileEntitySkull;
|
import net.minecraft.tileentity.TileEntitySkull;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
@Mixin(TileEntitySkullRenderer.class)
|
@Mixin(TileEntitySkullRenderer.class)
|
||||||
public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileEntitySkull> {
|
public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileEntitySkull> {
|
||||||
|
@ -25,7 +24,7 @@ public abstract class MixinSkullRenderer extends TileEntitySpecialRenderer<TileE
|
||||||
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
|
target = "Lnet/minecraft/client/renderer/tileentity/TileEntitySkullRenderer;bindTexture(Lnet/minecraft/util/ResourceLocation;)V",
|
||||||
ordinal = 4))
|
ordinal = 4))
|
||||||
private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta,
|
private void onBindTexture(TileEntitySkullRenderer tesr, ResourceLocation rl, float x, float y, float z, EnumFacing facing, float rotation, int meta,
|
||||||
GameProfile profile, int p_180543_8_, float ticks) {
|
GameProfile profile, int p_180543_8_, float ticks) {
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
|
Optional<ResourceLocation> skin = HDSkinManager.INSTANCE.getSkinLocation(profile, Type.SKIN, true);
|
||||||
if (skin.isPresent())
|
if (skin.isPresent())
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package com.voxelmodpack.hdskins.mod;
|
package com.voxelmodpack.hdskins.mod;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
import com.mumfrey.liteloader.modconfig.ConfigPanel;
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
|
@ -11,11 +8,12 @@ import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
||||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||||
import com.voxelmodpack.hdskins.gui.HDSkinsConfigPanel;
|
import com.voxelmodpack.hdskins.gui.HDSkinsConfigPanel;
|
||||||
import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
|
import com.voxelmodpack.hdskins.gui.RenderPlayerModel;
|
||||||
import com.voxelmodpack.voxelmenu.IPanoramaRenderer;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.IReloadableResourceManager;
|
import net.minecraft.client.resources.IReloadableResourceManager;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
public class LiteModHDSkinsMod implements HDSkinsMod {
|
public class LiteModHDSkinsMod implements HDSkinsMod {
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
@ -55,23 +53,6 @@ public class LiteModHDSkinsMod implements HDSkinsMod {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
public void onInitCompleted(Minecraft minecraft, LiteLoader loader) {
|
||||||
ModUtilities.addRenderer(EntityPlayerModel.class, new RenderPlayerModel<EntityPlayerModel>(minecraft.getRenderManager()));
|
ModUtilities.addRenderer(EntityPlayerModel.class, new RenderPlayerModel<>(minecraft.getRenderManager()));
|
||||||
}
|
|
||||||
|
|
||||||
public static IPanoramaRenderer getPanoramaRenderer(IPanoramaRenderer fallbackRenderer) {
|
|
||||||
try {
|
|
||||||
Class<?> ex = Class.forName("com.thevoxelbox.voxelmenu.VoxelMenuModCore");
|
|
||||||
Method mGetPanoramaRenderer = ex.getDeclaredMethod("getPanoramaRenderer");
|
|
||||||
IPanoramaRenderer panoramaRenderer = (IPanoramaRenderer) mGetPanoramaRenderer.invoke(null);
|
|
||||||
if (panoramaRenderer != null) {
|
|
||||||
return panoramaRenderer;
|
|
||||||
}
|
|
||||||
} catch (ClassNotFoundException var4) {
|
|
||||||
|
|
||||||
} catch (Exception var5) {
|
|
||||||
var5.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return fallbackRenderer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,18 @@
|
||||||
package com.voxelmodpack.hdskins.resource;
|
package com.voxelmodpack.hdskins.resource;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.concurrent.Callable;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
import com.google.common.base.Throwables;
|
||||||
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
||||||
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
|
import com.voxelmodpack.hdskins.ImageBufferDownloadHD;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
public class ImageLoader implements Callable<ResourceLocation> {
|
public class ImageLoader implements Callable<ResourceLocation> {
|
||||||
|
|
||||||
|
@ -33,14 +30,7 @@ public class ImageLoader implements Callable<ResourceLocation> {
|
||||||
final BufferedImage updated = new ImageBufferDownloadHD().parseUserSkin(image);
|
final BufferedImage updated = new ImageBufferDownloadHD().parseUserSkin(image);
|
||||||
if (updated == null)
|
if (updated == null)
|
||||||
return null;
|
return null;
|
||||||
return this.mc.addScheduledTask(new Callable<ResourceLocation>() {
|
return this.mc.addScheduledTask(() -> loadSkin(updated)).get();
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResourceLocation call() throws Exception {
|
|
||||||
return loadSkin(updated);
|
|
||||||
}
|
|
||||||
|
|
||||||
}).get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
package com.voxelmodpack.hdskins.resource;
|
package com.voxelmodpack.hdskins.resource;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
@SuppressWarnings("unused")
|
||||||
|
|
||||||
class SkinData {
|
class SkinData {
|
||||||
|
|
||||||
List<Skin> skins;
|
List<Skin> skins;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
class Skin {
|
class Skin {
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
UUID uuid;
|
UUID uuid;
|
||||||
private String skin;
|
String skin;
|
||||||
|
|
||||||
public ResourceLocation getTexture() {
|
public ResourceLocation getTexture() {
|
||||||
return new ResourceLocation("hdskins", String.format("textures/skins/%s.png", skin));
|
return new ResourceLocation("hdskins", String.format("textures/skins/%s.png", skin));
|
||||||
|
|
|
@ -1,18 +1,5 @@
|
||||||
package com.voxelmodpack.hdskins.resource;
|
package com.voxelmodpack.hdskins.resource;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.Future;
|
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.util.concurrent.ListenableFuture;
|
import com.google.common.util.concurrent.ListenableFuture;
|
||||||
import com.google.common.util.concurrent.ListeningExecutorService;
|
import com.google.common.util.concurrent.ListeningExecutorService;
|
||||||
|
@ -22,12 +9,22 @@ import com.google.gson.JsonParseException;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
import com.mojang.authlib.minecraft.MinecraftProfileTexture.Type;
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.resources.IResource;
|
import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
public class SkinResourceManager implements IResourceManagerReloadListener {
|
public class SkinResourceManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
|
@ -113,16 +110,13 @@ public class SkinResourceManager implements IResourceManagerReloadListener {
|
||||||
if (this.inProgress.get(res) == null) {
|
if (this.inProgress.get(res) == null) {
|
||||||
// read and convert in a new thread
|
// read and convert in a new thread
|
||||||
final ListenableFuture<ResourceLocation> conv = executor.submit(new ImageLoader(res));
|
final ListenableFuture<ResourceLocation> conv = executor.submit(new ImageLoader(res));
|
||||||
conv.addListener(new Runnable() {
|
conv.addListener(() -> {
|
||||||
@Override
|
try {
|
||||||
public void run() {
|
if (!conv.isCancelled())
|
||||||
try {
|
converted.put(res, conv.get());
|
||||||
if (!conv.isCancelled())
|
} catch (Exception e) {
|
||||||
converted.put(res, conv.get());
|
LogManager.getLogger().warn("Errored while processing " + res + ". Using original.", e);
|
||||||
} catch (Exception e) {
|
converted.put(res, res);
|
||||||
LogManager.getLogger().warn("Errored while processing " + res + ". Using original.", e);
|
|
||||||
converted.put(res, res);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, executor);
|
}, executor);
|
||||||
this.inProgress.put(res, conv);
|
this.inProgress.put(res, conv);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
package com.voxelmodpack.hdskins.upload;
|
package com.voxelmodpack.hdskins.upload;
|
||||||
|
|
||||||
public interface IUploadCompleteCallback {
|
public interface IUploadCompleteCallback {
|
||||||
public abstract void onUploadComplete(String response);
|
void onUploadComplete(String response);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package com.voxelmodpack.hdskins.upload;
|
package com.voxelmodpack.hdskins.upload;
|
||||||
|
|
||||||
|
import com.google.common.io.Files;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -19,7 +19,7 @@ import java.util.Map.Entry;
|
||||||
* @author Adam Mummery-Smith
|
* @author Adam Mummery-Smith
|
||||||
*/
|
*/
|
||||||
public class ThreadMultipartPostUpload extends Thread {
|
public class ThreadMultipartPostUpload extends Thread {
|
||||||
protected final Map<String, Object> sourceData;
|
protected final Map<String, ?> sourceData;
|
||||||
|
|
||||||
protected final String method;
|
protected final String method;
|
||||||
|
|
||||||
|
@ -39,12 +39,7 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
|
|
||||||
public String response;
|
public String response;
|
||||||
|
|
||||||
public int httpResponseCode;
|
public ThreadMultipartPostUpload(String method, String url, Map<String, ?> sourceData, String authorization, IUploadCompleteCallback callback) {
|
||||||
|
|
||||||
public String httpResponse;
|
|
||||||
|
|
||||||
public ThreadMultipartPostUpload(String method, String url, Map<String, Object> sourceData, String authorization,
|
|
||||||
IUploadCompleteCallback callback) {
|
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.urlString = url;
|
this.urlString = url;
|
||||||
this.sourceData = sourceData;
|
this.sourceData = sourceData;
|
||||||
|
@ -52,7 +47,7 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ThreadMultipartPostUpload(String url, Map<String, Object> sourceData, IUploadCompleteCallback callback) {
|
public ThreadMultipartPostUpload(String url, Map<String, ?> sourceData, IUploadCompleteCallback callback) {
|
||||||
this("POST", url, sourceData, null, callback);
|
this("POST", url, sourceData, null, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +61,6 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
this.uploadMultipart();
|
this.uploadMultipart();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
|
|
||||||
try {
|
|
||||||
this.httpResponseCode = this.httpClient.getResponseCode();
|
|
||||||
this.httpResponse = this.httpClient.getResponseMessage();
|
|
||||||
} catch (Exception ex1) {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.callback.onUploadComplete(this.getResponse());
|
this.callback.onUploadComplete(this.getResponse());
|
||||||
|
@ -87,12 +77,10 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
|
|
||||||
this.httpClient.setRequestMethod(this.method);
|
this.httpClient.setRequestMethod(this.method);
|
||||||
this.httpClient.setRequestProperty("Connection", "Close");
|
this.httpClient.setRequestProperty("Connection", "Close");
|
||||||
this.httpClient.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); // For
|
this.httpClient.addRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"); // For CloudFlare
|
||||||
// CloudFlare
|
|
||||||
|
|
||||||
if (this.sourceData.size() > 0) {
|
if (this.sourceData.size() > 0) {
|
||||||
this.httpClient.setRequestProperty("Content-Type",
|
this.httpClient.setRequestProperty("Content-Type", "multipart/form-data, boundary=" + boundary);
|
||||||
"multipart/form-data, boundary=" + ThreadMultipartPostUpload.boundary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.authorization != null) {
|
if (this.authorization != null) {
|
||||||
|
@ -101,30 +89,27 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
|
|
||||||
DataOutputStream outputStream = new DataOutputStream(this.httpClient.getOutputStream());
|
DataOutputStream outputStream = new DataOutputStream(this.httpClient.getOutputStream());
|
||||||
|
|
||||||
for (Entry<String, Object> data : this.sourceData.entrySet()) {
|
for (Entry<String, ?> data : this.sourceData.entrySet()) {
|
||||||
outputStream.writeBytes(ThreadMultipartPostUpload.twoHyphens + ThreadMultipartPostUpload.boundary
|
outputStream.writeBytes(twoHyphens + boundary + CRLF);
|
||||||
+ ThreadMultipartPostUpload.CRLF);
|
|
||||||
|
|
||||||
String paramName = data.getKey();
|
String paramName = data.getKey();
|
||||||
Object paramData = data.getValue();
|
Object paramData = data.getValue();
|
||||||
|
|
||||||
if (paramData instanceof File) {
|
if (paramData instanceof File) {
|
||||||
File uploadFile = (File) paramData;
|
File uploadFile = (File) paramData;
|
||||||
outputStream.writeBytes(
|
outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadFile.getName() + "\"" + CRLF + CRLF);
|
||||||
"Content-Disposition: form-data; name=\"" + paramName + "\"; filename=\"" + uploadFile.getName()
|
|
||||||
+ "\"" + ThreadMultipartPostUpload.CRLF + ThreadMultipartPostUpload.CRLF);
|
Files.asByteSource(uploadFile).copyTo(outputStream);
|
||||||
this.writeFile(uploadFile, outputStream);
|
|
||||||
} else {
|
} else {
|
||||||
outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\""
|
outputStream.writeBytes("Content-Disposition: form-data; name=\"" + paramName + "\"" + CRLF + CRLF);
|
||||||
+ ThreadMultipartPostUpload.CRLF + ThreadMultipartPostUpload.CRLF);
|
|
||||||
outputStream.writeBytes(paramData.toString());
|
outputStream.writeBytes(paramData.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.writeBytes(ThreadMultipartPostUpload.CRLF);
|
outputStream.writeBytes(ThreadMultipartPostUpload.CRLF);
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.writeBytes(ThreadMultipartPostUpload.twoHyphens + ThreadMultipartPostUpload.boundary
|
outputStream.writeBytes(twoHyphens + boundary + twoHyphens + CRLF);
|
||||||
+ ThreadMultipartPostUpload.twoHyphens + ThreadMultipartPostUpload.CRLF);
|
|
||||||
outputStream.flush();
|
outputStream.flush();
|
||||||
|
|
||||||
InputStream httpStream = this.httpClient.getInputStream();
|
InputStream httpStream = this.httpClient.getInputStream();
|
||||||
|
@ -145,36 +130,6 @@ public class ThreadMultipartPostUpload extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
outputStream.close();
|
outputStream.close();
|
||||||
|
|
||||||
this.httpResponseCode = this.httpClient.getResponseCode();
|
|
||||||
this.httpResponse = this.httpClient.getResponseMessage();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sourceFile
|
|
||||||
* @param outputStream
|
|
||||||
* @throws FileNotFoundException
|
|
||||||
* @throws IOException
|
|
||||||
*/
|
|
||||||
public void writeFile(File sourceFile, DataOutputStream outputStream) throws FileNotFoundException, IOException {
|
|
||||||
int bytesRead, bufferSize;
|
|
||||||
int maxBufferSize = 1 * 1024 * 1024;
|
|
||||||
|
|
||||||
FileInputStream fileInputStream = new FileInputStream(sourceFile);
|
|
||||||
|
|
||||||
int bytesAvailable = fileInputStream.available();
|
|
||||||
bufferSize = Math.min(bytesAvailable, maxBufferSize);
|
|
||||||
byte[] buffer = new byte[bufferSize];
|
|
||||||
|
|
||||||
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
|
|
||||||
|
|
||||||
while (bytesRead > 0) {
|
|
||||||
outputStream.write(buffer, 0, bufferSize);
|
|
||||||
bytesAvailable = fileInputStream.available();
|
|
||||||
bufferSize = Math.min(bytesAvailable, maxBufferSize);
|
|
||||||
bytesRead = fileInputStream.read(buffer, 0, bufferSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
fileInputStream.close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,7 @@ public interface IOpenFileCallback {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback method called when the "open file" dialog is closed
|
* Callback method called when the "open file" dialog is closed
|
||||||
*
|
|
||||||
* @param fileDialog
|
|
||||||
* @param dialogResult
|
|
||||||
*/
|
*/
|
||||||
public abstract void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult);
|
void onFileOpenDialogClosed(JFileChooser fileDialog, int dialogResult);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
package com.voxelmodpack.hdskins.upload.awt;
|
package com.voxelmodpack.hdskins.upload.awt;
|
||||||
|
|
||||||
import java.awt.Frame;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
import javax.swing.JFileChooser;
|
import javax.swing.JFileChooser;
|
||||||
import javax.swing.filechooser.FileFilter;
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for "open file" dialog threads
|
* Base class for "open file" dialog threads
|
||||||
*
|
*
|
||||||
* @author Adam Mummery-Smith
|
* @author Adam Mummery-Smith
|
||||||
*/
|
*/
|
||||||
public abstract class ThreadOpenFile extends Thread {
|
public abstract class ThreadOpenFile extends Thread {
|
||||||
/**
|
|
||||||
* Minecraft's AWT parent frame
|
|
||||||
*/
|
|
||||||
protected Frame parentFrame;
|
|
||||||
|
|
||||||
protected String dialogTitle;
|
protected String dialogTitle;
|
||||||
|
|
||||||
|
@ -25,10 +19,6 @@ public abstract class ThreadOpenFile extends Thread {
|
||||||
*/
|
*/
|
||||||
protected final IOpenFileCallback parentScreen;
|
protected final IOpenFileCallback parentScreen;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param minecraft
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
protected ThreadOpenFile(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
||||||
throws IllegalStateException {
|
throws IllegalStateException {
|
||||||
if (minecraft.isFullScreen()) {
|
if (minecraft.isFullScreen()) {
|
||||||
|
@ -45,15 +35,13 @@ public abstract class ThreadOpenFile extends Thread {
|
||||||
fileDialog.setDialogTitle(this.dialogTitle);
|
fileDialog.setDialogTitle(this.dialogTitle);
|
||||||
fileDialog.setFileFilter(this.getFileFilter());
|
fileDialog.setFileFilter(this.getFileFilter());
|
||||||
|
|
||||||
int dialogResult = fileDialog.showOpenDialog(this.parentFrame);
|
int dialogResult = fileDialog.showOpenDialog(null);
|
||||||
|
|
||||||
this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
this.parentScreen.onFileOpenDialogClosed(fileDialog, dialogResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclasses should override this to return a file filter
|
* Subclasses should override this to return a file filter
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
protected abstract FileFilter getFileFilter();
|
protected abstract FileFilter getFileFilter();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,31 +1,22 @@
|
||||||
package com.voxelmodpack.hdskins.upload.awt;
|
package com.voxelmodpack.hdskins.upload.awt;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.swing.filechooser.FileFilter;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
import javax.swing.filechooser.FileFilter;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens an awt "Open File" dialog with a PNG file filter
|
* Opens an awt "Open File" dialog with a PNG file filter
|
||||||
*
|
*
|
||||||
* @author Adam Mummery-Smith
|
* @author Adam Mummery-Smith
|
||||||
*/
|
*/
|
||||||
public class ThreadOpenFilePNG extends ThreadOpenFile {
|
public class ThreadOpenFilePNG extends ThreadOpenFile {
|
||||||
/**
|
|
||||||
* @param minecraft
|
|
||||||
* @param dialogTitle
|
|
||||||
* @param callback
|
|
||||||
* @throws IllegalStateException
|
|
||||||
*/
|
|
||||||
public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
public ThreadOpenFilePNG(Minecraft minecraft, String dialogTitle, IOpenFileCallback callback)
|
||||||
throws IllegalStateException {
|
throws IllegalStateException {
|
||||||
super(minecraft, dialogTitle, callback);
|
super(minecraft, dialogTitle, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected FileFilter getFileFilter() {
|
protected FileFilter getFileFilter() {
|
||||||
return new FileFilter() {
|
return new FileFilter() {
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.voxelmodpack.voxelmenu;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
|
|
||||||
public interface IPanoramaRenderer {
|
|
||||||
void setPanoramaResolution(Minecraft var1, int var2, int var3);
|
|
||||||
|
|
||||||
void initPanoramaRenderer();
|
|
||||||
|
|
||||||
void updatePanorama();
|
|
||||||
|
|
||||||
boolean renderPanorama(int var1, int var2, float var3);
|
|
||||||
|
|
||||||
int getUpdateCounter();
|
|
||||||
}
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.4.10",
|
"minVersion": "0.6",
|
||||||
"package": "com.voxelmodpack.hdskins.mixin",
|
"package": "com.voxelmodpack.hdskins.mixin",
|
||||||
"refmap": "mixin.hdskins.refmap.json",
|
"refmap": "mixin.hdskins.refmap.json",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinGuiMainMenu",
|
"MixinGuiMainMenu",
|
||||||
"MixinImageBufferDownload",
|
"MixinImageBufferDownload",
|
||||||
"MixinPlayerInfo",
|
"MixinPlayerInfo",
|
||||||
"MixinSkullRenderer"
|
"MixinSkullRenderer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,12 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.InitCompleteListener;
|
import com.mumfrey.liteloader.InitCompleteListener;
|
||||||
import com.mumfrey.liteloader.Tickable;
|
import com.mumfrey.liteloader.Tickable;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
|
public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
|
||||||
|
|
||||||
private MineLittlePony mlp;
|
private MineLittlePony mlp;
|
||||||
|
@ -23,7 +22,8 @@ public class LiteModMineLittlePony implements Tickable, InitCompleteListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void upgradeSettings(String version, File configPath, File oldConfigPath) {}
|
public void upgradeSettings(String version, File configPath, File oldConfigPath) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(File configPath) {
|
public void init(File configPath) {
|
||||||
|
|
|
@ -12,7 +12,6 @@ import com.minelittlepony.renderer.RenderPonyVillager;
|
||||||
import com.minelittlepony.renderer.RenderPonyVindicator;
|
import com.minelittlepony.renderer.RenderPonyVindicator;
|
||||||
import com.minelittlepony.renderer.RenderPonyZombie;
|
import com.minelittlepony.renderer.RenderPonyZombie;
|
||||||
import com.minelittlepony.renderer.RenderPonyZombieVillager;
|
import com.minelittlepony.renderer.RenderPonyZombieVillager;
|
||||||
import com.minelittlepony.util.MineLPLogger;
|
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
import com.mumfrey.liteloader.util.ModUtilities;
|
import com.mumfrey.liteloader.util.ModUtilities;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
@ -33,10 +32,15 @@ import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
import net.minecraft.entity.monster.EntityZombie;
|
||||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||||
import net.minecraft.entity.passive.EntityVillager;
|
import net.minecraft.entity.passive.EntityVillager;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.input.Keyboard;
|
import org.lwjgl.input.Keyboard;
|
||||||
|
|
||||||
public class MineLittlePony {
|
public class MineLittlePony {
|
||||||
|
|
||||||
|
public static final Logger logger = LogManager.getLogger("MineLittlePony");
|
||||||
|
|
||||||
|
|
||||||
public static final String MOD_NAME = "Mine Little Pony";
|
public static final String MOD_NAME = "Mine Little Pony";
|
||||||
public static final String MOD_VERSION = "@VERSION@";
|
public static final String MOD_VERSION = "@VERSION@";
|
||||||
|
|
||||||
|
@ -77,38 +81,39 @@ public class MineLittlePony {
|
||||||
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());
|
||||||
MineLPLogger.info("Set MineLP skin server URL.");
|
logger.info("Set MineLP skin server URL.");
|
||||||
|
|
||||||
RenderManager rm = minecraft.getRenderManager();
|
RenderManager rm = minecraft.getRenderManager();
|
||||||
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
ModUtilities.addRenderer(EntityPonyModel.class, new RenderPonyModel(rm));
|
||||||
if (this.config.villagers) {
|
if (this.config.villagers) {
|
||||||
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
ModUtilities.addRenderer(EntityVillager.class, new RenderPonyVillager(rm));
|
||||||
ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
|
ModUtilities.addRenderer(EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
|
||||||
MineLPLogger.info("Villagers are now ponies.");
|
logger.info("Villagers are now ponies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.zombies) {
|
if (this.config.zombies) {
|
||||||
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<EntityZombie>(rm));
|
ModUtilities.addRenderer(EntityZombie.class, new RenderPonyZombie<>(rm));
|
||||||
ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
|
ModUtilities.addRenderer(EntityHusk.class, new RenderPonyZombie.Husk(rm));
|
||||||
MineLPLogger.info("Zombies are now ponies.");
|
logger.info("Zombies are now ponies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.pigzombies) {
|
if (this.config.pigzombies) {
|
||||||
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyPigman(rm));
|
ModUtilities.addRenderer(EntityPigZombie.class, new RenderPonyPigman(rm));
|
||||||
MineLPLogger.info("Zombie pigmen are now ponies.");
|
logger.info("Zombie pigmen are now ponies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.skeletons) {
|
if (this.config.skeletons) {
|
||||||
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<EntitySkeleton>(rm));
|
ModUtilities.addRenderer(EntitySkeleton.class, new RenderPonySkeleton<>(rm));
|
||||||
ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
|
ModUtilities.addRenderer(EntityStray.class, new RenderPonySkeleton.Stray(rm));
|
||||||
ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
|
ModUtilities.addRenderer(EntityWitherSkeleton.class, new RenderPonySkeleton.Wither(rm));
|
||||||
MineLPLogger.info("Skeletons are now ponies.");
|
logger.info("Skeletons are now ponies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.config.illagers) {
|
if (this.config.illagers) {
|
||||||
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
|
ModUtilities.addRenderer(EntityVex.class, new RenderPonyVex(rm));
|
||||||
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
|
ModUtilities.addRenderer(EntityEvoker.class, new RenderPonyEvoker(rm));
|
||||||
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
|
ModUtilities.addRenderer(EntityVindicator.class, new RenderPonyVindicator(rm));
|
||||||
|
logger.info("Illagers are now ponies.");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,9 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Predicate;
|
|
||||||
import com.google.common.base.Splitter;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.util.MineLPLogger;
|
|
||||||
import com.minelittlepony.util.PonyFields;
|
import com.minelittlepony.util.PonyFields;
|
||||||
import com.mojang.authlib.GameProfile;
|
|
||||||
import com.mumfrey.webprefs.WebPreferencesManager;
|
|
||||||
import com.mumfrey.webprefs.interfaces.IWebPreferences;
|
|
||||||
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
|
@ -29,6 +13,10 @@ import net.minecraft.client.resources.IResource;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Pony {
|
public class Pony {
|
||||||
|
|
||||||
private static PonyConfig config = MineLittlePony.getConfig();
|
private static PonyConfig config = MineLittlePony.getConfig();
|
||||||
|
@ -36,7 +24,6 @@ public class Pony {
|
||||||
private static int ponyCount = 0;
|
private static int ponyCount = 0;
|
||||||
private final int ponyId = ponyCount++;
|
private final int ponyId = ponyCount++;
|
||||||
|
|
||||||
public GameProfile profile;
|
|
||||||
public ResourceLocation textureResourceLocation;
|
public ResourceLocation textureResourceLocation;
|
||||||
public PonyData metadata = new PonyData();
|
public PonyData metadata = new PonyData();
|
||||||
|
|
||||||
|
@ -44,16 +31,15 @@ public class Pony {
|
||||||
private boolean skinChecked;
|
private boolean skinChecked;
|
||||||
|
|
||||||
public Pony(@Nonnull AbstractClientPlayer player) {
|
public Pony(@Nonnull AbstractClientPlayer player) {
|
||||||
this.profile = player.getGameProfile();
|
|
||||||
this.textureResourceLocation = player.getLocationSkin();
|
this.textureResourceLocation = player.getLocationSkin();
|
||||||
MineLPLogger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId,
|
MineLittlePony.logger.debug("+ Initialising new pony #%d for player %s (%s) with resource location %s.", this.ponyId,
|
||||||
player.getName(), player.getUniqueID(), this.textureResourceLocation);
|
player.getName(), player.getUniqueID(), this.textureResourceLocation);
|
||||||
this.checkSkin(this.textureResourceLocation);
|
this.checkSkin(this.textureResourceLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pony(@Nonnull ResourceLocation aTextureResourceLocation) {
|
public Pony(@Nonnull ResourceLocation aTextureResourceLocation) {
|
||||||
this.textureResourceLocation = aTextureResourceLocation;
|
this.textureResourceLocation = aTextureResourceLocation;
|
||||||
MineLPLogger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation);
|
MineLittlePony.logger.debug("+ Initialising new pony #%d with resource location %s.", this.ponyId, this.textureResourceLocation);
|
||||||
this.checkSkin(this.textureResourceLocation);
|
this.checkSkin(this.textureResourceLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,10 +66,9 @@ public class Pony {
|
||||||
try {
|
try {
|
||||||
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
|
IResource skin = Minecraft.getMinecraft().getResourceManager().getResource(textureResourceLocation);
|
||||||
skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
|
skinImage = TextureUtil.readBufferedImage(skin.getInputStream());
|
||||||
MineLPLogger.debug("Obtained skin from resource location %s", textureResourceLocation);
|
MineLittlePony.logger.debug("Obtained skin from resource location %s", textureResourceLocation);
|
||||||
// this.checkSkin(skinImage);
|
// this.checkSkin(skinImage);
|
||||||
} catch (IOException var6) {
|
} catch (IOException e) {
|
||||||
Exception e = var6;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(textureResourceLocation);
|
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(textureResourceLocation);
|
||||||
|
@ -91,13 +76,13 @@ public class Pony {
|
||||||
|
|
||||||
skinImage = PonyFields.downloadedImage.get((ThreadDownloadImageData) e2);
|
skinImage = PonyFields.downloadedImage.get((ThreadDownloadImageData) e2);
|
||||||
if (skinImage != null) {
|
if (skinImage != null) {
|
||||||
MineLPLogger.debug(e, "Successfully reflected downloadedImage from texture object");
|
MineLittlePony.logger.debug("Successfully reflected downloadedImage from texture object", e);
|
||||||
// this.checkSkin(skinImage);
|
// this.checkSkin(skinImage);
|
||||||
}
|
}
|
||||||
} else if (e2 instanceof DynamicTextureImage) {
|
} else if (e2 instanceof DynamicTextureImage) {
|
||||||
skinImage = ((DynamicTextureImage) e2).getImage();
|
skinImage = ((DynamicTextureImage) e2).getImage();
|
||||||
}
|
}
|
||||||
} catch (Exception var5) {
|
} catch (Exception ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -106,12 +91,13 @@ public class Pony {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkSkin(BufferedImage bufferedimage) {
|
public void checkSkin(BufferedImage bufferedimage) {
|
||||||
MineLPLogger.debug("\tStart skin check #%d for pony #%d with image %s.", ++this.skinCheckCount, this.ponyId);
|
MineLittlePony.logger.debug("\tStart skin check #%d for pony #%d with image %s.", ++this.skinCheckCount, this.ponyId);
|
||||||
metadata = PonyData.parse(bufferedimage);
|
metadata = PonyData.parse(bufferedimage);
|
||||||
this.skinChecked = true;
|
this.skinChecked = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPegasusFlying(EntityPlayer player) {
|
public boolean isPegasusFlying(EntityPlayer player) {
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) {
|
if (this.metadata.getRace() == null || !this.metadata.getRace().hasWings()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -121,14 +107,14 @@ public class Pony {
|
||||||
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
|
public PlayerModel getModel(boolean ignorePony, boolean smallArms) {
|
||||||
boolean is_a_pony = false;
|
boolean is_a_pony = false;
|
||||||
switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel()) {
|
switch (ignorePony ? PonyLevel.BOTH : config.getPonyLevel()) {
|
||||||
case HUMANS:
|
case HUMANS:
|
||||||
is_a_pony = false;
|
is_a_pony = false;
|
||||||
break;
|
break;
|
||||||
case BOTH:
|
case BOTH:
|
||||||
is_a_pony = metadata.getRace() != null;
|
is_a_pony = metadata.getRace() != null;
|
||||||
break;
|
break;
|
||||||
case PONIES:
|
case PONIES:
|
||||||
is_a_pony = true;
|
is_a_pony = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerModel model;
|
PlayerModel model;
|
||||||
|
@ -144,7 +130,4 @@ public class Pony {
|
||||||
return this.textureResourceLocation;
|
return this.textureResourceLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GameProfile getProfile() {
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableBiMap;
|
|
||||||
import net.minecraft.client.resources.data.IMetadataSection;
|
|
||||||
|
|
||||||
public class PonyData implements IPonyData {
|
public class PonyData implements IPonyData {
|
||||||
|
|
||||||
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace> builder()
|
private static final Map<Integer, PonyRace> RACE_COLORS = ImmutableBiMap.<Integer, PonyRace>builder()
|
||||||
.put(0xf9b131, PonyRace.EARTH)
|
.put(0xf9b131, PonyRace.EARTH)
|
||||||
.put(0xd19fe4, PonyRace.UNICORN)
|
.put(0xd19fe4, PonyRace.UNICORN)
|
||||||
.put(0x88caf0, PonyRace.PEGASUS)
|
.put(0x88caf0, PonyRace.PEGASUS)
|
||||||
|
@ -16,12 +15,12 @@ public class PonyData implements IPonyData {
|
||||||
.put(0xd0cccf, PonyRace.ZEBRA)
|
.put(0xd0cccf, PonyRace.ZEBRA)
|
||||||
.put(0x282b29, PonyRace.CHANGELING)
|
.put(0x282b29, PonyRace.CHANGELING)
|
||||||
.build();
|
.build();
|
||||||
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths> builder()
|
private static final Map<Integer, TailLengths> TAIL_COLORS = ImmutableBiMap.<Integer, TailLengths>builder()
|
||||||
.put(0x425844, TailLengths.STUB)
|
.put(0x425844, TailLengths.STUB)
|
||||||
.put(0xd19fe4, TailLengths.QUARTER)
|
.put(0xd19fe4, TailLengths.QUARTER)
|
||||||
.put(0x534b76, TailLengths.HALF)
|
.put(0x534b76, TailLengths.HALF)
|
||||||
.put(0x8a6b7f, TailLengths.THREE_QUARTERS).build();
|
.put(0x8a6b7f, TailLengths.THREE_QUARTERS).build();
|
||||||
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize> builder()
|
private static final Map<Integer, PonySize> SIZE_COLORS = ImmutableBiMap.<Integer, PonySize>builder()
|
||||||
.put(0xffbe53, PonySize.FOAL)
|
.put(0xffbe53, PonySize.FOAL)
|
||||||
.put(0xce3254, PonySize.LARGE)
|
.put(0xce3254, PonySize.LARGE)
|
||||||
.put(0x534b76, PonySize.TALL)
|
.put(0x534b76, PonySize.TALL)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonDeserializationContext;
|
import com.google.gson.JsonDeserializationContext;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
|
|
|
@ -4,5 +4,5 @@ public enum PonyLevel {
|
||||||
|
|
||||||
PONIES,
|
PONIES,
|
||||||
HUMANS,
|
HUMANS,
|
||||||
BOTH;
|
BOTH
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,24 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonParseException;
|
||||||
|
import com.minelittlepony.model.PMAPI;
|
||||||
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
|
import net.minecraft.client.resources.IResource;
|
||||||
|
import net.minecraft.client.resources.IResourceManager;
|
||||||
|
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.apache.commons.compress.utils.IOUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import org.apache.commons.compress.utils.IOUtils;
|
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.google.common.collect.Maps;
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.JsonParseException;
|
|
||||||
import com.minelittlepony.model.PMAPI;
|
|
||||||
import com.minelittlepony.util.MineLPLogger;
|
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
|
||||||
import net.minecraft.client.resources.IResource;
|
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
|
||||||
import net.minecraft.client.resources.IResourceManagerReloadListener;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
public class PonyManager implements IResourceManagerReloadListener {
|
public class PonyManager implements IResourceManagerReloadListener {
|
||||||
|
|
||||||
|
@ -42,9 +39,9 @@ public class PonyManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initmodels() {
|
public void initmodels() {
|
||||||
MineLPLogger.info("Initializing models...");
|
MineLittlePony.logger.info("Initializing models...");
|
||||||
PMAPI.init();
|
PMAPI.init();
|
||||||
MineLPLogger.info("Done initializing models.");
|
MineLittlePony.logger.info("Done initializing models.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) {
|
private Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation, AbstractClientPlayer player) {
|
||||||
|
@ -65,7 +62,7 @@ public class PonyManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation) {
|
public Pony getPonyFromResourceRegistry(ResourceLocation skinResourceLocation) {
|
||||||
return this.getPonyFromResourceRegistry(skinResourceLocation, (AbstractClientPlayer) null);
|
return this.getPonyFromResourceRegistry(skinResourceLocation, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) {
|
public Pony getPonyFromResourceRegistry(AbstractClientPlayer player) {
|
||||||
|
@ -122,13 +119,13 @@ public class PonyManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
this.backgroundPonyList.addAll(ponies.getPonies());
|
this.backgroundPonyList.addAll(ponies.getPonies());
|
||||||
} catch (JsonParseException e) {
|
} catch (JsonParseException e) {
|
||||||
MineLPLogger.error(e, "Invalid bgponies.json in {}", res.getResourcePackName());
|
MineLittlePony.logger.error("Invalid bgponies.json in " + res.getResourcePackName(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// this isn't the exception you're looking for.
|
// this isn't the exception you're looking for.
|
||||||
}
|
}
|
||||||
MineLPLogger.info("Detected %d background ponies installed.", getNumberOfPonies());
|
MineLittlePony.logger.info("Detected %d background ponies installed.", getNumberOfPonies());
|
||||||
}
|
}
|
||||||
|
|
||||||
private BackgroundPonies getBackgroundPonies(InputStream stream) {
|
private BackgroundPonies getBackgroundPonies(InputStream stream) {
|
||||||
|
@ -147,18 +144,22 @@ public class PonyManager implements IResourceManagerReloadListener {
|
||||||
return backgroundPonyList.size();
|
return backgroundPonyList.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class BackgroundPonies implements Function<String, ResourceLocation> {
|
private static class BackgroundPonies {
|
||||||
|
|
||||||
public boolean override;
|
private boolean override;
|
||||||
private List<String> ponies;
|
private List<String> ponies;
|
||||||
|
|
||||||
@Override
|
private BackgroundPonies(List<String> ponies, boolean override) {
|
||||||
public ResourceLocation apply(String input) {
|
this.ponies = ponies;
|
||||||
|
this.override = override;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResourceLocation apply(String input) {
|
||||||
return new ResourceLocation("minelittlepony", String.format("textures/entity/pony/%s.png", input));
|
return new ResourceLocation("minelittlepony", String.format("textures/entity/pony/%s.png", input));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ResourceLocation> getPonies() {
|
public List<ResourceLocation> getPonies() {
|
||||||
return Lists.transform(ponies, this);
|
return this.ponies.stream().map(this::apply).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ public enum PonyRace {
|
||||||
private boolean wings;
|
private boolean wings;
|
||||||
private boolean horn;
|
private boolean horn;
|
||||||
|
|
||||||
private PonyRace(boolean wings, boolean horn) {
|
PonyRace(boolean wings, boolean horn) {
|
||||||
this.wings = wings;
|
this.wings = wings;
|
||||||
this.horn = horn;
|
this.horn = horn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.minelittlepony;
|
package com.minelittlepony;
|
||||||
|
|
||||||
|
import com.voxelmodpack.hdskins.ISkinModifier;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
import com.voxelmodpack.hdskins.ISkinModifier;
|
|
||||||
|
|
||||||
public class PonySkinModifier implements ISkinModifier {
|
public class PonySkinModifier implements ISkinModifier {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -10,10 +10,10 @@ public enum TailLengths {
|
||||||
|
|
||||||
private int size;
|
private int size;
|
||||||
|
|
||||||
private TailLengths(int size) {
|
TailLengths(int size) {
|
||||||
this.size = size;
|
this.size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getSize() {
|
public int getSize() {
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.forge;
|
package com.minelittlepony.forge;
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
|
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
@ -13,6 +12,7 @@ import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
clientSideOnly = true)
|
clientSideOnly = true)
|
||||||
public class MLPForge {
|
public class MLPForge {
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLPostInitializationEvent init) {
|
public void init(FMLPostInitializationEvent init) {
|
||||||
MLPCommonProxy.getInstance().setPonyArmors(new PonyArmors());
|
MLPCommonProxy.getInstance().setPonyArmors(new PonyArmors());
|
||||||
|
|
|
@ -1,17 +1,16 @@
|
||||||
package com.minelittlepony.gui;
|
package com.minelittlepony.gui;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.PonyConfig;
|
import com.minelittlepony.PonyConfig;
|
||||||
import com.minelittlepony.PonyLevel;
|
import com.minelittlepony.PonyLevel;
|
||||||
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
|
import com.mumfrey.liteloader.client.gui.GuiCheckbox;
|
||||||
import com.mumfrey.liteloader.core.LiteLoader;
|
import com.mumfrey.liteloader.core.LiteLoader;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.client.gui.GuiScreen;
|
import net.minecraft.client.gui.GuiScreen;
|
||||||
import net.minecraft.client.resources.I18n;
|
import net.minecraft.client.resources.I18n;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class PonySettingPanel extends GuiScreen {
|
public class PonySettingPanel extends GuiScreen {
|
||||||
|
|
||||||
private static final String _PREFIX = "minelp.options.";
|
private static final String _PREFIX = "minelp.options.";
|
||||||
|
@ -59,6 +58,7 @@ public class PonySettingPanel extends GuiScreen {
|
||||||
config = MineLittlePony.getConfig();
|
config = MineLittlePony.getConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedAssignment")
|
||||||
@Override
|
@Override
|
||||||
public void initGui() {
|
public void initGui() {
|
||||||
final int LEFT = width / 10 + 16;
|
final int LEFT = width / 10 + 16;
|
||||||
|
@ -81,16 +81,16 @@ public class PonySettingPanel extends GuiScreen {
|
||||||
this.buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
|
this.buttonList.add(skeleton = new GuiCheckbox(SKELETONS_ID, RIGHT, row += 15, I18n.format(SKELETONS)));
|
||||||
|
|
||||||
switch (config.getPonyLevel()) {
|
switch (config.getPonyLevel()) {
|
||||||
default:
|
default:
|
||||||
case PONIES:
|
case PONIES:
|
||||||
pony.checked = true;
|
pony.checked = true;
|
||||||
break;
|
break;
|
||||||
case HUMANS:
|
case HUMANS:
|
||||||
human.checked = true;
|
human.checked = true;
|
||||||
break;
|
break;
|
||||||
case BOTH:
|
case BOTH:
|
||||||
both.checked = true;
|
both.checked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hd.checked = config.hd;
|
hd.checked = config.hd;
|
||||||
sizes.checked = config.sizes;
|
sizes.checked = config.sizes;
|
||||||
|
@ -123,49 +123,49 @@ public class PonySettingPanel extends GuiScreen {
|
||||||
((GuiCheckbox) button).checked = checked;
|
((GuiCheckbox) button).checked = checked;
|
||||||
|
|
||||||
switch (button.id) {
|
switch (button.id) {
|
||||||
case PONY_ID:
|
case PONY_ID:
|
||||||
config.setPonyLevel(PonyLevel.PONIES);
|
config.setPonyLevel(PonyLevel.PONIES);
|
||||||
ponies.checked = true;
|
ponies.checked = true;
|
||||||
humans.checked = false;
|
humans.checked = false;
|
||||||
both.checked = false;
|
both.checked = false;
|
||||||
break;
|
break;
|
||||||
case HUMAN_ID:
|
case HUMAN_ID:
|
||||||
config.setPonyLevel(PonyLevel.HUMANS);
|
config.setPonyLevel(PonyLevel.HUMANS);
|
||||||
humans.checked = true;
|
humans.checked = true;
|
||||||
ponies.checked = false;
|
ponies.checked = false;
|
||||||
both.checked = false;
|
both.checked = false;
|
||||||
break;
|
break;
|
||||||
case BOTH_ID:
|
case BOTH_ID:
|
||||||
config.setPonyLevel(PonyLevel.BOTH);
|
config.setPonyLevel(PonyLevel.BOTH);
|
||||||
both.checked = true;
|
both.checked = true;
|
||||||
ponies.checked = false;
|
ponies.checked = false;
|
||||||
humans.checked = false;
|
humans.checked = false;
|
||||||
break;
|
break;
|
||||||
case HD_ID:
|
case HD_ID:
|
||||||
config.hd = checked;
|
config.hd = checked;
|
||||||
break;
|
break;
|
||||||
case SIZES_ID:
|
case SIZES_ID:
|
||||||
config.sizes = checked;
|
config.sizes = checked;
|
||||||
break;
|
break;
|
||||||
case SNUZZLES_ID:
|
case SNUZZLES_ID:
|
||||||
config.snuzzles = checked;
|
config.snuzzles = checked;
|
||||||
break;
|
break;
|
||||||
case SHOW_SCALE_ID:
|
case SHOW_SCALE_ID:
|
||||||
config.showscale = checked;
|
config.showscale = checked;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VILLAGERS_ID:
|
case VILLAGERS_ID:
|
||||||
config.villagers = checked;
|
config.villagers = checked;
|
||||||
break;
|
break;
|
||||||
case ZOMBIES_ID:
|
case ZOMBIES_ID:
|
||||||
config.zombies=checked;
|
config.zombies = checked;
|
||||||
break;
|
break;
|
||||||
case ZOMBIE_PIGMEN_ID:
|
case ZOMBIE_PIGMEN_ID:
|
||||||
config.pigzombies = checked;
|
config.pigzombies = checked;
|
||||||
break;
|
break;
|
||||||
case SKELETONS_ID:
|
case SKELETONS_ID:
|
||||||
config.skeletons=checked;
|
config.skeletons = checked;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.minelittlepony.hdskins.gui;
|
package com.minelittlepony.hdskins.gui;
|
||||||
|
|
||||||
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.PonyManager;
|
import com.minelittlepony.PonyManager;
|
||||||
import com.minelittlepony.util.MineLPLogger;
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
import com.voxelmodpack.hdskins.gui.EntityPlayerModel;
|
||||||
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
import com.voxelmodpack.hdskins.gui.GuiSkins;
|
||||||
|
@ -23,13 +23,13 @@ public class GuiSkinsMineLP extends GuiSkins {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSetLocalSkin(BufferedImage skin) {
|
protected void onSetLocalSkin(BufferedImage skin) {
|
||||||
MineLPLogger.debug("Invalidating old local skin, checking updated local skin");
|
MineLittlePony.logger.debug("Invalidating old local skin, checking updated local skin");
|
||||||
ponyManager.getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).checkSkin(skin);
|
ponyManager.getPonyFromResourceRegistry(this.localPlayer.getSkinTexture()).checkSkin(skin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onSetRemoteSkin() {
|
protected void onSetRemoteSkin() {
|
||||||
MineLPLogger.debug("Invalidating old remove skin, checking updated remote skin");
|
MineLittlePony.logger.debug("Invalidating old remove skin, checking updated remote skin");
|
||||||
ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck();
|
ponyManager.getPonyFromResourceRegistry(this.remotePlayer.getSkinTexture()).invalidateSkinCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,5 @@
|
||||||
package com.minelittlepony.mixin;
|
package com.minelittlepony.mixin;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.scale;
|
|
||||||
|
|
||||||
import org.objectweb.asm.Opcodes;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|
||||||
|
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.Pony;
|
import com.minelittlepony.Pony;
|
||||||
import com.minelittlepony.PonySize;
|
import com.minelittlepony.PonySize;
|
||||||
|
@ -24,7 +13,6 @@ import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyCape;
|
import com.minelittlepony.renderer.layer.LayerPonyCape;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
import com.minelittlepony.renderer.layer.LayerPonyElytra;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.model.ModelPlayer;
|
import net.minecraft.client.model.ModelPlayer;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
@ -34,6 +22,16 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
import net.minecraft.client.renderer.entity.layers.LayerArrow;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import org.objectweb.asm.Opcodes;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
|
|
||||||
@Mixin(RenderPlayer.class)
|
@Mixin(RenderPlayer.class)
|
||||||
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
|
public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientPlayer> implements IRenderPony {
|
||||||
|
@ -53,7 +51,6 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
||||||
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
|
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
|
||||||
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
|
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
|
||||||
this.mainModel = this.playerModel.getModel();
|
this.mainModel = this.playerModel.getModel();
|
||||||
this.shadowSize = this.playerModel.getShadowsize();
|
|
||||||
this.layerRenderers.clear();
|
this.layerRenderers.clear();
|
||||||
|
|
||||||
this.addLayer(new LayerPonyArmor(this));
|
this.addLayer(new LayerPonyArmor(this));
|
||||||
|
|
|
@ -7,14 +7,6 @@ public abstract class AbstractArmor {
|
||||||
public AbstractPonyModel modelArmorChestplate;
|
public AbstractPonyModel modelArmorChestplate;
|
||||||
public AbstractPonyModel modelArmor;
|
public AbstractPonyModel modelArmor;
|
||||||
|
|
||||||
public float layer() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int subimage(int slot) {
|
|
||||||
return slot == 2 ? 2 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void apply(PonyData meta) {
|
public void apply(PonyData meta) {
|
||||||
modelArmorChestplate.metadata = meta;
|
modelArmorChestplate.metadata = meta;
|
||||||
modelArmor.metadata = meta;
|
modelArmor.metadata = meta;
|
||||||
|
|
|
@ -1,18 +1,11 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minelittlepony.PonyData;
|
import com.minelittlepony.PonyData;
|
||||||
import com.minelittlepony.PonySize;
|
import com.minelittlepony.PonySize;
|
||||||
import com.minelittlepony.model.part.IPonyPart;
|
import com.minelittlepony.model.part.IPonyPart;
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||||
import com.minelittlepony.renderer.PlaneRenderer;
|
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelPlayer;
|
import net.minecraft.client.model.ModelPlayer;
|
||||||
|
@ -25,6 +18,13 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.rotate;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||||
|
|
||||||
public abstract class AbstractPonyModel extends ModelPlayer {
|
public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
|
|
||||||
protected float scale = 0.0625F;
|
protected float scale = 0.0625F;
|
||||||
|
@ -58,13 +58,17 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initTextures() {}
|
protected void initTextures() {
|
||||||
|
}
|
||||||
|
|
||||||
protected void initPositions(float yOffset, float stretch) {}
|
protected void initPositions(float yOffset, float stretch) {
|
||||||
|
}
|
||||||
|
|
||||||
protected void animate(float move, float swing, float tick, float horz, float vert, Entity entityIn) {}
|
protected void animate(float move, float swing, float tick, float horz, float vert, Entity entityIn) {
|
||||||
|
}
|
||||||
|
|
||||||
protected void render() {}
|
protected void render() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(Entity player, float Move, float Moveswing, float Loop, float Right, float Down, float Scale) {
|
public void render(Entity player, float Move, float Moveswing, float Loop, float Right, float Down, float Scale) {
|
||||||
|
@ -174,29 +178,12 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ArmPose getMainArmPose(Entity entity) {
|
|
||||||
EnumHandSide mainHand = this.getMainHand(entity);
|
|
||||||
return mainHand == EnumHandSide.RIGHT ? this.rightArmPose : this.leftArmPose;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) {
|
public static void setRotationPoint(ModelRenderer aRenderer, float setX, float setY, float setZ) {
|
||||||
aRenderer.rotationPointX = setX;
|
aRenderer.rotationPointX = setX;
|
||||||
aRenderer.rotationPointY = setY;
|
aRenderer.rotationPointY = setY;
|
||||||
aRenderer.rotationPointZ = setZ;
|
aRenderer.rotationPointZ = setZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setRotationPoint(PlaneRenderer aPlaneRenderer, float setX, float setY, float setZ) {
|
|
||||||
aPlaneRenderer.rotationPointX = setX;
|
|
||||||
aPlaneRenderer.rotationPointY = setY;
|
|
||||||
aPlaneRenderer.rotationPointZ = setZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void shiftRotationPoint(PlaneRenderer aPlaneRenderer, float shiftX, float shiftY, float shiftZ) {
|
|
||||||
aPlaneRenderer.rotationPointX += shiftX;
|
|
||||||
aPlaneRenderer.rotationPointY += shiftY;
|
|
||||||
aPlaneRenderer.rotationPointZ += shiftZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) {
|
public static void shiftRotationPoint(ModelRenderer aRenderer, float shiftX, float shiftY, float shiftZ) {
|
||||||
aRenderer.rotationPointX += shiftX;
|
aRenderer.rotationPointX += shiftX;
|
||||||
aRenderer.rotationPointY += shiftY;
|
aRenderer.rotationPointY += shiftY;
|
||||||
|
@ -230,33 +217,33 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
translate(0, -.1, 0);
|
translate(0, -.1, 0);
|
||||||
}
|
}
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case NECK:
|
case NECK:
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0.0F, 0.76F, 0.0F);
|
translate(0.0F, 0.76F, 0.0F);
|
||||||
scale(0.9F, 0.9F, 0.9F);
|
scale(0.9F, 0.9F, 0.9F);
|
||||||
if (part == BodyPart.HEAD)
|
if (part == BodyPart.HEAD)
|
||||||
|
break;
|
||||||
|
if (this.isSneak && !this.isFlying) {
|
||||||
|
translate(0.0F, -0.01F, 0.15F);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
if (this.isSneak && !this.isFlying) {
|
case BODY:
|
||||||
translate(0.0F, -0.01F, 0.15F);
|
case TAIL:
|
||||||
}
|
translate(0.0F, 0.76F, -0.04F);
|
||||||
break;
|
scale(0.6F, 0.6F, 0.6F);
|
||||||
case BODY:
|
break;
|
||||||
case TAIL:
|
case LEGS:
|
||||||
translate(0.0F, 0.76F, -0.04F);
|
translate(0.0F, 0.89F, 0.0F);
|
||||||
scale(0.6F, 0.6F, 0.6F);
|
scale(0.6F, 0.41F, 0.6F);
|
||||||
break;
|
if (this.isSneak && !this.isFlying) {
|
||||||
case LEGS:
|
translate(0.0F, 0.12F, 0.0F);
|
||||||
translate(0.0F, 0.89F, 0.0F);
|
}
|
||||||
scale(0.6F, 0.41F, 0.6F);
|
|
||||||
if (this.isSneak && !this.isFlying) {
|
|
||||||
translate(0.0F, 0.12F, 0.0F);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
|
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
|
||||||
translate(0.0F, -0.08F, 0.0F);
|
translate(0.0F, -0.08F, 0.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.metadata.getSize() == PonySize.LARGE) {
|
} else if (this.metadata.getSize() == PonySize.LARGE) {
|
||||||
|
@ -265,36 +252,36 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case HEAD:
|
case HEAD:
|
||||||
|
|
||||||
translate(0.0F, -0.17F, -0.04F);
|
translate(0.0F, -0.17F, -0.04F);
|
||||||
if (this.isSleeping) {
|
if (this.isSleeping) {
|
||||||
translate(0.0F, 0.0F, -0.1F);
|
translate(0.0F, 0.0F, -0.1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isSneak && !this.isFlying) {
|
if (this.isSneak && !this.isFlying) {
|
||||||
translate(0.0F, 0.15F, 0.0F);
|
translate(0.0F, 0.15F, 0.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0.0F, -0.15F, -0.07F);
|
translate(0.0F, -0.15F, -0.07F);
|
||||||
if (this.isSneak && !this.isFlying) {
|
if (this.isSneak && !this.isFlying) {
|
||||||
translate(0.0F, 0.0F, -0.05F);
|
translate(0.0F, 0.0F, -0.05F);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
translate(0.0F, -0.2F, -0.04F);
|
translate(0.0F, -0.2F, -0.04F);
|
||||||
scale(1.15F, 1.2F, 1.2F);
|
scale(1.15F, 1.2F, 1.2F);
|
||||||
break;
|
break;
|
||||||
case TAIL:
|
case TAIL:
|
||||||
translate(0.0F, -0.2F, 0.08F);
|
translate(0.0F, -0.2F, 0.08F);
|
||||||
break;
|
break;
|
||||||
case LEGS:
|
case LEGS:
|
||||||
translate(0.0F, -0.14F, 0.0F);
|
translate(0.0F, -0.14F, 0.0F);
|
||||||
scale(1.15F, 1.12F, 1.15F);
|
scale(1.15F, 1.12F, 1.15F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (this.metadata.getSize() == PonySize.TALL) {
|
} else if (this.metadata.getSize() == PonySize.TALL) {
|
||||||
if (this.isSleeping) {
|
if (this.isSleeping) {
|
||||||
|
@ -302,31 +289,31 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (part) {
|
switch (part) {
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0.0F, -0.15F, 0.01F);
|
translate(0.0F, -0.15F, 0.01F);
|
||||||
if (this.isSneak && !this.isFlying) {
|
if (this.isSneak && !this.isFlying) {
|
||||||
translate(0.0F, 0.05F, 0.0F);
|
translate(0.0F, 0.05F, 0.0F);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0.0F, -0.19F, -0.01F);
|
translate(0.0F, -0.19F, -0.01F);
|
||||||
scale(1.0F, 1.1F, 1.0F);
|
scale(1.0F, 1.1F, 1.0F);
|
||||||
if (this.isSneak && !this.isFlying) {
|
if (this.isSneak && !this.isFlying) {
|
||||||
translate(0.0F, -0.06F, -0.04F);
|
translate(0.0F, -0.06F, -0.04F);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
case TAIL:
|
case TAIL:
|
||||||
translate(0.0F, -0.1F, 0.0F);
|
translate(0.0F, -0.1F, 0.0F);
|
||||||
scale(1.0F, 1.0F, 1.0F);
|
scale(1.0F, 1.0F, 1.0F);
|
||||||
break;
|
break;
|
||||||
case LEGS:
|
case LEGS:
|
||||||
translate(0.0F, -0.25F, 0.03F);
|
translate(0.0F, -0.25F, 0.03F);
|
||||||
scale(1.0F, 1.18F, 1.0F);
|
scale(1.0F, 1.18F, 1.0F);
|
||||||
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
|
if (this instanceof ModelPlayerPony && ((ModelPlayerPony) this).rainboom) {
|
||||||
translate(0.0F, 0.05F, 0.0F);
|
translate(0.0F, 0.05F, 0.0F);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (this.isSleeping) {
|
if (this.isSleeping) {
|
||||||
|
@ -352,7 +339,7 @@ public abstract class AbstractPonyModel extends ModelPlayer {
|
||||||
@Override
|
@Override
|
||||||
public ModelRenderer getRandomModelBox(Random rand) {
|
public ModelRenderer getRandomModelBox(Random rand) {
|
||||||
// empty lists cause problems
|
// empty lists cause problems
|
||||||
ModelRenderer mr = null;
|
ModelRenderer mr;
|
||||||
do {
|
do {
|
||||||
// try until it's not
|
// try until it's not
|
||||||
mr = super.getRandomModelBox(rand);
|
mr = super.getRandomModelBox(rand);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import com.minelittlepony.renderer.HornGlowRenderer;
|
import com.minelittlepony.renderer.HornGlowRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBox;
|
import net.minecraft.client.model.ModelBox;
|
||||||
import net.minecraft.client.model.PositionTextureVertex;
|
import net.minecraft.client.model.PositionTextureVertex;
|
||||||
import net.minecraft.client.model.TexturedQuad;
|
import net.minecraft.client.model.TexturedQuad;
|
||||||
|
@ -11,11 +10,9 @@ public class ModelHornGlow extends ModelBox {
|
||||||
|
|
||||||
private TexturedQuad[] quadList;
|
private TexturedQuad[] quadList;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
|
||||||
public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) {
|
public ModelHornGlow(HornGlowRenderer par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) {
|
||||||
super(par1ModelRenderer, par2, par3, par4, par5, par6, par7, par8, par9, par10);
|
super(par1ModelRenderer, par2, par3, par4, par5, par6, par7, par8, par9, par10);
|
||||||
|
|
||||||
PositionTextureVertex[] vertexPositions = new PositionTextureVertex[8];
|
|
||||||
this.quadList = new TexturedQuad[6];
|
this.quadList = new TexturedQuad[6];
|
||||||
float var11 = par4 + par7;
|
float var11 = par4 + par7;
|
||||||
float var12 = par5 + par8;
|
float var12 = par5 + par8;
|
||||||
|
@ -30,8 +27,6 @@ public class ModelHornGlow extends ModelBox {
|
||||||
var11 += par10;
|
var11 += par10;
|
||||||
var12 += par10;
|
var12 += par10;
|
||||||
var13 += par10;
|
var13 += par10;
|
||||||
float xcentre = (par4 + var11) / 2.0F;
|
|
||||||
float zcentre = (par6 + var13) / 2.0F;
|
|
||||||
if (par1ModelRenderer.mirror) {
|
if (par1ModelRenderer.mirror) {
|
||||||
float var26 = var11;
|
float var26 = var11;
|
||||||
var11 = par4;
|
var11 = par4;
|
||||||
|
@ -47,21 +42,21 @@ public class ModelHornGlow extends ModelBox {
|
||||||
PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F);
|
PositionTextureVertex var20 = new PositionTextureVertex(var11, var12, var13, 8.0F, 8.0F);
|
||||||
PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F);
|
PositionTextureVertex var21 = new PositionTextureVertex(par4, var12, var13, 8.0F, 0.0F);
|
||||||
|
|
||||||
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { var19, var15, var16, var20 },
|
this.quadList[0] = new TexturedQuad(new PositionTextureVertex[]{var19, var15, var16, var20},
|
||||||
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8,
|
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par9, par3 + par9 + par8,
|
||||||
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||||
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { var32, var18, var21, var17 }, par2,
|
this.quadList[1] = new TexturedQuad(new PositionTextureVertex[]{var32, var18, var21, var17}, par2,
|
||||||
par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth,
|
par3 + par9, par2 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth,
|
||||||
par1ModelRenderer.textureHeight);
|
par1ModelRenderer.textureHeight);
|
||||||
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { var19, var18, var32, var15 }, par2 + par9,
|
this.quadList[2] = new TexturedQuad(new PositionTextureVertex[]{var19, var18, var32, var15}, par2 + par9,
|
||||||
par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
par3, par2 + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||||
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { var16, var17, var21, var20 },
|
this.quadList[3] = new TexturedQuad(new PositionTextureVertex[]{var16, var17, var21, var20},
|
||||||
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth,
|
par2 + par9 + par7, par3 + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth,
|
||||||
par1ModelRenderer.textureHeight);
|
par1ModelRenderer.textureHeight);
|
||||||
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { var15, var32, var17, var16 }, par2 + par9,
|
this.quadList[4] = new TexturedQuad(new PositionTextureVertex[]{var15, var32, var17, var16}, par2 + par9,
|
||||||
par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth,
|
par3 + par9, par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth,
|
||||||
par1ModelRenderer.textureHeight);
|
par1ModelRenderer.textureHeight);
|
||||||
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { var18, var19, var20, var21 },
|
this.quadList[5] = new TexturedQuad(new PositionTextureVertex[]{var18, var19, var20, var21},
|
||||||
par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8,
|
par2 + par9 + par7 + par9, par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8,
|
||||||
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight);
|
||||||
if (par1ModelRenderer.mirror) {
|
if (par1ModelRenderer.mirror) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import com.minelittlepony.renderer.PlaneRenderer;
|
import com.minelittlepony.renderer.PlaneRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBox;
|
import net.minecraft.client.model.ModelBox;
|
||||||
import net.minecraft.client.model.PositionTextureVertex;
|
import net.minecraft.client.model.PositionTextureVertex;
|
||||||
import net.minecraft.client.model.TexturedQuad;
|
import net.minecraft.client.model.TexturedQuad;
|
||||||
|
@ -13,8 +12,8 @@ public class ModelPlane extends ModelBox {
|
||||||
private final Face face;
|
private final Face face;
|
||||||
|
|
||||||
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY,
|
public ModelPlane(PlaneRenderer renderer, int textureX, int textureY,
|
||||||
float x, float y, float z, int w, int h, int d,
|
float x, float y, float z, int w, int h, int d,
|
||||||
float scale, Face face) {
|
float scale, Face face) {
|
||||||
super(renderer, textureX, textureY, x, y, z, w, h, d, scale, false);
|
super(renderer, textureX, textureY, x, y, z, w, h, d, scale, false);
|
||||||
this.face = face;
|
this.face = face;
|
||||||
|
|
||||||
|
@ -60,37 +59,37 @@ public class ModelPlane extends ModelBox {
|
||||||
|
|
||||||
// east
|
// east
|
||||||
this.quadList[0] = new TexturedQuad(
|
this.quadList[0] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { edn, eds, eus, eun },
|
new PositionTextureVertex[]{edn, eds, eus, eun},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + d, textureY + h,
|
textureX + d, textureY + h,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
// west
|
// west
|
||||||
this.quadList[1] = new TexturedQuad(
|
this.quadList[1] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { wds, wdn, wun, wus },
|
new PositionTextureVertex[]{wds, wdn, wun, wus},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + d, textureY + h,
|
textureX + d, textureY + h,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
// down
|
// down
|
||||||
this.quadList[3] = new TexturedQuad(
|
this.quadList[3] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { edn, wdn, wds, eds },
|
new PositionTextureVertex[]{edn, wdn, wds, eds},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + w, textureY + d,
|
textureX + w, textureY + d,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
// up
|
// up
|
||||||
this.quadList[2] = new TexturedQuad(
|
this.quadList[2] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { eus, wus, wun, eun },
|
new PositionTextureVertex[]{eus, wus, wun, eun},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + w, textureY + d,
|
textureX + w, textureY + d,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
// south
|
// south
|
||||||
this.quadList[4] = new TexturedQuad(
|
this.quadList[4] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { eds, wds, wus, eus },
|
new PositionTextureVertex[]{eds, wds, wus, eus},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + w, textureY + h,
|
textureX + w, textureY + h,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
// north
|
// north
|
||||||
this.quadList[5] = new TexturedQuad(
|
this.quadList[5] = new TexturedQuad(
|
||||||
new PositionTextureVertex[] { wdn, edn, eun, wun },
|
new PositionTextureVertex[]{wdn, edn, eun, wun},
|
||||||
textureX, textureY,
|
textureX, textureY,
|
||||||
textureX + w, textureY + h,
|
textureX + w, textureY + h,
|
||||||
renderer.textureWidth, renderer.textureHeight);
|
renderer.textureWidth, renderer.textureHeight);
|
||||||
|
@ -107,12 +106,12 @@ public class ModelPlane extends ModelBox {
|
||||||
this.quadList[this.face.ordinal()].draw(renderer, scale);
|
this.quadList[this.face.ordinal()].draw(renderer, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static enum Face {
|
public enum Face {
|
||||||
EAST,
|
EAST,
|
||||||
WEST,
|
WEST,
|
||||||
DOWN,
|
DOWN,
|
||||||
UP,
|
UP,
|
||||||
SOUTH,
|
SOUTH,
|
||||||
NORTH;
|
NORTH
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,8 +77,4 @@ public class ModelPonyElytra extends ModelBase {
|
||||||
this.rightWing.rotateAngleZ = -this.leftWing.rotateAngleZ;
|
this.rightWing.rotateAngleZ = -this.leftWing.rotateAngleZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
}
|
||||||
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime) {
|
|
||||||
super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.model;
|
package com.minelittlepony.model;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||||
import com.minelittlepony.model.pony.ModelSkeletonPony;
|
import com.minelittlepony.model.pony.ModelSkeletonPony;
|
||||||
|
@ -12,6 +10,8 @@ import com.minelittlepony.model.pony.armor.PonyArmors;
|
||||||
import com.minelittlepony.model.pony.armor.SkeletonPonyArmors;
|
import com.minelittlepony.model.pony.armor.SkeletonPonyArmors;
|
||||||
import com.minelittlepony.model.pony.armor.ZombiePonyArmors;
|
import com.minelittlepony.model.pony.armor.ZombiePonyArmors;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
public final class PMAPI {
|
public final class PMAPI {
|
||||||
|
|
||||||
public static final PlayerModel pony = new PlayerModel(new ModelPlayerPony(false)).setArmor(new PonyArmors());
|
public static final PlayerModel pony = new PlayerModel(new ModelPlayerPony(false)).setArmor(new PonyArmors());
|
||||||
|
|
|
@ -6,17 +6,11 @@ public class PlayerModel {
|
||||||
|
|
||||||
private final AbstractPonyModel model;
|
private final AbstractPonyModel model;
|
||||||
private AbstractArmor armor;
|
private AbstractArmor armor;
|
||||||
private float shadowsize = 0.5F;
|
|
||||||
|
|
||||||
public PlayerModel(AbstractPonyModel model) {
|
public PlayerModel(AbstractPonyModel model) {
|
||||||
this.model = model;
|
this.model = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerModel setTextureHeight(int height) {
|
|
||||||
getModel().textureHeight = height;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AbstractPonyModel getModel() {
|
public AbstractPonyModel getModel() {
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
@ -27,15 +21,6 @@ public class PlayerModel {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlayerModel setShadowsize(float shadowsize) {
|
|
||||||
this.shadowsize = shadowsize;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getShadowsize() {
|
|
||||||
return shadowsize;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void init() {
|
public void init() {
|
||||||
getModel().init(0, 0);
|
getModel().init(0, 0);
|
||||||
getArmor().modelArmorChestplate.init(0.0F, 1.0F);
|
getArmor().modelArmorChestplate.init(0.0F, 1.0F);
|
||||||
|
@ -45,7 +30,7 @@ public class PlayerModel {
|
||||||
public AbstractArmor getArmor() {
|
public AbstractArmor getArmor() {
|
||||||
return armor;
|
return armor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void apply(PonyData meta) {
|
public void apply(PonyData meta) {
|
||||||
model.metadata = meta;
|
model.metadata = meta;
|
||||||
armor.apply(meta);
|
armor.apply(meta);
|
||||||
|
|
|
@ -30,20 +30,10 @@ public interface PonyModelConstants {
|
||||||
float LEFT_WING_EXT_RP_Y = 5.0F;
|
float LEFT_WING_EXT_RP_Y = 5.0F;
|
||||||
float LEFT_WING_EXT_RP_Z = 6.0F;
|
float LEFT_WING_EXT_RP_Z = 6.0F;
|
||||||
float LEFT_WING_ROTATE_ANGLE_Z_SNEAK = -6.0F;
|
float LEFT_WING_ROTATE_ANGLE_Z_SNEAK = -6.0F;
|
||||||
float LEFT_WING_RP_Y_NOTSNEAK = 5.5F;
|
|
||||||
float LEFT_WING_RP_Y_SNEAK = 10.5F;
|
|
||||||
float LEFT_WING_RP_Z_NOTSNEAK = 3.0F;
|
|
||||||
float LEFT_WING_RP_Z_SNEAK = 2.0F;
|
|
||||||
float RIDING_SHIFT_Y = -10.0F;
|
|
||||||
float RIDING_SHIFT_Z = -10.0F;
|
|
||||||
float RIGHT_WING_EXT_RP_X = -4.5F;
|
float RIGHT_WING_EXT_RP_X = -4.5F;
|
||||||
float RIGHT_WING_EXT_RP_Y = 5.0F;
|
float RIGHT_WING_EXT_RP_Y = 5.0F;
|
||||||
float RIGHT_WING_EXT_RP_Z = 6.0F;
|
float RIGHT_WING_EXT_RP_Z = 6.0F;
|
||||||
float RIGHT_WING_ROTATE_ANGLE_Z_SNEAK = 6.0F;
|
float RIGHT_WING_ROTATE_ANGLE_Z_SNEAK = 6.0F;
|
||||||
float RIGHT_WING_RP_Y_NOTSNEAK = 6.5F;
|
|
||||||
float RIGHT_WING_RP_Y_SNEAK = 11.5F;
|
|
||||||
float RIGHT_WING_RP_Z_NOTSNEAK = 3.0F;
|
|
||||||
float RIGHT_WING_RP_Z_SNEAK = 2.0F;
|
|
||||||
float ROTATE_270 = 4.712F;
|
float ROTATE_270 = 4.712F;
|
||||||
float ROTATE_90 = 1.571F;
|
float ROTATE_90 = 1.571F;
|
||||||
float SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F;
|
float SNEAK_LEG_X_ROTATION_ADJUSTMENT = 0.4F;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.PonyData;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.PonyModelConstants;
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@ -103,11 +102,11 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
|
||||||
if (pony.swingProgress > -9990.0F && !metadata.hasMagic()) {
|
if (pony.swingProgress > -9990.0F && !metadata.hasMagic()) {
|
||||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(pony.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < this.leftWing.length; ++i) {
|
for (ModelRenderer aLeftWing : this.leftWing) {
|
||||||
this.leftWing[i].rotateAngleY = bodySwingRotation * 0.2F;
|
aLeftWing.rotateAngleY = bodySwingRotation * 0.2F;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < this.rightWing.length; ++i) {
|
for (ModelRenderer aRightWing : this.rightWing) {
|
||||||
this.rightWing[i].rotateAngleY = bodySwingRotation * 0.2F;
|
aRightWing.rotateAngleY = bodySwingRotation * 0.2F;
|
||||||
}
|
}
|
||||||
if (pony.isSneak && !pony.isFlying) {
|
if (pony.isSneak && !pony.isFlying) {
|
||||||
this.sneak();
|
this.sneak();
|
||||||
|
@ -118,11 +117,11 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
|
||||||
|
|
||||||
float angle = ROTATE_90;
|
float angle = ROTATE_90;
|
||||||
|
|
||||||
for (int i = 0; i < this.leftWing.length; i++) {
|
for (ModelRenderer aLeftWing : this.leftWing) {
|
||||||
this.leftWing[i].rotateAngleX = angle;
|
aLeftWing.rotateAngleX = angle;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < this.rightWing.length; i++) {
|
for (ModelRenderer aRightWing : this.rightWing) {
|
||||||
this.rightWing[i].rotateAngleX = angle;
|
aRightWing.rotateAngleX = angle;
|
||||||
}
|
}
|
||||||
// Special
|
// Special
|
||||||
this.leftWingExt[1].rotateAngleX -= 0.85F;
|
this.leftWingExt[1].rotateAngleX -= 0.85F;
|
||||||
|
@ -143,30 +142,30 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
|
||||||
if (data.getRace() != null && data.getRace().hasWings()) {
|
if (data.getRace() != null && data.getRace().hasWings()) {
|
||||||
if (!pony.isFlying && !pony.isSneak) {
|
if (!pony.isFlying && !pony.isSneak) {
|
||||||
|
|
||||||
for (int k1 = 0; k1 < this.leftWing.length; ++k1) {
|
for (ModelRenderer aLeftWing : this.leftWing) {
|
||||||
this.leftWing[k1].render(scale);
|
aLeftWing.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int k1 = 0; k1 < this.rightWing.length; ++k1) {
|
for (ModelRenderer aRightWing : this.rightWing) {
|
||||||
this.rightWing[k1].render(scale);
|
aRightWing.render(scale);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (int k1 = 0; k1 < this.leftWingExt.length; ++k1) {
|
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
|
||||||
this.leftWingExt[k1].render(scale);
|
aLeftWingExt.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.rightWingExt.length; ++i) {
|
for (ModelRenderer aRightWingExt : this.rightWingExt) {
|
||||||
this.rightWingExt[i].render(scale);
|
aRightWingExt.render(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sneak() {
|
private void sneak() {
|
||||||
for (int i = 0; i < this.leftWingExt.length; ++i) {
|
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
|
||||||
this.leftWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
aLeftWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
||||||
this.leftWingExt[i].rotateAngleZ = LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
|
aLeftWingExt.rotateAngleZ = LEFT_WING_ROTATE_ANGLE_Z_SNEAK;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.leftWingExt.length; ++i) {
|
for (int i = 0; i < this.leftWingExt.length; ++i) {
|
||||||
|
@ -179,14 +178,14 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
|
||||||
if (pony.isFlying) {
|
if (pony.isFlying) {
|
||||||
float WingRotateAngleZ = MathHelper.sin(tick * 0.536F) * 1.0F;
|
float WingRotateAngleZ = MathHelper.sin(tick * 0.536F) * 1.0F;
|
||||||
|
|
||||||
for (int i = 0; i < this.leftWingExt.length; ++i) {
|
for (ModelRenderer aLeftWingExt : this.leftWingExt) {
|
||||||
this.leftWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
aLeftWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
||||||
this.leftWingExt[i].rotateAngleZ = -WingRotateAngleZ - ROTATE_270 - 0.4F;
|
aLeftWingExt.rotateAngleZ = -WingRotateAngleZ - ROTATE_270 - 0.4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < this.rightWingExt.length; ++i) {
|
for (ModelRenderer aRightWingExt : this.rightWingExt) {
|
||||||
this.rightWingExt[i].rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
aRightWingExt.rotateAngleX = EXT_WING_ROTATE_ANGLE_X;
|
||||||
this.rightWingExt[i].rotateAngleZ = WingRotateAngleZ + ROTATE_270 + 0.4F;
|
aRightWingExt.rotateAngleZ = WingRotateAngleZ + ROTATE_270 + 0.4F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,14 @@
|
||||||
package com.minelittlepony.model.part;
|
package com.minelittlepony.model.part;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
|
||||||
|
|
||||||
import com.minelittlepony.PonyData;
|
import com.minelittlepony.PonyData;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.PonyModelConstants;
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
import com.minelittlepony.renderer.HornGlowRenderer;
|
import com.minelittlepony.renderer.HornGlowRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBiped.ArmPose;
|
import net.minecraft.client.model.ModelBiped.ArmPose;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants {
|
public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants {
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants
|
||||||
blendFunc(GL11.GL_SRC_ALPHA, 1);
|
blendFunc(GL11.GL_SRC_ALPHA, 1);
|
||||||
|
|
||||||
this.horn.postRender(scale);
|
this.horn.postRender(scale);
|
||||||
|
|
||||||
color(red, green, blue, 0.4F);
|
color(red, green, blue, 0.4F);
|
||||||
this.hornglow[0].render(scale);
|
this.hornglow[0].render(scale);
|
||||||
color(red, green, blue, 0.2F);
|
color(red, green, blue, 0.2F);
|
||||||
|
|
|
@ -124,29 +124,29 @@ public class ModelBreezie extends ModelBiped {
|
||||||
this.bipedRightArm.rotateAngleZ = 0F;
|
this.bipedRightArm.rotateAngleZ = 0F;
|
||||||
|
|
||||||
switch (this.leftArmPose) {
|
switch (this.leftArmPose) {
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
|
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||||
this.bipedLeftArm.rotateAngleY = 0.5235988F;
|
this.bipedLeftArm.rotateAngleY = 0.5235988F;
|
||||||
break;
|
break;
|
||||||
case ITEM:
|
case ITEM:
|
||||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
||||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.rightArmPose) {
|
switch (this.rightArmPose) {
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
|
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||||
this.bipedRightArm.rotateAngleY = -0.5235988F;
|
this.bipedRightArm.rotateAngleY = -0.5235988F;
|
||||||
break;
|
break;
|
||||||
case ITEM:
|
case ITEM:
|
||||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float) Math.PI / 10F);
|
||||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.swingProgress > 0.0F) {
|
if (this.swingProgress > 0.0F) {
|
||||||
|
@ -165,6 +165,7 @@ public class ModelBreezie extends ModelBiped {
|
||||||
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
|
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
|
||||||
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
||||||
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
||||||
|
//noinspection SuspiciousNameCombination
|
||||||
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
|
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
|
||||||
f1 = 1.0F - this.swingProgress;
|
f1 = 1.0F - this.swingProgress;
|
||||||
f1 = f1 * f1;
|
f1 = f1 * f1;
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class ModelEvokerPony extends ModelIllagerPony {
|
||||||
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
super.render(entityIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
|
||||||
EntityEvoker evoker = (EntityEvoker) entityIn;
|
EntityEvoker evoker = (EntityEvoker) entityIn;
|
||||||
|
|
||||||
if (evoker.isCastingSpell()) {
|
if (isUnicorn && evoker.isCastingSpell()) {
|
||||||
GL11.glPushAttrib(24577);
|
GL11.glPushAttrib(24577);
|
||||||
disableTexture2D();
|
disableTexture2D();
|
||||||
disableLighting();
|
disableLighting();
|
||||||
|
|
|
@ -2,13 +2,8 @@ package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
|
||||||
|
|
||||||
public class ModelHumanPlayer extends AbstractPonyModel {
|
public class ModelHumanPlayer extends AbstractPonyModel {
|
||||||
|
|
||||||
public ModelRenderer bipedEars;
|
|
||||||
public ModelRenderer cloak;
|
|
||||||
|
|
||||||
public ModelHumanPlayer(boolean smallArms) {
|
public ModelHumanPlayer(boolean smallArms) {
|
||||||
super(smallArms);
|
super(smallArms);
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,7 +87,6 @@ public abstract class ModelIllagerPony extends ModelBase {
|
||||||
tail.addChild(tailStub);
|
tail.addChild(tailStub);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package com.minelittlepony.model.pony;
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.PonyModelConstants;
|
import com.minelittlepony.model.PonyModelConstants;
|
||||||
|
@ -10,7 +8,6 @@ import com.minelittlepony.model.part.PonyEars;
|
||||||
import com.minelittlepony.model.part.PonySnout;
|
import com.minelittlepony.model.part.PonySnout;
|
||||||
import com.minelittlepony.model.part.UnicornHorn;
|
import com.minelittlepony.model.part.UnicornHorn;
|
||||||
import com.minelittlepony.renderer.PlaneRenderer;
|
import com.minelittlepony.renderer.PlaneRenderer;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -18,6 +15,9 @@ import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||||
|
|
||||||
public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConstants {
|
public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConstants {
|
||||||
|
|
||||||
private final boolean smallArms;
|
private final boolean smallArms;
|
||||||
|
@ -103,10 +103,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06);
|
this.bipedLeftArm.rotateAngleZ = (float) (Math.PI * -0.06);
|
||||||
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06);
|
this.bipedRightArm.rotateAngleZ = (float) (Math.PI * 0.06);
|
||||||
|
|
||||||
for (int i = 0; i < Tail.length; ++i) {
|
for (PlaneRenderer aTail : Tail) {
|
||||||
this.Tail[i].rotationPointZ = 13;
|
aTail.rotationPointZ = 13;
|
||||||
this.Tail[i].rotationPointY = 3;
|
aTail.rotationPointY = 3;
|
||||||
this.Tail[i].rotateAngleX = (float) (Math.PI * 0.2);
|
aTail.rotateAngleX = (float) (Math.PI * 0.2);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
|
|
||||||
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
this.swingArms(entity, tick);
|
this.swingArms(tick);
|
||||||
this.setHead(0.0F, 0.0F, 0.0F);
|
this.setHead(0.0F, 0.0F, 0.0F);
|
||||||
|
|
||||||
for (k1 = 0; k1 < tailstop; ++k1) {
|
for (k1 = 0; k1 < tailstop; ++k1) {
|
||||||
|
@ -289,6 +289,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
|
|
||||||
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
||||||
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
|
||||||
|
//noinspection SuspiciousNameCombination
|
||||||
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
|
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
|
||||||
|
|
||||||
this.bipedRightArm.rotationPointY = 8.0F;
|
this.bipedRightArm.rotationPointY = 8.0F;
|
||||||
|
@ -332,39 +333,39 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
boolean bothHoovesAreOccupied = this.leftArmPose == ArmPose.ITEM && this.rightArmPose == ArmPose.ITEM;
|
boolean bothHoovesAreOccupied = this.leftArmPose == ArmPose.ITEM && this.rightArmPose == ArmPose.ITEM;
|
||||||
|
|
||||||
switch (this.leftArmPose) {
|
switch (this.leftArmPose) {
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
|
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||||
this.bipedLeftArm.rotateAngleY = (float) (Math.PI / 6);
|
this.bipedLeftArm.rotateAngleY = (float) (Math.PI / 6);
|
||||||
break;
|
break;
|
||||||
case ITEM:
|
case ITEM:
|
||||||
float swag = 1f;
|
float swag = 1f;
|
||||||
if (!isFlying && bothHoovesAreOccupied) {
|
if (!isFlying && bothHoovesAreOccupied) {
|
||||||
swag = (float) (1d - Math.pow(swing, 2d));
|
swag = (float) (1d - Math.pow(swing, 2d));
|
||||||
}
|
}
|
||||||
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
|
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
|
||||||
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
|
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
|
||||||
this.bipedLeftArm.rotateAngleY = 0.0F;
|
this.bipedLeftArm.rotateAngleY = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (this.rightArmPose) {
|
switch (this.rightArmPose) {
|
||||||
case EMPTY:
|
case EMPTY:
|
||||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||||
break;
|
break;
|
||||||
case BLOCK:
|
case BLOCK:
|
||||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
|
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - 0.9424779F;
|
||||||
this.bipedRightArm.rotateAngleY = (float) (-Math.PI / 6);
|
this.bipedRightArm.rotateAngleY = (float) (-Math.PI / 6);
|
||||||
break;
|
break;
|
||||||
case ITEM:
|
case ITEM:
|
||||||
float swag = 1f;
|
float swag = 1f;
|
||||||
if (!isFlying && bothHoovesAreOccupied) {
|
if (!isFlying && bothHoovesAreOccupied) {
|
||||||
swag = (float) (1d - Math.pow(swing, 2d));
|
swag = (float) (1d - Math.pow(swing, 2d));
|
||||||
}
|
}
|
||||||
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
|
float rotationMultiplier = 0.5f + 0.5f * (1f - swag);
|
||||||
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
|
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * rotationMultiplier - ((float) Math.PI / 10F) * swag;
|
||||||
this.bipedRightArm.rotateAngleY = 0.0F;
|
this.bipedRightArm.rotateAngleY = 0.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (this.metadata.hasMagic()) {
|
} else if (this.metadata.hasMagic()) {
|
||||||
|
@ -411,7 +412,7 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void swingArms(Entity entity, float tick) {
|
protected void swingArms(float tick) {
|
||||||
|
|
||||||
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
|
if (this.rightArmPose != ArmPose.EMPTY && !this.isSleeping) {
|
||||||
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
float cosTickFactor = MathHelper.cos(tick * 0.09F) * 0.05F + 0.05F;
|
||||||
|
@ -461,10 +462,10 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
protected void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) {
|
||||||
for (int k3 = 0; k3 < this.BodypieceNeck.length; ++k3) {
|
for (PlaneRenderer aBodypieceNeck : this.BodypieceNeck) {
|
||||||
this.BodypieceNeck[k3].rotateAngleX = NECK_ROT_X + rotateAngleX;
|
aBodypieceNeck.rotateAngleX = NECK_ROT_X + rotateAngleX;
|
||||||
this.BodypieceNeck[k3].rotationPointY = rotationPointY;
|
aBodypieceNeck.rotationPointY = rotationPointY;
|
||||||
this.BodypieceNeck[k3].rotationPointZ = rotationPointZ;
|
aBodypieceNeck.rotationPointZ = rotationPointZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -564,7 +565,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
this.Bodypiece[13].rotateAngleX += 0.5F;
|
this.Bodypiece[13].rotateAngleX += 0.5F;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fixSpecialRotationPoints(float move) {}
|
protected void fixSpecialRotationPoints(float move) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render() {
|
public void render() {
|
||||||
|
@ -608,8 +610,8 @@ public class ModelPlayerPony extends AbstractPonyModel implements PonyModelConst
|
||||||
if (this.textureHeight == 64) {
|
if (this.textureHeight == 64) {
|
||||||
this.bipedBodyWear.render(this.scale);
|
this.bipedBodyWear.render(this.scale);
|
||||||
}
|
}
|
||||||
for (int k1 = 0; k1 < this.Bodypiece.length; ++k1) {
|
for (PlaneRenderer aBodypiece : this.Bodypiece) {
|
||||||
this.Bodypiece[k1].render(this.scale);
|
aBodypiece.render(this.scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package com.minelittlepony.model.pony;
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class ModelSkeletonPony extends ModelPlayerPony {
|
public class ModelSkeletonPony extends ModelPlayerPony {
|
||||||
|
|
||||||
public ModelSkeletonPony() {
|
public ModelSkeletonPony() {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.model.pony;
|
package com.minelittlepony.model.pony;
|
||||||
|
|
||||||
import com.minelittlepony.renderer.PlaneRenderer;
|
import com.minelittlepony.renderer.PlaneRenderer;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
@ -24,8 +23,8 @@ public class ModelVillagerPony extends ModelPlayerPony {
|
||||||
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
if (this.swingProgress > -9990.0F && !this.metadata.hasMagic()) {
|
||||||
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(this.swingProgress) * 3.1415927F * 2.0F) * 0.2F;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < this.VillagerBagPiece.length; ++i) {
|
for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) {
|
||||||
this.VillagerBagPiece[i].rotateAngleY = bodySwingRotation * 0.2F;
|
aVillagerBagPiece.rotateAngleY = bodySwingRotation * 0.2F;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.VillagerBagPiece[4].rotateAngleY += 4.712389F;
|
this.VillagerBagPiece[4].rotateAngleY += 4.712389F;
|
||||||
|
@ -42,8 +41,8 @@ public class ModelVillagerPony extends ModelPlayerPony {
|
||||||
|
|
||||||
this.bipedBody.postRender(scale);
|
this.bipedBody.postRender(scale);
|
||||||
if (profession < 2) {
|
if (profession < 2) {
|
||||||
for (int i = 0; i < this.VillagerBagPiece.length; ++i) {
|
for (PlaneRenderer aVillagerBagPiece : this.VillagerBagPiece) {
|
||||||
this.VillagerBagPiece[i].render(this.scale);
|
aVillagerBagPiece.render(this.scale);
|
||||||
}
|
}
|
||||||
} else if (profession == 2) {
|
} else if (profession == 2) {
|
||||||
this.VillagerTrinket.render(this.scale);
|
this.VillagerTrinket.render(this.scale);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.model.pony.armor;
|
package com.minelittlepony.model.pony.armor;
|
||||||
|
|
||||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -72,7 +71,7 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
||||||
|
|
||||||
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
this.bipedRightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
this.bipedLeftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
this.swingArms(entity, tick);
|
this.swingArms(tick);
|
||||||
this.setHead(0.0F, 0.0F, 0.0F);
|
this.setHead(0.0F, 0.0F, 0.0F);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -120,19 +119,6 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
||||||
this.extBody.rotationPointZ = rotationPointZ;
|
this.extBody.rotationPointZ = rotationPointZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void ridingPony() {
|
|
||||||
this.setHead(this.bipedHead.rotationPointX + 0.0F, this.bipedHead.rotationPointY + RIDING_SHIFT_Y, this.bipedHead.rotationPointZ + RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.bipedBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.Bodypiece, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.extBody, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.bipedLeftArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.bipedRightArm, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.bipedLeftLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.bipedRightLeg, 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.extLegs[0], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
shiftRotationPoint(this.extLegs[1], 0.0F, RIDING_SHIFT_Y, RIDING_SHIFT_Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderHead() {
|
protected void renderHead() {
|
||||||
this.bipedHead.render(this.scale);
|
this.bipedHead.render(this.scale);
|
||||||
|
@ -142,7 +128,8 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderNeck() {}
|
protected void renderNeck() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderBody() {
|
protected void renderBody() {
|
||||||
|
@ -152,7 +139,8 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderTail() {}
|
protected void renderTail() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderLegs() {
|
protected void renderLegs() {
|
||||||
|
@ -297,7 +285,8 @@ public class ModelPonyArmor extends ModelPlayerPony {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void setModelVisibilities(AbstractClientPlayer clientPlayer) {}
|
protected void setModelVisibilities(AbstractClientPlayer clientPlayer) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInvisible(boolean invisible) {
|
public void setInvisible(boolean invisible) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.model.ModelHornGlow;
|
import com.minelittlepony.model.ModelHornGlow;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
import net.minecraft.client.model.TextureOffset;
|
import net.minecraft.client.model.TextureOffset;
|
||||||
|
|
|
@ -2,10 +2,10 @@ package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.model.ModelPlane;
|
import com.minelittlepony.model.ModelPlane;
|
||||||
import com.minelittlepony.model.ModelPlane.Face;
|
import com.minelittlepony.model.ModelPlane.Face;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
public class PlaneRenderer extends ModelRenderer {
|
public class PlaneRenderer extends ModelRenderer {
|
||||||
|
|
||||||
public boolean mirrory;
|
public boolean mirrory;
|
||||||
|
@ -14,9 +14,9 @@ public class PlaneRenderer extends ModelRenderer {
|
||||||
private int textureOffsetX;
|
private int textureOffsetX;
|
||||||
private int textureOffsetY;
|
private int textureOffsetY;
|
||||||
|
|
||||||
public PlaneRenderer(ModelBase model, String boxNameIn) {
|
// public PlaneRenderer(ModelBase model, String boxNameIn) {
|
||||||
super(model, boxNameIn);
|
// super(model, boxNameIn);
|
||||||
}
|
// }
|
||||||
|
|
||||||
public PlaneRenderer(ModelBase model) {
|
public PlaneRenderer(ModelBase model) {
|
||||||
super(model);
|
super(model);
|
||||||
|
@ -61,4 +61,4 @@ public class PlaneRenderer extends ModelRenderer {
|
||||||
public void addBackPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
|
public void addBackPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale) {
|
||||||
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.SOUTH);
|
this.addPlane(offX, offY, offZ, width, height, depth, scale, Face.SOUTH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,10 @@ public class RenderPonyEvoker extends RenderLiving<EntityEvoker> {
|
||||||
IResource resource = resources.getResource(EVOKER);
|
IResource resource = resources.getResource(EVOKER);
|
||||||
if (resource.hasMetadata()) {
|
if (resource.hasMetadata()) {
|
||||||
PonyData meta = resource.getMetadata(PonyDataSerialzier.NAME);
|
PonyData meta = resource.getMetadata(PonyDataSerialzier.NAME);
|
||||||
model.isUnicorn = meta.hasMagic();
|
if (meta != null) {
|
||||||
model.glowColor = meta.getGlowColor();
|
model.isUnicorn = meta.hasMagic();
|
||||||
|
model.glowColor = meta.getGlowColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -5,13 +5,11 @@ import com.minelittlepony.PonyGender;
|
||||||
import com.minelittlepony.PonyRace;
|
import com.minelittlepony.PonyRace;
|
||||||
import com.minelittlepony.TailLengths;
|
import com.minelittlepony.TailLengths;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
import com.minelittlepony.renderer.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
import com.minelittlepony.renderer.layer.LayerPonySkull;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
|
@ -19,12 +17,10 @@ import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
||||||
|
|
||||||
protected AbstractPonyModel mobModel;
|
|
||||||
protected PlayerModel playerModel;
|
protected PlayerModel playerModel;
|
||||||
|
|
||||||
public RenderPonyMob(RenderManager renderManager, PlayerModel playerModel) {
|
public RenderPonyMob(RenderManager renderManager, PlayerModel playerModel) {
|
||||||
super(renderManager, playerModel.getModel(), playerModel.getShadowsize());
|
super(renderManager, playerModel.getModel(), 0.5F);
|
||||||
this.mobModel = playerModel.getModel();
|
|
||||||
this.playerModel = playerModel;
|
this.playerModel = playerModel;
|
||||||
|
|
||||||
this.addLayer(new LayerPonyArmor(this));
|
this.addLayer(new LayerPonyArmor(this));
|
||||||
|
@ -35,7 +31,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw,
|
public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw,
|
||||||
float partialTicks) {
|
float partialTicks) {
|
||||||
double yOrigin = yPosition;
|
double yOrigin = yPosition;
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
yOrigin -= 0.125D;
|
yOrigin -= 0.125D;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.monster.EntityPigZombie;
|
import net.minecraft.entity.monster.EntityPigZombie;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.PonyGender;
|
import com.minelittlepony.PonyGender;
|
||||||
import com.minelittlepony.PonyRace;
|
import com.minelittlepony.PonyRace;
|
||||||
import com.minelittlepony.PonySize;
|
import com.minelittlepony.PonySize;
|
||||||
import com.minelittlepony.TailLengths;
|
import com.minelittlepony.TailLengths;
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
import com.minelittlepony.renderer.layer.LayerPonyStrayOverlay;
|
import com.minelittlepony.renderer.layer.LayerPonyStrayOverlay;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
|
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
|
||||||
|
@ -17,6 +14,8 @@ import net.minecraft.entity.monster.EntityStray;
|
||||||
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
import net.minecraft.entity.monster.EntityWitherSkeleton;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends RenderPonyMob<Skeleton> {
|
public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends RenderPonyMob<Skeleton> {
|
||||||
|
|
||||||
private static final ResourceLocation SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
|
private static final ResourceLocation SKELETON = new ResourceLocation("minelittlepony", "textures/entity/skeleton/skeleton_pony.png");
|
||||||
|
@ -41,15 +40,15 @@ public class RenderPonySkeleton<Skeleton extends AbstractSkeleton> extends Rende
|
||||||
Random rand = new Random(skeleton.getUniqueID().hashCode());
|
Random rand = new Random(skeleton.getUniqueID().hashCode());
|
||||||
this.playerModel.getModel().metadata.setGender(rand.nextBoolean() ? PonyGender.MARE : PonyGender.STALLION);
|
this.playerModel.getModel().metadata.setGender(rand.nextBoolean() ? PonyGender.MARE : PonyGender.STALLION);
|
||||||
switch (rand.nextInt(4)) {
|
switch (rand.nextInt(4)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN);
|
this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.PEGASUS);
|
this.playerModel.getModel().metadata.setRace(PonyRace.PEGASUS);
|
||||||
}
|
}
|
||||||
PonySize[] sizes = PonySize.values();
|
PonySize[] sizes = PonySize.values();
|
||||||
PonySize size = sizes[rand.nextInt(sizes.length)];
|
PonySize size = sizes[rand.nextInt(sizes.length)];
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.model.pony.ModelBreezie;
|
import com.minelittlepony.model.pony.ModelBreezie;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderBiped;
|
import net.minecraft.client.renderer.entity.RenderBiped;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
import com.minelittlepony.model.pony.ModelVillagerPony;
|
import com.minelittlepony.model.pony.ModelVillagerPony;
|
||||||
import com.minelittlepony.util.Villagers;
|
import com.minelittlepony.util.Villagers;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.passive.EntityVillager;
|
import net.minecraft.entity.passive.EntityVillager;
|
||||||
|
@ -46,19 +45,19 @@ public class RenderPonyVillager extends RenderPonyMob<EntityVillager> {
|
||||||
|
|
||||||
private ResourceLocation getTextureForVillager(EntityVillager villager) {
|
private ResourceLocation getTextureForVillager(EntityVillager villager) {
|
||||||
switch (villager.getProfession()) {
|
switch (villager.getProfession()) {
|
||||||
case Villagers.FARMER:
|
case Villagers.FARMER:
|
||||||
return FARMER;
|
return FARMER;
|
||||||
case Villagers.LIBRARIAN:
|
case Villagers.LIBRARIAN:
|
||||||
return LIBRARIAN;
|
return LIBRARIAN;
|
||||||
case Villagers.PRIEST:
|
case Villagers.PRIEST:
|
||||||
return PRIEST;
|
return PRIEST;
|
||||||
case Villagers.BLACKSMITH:
|
case Villagers.BLACKSMITH:
|
||||||
return SMITH;
|
return SMITH;
|
||||||
case Villagers.BUTCHER:
|
case Villagers.BUTCHER:
|
||||||
return BUTCHER;
|
return BUTCHER;
|
||||||
case Villagers.GENERIC:
|
case Villagers.GENERIC:
|
||||||
default:
|
default:
|
||||||
return GENERIC;
|
return GENERIC;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.PonyData;
|
|
||||||
import com.minelittlepony.PonyDataSerialzier;
|
|
||||||
import com.minelittlepony.model.pony.ModelIllagerPony;
|
import com.minelittlepony.model.pony.ModelIllagerPony;
|
||||||
import com.minelittlepony.model.pony.ModelVindicatorPony;
|
import com.minelittlepony.model.pony.ModelVindicatorPony;
|
||||||
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
import com.minelittlepony.renderer.layer.LayerHeldPonyItem;
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderLiving;
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.resources.IResource;
|
|
||||||
import net.minecraft.client.resources.IResourceManager;
|
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.monster.EntityVindicator;
|
import net.minecraft.entity.monster.EntityVindicator;
|
||||||
import net.minecraft.util.EnumHandSide;
|
import net.minecraft.util.EnumHandSide;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public class RenderPonyVindicator extends RenderLiving<EntityVindicator> {
|
public class RenderPonyVindicator extends RenderLiving<EntityVindicator> {
|
||||||
|
|
||||||
private static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png");
|
private static final ResourceLocation VINDICATOR = new ResourceLocation("minelittlepony", "textures/entity/illager/vindicator_pony.png");
|
||||||
|
|
|
@ -1,19 +1,18 @@
|
||||||
package com.minelittlepony.renderer;
|
package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.minelittlepony.PonyGender;
|
import com.minelittlepony.PonyGender;
|
||||||
import com.minelittlepony.PonyRace;
|
import com.minelittlepony.PonyRace;
|
||||||
import com.minelittlepony.PonySize;
|
import com.minelittlepony.PonySize;
|
||||||
import com.minelittlepony.TailLengths;
|
import com.minelittlepony.TailLengths;
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.monster.EntityHusk;
|
import net.minecraft.entity.monster.EntityHusk;
|
||||||
import net.minecraft.entity.monster.EntityZombie;
|
import net.minecraft.entity.monster.EntityZombie;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob<Zombie> {
|
public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob<Zombie> {
|
||||||
|
|
||||||
private static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png");
|
private static final ResourceLocation ZOMBIE = new ResourceLocation("minelittlepony", "textures/entity/zombie/zombie_pony.png");
|
||||||
|
@ -33,16 +32,16 @@ public class RenderPonyZombie<Zombie extends EntityZombie> extends RenderPonyMob
|
||||||
|
|
||||||
// races
|
// races
|
||||||
switch (rand.nextInt(2) + 2) {
|
switch (rand.nextInt(2) + 2) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
this.playerModel.getModel().metadata.setRace(PonyRace.EARTH);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.PEGASUS);
|
this.playerModel.getModel().metadata.setRace(PonyRace.PEGASUS);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN);
|
this.playerModel.getModel().metadata.setRace(PonyRace.UNICORN);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Let's play the lottery!
|
// Let's play the lottery!
|
||||||
if (rand.nextInt(10000) == 0) {
|
if (rand.nextInt(10000) == 0) {
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.minelittlepony.renderer;
|
||||||
|
|
||||||
import com.minelittlepony.model.PMAPI;
|
import com.minelittlepony.model.PMAPI;
|
||||||
import com.minelittlepony.util.Villagers;
|
import com.minelittlepony.util.Villagers;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.entity.monster.EntityZombieVillager;
|
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -27,19 +26,19 @@ public class RenderPonyZombieVillager extends RenderPonyMob<EntityZombieVillager
|
||||||
|
|
||||||
private ResourceLocation getTextureForVillager(EntityZombieVillager villager) {
|
private ResourceLocation getTextureForVillager(EntityZombieVillager villager) {
|
||||||
switch (villager.getProfession()) { // getProfession
|
switch (villager.getProfession()) { // getProfession
|
||||||
case Villagers.FARMER:
|
case Villagers.FARMER:
|
||||||
return FARMER; // applejack
|
return FARMER; // applejack
|
||||||
case Villagers.LIBRARIAN:
|
case Villagers.LIBRARIAN:
|
||||||
return LIBRARIAN; // twilight sparkle
|
return LIBRARIAN; // twilight sparkle
|
||||||
case Villagers.PRIEST:
|
case Villagers.PRIEST:
|
||||||
return PRIEST; // fluttershy
|
return PRIEST; // fluttershy
|
||||||
case Villagers.BLACKSMITH:
|
case Villagers.BLACKSMITH:
|
||||||
return SMITH; // rarity
|
return SMITH; // rarity
|
||||||
case Villagers.BUTCHER:
|
case Villagers.BUTCHER:
|
||||||
return BUTCHER; // rainbow dash
|
return BUTCHER; // rainbow dash
|
||||||
case Villagers.GENERIC:
|
case Villagers.GENERIC:
|
||||||
default:
|
default:
|
||||||
return GENERIC; // pinkie pie
|
return GENERIC; // pinkie pie
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class LayerHeldPonyItem implements LayerRenderer<EntityLivingBase> {
|
||||||
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
|
Minecraft.getMinecraft().getItemRenderer().renderItemSide(entity, drop, transform, isLeft);
|
||||||
|
|
||||||
if (isUnicorn) {
|
if (isUnicorn) {
|
||||||
PonyData metadata = ((AbstractPonyModel)this.livingPonyEntity.getMainModel()).metadata;
|
PonyData metadata = ((AbstractPonyModel) this.livingPonyEntity.getMainModel()).metadata;
|
||||||
this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor());
|
this.renderItemGlow(entity, drop, transform, hand, metadata.getGlowColor());
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
package com.minelittlepony.renderer.layer;
|
package com.minelittlepony.renderer.layer;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
|
@ -11,7 +8,6 @@ import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
import com.minelittlepony.model.pony.armor.ModelPonyArmor;
|
import com.minelittlepony.model.pony.armor.ModelPonyArmor;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.model.ModelRenderer;
|
import net.minecraft.client.model.ModelRenderer;
|
||||||
|
@ -26,6 +22,9 @@ import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
|
public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
private static final ResourceLocation ENCHANTED_ITEM_GLINT_RES = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||||
|
@ -57,7 +56,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale,
|
private void renderArmor(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale,
|
||||||
EntityEquipmentSlot armorSlot) {
|
EntityEquipmentSlot armorSlot) {
|
||||||
ItemStack itemstack = entity.getItemStackFromSlot(armorSlot);
|
ItemStack itemstack = entity.getItemStackFromSlot(armorSlot);
|
||||||
|
|
||||||
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
|
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
|
||||||
|
@ -117,36 +116,36 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
|
||||||
model.setInvisible(false);
|
model.setInvisible(false);
|
||||||
|
|
||||||
switch (slot) {
|
switch (slot) {
|
||||||
// feet
|
// feet
|
||||||
case FEET:
|
case FEET:
|
||||||
model.bipedRightArm.showModel = true;
|
model.bipedRightArm.showModel = true;
|
||||||
model.bipedLeftArm.showModel = true;
|
model.bipedLeftArm.showModel = true;
|
||||||
model.bipedRightLeg.showModel = true;
|
model.bipedRightLeg.showModel = true;
|
||||||
model.bipedLeftLeg.showModel = true;
|
model.bipedLeftLeg.showModel = true;
|
||||||
break;
|
break;
|
||||||
// legs
|
// legs
|
||||||
case LEGS:
|
case LEGS:
|
||||||
model.bipedRightLeg.showModel = true;
|
model.bipedRightLeg.showModel = true;
|
||||||
model.bipedLeftLeg.showModel = true;
|
model.bipedLeftLeg.showModel = true;
|
||||||
model.bipedRightArm.showModel = true;
|
model.bipedRightArm.showModel = true;
|
||||||
model.bipedLeftArm.showModel = true;
|
model.bipedLeftArm.showModel = true;
|
||||||
model.extBody.showModel = true;
|
model.extBody.showModel = true;
|
||||||
break;
|
break;
|
||||||
// chest
|
// chest
|
||||||
case CHEST:
|
case CHEST:
|
||||||
model.extBody.showModel = true;
|
model.extBody.showModel = true;
|
||||||
break;
|
break;
|
||||||
// head
|
// head
|
||||||
case HEAD:
|
case HEAD:
|
||||||
model.bipedHead.showModel = true;
|
model.bipedHead.showModel = true;
|
||||||
for (ModelRenderer m : model.extHead) {
|
for (ModelRenderer m : model.extHead) {
|
||||||
m.showModel = true;
|
m.showModel = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_,
|
private void renderEnchantment(EntityLivingBase entitylivingbaseIn, ModelBase modelbaseIn, float p_177183_3_, float p_177183_4_, float p_177183_5_,
|
||||||
float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) {
|
float p_177183_6_, float p_177183_7_, float p_177183_8_, float p_177183_9_) {
|
||||||
float f7 = entitylivingbaseIn.ticksExisted + p_177183_5_;
|
float f7 = entitylivingbaseIn.ticksExisted + p_177183_5_;
|
||||||
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
this.renderer.bindTexture(ENCHANTED_ITEM_GLINT_RES);
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
|
@ -185,12 +184,7 @@ public class LayerPonyArmor implements LayerRenderer<EntityLivingBase> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceLocation getHumanResource(String s1) {
|
private static ResourceLocation getHumanResource(String s1) {
|
||||||
ResourceLocation human = HUMAN_ARMORS.get(s1);
|
return HUMAN_ARMORS.computeIfAbsent(s1, k -> new ResourceLocation(s1));
|
||||||
if (human == null) {
|
|
||||||
human = new ResourceLocation(s1);
|
|
||||||
HUMAN_ARMORS.put(s1, human);
|
|
||||||
}
|
|
||||||
return human;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResourceLocation getPonyResource(ResourceLocation human) {
|
private static ResourceLocation getPonyResource(ResourceLocation human) {
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package com.minelittlepony.renderer.layer;
|
package com.minelittlepony.renderer.layer;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
|
@ -15,6 +12,8 @@ import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||||
import net.minecraft.entity.player.EnumPlayerModelParts;
|
import net.minecraft.entity.player.EnumPlayerModelParts;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
|
public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
|
||||||
|
|
||||||
private RenderLivingBase<? extends AbstractClientPlayer> renderer;
|
private RenderLivingBase<? extends AbstractClientPlayer> renderer;
|
||||||
|
@ -27,7 +26,7 @@ public class LayerPonyCape implements LayerRenderer<AbstractClientPlayer> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRenderLayer(AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6,
|
public void doRenderLayer(AbstractClientPlayer clientPlayer, float p2, float p3, float ticks, float p5, float p6,
|
||||||
float p7, float scale) {
|
float p7, float scale) {
|
||||||
PlayerModel model = ((IRenderPony) renderer).getPony();
|
PlayerModel model = ((IRenderPony) renderer).getPony();
|
||||||
if (model.getModel() instanceof ModelHumanPlayer) {
|
if (model.getModel() instanceof ModelHumanPlayer) {
|
||||||
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
|
cape.doRenderLayer(clientPlayer, p2, p3, ticks, p5, p6, p7, scale);
|
||||||
|
|
|
@ -5,7 +5,6 @@ import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.ModelPonyElytra;
|
import com.minelittlepony.model.ModelPonyElytra;
|
||||||
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
import com.minelittlepony.model.pony.ModelHumanPlayer;
|
||||||
|
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
package com.minelittlepony.renderer.layer;
|
package com.minelittlepony.renderer.layer;
|
||||||
|
|
||||||
import static net.minecraft.client.renderer.GlStateManager.*;
|
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IRenderPony;
|
import com.minelittlepony.ducks.IRenderPony;
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.BodyPart;
|
import com.minelittlepony.model.BodyPart;
|
||||||
import com.minelittlepony.model.PlayerModel;
|
import com.minelittlepony.model.PlayerModel;
|
||||||
import com.minelittlepony.model.pony.ModelPlayerPony;
|
import com.minelittlepony.model.pony.ModelPlayerPony;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
|
@ -27,6 +24,8 @@ import net.minecraft.nbt.NBTUtil;
|
||||||
import net.minecraft.tileentity.TileEntitySkull;
|
import net.minecraft.tileentity.TileEntitySkull;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.*;
|
||||||
|
|
||||||
public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
private RenderLivingBase<? extends EntityLivingBase> renderer;
|
private RenderLivingBase<? extends EntityLivingBase> renderer;
|
||||||
|
@ -37,7 +36,7 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float p_177141_3_,
|
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float p_177141_3_,
|
||||||
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||||
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
ItemStack itemstack = entity.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
|
||||||
if (itemstack != null && itemstack.getItem() != null) {
|
if (itemstack != null && itemstack.getItem() != null) {
|
||||||
AbstractPonyModel model = getModel().getModel();
|
AbstractPonyModel model = getModel().getModel();
|
||||||
|
@ -86,6 +85,7 @@ public class LayerPonySkull implements LayerRenderer<EntityLivingBase> {
|
||||||
if (itemstack.hasTagCompound()) {
|
if (itemstack.hasTagCompound()) {
|
||||||
NBTTagCompound nbt = itemstack.getTagCompound();
|
NBTTagCompound nbt = itemstack.getTagCompound();
|
||||||
|
|
||||||
|
assert nbt != null;
|
||||||
if (nbt.hasKey("SkullOwner", 10)) {
|
if (nbt.hasKey("SkullOwner", 10)) {
|
||||||
profile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner"));
|
profile = NBTUtil.readGameProfileFromNBT(nbt.getCompoundTag("SkullOwner"));
|
||||||
} else if (nbt.hasKey("SkullOwner", 8)) {
|
} else if (nbt.hasKey("SkullOwner", 8)) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.renderer.layer;
|
package com.minelittlepony.renderer.layer;
|
||||||
|
|
||||||
import com.minelittlepony.model.pony.ModelSkeletonPony;
|
import com.minelittlepony.model.pony.ModelSkeletonPony;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelBase;
|
import net.minecraft.client.model.ModelBase;
|
||||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||||
import net.minecraft.entity.monster.EntityStray;
|
import net.minecraft.entity.monster.EntityStray;
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
package com.minelittlepony.util;
|
|
||||||
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
|
|
||||||
|
|
||||||
public class MineLPLogger {
|
|
||||||
private static Logger logger = LogManager.getLogger("MineLittlePony");
|
|
||||||
|
|
||||||
public static Logger getLogger() {
|
|
||||||
return logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void log(Level level, String format, Object... data) {
|
|
||||||
logger.log(level, "MineLittlePony> " + String.format(format, data));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void log(Level level, Throwable t, String format, Object... data) {
|
|
||||||
logger.log(level, "MineLittlePony> " + String.format(format, data), t);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(String message) {
|
|
||||||
log(Level.INFO, message, new Object[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(String message, Object... data) {
|
|
||||||
log(Level.INFO, message, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String message) {
|
|
||||||
if(LiteLoaderLogger.DEBUG) {
|
|
||||||
log(Level.INFO, message, new Object[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(String message, Object... data) {
|
|
||||||
if(LiteLoaderLogger.DEBUG) {
|
|
||||||
log(Level.INFO, message, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void debug(Throwable t, String message, Object... data) {
|
|
||||||
if(LiteLoaderLogger.DEBUG) {
|
|
||||||
log(Level.INFO, message, new Object[]{data, t});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(String message) {
|
|
||||||
log(Level.WARN, message, new Object[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(String message, Object... data) {
|
|
||||||
log(Level.WARN, message, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(Throwable t, String message, Object... data) {
|
|
||||||
log(Level.WARN, t, message, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(String message) {
|
|
||||||
log(Level.ERROR, message, new Object[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(String message, Object... data) {
|
|
||||||
log(Level.ERROR, message, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void error(Throwable t, String message, Object... data) {
|
|
||||||
log(Level.ERROR, t, message, data);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,12 +1,11 @@
|
||||||
package com.minelittlepony.util;
|
package com.minelittlepony.util;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
|
|
||||||
import com.mumfrey.liteloader.core.runtime.Obf;
|
import com.mumfrey.liteloader.core.runtime.Obf;
|
||||||
import com.mumfrey.liteloader.util.PrivateFields;
|
import com.mumfrey.liteloader.util.PrivateFields;
|
||||||
|
|
||||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
|
||||||
public class PonyFields<P, T> extends PrivateFields<P, T> {
|
public class PonyFields<P, T> extends PrivateFields<P, T> {
|
||||||
|
|
||||||
public static final PrivateFields<ThreadDownloadImageData, BufferedImage> downloadedImage = field(ThreadDownloadImageData.class, PonyObf.downloadedImage);
|
public static final PrivateFields<ThreadDownloadImageData, BufferedImage> downloadedImage = field(ThreadDownloadImageData.class, PonyObf.downloadedImage);
|
||||||
|
@ -16,7 +15,7 @@ public class PonyFields<P, T> extends PrivateFields<P, T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static <P, T> PrivateFields<P, T> field(Class<P> c, Obf o) {
|
private static <P, T> PrivateFields<P, T> field(Class<P> c, Obf o) {
|
||||||
return new PonyFields<P, T>(c, o);
|
return new PonyFields<>(c, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class PonyObf extends Obf {
|
private static class PonyObf extends Obf {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
// Removes all of the previous resourcepack's ponies
|
// Removes all of the previous resourcepack's ponies
|
||||||
"override": false,
|
"override": false,
|
||||||
// A list of all the pony names without the extension
|
// A list of all the pony names without the extension
|
||||||
// e.g. textures/entity/pony/bpony_12.png
|
// e.g. textures/entity/pony/bpony_12.png
|
||||||
"ponies": [
|
"ponies": [
|
||||||
"bpony_0",
|
"bpony_0",
|
||||||
"bpony_1",
|
"bpony_1",
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "minelittlepony",
|
"name": "minelittlepony",
|
||||||
"mcversion": "${mcversion}",
|
"mcversion": "${mcversion}",
|
||||||
"version": "${version}",
|
"version": "${version}",
|
||||||
"revision": "${revision}",
|
"revision": "${revision}",
|
||||||
"description": "Mine Little Pony turns players and mobs into ponies",
|
"description": "Mine Little Pony turns players and mobs into ponies",
|
||||||
"mixinConfigs": [
|
"mixinConfigs": [
|
||||||
"mixin.minelp.json",
|
"mixin.minelp.json",
|
||||||
"mixin.hdskins.json"
|
"mixin.hdskins.json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.4.10",
|
"minVersion": "0.6",
|
||||||
"package": "com.minelittlepony.mixin",
|
"package": "com.minelittlepony.mixin",
|
||||||
"refmap": "mixin.minelp.refmap.json",
|
"refmap": "mixin.minelp.refmap.json",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinRenderPlayer"
|
"MixinRenderPlayer"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue