mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Merge branch 'master' of https://github.com/MineLittlePony/MineLittlePony
This commit is contained in:
commit
b9ea6ad28a
5 changed files with 18 additions and 13 deletions
|
@ -30,7 +30,7 @@ sourceCompatibility = 1.8
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
version = "1.12.2"
|
version = "1.12.2"
|
||||||
mappings = 'snapshot_20170919'
|
mappings = 'stable_39'
|
||||||
runDir = 'run'
|
runDir = 'run'
|
||||||
replace '@VERSION@', project.version
|
replace '@VERSION@', project.version
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ 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 javax.annotation.Nullable;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -14,6 +13,8 @@ import java.util.concurrent.Callable;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class ImageLoader implements Supplier<ResourceLocation> {
|
public class ImageLoader implements Supplier<ResourceLocation> {
|
||||||
|
|
||||||
private static Minecraft mc = Minecraft.getMinecraft();
|
private static Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
@ -60,7 +61,7 @@ public class ImageLoader implements Supplier<ResourceLocation> {
|
||||||
@Nullable
|
@Nullable
|
||||||
private ResourceLocation loadSkin(BufferedImage image) {
|
private ResourceLocation loadSkin(BufferedImage image) {
|
||||||
|
|
||||||
ResourceLocation conv = new ResourceLocation(original.getResourceDomain() + "-converted", original.getResourcePath());
|
ResourceLocation conv = new ResourceLocation(original.getNamespace() + "-converted", original.getPath());
|
||||||
boolean success = mc.getTextureManager().loadTexture(conv, new DynamicTextureImage(image));
|
boolean success = mc.getTextureManager().loadTexture(conv, new DynamicTextureImage(image));
|
||||||
return success ? conv : null;
|
return success ? conv : null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,13 +34,13 @@ public class LayerEntityOnPonyShoulder extends AbstractPonyLayer<AbstractClientP
|
||||||
|
|
||||||
NBTTagCompound leftTag = player.getLeftShoulderEntity();
|
NBTTagCompound leftTag = player.getLeftShoulderEntity();
|
||||||
|
|
||||||
if (!leftTag.hasNoTags()) {
|
if (!leftTag.isEmpty()) {
|
||||||
leftEntity = renderShoulderEntity(player, leftEntity, leftTag, headYaw, headPitch, true);
|
leftEntity = renderShoulderEntity(player, leftEntity, leftTag, headYaw, headPitch, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
NBTTagCompound rightTag = player.getRightShoulderEntity();
|
NBTTagCompound rightTag = player.getRightShoulderEntity();
|
||||||
|
|
||||||
if (!rightTag.hasNoTags()) {
|
if (!rightTag.isEmpty()) {
|
||||||
rightEntity = renderShoulderEntity(player, rightEntity, rightTag, headYaw, headPitch, false);
|
rightEntity = renderShoulderEntity(player, rightEntity, rightTag, headYaw, headPitch, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.minelittlepony.model.armour.IEquestrianArmor;
|
||||||
import com.minelittlepony.model.armour.ModelPonyArmor;
|
import com.minelittlepony.model.armour.ModelPonyArmor;
|
||||||
import com.minelittlepony.model.capabilities.IModelArmor;
|
import com.minelittlepony.model.capabilities.IModelArmor;
|
||||||
import com.minelittlepony.util.coordinates.Color;
|
import com.minelittlepony.util.coordinates.Color;
|
||||||
|
|
||||||
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.ModelBiped;
|
import net.minecraft.client.model.ModelBiped;
|
||||||
|
@ -24,11 +23,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.Tuple;
|
import net.minecraft.util.Tuple;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
||||||
|
|
||||||
private static final Map<String, ResourceLocation> HUMAN_ARMOUR = Maps.newHashMap();
|
private static final Map<String, ResourceLocation> HUMAN_ARMOUR = Maps.newHashMap();
|
||||||
|
@ -149,11 +148,11 @@ public class LayerPonyArmor<T extends EntityLivingBase> extends AbstractPonyLaye
|
||||||
|
|
||||||
private static ResourceLocation getPonyResource(ResourceLocation human) {
|
private static ResourceLocation getPonyResource(ResourceLocation human) {
|
||||||
return PONY_ARMOUR.computeIfAbsent(human, key -> {
|
return PONY_ARMOUR.computeIfAbsent(human, key -> {
|
||||||
String domain = human.getResourceDomain();
|
String domain = human.getNamespace();
|
||||||
if ("minecraft".equals(domain)) {
|
if ("minecraft".equals(domain)) {
|
||||||
domain = "minelittlepony"; // it's a vanilla armor. I provide these.
|
domain = "minelittlepony"; // it's a vanilla armor. I provide these.
|
||||||
}
|
}
|
||||||
String path = human.getResourcePath().replace(".png", "_pony.png");
|
String path = human.getPath().replace(".png", "_pony.png");
|
||||||
return new ResourceLocation(domain, path);
|
return new ResourceLocation(domain, path);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package com.minelittlepony.render.layer;
|
package com.minelittlepony.render.layer;
|
||||||
|
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.color;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.popMatrix;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.pushMatrix;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.rotate;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.scale;
|
||||||
|
import static net.minecraft.client.renderer.GlStateManager.translate;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -23,8 +30,6 @@ 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 LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRenderer<T> {
|
public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRenderer<T> {
|
||||||
|
|
||||||
private RenderLivingBase<T> renderer;
|
private RenderLivingBase<T> renderer;
|
||||||
|
@ -92,7 +97,7 @@ public class LayerPonyCustomHead<T extends EntityLivingBase> implements LayerRen
|
||||||
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)) {
|
||||||
profile = TileEntitySkull.updateGameprofile(new GameProfile(null, nbt.getString("SkullOwner")));
|
profile = TileEntitySkull.updateGameProfile(new GameProfile(null, nbt.getString("SkullOwner")));
|
||||||
nbt.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), profile));
|
nbt.setTag("SkullOwner", NBTUtil.writeGameProfile(new NBTTagCompound(), profile));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue