mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 06:07:27 +00:00
Max Hitbox Scale Config
This commit is contained in:
1 parent
ea48e445e2
commit
7bd055296b
3 files changed
+19
-2
No files matched your search
@@ -24,12 +24,12 @@ public class SubGuiCustomHitbox extends SubGuiInterface implements ITextfieldLis
|
||||
addLabel(new GuiNpcLabel(3,"hitbox.width", guiLeft + 5, guiTop + 57));
|
||||
addTextField(new GuiNpcTextField(2,this, fontRendererObj, guiLeft + 122, guiTop + 53, 50, 18, hitboxData.getWidthScale() + ""));
|
||||
getTextField(2).floatsOnly = true;
|
||||
getTextField(2).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 20);
|
||||
getTextField(2).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1);
|
||||
|
||||
addLabel(new GuiNpcLabel(4,"hitbox.height", guiLeft + 5, guiTop + 79));
|
||||
addTextField(new GuiNpcTextField(3,this, fontRendererObj, guiLeft + 122, guiTop + 75, 50, 18, hitboxData.getHeightScale() + ""));
|
||||
getTextField(3).floatsOnly = true;
|
||||
getTextField(3).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 20);
|
||||
getTextField(3).setMinMaxDefaultFloat(0, Float.MAX_VALUE, 1);
|
||||
}
|
||||
addButton(new GuiNpcButton(66, guiLeft + 82, guiTop + 190,98, 20, "gui.done"));
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ public class ConfigMain
|
||||
public static Property NpcUseOpCommandsProperty;
|
||||
public static boolean NpcUseOpCommands = false;
|
||||
|
||||
public static Property HitBoxScaleMaxProperty;
|
||||
public static int HitBoxScaleMax = 15;
|
||||
|
||||
/**
|
||||
* Update Properties
|
||||
**/
|
||||
@@ -192,6 +195,9 @@ public class ConfigMain
|
||||
SkinOverlayLimitProperty = config.get(NPC, "Skin Overlay Limit", 10, "The maximum number of overlays any npc/player can hold.");
|
||||
SkinOverlayLimit = SkinOverlayLimitProperty.getInt(10);
|
||||
|
||||
HitBoxScaleMaxProperty = config.get(NPC, "HitBox Scale Limit", 15, "The maximum scale factor for a custom hitbox");
|
||||
HitBoxScaleMax = HitBoxScaleMaxProperty.getInt(15);
|
||||
|
||||
// Update
|
||||
TrackedQuestUpdateFrequencyProperty = config.get(UPDATE, "Tracked Quest Update Frequency", 5, "How often in seconds to update a players tracked quest. [Only applies to Item Quest currently]");
|
||||
TrackedQuestUpdateFrequency = TrackedQuestUpdateFrequencyProperty.getInt(5);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.config.ConfigMain;
|
||||
|
||||
public class HitboxData {
|
||||
|
||||
@@ -11,7 +12,12 @@ public class HitboxData {
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setBoolean("HitboxEnabled", hitboxEnabled);
|
||||
if(hitboxEnabled) {
|
||||
if(widthScale > ConfigMain.HitBoxScaleMax)
|
||||
widthScale = ConfigMain.HitBoxScaleMax;
|
||||
nbttagcompound.setFloat("HitboxWidthScale", widthScale);
|
||||
|
||||
if(heightScale > ConfigMain.HitBoxScaleMax)
|
||||
heightScale = ConfigMain.HitBoxScaleMax;
|
||||
nbttagcompound.setFloat("HitboxHeightScale", heightScale);
|
||||
}
|
||||
return nbttagcompound;
|
||||
@@ -21,7 +27,12 @@ public class HitboxData {
|
||||
hitboxEnabled = nbttagcompound.getBoolean("HitboxEnabled");
|
||||
if(hitboxEnabled) {
|
||||
widthScale = nbttagcompound.getFloat("HitboxWidthScale");
|
||||
if(widthScale > ConfigMain.HitBoxScaleMax)
|
||||
widthScale = ConfigMain.HitBoxScaleMax;
|
||||
|
||||
heightScale = nbttagcompound.getFloat("HitboxHeightScale");
|
||||
if(heightScale > ConfigMain.HitBoxScaleMax)
|
||||
heightScale = ConfigMain.HitBoxScaleMax;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user