update to 1.10.2

Work on better skin caching. Needs skin hash from server.
Fix up the stray skeleton. Still need proper textures
This commit is contained in:
Matthew Messinger 2016-07-07 02:57:52 -04:00
parent 6645410497
commit 45ddc6baca
13 changed files with 146 additions and 44 deletions

View file

@ -28,12 +28,12 @@ apply plugin: 'org.spongepowered.mixin'
apply plugin: 'mnm.gradle.ap-ide' apply plugin: 'mnm.gradle.ap-ide'
group = 'com.brohoof.minelp' group = 'com.brohoof.minelp'
version = '1.10.0.0' version = '1.10.2.0'
description = 'Mine Little Pony' description = 'Mine Little Pony'
minecraft { minecraft {
version = "1.10" version = "1.10.2"
mappings = 'snapshot_20160619' mappings = 'snapshot_20160704' // 'murica! F*** yeah!
runDir = 'run' runDir = 'run'
replace '@VERSION@',project.version replace '@VERSION@',project.version
} }
@ -55,29 +55,14 @@ sourceSets {
compileClasspath += files(deps + [ main.output, api.output ]) compileClasspath += files(deps + [ main.output, api.output ])
} }
} }
//litemod.json { litemod.json {
// mixinConfigs += ['mixin.minelp.json', 'mixin.hdskins.json'] author = "Verdana, Rene_Z, Mumfrey, JoyJoy"
// author = "author": "Verdana, Rene_Z, Mumfrey, JoyJoy" description = "Mine Little Pony turns players and mobs into ponies"
// description = "Mine Little Pony turns players and mobs into ponies" description.litemodminelittlepony = """Mine Little Pony turns players and mobs into ponies
// description.litemodminelittlepony = """Mine Little Pony turns players and mobs into ponies Press F9 ingame to access settings"""
// Press F9 ingame to access settings""" description.litemodhdskinsmod = """Seperate skin server for Mine Little Pony that also supports HD skins.
// description.litemodhdskinsmod = """Seperate skin server for Mine Little Pony that also supports HD skins. Access via Skin Manager key binding (default: F1) in the main menu."""
// Access via Skin Manager key binding (default: F1) in the main menu.""" mixinConfigs += ['mixin.minelp.json', 'mixin.hdskins.json']
//}
processResources {
def props = [
version: version,
mcversion: minecraft.version,
revision: revision
]
inputs.properties props
from(sourceSets.main.resources.srcDirs) {
include 'litemod.json'
expand props
}
from(sourceSets.main.resources.srcDirs) {
exclude 'litemod.json'
}
} }
afterEvaluate { afterEvaluate {
dependencies { dependencies {
@ -91,6 +76,7 @@ afterEvaluate {
} }
jar { jar {
from sourceSets.findAll { it.name != 'api' }*.output from sourceSets.findAll { it.name != 'api' }*.output
from litemod.outputs
} }
mixin { mixin {
defaultObfuscationEnv notch defaultObfuscationEnv notch

3
build.number Normal file
View file

@ -0,0 +1,3 @@
#Build Number for ANT. Do not edit!
#Wed Jun 29 02:28:19 EDT 2016
build.number=232

1
buildSrc Submodule

@ -0,0 +1 @@
Subproject commit 95e55a52799b8d1c70b7fdcb155e77c3f34e7b96

View file

@ -0,0 +1,26 @@
package com.voxelmodpack.hdskins;
import java.util.Map;
import javax.annotation.Nullable;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
/**
* Profile texture with a custom hash which is not the file name.
*/
public class HDProfileTexture extends MinecraftProfileTexture {
private String hash;
public HDProfileTexture(String url, @Nullable String hash, Map<String, String> metadata) {
super(url, metadata);
this.hash = hash;
}
@Override
public String getHash() {
return this.hash == null ? super.getHash() : this.hash;
}
}

View file

@ -4,6 +4,7 @@ import java.awt.Graphics;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URL;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
@ -11,11 +12,13 @@ import java.util.UUID;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import com.google.common.base.Charsets;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.common.io.Resources;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
@ -104,9 +107,9 @@ public final class HDSkinManager {
return; return;
} }
String dir = type.toString().toLowerCase() + "s/"; String skinDir = "hd" + type.toString().toLowerCase() + "s/";
final ResourceLocation skin = new ResourceLocation(dir + texture.getHash()); final ResourceLocation skin = new ResourceLocation(skinDir + texture.getHash());
File file1 = new File(new File("assets/" + dir), texture.getHash().substring(0, 2)); File file1 = new File(new File("assets/" + skinDir), texture.getHash().substring(0, 2));
File file2 = new File(file1, texture.getHash()); File file2 = new File(file1, texture.getHash());
final IImageBuffer imagebufferdownload = new ImageBufferDownloadHD(); final IImageBuffer imagebufferdownload = new ImageBufferDownloadHD();
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, texture.getUrl(), ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, texture.getUrl(),
@ -137,14 +140,16 @@ public final class HDSkinManager {
if (textures == null) { if (textures == null) {
String uuid = UUIDTypeAdapter.fromUUID(profile.getId()); String uuid = UUIDTypeAdapter.fromUUID(profile.getId());
String skinUrl = getCustomTextureURLForId(Type.SKIN, uuid, false);
String capeUrl = getCustomTextureURLForId(Type.CAPE, uuid);
String elytraUrl = getCustomTextureURLForId(Type.ELYTRA, uuid);
textures = ImmutableMap.of( ImmutableMap.Builder<Type, MinecraftProfileTexture> builder = ImmutableMap.builder();
Type.SKIN, new MinecraftProfileTexture(skinUrl, null), for (Type type : Type.values()) {
Type.CAPE, new MinecraftProfileTexture(capeUrl, null), String url = getCustomTextureURLForId(type, uuid);
Type.ELYTRA, new MinecraftProfileTexture(elytraUrl, null)); String hash = getTextureHash(type, uuid);
builder.put(type, new HDProfileTexture(url, hash, null));
}
textures = builder.build();
this.profileTextures.put(profile.getId(), textures); this.profileTextures.put(profile.getId(), textures);
} }
return textures; return textures;
@ -196,6 +201,15 @@ public final class HDSkinManager {
return getCustomTextureURLForId(type, uuid, false); return getCustomTextureURLForId(type, uuid, false);
} }
private String getTextureHash(Type type, String uuid) {
try {
URL url = new URL(getCustomTextureURLForId(type, uuid) + ".md5");
return Resources.asCharSource(url, Charsets.UTF_8).readFirstLine();
} catch (IOException e) {
return null;
}
}
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
this.enabled = enabled; this.enabled = enabled;
} }

View file

@ -22,6 +22,7 @@ public class PonyManager {
public static final ResourceLocation SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_pony.png"); public static final ResourceLocation SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_pony.png");
public static final ResourceLocation WITHER_SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_wither_pony.png"); public static final ResourceLocation WITHER_SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/skeleton_wither_pony.png");
public static final ResourceLocation STRAY_SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/stray_pony.png"); public static final ResourceLocation STRAY_SKELETON = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/stray_pony.png");
public static final ResourceLocation STRAY_SKELETON_OVERLAY = new ResourceLocation(NAMESPACE, "textures/entity/skeleton/stray_pony_overlay.png");
public static final ResourceLocation STEVE = new ResourceLocation(NAMESPACE, "textures/entity/steve_pony.png"); public static final ResourceLocation STEVE = new ResourceLocation(NAMESPACE, "textures/entity/steve_pony.png");
public static final ResourceLocation ALEX = new ResourceLocation(NAMESPACE, "textures/entity/alex_pony.png"); public static final ResourceLocation ALEX = new ResourceLocation(NAMESPACE, "textures/entity/alex_pony.png");

View file

@ -48,7 +48,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
} }
@Inject( @Inject(
method = "<init>(" + "Lnet/minecraft/client/renderer/entity/RenderManager;" + "Z)V", method = "<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V",
at = @At("RETURN")) at = @At("RETURN"))
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;

View file

@ -8,6 +8,7 @@ import com.brohoof.minelittlepony.PonyRace;
import com.brohoof.minelittlepony.PonySize; import com.brohoof.minelittlepony.PonySize;
import com.brohoof.minelittlepony.TailLengths; import com.brohoof.minelittlepony.TailLengths;
import com.brohoof.minelittlepony.model.PMAPI; import com.brohoof.minelittlepony.model.PMAPI;
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkeletonOverlay;
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;
@ -19,20 +20,20 @@ import net.minecraft.util.ResourceLocation;
public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> { public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
public RenderPonySkeleton(RenderManager rm) { public RenderPonySkeleton(RenderManager rm) {
super(rm, PMAPI.skeleton); super(rm, PMAPI.skeleton);
addLayer(new LayerBipedArmor(this) { this.addLayer(new LayerBipedArmor(this) {
@Override @Override
protected void initArmor() { protected void initArmor() {
this.modelLeggings = PMAPI.skeleton.getArmor().modelArmor; this.modelLeggings = PMAPI.skeleton.getArmor().modelArmor;
this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate; this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate;
} }
}); });
this.addLayer(new LayerPonySkeletonOverlay(this));
} }
@Override @Override
protected void preRenderCallback(EntitySkeleton skeleton, float partialTicks) { protected void preRenderCallback(EntitySkeleton skeleton, float partialTicks) {
super.preRenderCallback(skeleton, partialTicks); super.preRenderCallback(skeleton, partialTicks);
if (skeleton.func_189771_df() == SkeletonType.WITHER) {// getSkeletonType() if (skeleton.getSkeletonType() == SkeletonType.WITHER) {
// == 1) {
GlStateManager.scale(1.2F, 1.2F, 1.2F); GlStateManager.scale(1.2F, 1.2F, 1.2F);
} }
@ -58,7 +59,7 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
@Override @Override
protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) { protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) {
SkeletonType type = skeleton.func_189771_df(); SkeletonType type = skeleton.getSkeletonType();
if (type == SkeletonType.WITHER) if (type == SkeletonType.WITHER)
return PonyManager.WITHER_SKELETON; return PonyManager.WITHER_SKELETON;
else if (type == SkeletonType.STRAY) else if (type == SkeletonType.STRAY)

View file

@ -0,0 +1,35 @@
package com.brohoof.minelittlepony.renderer.layer;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.ResourceLocation;
// separate class in case I need it later
public abstract class LayerOverlayBase<T extends EntityLiving> implements LayerRenderer<T> {
protected final RenderLivingBase<?> renderer;
public LayerOverlayBase(RenderLivingBase<?> render) {
this.renderer = render;
}
@Override
public boolean shouldCombineTextures() {
return true;
}
protected void renderOverlay(T skele, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
ModelBase overlayModel = this.getOverlayModel();
overlayModel.setModelAttributes(this.renderer.getMainModel());
overlayModel.setLivingAnimations(skele, limbSwing, limbSwingAmount, partialTicks);
renderer.bindTexture(this.getOverlayTexture());
overlayModel.render(skele, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
}
protected abstract ModelBase getOverlayModel();
protected abstract ResourceLocation getOverlayTexture();
}

View file

@ -0,0 +1,38 @@
package com.brohoof.minelittlepony.renderer.layer;
import com.brohoof.minelittlepony.PonyManager;
import com.brohoof.minelittlepony.model.pony.ModelSkeletonPony;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.SkeletonType;
import net.minecraft.util.ResourceLocation;
public class LayerPonySkeletonOverlay extends LayerOverlayBase<EntitySkeleton> {
private final ModelSkeletonPony overlayModel;
public LayerPonySkeletonOverlay(RenderLivingBase<?> render) {
super(render);
this.overlayModel = new ModelSkeletonPony();
this.overlayModel.init(0F, 0.25F);
}
@Override
public void doRenderLayer(EntitySkeleton skele, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
if (skele.getSkeletonType() == SkeletonType.STRAY) {
this.renderOverlay(skele, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
@Override
protected ModelBase getOverlayModel() {
return this.overlayModel;
}
@Override
protected ResourceLocation getOverlayTexture() {
return PonyManager.STRAY_SKELETON_OVERLAY;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,017 B

View file

@ -3,10 +3,7 @@
"mcversion": "${mcversion}", "mcversion": "${mcversion}",
"version": "${version}", "version": "${version}",
"revision": "${revision}", "revision": "${revision}",
"author": "Verdana, Rene_Z, Mumfrey, JoyJoy",
"description": "Mine Little Pony turns players and mobs into ponies", "description": "Mine Little Pony turns players and mobs into ponies",
"description.litemodminelittlepony": "Mine Little Pony turns players and mobs into ponies",
"description.litemodhdskinsmod": "Seperate skin server for Mine Little Pony that also supports HD skins. Access via Skin Manager key binding (default: F1) in the main menu.",
"mixinConfigs": [ "mixinConfigs": [
"mixin.minelp.json", "mixin.minelp.json",
"mixin.hdskins.json" "mixin.hdskins.json"