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-18 17:25:55 +03:00
|
|
|
private float width = 1f;
|
|
|
|
|
private float height = 1.8f;
|
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-18 17:25:55 +03:00
|
|
|
nbttagcompound.setFloat("HitboxWidth", width);
|
|
|
|
|
nbttagcompound.setFloat("HitboxHeight", height);
|
|
|
|
|
}
|
|
|
|
|
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-18 17:25:55 +03:00
|
|
|
width = nbttagcompound.getFloat("HitboxWidth");
|
|
|
|
|
height = nbttagcompound.getFloat("HitboxHeight");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getWidth() {
|
|
|
|
|
return width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setWidth(float width) {
|
|
|
|
|
this.width = width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float getHeight() {
|
|
|
|
|
return height;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setHeight(float height) {
|
|
|
|
|
this.height = height;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
}
|