mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-17 14:35:12 +00:00
Proper Reformating
This commit is contained in:
1 parent
ce75880aba
commit
180d257024
1179 files changed
+59847
-61583
No files matched your search
@@ -11,85 +11,83 @@ import noppes.npcs.entity.data.ModelData;
|
||||
import noppes.npcs.entity.data.ModelPartData;
|
||||
|
||||
public class EntityCustomNpc extends EntityNPCFlying {
|
||||
public ModelData modelData = new ModelData();
|
||||
public ModelData modelData = new ModelData();
|
||||
|
||||
public EntityCustomNpc(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound) {
|
||||
super.readEntityFromNBT(compound);
|
||||
if(compound.hasKey("NpcModelData")) {
|
||||
npcVersion = compound.getInteger("ModRev");
|
||||
VersionCompatibility.CheckModelCompatibility(this, compound);
|
||||
modelData.readFromNBT(compound.getCompoundTag("NpcModelData"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound) {
|
||||
super.writeEntityToNBT(compound);
|
||||
compound.setTag("NpcModelData", modelData.writeToNBT());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
super.onUpdate();
|
||||
if(isRemote()){
|
||||
ModelPartData particles = modelData.getPartData("particles");
|
||||
if(particles != null && !isKilled()){
|
||||
CustomNpcs.proxy.spawnParticle(this, "ModelData", modelData, particles);
|
||||
}
|
||||
EntityLivingBase entity = modelData.getEntity(this);
|
||||
if(entity != null){
|
||||
try{
|
||||
entity.onUpdate();
|
||||
}
|
||||
catch(Exception e){
|
||||
|
||||
}
|
||||
EntityUtil.Copy(this, entity);
|
||||
}
|
||||
}
|
||||
public EntityCustomNpc(World world) {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mountEntity(Entity par1Entity){
|
||||
super.mountEntity(par1Entity);
|
||||
updateHitbox();
|
||||
@Override
|
||||
public void readEntityFromNBT(NBTTagCompound compound) {
|
||||
super.readEntityFromNBT(compound);
|
||||
if (compound.hasKey("NpcModelData")) {
|
||||
npcVersion = compound.getInteger("ModRev");
|
||||
VersionCompatibility.CheckModelCompatibility(this, compound);
|
||||
modelData.readFromNBT(compound.getCompoundTag("NpcModelData"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHitbox() {
|
||||
Entity entity = modelData.getEntity(this);
|
||||
if(modelData == null || entity == null){
|
||||
baseHeight = 1.9f - modelData.getBodyY() + (modelData.modelScale.head.scaleY - 1) / 2;
|
||||
super.updateHitbox();
|
||||
}
|
||||
else{
|
||||
if(entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface)entity).updateHitbox();
|
||||
width = (entity.width / 5f) * display.modelSize;
|
||||
height = (entity.height / 5f) * display.modelSize;
|
||||
if(display.hitboxData.isHitboxEnabled()){
|
||||
@Override
|
||||
public void writeEntityToNBT(NBTTagCompound compound) {
|
||||
super.writeEntityToNBT(compound);
|
||||
compound.setTag("NpcModelData", modelData.writeToNBT());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
super.onUpdate();
|
||||
if (isRemote()) {
|
||||
ModelPartData particles = modelData.getPartData("particles");
|
||||
if (particles != null && !isKilled()) {
|
||||
CustomNpcs.proxy.spawnParticle(this, "ModelData", modelData, particles);
|
||||
}
|
||||
EntityLivingBase entity = modelData.getEntity(this);
|
||||
if (entity != null) {
|
||||
try {
|
||||
entity.onUpdate();
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
EntityUtil.Copy(this, entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mountEntity(Entity par1Entity) {
|
||||
super.mountEntity(par1Entity);
|
||||
updateHitbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateHitbox() {
|
||||
Entity entity = modelData.getEntity(this);
|
||||
if (modelData == null || entity == null) {
|
||||
baseHeight = 1.9f - modelData.getBodyY() + (modelData.modelScale.head.scaleY - 1) / 2;
|
||||
super.updateHitbox();
|
||||
} else {
|
||||
if (entity instanceof EntityNPCInterface)
|
||||
((EntityNPCInterface) entity).updateHitbox();
|
||||
width = (entity.width / 5f) * display.modelSize;
|
||||
height = (entity.height / 5f) * display.modelSize;
|
||||
if (display.hitboxData.isHitboxEnabled()) {
|
||||
width = width * display.hitboxData.getWidthScale();
|
||||
height = height * display.hitboxData.getHeightScale();
|
||||
}
|
||||
|
||||
if(width < 0.1f)
|
||||
width = 0.1f;
|
||||
if(height < 0.1f)
|
||||
height = 0.1f;
|
||||
if(isKilled() && stats.hideKilledBody){
|
||||
if (width < 0.1f)
|
||||
width = 0.1f;
|
||||
if (height < 0.1f)
|
||||
height = 0.1f;
|
||||
if (isKilled() && stats.hideKilledBody) {
|
||||
width = 0.00001f;
|
||||
}
|
||||
if(width / 2 > worldObj.MAX_ENTITY_RADIUS) {
|
||||
if (width / 2 > worldObj.MAX_ENTITY_RADIUS) {
|
||||
worldObj.MAX_ENTITY_RADIUS = width / 2;
|
||||
}
|
||||
|
||||
this.setPosition(posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
this.setPosition(posX, posY, posZ);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user