Added configurable limits to skin overlays and dialog images.

This commit is contained in:
Luis C.M committed 2022-06-14 23:27:15 -05:00
1 parent 7cfc4ccca4
commit 40a210ce8f
5 files changed
+29 -1

No files matched your search

+14
View File
@@ -103,6 +103,12 @@ public class CustomNpcs {
@ConfigProp(info = "Number of chunk loading npcs that can be active at the same time")
public static int ChuckLoaders = 20;
@ConfigProp(info = "The maximum number of images any dialog can hold.")
public static int DialogImageLimit = 10;
@ConfigProp(info = "The maximum number of images any dialog can hold.")
public static int SkinOverlayLimit = 10;
public static File Dir;
@ConfigProp(info = "Set to false if you want to disable guns")
@@ -174,6 +180,14 @@ public class CustomNpcs {
if(NpcSizeLimit < 1)
NpcSizeLimit = 1;
if (DialogImageLimit < 0) {
DialogImageLimit = 0;
}
if (SkinOverlayLimit < 0) {
SkinOverlayLimit = 0;
}
if (TrackingInfoAlignment < 0)
TrackingInfoAlignment = 0;
if (TrackingInfoAlignment > 8)
@@ -3,6 +3,7 @@ package noppes.npcs.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.nbt.NBTTagCompound;
import noppes.npcs.CustomNpcs;
import noppes.npcs.client.Client;
import noppes.npcs.client.NoppesUtil;
import noppes.npcs.client.gui.global.GuiNPCManageDialogs;
@@ -323,6 +324,10 @@ public class SubGuiNpcDialogVisual extends SubGuiInterface implements ISubGuiLis
if (activeMenu == 3) {
if (button.id == 1) {
if (dialog.dialogImages.size() >= CustomNpcs.DialogImageLimit) {
return;
}
int addId = 0;
if (selected != -1 && imageScroll.getSelected() != null) {
DialogImage selectedImage = (DialogImage) dialog.dialogImages.get(Integer.valueOf(imageScroll.getSelected()));
@@ -211,7 +211,7 @@ public class RenderNPCHumanMale extends RenderNPCInterface
GL11.glRotatef(f15 / 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f15 / 2.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180F, 0.0F, 1.0F, 0.0F);
GL11.glColor4f(1.0F,1.0F,1.0F, npc.isInvisible() && !npc.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer) ? 0.2F : 1.0F);
GL11.glColor4f(1.0F,1.0F,1.0F, npc.isInvisible() ? 0.2F : 1.0F);
GL11.glEnable(GL11.GL_BLEND);
modelBipedMain.renderCloak(0.0625F);
GL11.glPopMatrix();
@@ -2,6 +2,7 @@ package noppes.npcs.entity.data;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.CustomNpcs;
import noppes.npcs.Server;
import noppes.npcs.constants.EnumPacketClient;
import noppes.npcs.controllers.data.PlayerData;
@@ -58,6 +59,10 @@ public class DataSkinOverlays implements IOverlayHandler {
}
public void add(int id, ISkinOverlay data) {
if (this.overlayList.size() >= CustomNpcs.SkinOverlayLimit) {
return;
}
((SkinOverlay) data).parent = this;
this.overlayList.put(id, data);
updateClient();
@@ -1146,6 +1146,10 @@ public class ScriptNpc<T extends EntityNPCInterface> extends ScriptLiving<T> imp
}
public void setOverlayTexture(String overlayTexture) {
if (this.getOverlays().size() >= CustomNpcs.SkinOverlayLimit) {
return;
}
this.getOverlays().add(0, NpcAPI.Instance().createSkinOverlay(overlayTexture));
npc.updateClient = true;
}