character selector

This commit is contained in:
Sen 2025-03-27 17:54:03 +01:00
parent 0af8ca57d1
commit 74f730e450
24 changed files with 554 additions and 154 deletions

View file

@ -2569,10 +2569,10 @@ public abstract class Entity
// return new HoverEvent(HoverEvent.Action.SHOW_ENTITY, new ChatComponentText(nbttagcompound.toString()));
// }
// public boolean isVisibleTo(EntityNPCMP player)
// {
// return true;
// }
public boolean isVisibleTo(EntityNPC player)
{
return true;
}
public BoundingBox getEntityBoundingBox()
{

View file

@ -371,7 +371,7 @@ public class EntityTrackerEntry {
double d1 = playerMP.posZ - (double)(this.encodedPosZ / 32);
return d0 >= (double)(-this.trackingDistanceThreshold) && d0 <= (double)this.trackingDistanceThreshold
&& d1 >= (double)(-this.trackingDistanceThreshold) && d1 <= (double)this.trackingDistanceThreshold
; // && this.trackedEntity.isVisibleTo(playerMP);
&& this.trackedEntity.isVisibleTo(playerMP);
}
private boolean isPlayerWatchingThisChunk(EntityNPC playerMP) {

View file

@ -1134,6 +1134,11 @@ public abstract class EntityNPC extends EntityLiving
public float getHeightDeviation(Random rand) {
return 0.0f;
}
public boolean isVisibleTo(EntityNPC player)
{
return this.connection == null || !this.connection.isInEditor();
}
// public abstract Alignment getNaturalAlign(Random rand);
@ -3256,7 +3261,7 @@ public abstract class EntityNPC extends EntityLiving
}
public void onDataWatcherUpdate(int data) {
if(this.isPlayer() && (data == 29 || data == 11)) // && this.worldObj.client)
if(this.isPlayer() && data == 29) // (data == 29 || data == 11)) // && this.worldObj.client)
this.updateSize();
}
@ -3457,7 +3462,7 @@ public abstract class EntityNPC extends EntityLiving
// align = this.getNaturalAlign(this.rand);
// }
this.setAlignment(align);
this.setHeight(tagCompund.hasKey("Height", 5) ? tagCompund.getFloat("Height") : this.getBaseSize(this.rand));
this.setHeight(tagCompund.hasKey("Height", 5) ? tagCompund.getFloat("Height") : (this.isPlayer() ? this.getBaseSize(this.rand) / this.species.renderer.height * this.species.size : this.getBaseSize(this.rand)));
this.setManaPoints(tagCompund.getInteger("Mana"));
Enum type = null;
if(tagCompund.hasKey("ClassType", 8) && this.species != null && this.species.classEnum != null) {
@ -4426,7 +4431,7 @@ public abstract class EntityNPC extends EntityLiving
if(!this.isPlayer())
this.setItemInfo(info);
this.setAlignment(align != null ? align.alignment : this.getNaturalAlign(this.rand));
this.setHeight(this.getBaseSize(this.rand));
this.setHeight(this.isPlayer() ? this.getBaseSize(this.rand) / this.species.renderer.height * this.species.size : this.getBaseSize(this.rand));
return align != null ? align : new AlignmentData(this.alignment);
}

View file

@ -0,0 +1,23 @@
package game.entity.npc;
import game.world.BlockPos;
public class PlayerCharacter {
public final String name;
public final String info;
public final Alignment align;
public final String dim;
public final BlockPos pos;
public final String type;
public final int level;
public PlayerCharacter(String name, String info, Alignment align, String dim, BlockPos pos, String type, int level) {
this.name = name;
this.info = info;
this.align = align;
this.dim = dim;
this.pos = pos;
this.type = type;
this.level = level;
}
}

View file

@ -144,6 +144,8 @@ public abstract class EntityLiving extends Entity
protected boolean firstEffectUpdate = true;
private boolean attacked;
private boolean damaged;
private String description;
private String blockType;
@ -477,6 +479,14 @@ public abstract class EntityLiving extends Entity
// /**
// * Only use is to identify if class is an instance of player for experience dropping
// */
public String getDescription() {
return this.description;
}
public void setDescription(String desc) {
this.description = desc;
}
public Random getRNG()
{
@ -594,6 +604,8 @@ public abstract class EntityLiving extends Entity
// tagCompound.setBoolean("NoAI", this.isAIDisabled());
// }
tagCompound.setInteger("Age", this.getGrowingAge());
if(this.description != null)
tagCompound.setString("Description", this.description);
}
/**
@ -661,6 +673,9 @@ public abstract class EntityLiving extends Entity
// this.setNoAI(tagCompund.getBoolean("NoAI"));
this.setGrowingAge(tagCompund.getInteger("Age"));
this.description = tagCompund.hasKey("Description", 8) ? tagCompund.getString("Description") : null;
if(this.description != null && this.description.isEmpty())
this.description = null;
}
protected void updateEffects()