2024-02-18 17:25:55 +03:00
|
|
|
package noppes.npcs.controllers.data;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
|
|
2024-02-29 22:20:35 -05:00
|
|
|
public class HitboxData {
|
|
|
|
|
|
2024-02-29 22:41:58 -05:00
|
|
|
private float widthScale = 1f;
|
|
|
|
|
private float heightScale = 1f;
|
2024-02-29 22:20:35 -05:00
|
|
|
private boolean hitboxEnabled = false;
|
2024-02-18 17:25:55 +03:00
|
|
|
|
|
|
|
|
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
2024-02-29 22:20:35 -05:00
|
|
|
nbttagcompound.setBoolean("HitboxEnabled", hitboxEnabled);
|
|
|
|
|
if(hitboxEnabled) {
|
2024-02-29 22:41:58 -05:00
|
|
|
nbttagcompound.setFloat("HitboxWidthScale", widthScale);
|
|
|
|
|
nbttagcompound.setFloat("HitboxHeightScale", heightScale);
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
return nbttagcompound;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
2024-02-29 22:34:09 -05:00
|
|
|
hitboxEnabled = nbttagcompound.getBoolean("HitboxEnabled");
|
2024-02-29 22:20:35 -05:00
|
|
|
if(hitboxEnabled) {
|
2024-02-29 22:41:58 -05:00
|
|
|
widthScale = nbttagcompound.getFloat("HitboxWidthScale");
|
|
|
|
|
heightScale = nbttagcompound.getFloat("HitboxHeightScale");
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:41:58 -05:00
|
|
|
public float getWidthScale() {
|
|
|
|
|
return widthScale;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:41:58 -05:00
|
|
|
public void setWidthScale(float widthScale) {
|
|
|
|
|
this.widthScale = widthScale;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:41:58 -05:00
|
|
|
public float getHeightScale() {
|
|
|
|
|
return heightScale;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:41:58 -05:00
|
|
|
public void setHeightScale(float heightScale) {
|
|
|
|
|
this.heightScale = heightScale;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:20:35 -05:00
|
|
|
public boolean isHitboxEnabled() {
|
|
|
|
|
return hitboxEnabled;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
|
2024-02-29 22:20:35 -05:00
|
|
|
public void setHitboxEnabled(boolean hitboxEnabled) {
|
|
|
|
|
this.hitboxEnabled = hitboxEnabled;
|
2024-02-18 17:25:55 +03:00
|
|
|
}
|
|
|
|
|
}
|