Files
CustomNPC-Plus/src/main/java/noppes/npcs/controllers/data/HitboxData.java
T

51 lines
1.4 KiB
Java
Raw Normal View History

2024-02-18 17:25:55 +03:00
package noppes.npcs.controllers.data;
import net.minecraft.nbt.NBTTagCompound;
public class HitboxData {
2024-02-29 22:41:58 -05:00
private float widthScale = 1f;
private float heightScale = 1f;
private boolean hitboxEnabled = false;
2024-02-18 17:25:55 +03:00
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
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");
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
}
public boolean isHitboxEnabled() {
return hitboxEnabled;
2024-02-18 17:25:55 +03:00
}
public void setHitboxEnabled(boolean hitboxEnabled) {
this.hitboxEnabled = hitboxEnabled;
2024-02-18 17:25:55 +03:00
}
}