This commit is contained in:
Sen 2025-03-18 17:42:21 +01:00
parent 09ce79e666
commit 868a5ed9ea
7 changed files with 366 additions and 2087 deletions

File diff suppressed because it is too large Load diff

View file

@ -4608,7 +4608,7 @@ public abstract class EntityNPC extends EntityLiving
public LayerExtra getExtrasLayer()
{
return this.isPlayer() ? EntityTexManager.getLayer(this.getId()) : EntityTexManager.getNpcLayer(this.getChar());
return this.isPlayer() ? EntityTexManager.getLayer(this.getId(), this.species.renderer) : EntityTexManager.getNpcLayer(this.getChar(), this.species.renderer);
}
public String getLocationSkin()

View file

@ -106,7 +106,8 @@ public class GuiMenu extends Gui {
}
else {
this.add(new ActButton(0, 0, 400, 24, (Gui)null, "Zurück zum Spiel"));
this.add(new ActButton(0, 28, 400, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new ActButton(0, 28, 198, 24, GuiOptions.getPage(), "Einstellungen"));
this.add(new ActButton(202, 28, 198, 24, GuiSkin.INSTANCE, "Charakter"));
if(!this.gm.isRemote() && !this.gm.debugWorld) {
this.add(new Textbox(0, 56, 96, 24, 5, true, new Textbox.Callback() {
public void use(Textbox elem, Action value) {

File diff suppressed because it is too large Load diff

View file

@ -73,6 +73,10 @@ public abstract class GuiList<T extends ListEntry> extends Gui
public final int getSize() {
return this.elements.size();
}
public final void setSelected(int index) {
this.selectedElement = index;
}
protected int getContentHeight()
{

View file

@ -20,6 +20,7 @@ import game.world.World;
public abstract class Render<T extends Entity>
{
public static boolean drawNames = true;
// private static final String shadowTextures = "textures/world/shadow.png";
protected final RenderManager renderManager;
@ -310,7 +311,7 @@ public abstract class Render<T extends Entity>
protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance) {
double d0 = entityIn.getDistanceSqToEntity(this.renderManager.livingPlayer);
if (d0 <= (double)(maxDistance * maxDistance)) {
if (d0 <= (double)(maxDistance * maxDistance) && drawNames) {
// WCF.glPushMatrix();
// WCF.glTranslatef((float)x, (float)y + entityIn.height + 0.5f, (float)z);
// float f = 1.0f / 64.0f;

View file

@ -25,12 +25,17 @@ import game.util.FileUtils;
public abstract class EntityTexManager
{
public static String altTexture = null;
public static int altLayer = -1;
public static String altNpcLayer = null;
public static final int MAX_SKIN_SIZE = 65536;
private static final Set<Integer> USER_TEXTURES = Sets.newHashSet();
private static final Map<Integer, LayerExtra> USER_LAYERS = Maps.newHashMap();
private static final Map<String, LayerExtra> NPC_LAYERS = Maps.newHashMap();
private static final Map<ModelType, String> DEF_TEXTURES = Maps.newEnumMap(ModelType.class);
private static final Map<ModelType, LayerExtra> DEF_LAYERS = Maps.newEnumMap(ModelType.class);
public static void loadNpcTextures() {
TextureManager manager = Game.getGame().getTextureManager();
@ -75,6 +80,9 @@ public abstract class EntityTexManager
}
dyntex.updateDynamicTexture();
LayerExtra extra = LayerExtra.getLayer(dyntex.getTextureData(), dyntex.getWidth(), dyntex.getHeight(), entry.getValue());
if(EntityNPC.getSkinTexture(skin).equals(getDefault(entry.getValue()))) {
DEF_LAYERS.put(entry.getValue(), extra);
}
if(extra != null) {
extra = NPC_LAYERS.put(skin, extra);
}
@ -116,6 +124,10 @@ public abstract class EntityTexManager
dyntex.updateDynamicTexture();
// setCape(cape, image);
}
// for(ModelType model : ModelType.values()) {
// if(DEF_TEXTURES.get(model) == null)
// Log.IO.warn(altNpcLayer);
// }
}
public static String getDefault(ModelType model) {
@ -137,19 +149,20 @@ public abstract class EntityTexManager
return "capes/" + name.toLowerCase() + "/dyn";
}
public static LayerExtra getLayer(int id)
public static LayerExtra getLayer(int id, ModelType model)
{
return USER_LAYERS.get(id);
return altNpcLayer != null ? getNpcLayer(altNpcLayer, model) : (altLayer != -1 ? USER_LAYERS.get(altLayer) : (USER_TEXTURES.contains(id) ? USER_LAYERS.get(id) : DEF_LAYERS.get(model)));
}
public static LayerExtra getNpcLayer(String skin)
public static LayerExtra getNpcLayer(String skin, ModelType model)
{
return NPC_LAYERS.get((skin.startsWith("~") ? skin.substring(1) : skin).toLowerCase());
return Game.getGame().getTextureManager().getTexture(getNpcSkinLocation(skin.startsWith("~") ? skin.substring(1) : skin)) != null ?
NPC_LAYERS.get((skin.startsWith("~") ? skin.substring(1) : skin).toLowerCase()) : DEF_LAYERS.get(model);
}
public static String getSkin(int id, ModelType model)
{
String loc = getSkinLocation(id);
String loc = altTexture != null ? altTexture : getSkinLocation(id);
return Game.getGame().getTextureManager().getTexture(loc) != null ? loc : getDefault(model);
}