-Overlays for players and NPCs are now grouped in an "overlay handler" object, similar to how you retrieve timers.

-Fixed client NPC overlay updates.
This commit is contained in:
Luis C.M committed 2022-05-23 20:41:32 -05:00
1 parent 6fa5d0d8de
commit 6220a8ce14
20 files changed
+203 -164

No files matched your search

@@ -1,9 +1,13 @@
package noppes.npcs.controllers.data;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import noppes.npcs.entity.data.DataSkinOverlays;
import noppes.npcs.scripted.interfaces.ISkinOverlay;
public class SkinOverlayData implements ISkinOverlay {
public DataSkinOverlays parent;
public ResourceLocation location = null;
public String texture;
public boolean glow = true;
@@ -20,6 +24,9 @@ public class SkinOverlayData implements ISkinOverlay {
public float offsetY = 0.0F;
public float offsetZ = 0.0F;
public SkinOverlayData() {
}
public SkinOverlayData(String texture) {
this.texture = texture;
}
@@ -41,6 +48,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setTexture(String texture) {
this.texture = texture;
this.updateClient();
}
public String getTexture() {
return texture;
@@ -48,6 +56,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setGlow(boolean glow) {
this.glow = glow;
this.updateClient();
}
public boolean getGlow() {
return glow;
@@ -55,6 +64,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setAlpha(float alpha) {
this.alpha = alpha;
this.updateClient();
}
public float getAlpha() {
return alpha;
@@ -62,6 +72,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setSize(float size) {
this.size = size;
this.updateClient();
}
public float getSize() {
return size;
@@ -70,6 +81,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setScale(float scaleX, float scaleY) {
this.scaleX = scaleX;
this.scaleY = scaleY;
this.updateClient();
}
public float getScaleX() {
return scaleX;
@@ -81,6 +93,7 @@ public class SkinOverlayData implements ISkinOverlay {
public void setSpeed(float speedX, float speedY) {
this.speedX = speedX;
this.speedY = speedY;
this.updateClient();
}
public float getSpeedX() {
return speedX;
@@ -93,6 +106,7 @@ public class SkinOverlayData implements ISkinOverlay {
this.offsetX = offsetX;
this.offsetY = offsetY;
this.offsetZ = offsetZ;
this.updateClient();
}
public float getOffsetX() {
return offsetX;
@@ -106,8 +120,51 @@ public class SkinOverlayData implements ISkinOverlay {
public void setLocation(ResourceLocation location) {
this.location = location;
this.updateClient();
}
public ResourceLocation getLocation() {
return this.location;
}
public void readFromNBT(NBTTagCompound compound) {
this.texture = compound.getString("SkinOverlayTexture");
this.glow = compound.getBoolean("SkinOverlayGlow");
this.alpha = compound.getFloat("SkinOverlayAlpha");
this.size = compound.getFloat("SkinOverlaySize");
this.speedX = compound.getFloat("SkinOverlaySpeedX");
this.speedY = compound.getFloat("SkinOverlaySpeedY");
this.scaleX = compound.getFloat("SkinOverlayScaleX");
this.scaleY = compound.getFloat("SkinOverlayScaleY");
this.offsetX = compound.getFloat("SkinOverlayOffsetX");
this.offsetY = compound.getFloat("SkinOverlayOffsetY");
this.offsetZ = compound.getFloat("SkinOverlayOffsetZ");
}
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
compound.setString("SkinOverlayTexture", this.getTexture());
compound.setBoolean("SkinOverlayGlow", this.getGlow());
compound.setFloat("SkinOverlayAlpha", this.getAlpha());
compound.setFloat("SkinOverlaySize", this.getSize());
compound.setFloat("SkinOverlaySpeedX", this.getSpeedX());
compound.setFloat("SkinOverlaySpeedY", this.getSpeedY());
compound.setFloat("SkinOverlayScaleX", this.getScaleX());
compound.setFloat("SkinOverlayScaleY", this.getScaleY());
compound.setFloat("SkinOverlayOffsetX", this.getOffsetX());
compound.setFloat("SkinOverlayOffsetY", this.getOffsetY());
compound.setFloat("SkinOverlayOffsetZ", this.getOffsetZ());
return compound;
}
public static ISkinOverlay overlayFromNBT(NBTTagCompound compound) {
SkinOverlayData overlay = new SkinOverlayData();
overlay.readFromNBT(compound);
return overlay;
}
private void updateClient() {
if (this.parent != null) {
this.parent.updateClient();
}
}
}