mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 14:27:59 +01:00
Remove slim from Pony class.
This commit is contained in:
parent
dfcae69ab7
commit
d9ddd3f842
6 changed files with 14 additions and 36 deletions
|
@ -54,15 +54,8 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
||||||
*
|
*
|
||||||
* @param resource A texture resource
|
* @param resource A texture resource
|
||||||
*/
|
*/
|
||||||
public Pony getPony(ResourceLocation resource, boolean slim) {
|
public Pony getPony(ResourceLocation resource) {
|
||||||
Pony pony = poniesCache.computeIfAbsent(resource, res -> new Pony(res, slim));
|
return poniesCache.computeIfAbsent(resource, Pony::new);
|
||||||
|
|
||||||
if (pony.usesThinArms() != slim) {
|
|
||||||
pony = new Pony(resource, slim);
|
|
||||||
poniesCache.put(resource, pony);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pony;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,7 +94,7 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
||||||
* @param uuid id of a player or entity
|
* @param uuid id of a player or entity
|
||||||
*/
|
*/
|
||||||
public Pony getPony(ResourceLocation resource, UUID uuid) {
|
public Pony getPony(ResourceLocation resource, UUID uuid) {
|
||||||
Pony pony = getPony(resource, isSlimSkin(uuid));
|
Pony pony = getPony(resource);
|
||||||
|
|
||||||
if (config.getPonyLevel() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
|
if (config.getPonyLevel() == PonyLevel.PONIES && pony.getMetadata().getRace().isHuman()) {
|
||||||
return getBackgroundPony(uuid);
|
return getBackgroundPony(uuid);
|
||||||
|
@ -117,7 +110,7 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
||||||
*/
|
*/
|
||||||
public Pony getDefaultPony(UUID uuid) {
|
public Pony getDefaultPony(UUID uuid) {
|
||||||
if (config.getPonyLevel() != PonyLevel.PONIES) {
|
if (config.getPonyLevel() != PonyLevel.PONIES) {
|
||||||
return getPony(DefaultPlayerSkin.getDefaultSkin(uuid), isSlimSkin(uuid));
|
return getPony(DefaultPlayerSkin.getDefaultSkin(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
return getBackgroundPony(uuid);
|
return getBackgroundPony(uuid);
|
||||||
|
@ -125,13 +118,13 @@ public class PonyManager implements IResourceManagerReloadListener, ISkinCacheCl
|
||||||
|
|
||||||
private Pony getBackgroundPony(UUID uuid) {
|
private Pony getBackgroundPony(UUID uuid) {
|
||||||
if (getNumberOfPonies() == 0 || isUser(uuid)) {
|
if (getNumberOfPonies() == 0 || isUser(uuid)) {
|
||||||
return getPony(getDefaultSkin(uuid), isSlimSkin(uuid));
|
return getPony(getDefaultSkin(uuid));
|
||||||
}
|
}
|
||||||
|
|
||||||
int bgi = uuid.hashCode() % getNumberOfPonies();
|
int bgi = uuid.hashCode() % getNumberOfPonies();
|
||||||
while (bgi < 0) bgi += getNumberOfPonies();
|
while (bgi < 0) bgi += getNumberOfPonies();
|
||||||
|
|
||||||
return getPony(backgroundPonyList.get(bgi), false);
|
return getPony(backgroundPonyList.get(bgi));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isUser(UUID uuid) {
|
private boolean isUser(UUID uuid) {
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class PonySkinParser implements ISkinParser {
|
||||||
// TODO use proper model metadata system
|
// TODO use proper model metadata system
|
||||||
|
|
||||||
metadata.put("model", MineLittlePony.getInstance().getManager()
|
metadata.put("model", MineLittlePony.getInstance().getManager()
|
||||||
.getPony(resource, slim)
|
.getPony(resource)
|
||||||
.getRace(false)
|
.getRace(false)
|
||||||
.getModel()
|
.getModel()
|
||||||
.getId(slim));
|
.getId(slim));
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
||||||
boolean slim = entity.usesThinSkin();
|
boolean slim = entity.usesThinSkin();
|
||||||
ResourceLocation loc = getEntityTexture(entity);
|
ResourceLocation loc = getEntityTexture(entity);
|
||||||
|
|
||||||
return MineLittlePony.getInstance().getManager().getPony(loc, slim);
|
return MineLittlePony.getInstance().getManager().getPony(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,7 +70,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
||||||
|
|
||||||
boolean slim = playermodel.usesThinSkin();
|
boolean slim = playermodel.usesThinSkin();
|
||||||
|
|
||||||
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc, slim);
|
Pony thePony = MineLittlePony.getInstance().getManager().getPony(loc);
|
||||||
|
|
||||||
PonyRace race = thePony.getRace(false);
|
PonyRace race = thePony.getRace(false);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ public class RenderPonyModel extends RenderPlayerModel<EntityPonyModel> implemen
|
||||||
|
|
||||||
boolean canWet = playermodel.wet && (loc == playermodel.getBlankSkin(Type.SKIN) || race == PonyRace.SEAPONY);
|
boolean canWet = playermodel.wet && (loc == playermodel.getBlankSkin(Type.SKIN) || race == PonyRace.SEAPONY);
|
||||||
|
|
||||||
playerModel = canWet ? PlayerModels.SEAPONY.getModel(slim) : thePony.getModel(true);
|
playerModel = canWet ? PlayerModels.SEAPONY.getModel(slim) : thePony.getRace(true).getModel().getModel(slim);
|
||||||
playerModel.apply(thePony.getMetadata());
|
playerModel.apply(thePony.getMetadata());
|
||||||
|
|
||||||
renderPony.setPonyModel(playerModel);
|
renderPony.setPonyModel(playerModel);
|
||||||
|
|
|
@ -3,10 +3,8 @@ package com.minelittlepony.pony.data;
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.mixin.MixinThreadDownloadImageData;
|
import com.minelittlepony.mixin.MixinThreadDownloadImageData;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
|
||||||
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
||||||
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
|
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
|
||||||
|
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.texture.ITextureObject;
|
import net.minecraft.client.renderer.texture.ITextureObject;
|
||||||
|
@ -39,12 +37,9 @@ public class Pony {
|
||||||
private final ResourceLocation texture;
|
private final ResourceLocation texture;
|
||||||
private final IPonyData metadata;
|
private final IPonyData metadata;
|
||||||
|
|
||||||
private final boolean smallArms;
|
public Pony(ResourceLocation resource) {
|
||||||
|
|
||||||
public Pony(ResourceLocation resource, boolean slim) {
|
|
||||||
texture = resource;
|
texture = resource;
|
||||||
metadata = checkSkin(texture);
|
metadata = checkSkin(texture);
|
||||||
smallArms = slim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IPonyData checkSkin(ResourceLocation resource) {
|
private IPonyData checkSkin(ResourceLocation resource) {
|
||||||
|
@ -135,18 +130,10 @@ public class Pony {
|
||||||
return !(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD;
|
return !(item instanceof ItemArmor) || ((ItemArmor)item).getEquipmentSlot() != EntityEquipmentSlot.HEAD;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWrapper getModel(boolean ignorePony) {
|
|
||||||
return getRace(ignorePony).getModel().getModel(smallArms);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PonyRace getRace(boolean ignorePony) {
|
public PonyRace getRace(boolean ignorePony) {
|
||||||
return metadata.getRace().getEffectiveRace(MineLittlePony.getConfig().getEffectivePonyLevel(ignorePony));
|
return metadata.getRace().getEffectiveRace(MineLittlePony.getConfig().getEffectivePonyLevel(ignorePony));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean usesThinArms() {
|
|
||||||
return smallArms;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ResourceLocation getTexture() {
|
public ResourceLocation getTexture() {
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,7 +101,7 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
||||||
} else {
|
} else {
|
||||||
ResourceLocation skin = skull.getSkinResource(profile);
|
ResourceLocation skin = skull.getSkinResource(profile);
|
||||||
|
|
||||||
skull.bindPony(MineLittlePony.getInstance().getManager().getPony(skin, false));
|
skull.bindPony(MineLittlePony.getInstance().getManager().getPony(skin));
|
||||||
|
|
||||||
bindTexture(skin);
|
bindTexture(skin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.minelittlepony.render.layer.LayerPonyArmor;
|
||||||
import com.minelittlepony.render.layer.LayerPonyCustomHead;
|
import com.minelittlepony.render.layer.LayerPonyCustomHead;
|
||||||
import com.minelittlepony.render.layer.LayerPonyElytra;
|
import com.minelittlepony.render.layer.LayerPonyElytra;
|
||||||
import com.voxelmodpack.hdskins.HDSkinManager;
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
|
|
||||||
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;
|
||||||
|
@ -19,9 +18,8 @@ import net.minecraft.client.renderer.entity.layers.LayerRenderer;
|
||||||
import net.minecraft.entity.EntityLiving;
|
import net.minecraft.entity.EntityLiving;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> {
|
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony<T> {
|
||||||
|
|
||||||
|
@ -78,7 +76,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pony getEntityPony(T entity) {
|
public Pony getEntityPony(T entity) {
|
||||||
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity), false);
|
return MineLittlePony.getInstance().getManager().getPony(getEntityTexture(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue