mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
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:
parent
6645410497
commit
45ddc6baca
13 changed files with 146 additions and 44 deletions
38
build.gradle
38
build.gradle
|
@ -28,12 +28,12 @@ apply plugin: 'org.spongepowered.mixin'
|
|||
apply plugin: 'mnm.gradle.ap-ide'
|
||||
|
||||
group = 'com.brohoof.minelp'
|
||||
version = '1.10.0.0'
|
||||
version = '1.10.2.0'
|
||||
description = 'Mine Little Pony'
|
||||
|
||||
minecraft {
|
||||
version = "1.10"
|
||||
mappings = 'snapshot_20160619'
|
||||
version = "1.10.2"
|
||||
mappings = 'snapshot_20160704' // 'murica! F*** yeah!
|
||||
runDir = 'run'
|
||||
replace '@VERSION@',project.version
|
||||
}
|
||||
|
@ -55,29 +55,14 @@ sourceSets {
|
|||
compileClasspath += files(deps + [ main.output, api.output ])
|
||||
}
|
||||
}
|
||||
//litemod.json {
|
||||
// mixinConfigs += ['mixin.minelp.json', 'mixin.hdskins.json']
|
||||
// author = "author": "Verdana, Rene_Z, Mumfrey, JoyJoy"
|
||||
// description = "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"""
|
||||
// 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."""
|
||||
//}
|
||||
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'
|
||||
}
|
||||
litemod.json {
|
||||
author = "Verdana, Rene_Z, Mumfrey, JoyJoy"
|
||||
description = "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"""
|
||||
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 += ['mixin.minelp.json', 'mixin.hdskins.json']
|
||||
}
|
||||
afterEvaluate {
|
||||
dependencies {
|
||||
|
@ -91,6 +76,7 @@ afterEvaluate {
|
|||
}
|
||||
jar {
|
||||
from sourceSets.findAll { it.name != 'api' }*.output
|
||||
from litemod.outputs
|
||||
}
|
||||
mixin {
|
||||
defaultObfuscationEnv notch
|
||||
|
|
3
build.number
Normal file
3
build.number
Normal 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
1
buildSrc
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 95e55a52799b8d1c70b7fdcb155e77c3f34e7b96
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -4,6 +4,7 @@ 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;
|
||||
|
@ -11,11 +12,13 @@ import java.util.UUID;
|
|||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.io.Resources;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
@ -104,9 +107,9 @@ public final class HDSkinManager {
|
|||
return;
|
||||
}
|
||||
|
||||
String dir = type.toString().toLowerCase() + "s/";
|
||||
final ResourceLocation skin = new ResourceLocation(dir + texture.getHash());
|
||||
File file1 = new File(new File("assets/" + dir), texture.getHash().substring(0, 2));
|
||||
String skinDir = "hd" + type.toString().toLowerCase() + "s/";
|
||||
final ResourceLocation skin = new ResourceLocation(skinDir + texture.getHash());
|
||||
File file1 = new File(new File("assets/" + skinDir), texture.getHash().substring(0, 2));
|
||||
File file2 = new File(file1, texture.getHash());
|
||||
final IImageBuffer imagebufferdownload = new ImageBufferDownloadHD();
|
||||
ThreadDownloadImageData threaddownloadimagedata = new ThreadDownloadImageData(file2, texture.getUrl(),
|
||||
|
@ -137,14 +140,16 @@ public final class HDSkinManager {
|
|||
if (textures == null) {
|
||||
|
||||
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(
|
||||
Type.SKIN, new MinecraftProfileTexture(skinUrl, null),
|
||||
Type.CAPE, new MinecraftProfileTexture(capeUrl, null),
|
||||
Type.ELYTRA, new MinecraftProfileTexture(elytraUrl, null));
|
||||
ImmutableMap.Builder<Type, MinecraftProfileTexture> builder = ImmutableMap.builder();
|
||||
for (Type type : Type.values()) {
|
||||
String url = getCustomTextureURLForId(type, uuid);
|
||||
String hash = getTextureHash(type, uuid);
|
||||
|
||||
builder.put(type, new HDProfileTexture(url, hash, null));
|
||||
}
|
||||
|
||||
textures = builder.build();
|
||||
this.profileTextures.put(profile.getId(), textures);
|
||||
}
|
||||
return textures;
|
||||
|
@ -196,6 +201,15 @@ public final class HDSkinManager {
|
|||
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) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
|
|
@ -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 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_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 ALEX = new ResourceLocation(NAMESPACE, "textures/entity/alex_pony.png");
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public abstract class MixinRenderPlayer extends RenderLivingBase<AbstractClientP
|
|||
}
|
||||
|
||||
@Inject(
|
||||
method = "<init>(" + "Lnet/minecraft/client/renderer/entity/RenderManager;" + "Z)V",
|
||||
method = "<init>(Lnet/minecraft/client/renderer/entity/RenderManager;Z)V",
|
||||
at = @At("RETURN"))
|
||||
private void init(RenderManager renderManager, boolean useSmallArms, CallbackInfo ci) {
|
||||
this.playerModel = smallArms ? PMAPI.ponySmall : PMAPI.pony;
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.brohoof.minelittlepony.PonyRace;
|
|||
import com.brohoof.minelittlepony.PonySize;
|
||||
import com.brohoof.minelittlepony.TailLengths;
|
||||
import com.brohoof.minelittlepony.model.PMAPI;
|
||||
import com.brohoof.minelittlepony.renderer.layer.LayerPonySkeletonOverlay;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
|
@ -19,20 +20,20 @@ import net.minecraft.util.ResourceLocation;
|
|||
public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
|
||||
public RenderPonySkeleton(RenderManager rm) {
|
||||
super(rm, PMAPI.skeleton);
|
||||
addLayer(new LayerBipedArmor(this) {
|
||||
this.addLayer(new LayerBipedArmor(this) {
|
||||
@Override
|
||||
protected void initArmor() {
|
||||
this.modelLeggings = PMAPI.skeleton.getArmor().modelArmor;
|
||||
this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate;
|
||||
}
|
||||
});
|
||||
this.addLayer(new LayerPonySkeletonOverlay(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void preRenderCallback(EntitySkeleton skeleton, float partialTicks) {
|
||||
super.preRenderCallback(skeleton, partialTicks);
|
||||
if (skeleton.func_189771_df() == SkeletonType.WITHER) {// getSkeletonType()
|
||||
// == 1) {
|
||||
if (skeleton.getSkeletonType() == SkeletonType.WITHER) {
|
||||
GlStateManager.scale(1.2F, 1.2F, 1.2F);
|
||||
}
|
||||
|
||||
|
@ -58,7 +59,7 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
|
|||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntitySkeleton skeleton) {
|
||||
SkeletonType type = skeleton.func_189771_df();
|
||||
SkeletonType type = skeleton.getSkeletonType();
|
||||
if (type == SkeletonType.WITHER)
|
||||
return PonyManager.WITHER_SKELETON;
|
||||
else if (type == SkeletonType.STRAY)
|
||||
|
|
|
@ -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();
|
||||
|
||||
}
|
|
@ -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 |
|
@ -3,10 +3,7 @@
|
|||
"mcversion": "${mcversion}",
|
||||
"version": "${version}",
|
||||
"revision": "${revision}",
|
||||
"author": "Verdana, Rene_Z, Mumfrey, JoyJoy",
|
||||
"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": [
|
||||
"mixin.minelp.json",
|
||||
"mixin.hdskins.json"
|
||||
|
|
Loading…
Reference in a new issue