mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 15:27:29 +00:00
Fix Some Bugs
This commit is contained in:
1 parent
4ae8978399
commit
e3cfdd5ee1
6 files changed
+18
-19
No files matched your search
@@ -56,6 +56,6 @@ public final class ScrollGroupPacket extends LargeAbstractPacket {
|
||||
|
||||
@Override
|
||||
protected void handleCompleteData(ByteBuf data, EntityPlayer player) throws IOException {
|
||||
NoppesUtil.setScrollData(data);
|
||||
NoppesUtil.setScrollGroup(data);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import kamkeel.npcs.util.ByteBufUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.LogWriter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -81,10 +82,14 @@ public final class SyncPacket extends LargeAbstractPacket {
|
||||
|
||||
EnumSyncType type = EnumSyncType.values()[syncTypeOrdinal];
|
||||
EnumSyncAction action = EnumSyncAction.values()[syncActionOrdinal];
|
||||
NBTTagCompound tag = ByteBufUtils.readBigNBT(data);
|
||||
|
||||
// Now do your client-side logic (similar to your old clientSync() or clientSyncUpdate() approach)
|
||||
handleSyncPacketClient(type, action, categoryID, tag);
|
||||
try {
|
||||
NBTTagCompound tag = ByteBufUtils.readBigNBT(data);
|
||||
// Now do your client-side logic (similar to your old clientSync() or clientSyncUpdate() approach)
|
||||
handleSyncPacketClient(type, action, categoryID, tag);
|
||||
}
|
||||
catch (RuntimeException e){
|
||||
LogWriter.error(String.format("Attempted to Sync %s but it was too big", type.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSyncPacketClient(EnumSyncType enumSyncType, EnumSyncAction enumSyncAction, int id, NBTTagCompound data) {
|
||||
|
||||
@@ -42,7 +42,7 @@ public final class GuiRequestPacket extends AbstractPacket {
|
||||
|
||||
@Override
|
||||
public boolean needsNPC() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ByteBufUtils extends cpw.mods.fml.common.network.ByteBufUtils {
|
||||
int length = buffer.readInt();
|
||||
byte[] bytes = new byte[length];
|
||||
buffer.readBytes(bytes);
|
||||
return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(31457280L));
|
||||
return CompressedStreamTools.func_152457_a(bytes, new NBTSizeTracker(15728640L));
|
||||
}
|
||||
|
||||
public static void writeString(ByteBuf buffer, String s){
|
||||
|
||||
@@ -191,18 +191,6 @@ public class NoppesUtil {
|
||||
group = new HashMap<String,Integer>();
|
||||
}
|
||||
|
||||
public static void addScrollData(ByteBuf buffer) {
|
||||
try {
|
||||
int size = buffer.readInt();
|
||||
for(int i = 0; i < size; i++){
|
||||
int id = buffer.readInt();
|
||||
String name = ByteBufUtils.readString(buffer);
|
||||
data.put(name, id);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void setScrollData(ByteBuf buffer) {
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null)
|
||||
|
||||
@@ -91,6 +91,7 @@ public class DialogController implements IDialogHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private DialogCategory loadCategoryDir(File dir) {
|
||||
DialogCategory category = new DialogCategory();
|
||||
category.title = dir.getName();
|
||||
@@ -103,6 +104,11 @@ public class DialogController implements IDialogHandler {
|
||||
dialog.readNBTPartial(NBTJsonUtil.LoadFile(file));
|
||||
category.dialogs.put(dialog.id, dialog);
|
||||
dialog.category = category;
|
||||
|
||||
if (dialog.text != null && dialog.text.length() > 15000) {
|
||||
LogWriter.error("Extremely big dialog loaded: [ID: " + dialog.id + "] Title: "
|
||||
+ dialog.title + " (Length: " + dialog.text.length() + " chars)");
|
||||
}
|
||||
}
|
||||
catch(Exception e){
|
||||
LogWriter.error("Error loading: " + file.getAbsolutePath(), e);
|
||||
|
||||
Reference in new issue
Block a user