Merge pull request #59 from c0508383/master

CNPC+ 1.6 Fixes
This commit is contained in:
Luis C.M authored and GitHub committed 2022-06-15 00:57:57 -05:00
commit c6cdae5106
7 files changed
+36 -3

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)
@@ -284,7 +284,7 @@ public class PacketHandlerClient extends PacketHandlerServer{
Minecraft.getMinecraft().thePlayer.swingItem();
}
else if(type == EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS) {
EntityPlayer sendingPlayer = (EntityPlayer) Minecraft.getMinecraft().theWorld.getEntityByID(buffer.readInt());
EntityPlayer sendingPlayer = Minecraft.getMinecraft().theWorld.getPlayerEntityByName(Server.readString(buffer));
NBTTagCompound compound = Server.readNBT(buffer);
NoppesUtil.updateSkinOverlayData(sendingPlayer, compound);
}
@@ -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();
@@ -7,6 +7,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import noppes.npcs.CustomNpcs;
import noppes.npcs.ICompatibilty;
import noppes.npcs.VersionCompatibility;
import noppes.npcs.constants.EnumOptionType;
@@ -529,6 +530,10 @@ public class Dialog implements ICompatibilty, IDialog {
}
public void addImage(int id, IDialogImage image) {
if (dialogImages.size() >= CustomNpcs.DialogImageLimit) {
return;
}
((DialogImage) image).id = id;
dialogImages.put(id, image);
}
@@ -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;
@@ -51,13 +52,17 @@ public class DataSkinOverlays implements IOverlayHandler {
if (parent instanceof PlayerData) {
NBTTagCompound compound = this.writeToNBT(new NBTTagCompound());
((PlayerData) parent).player.getEntityData().setTag("SkinOverlayData", compound.getTagList("SkinOverlayData",10));
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, ((PlayerData) parent).player.getEntityId(), compound);
Server.sendToAll(EnumPacketClient.PLAYER_UPDATE_SKIN_OVERLAYS, ((PlayerData) parent).player.getCommandSenderName(), compound);
} else if (parent instanceof EntityNPCInterface) {
((EntityNPCInterface) parent).updateClient = true;
}
}
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;
}