mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 02:20:01 +03:00
54 lines
2.5 KiB
Diff
54 lines
2.5 KiB
Diff
--- ../src-base/minecraft/net/minecraft/item/ItemWrittenBook.java
|
|
+++ ../src-work/minecraft/net/minecraft/item/ItemWrittenBook.java
|
|
@@ -10,6 +10,7 @@
|
|
import net.minecraft.nbt.NBTTagList;
|
|
import net.minecraft.nbt.NBTTagString;
|
|
import net.minecraft.network.play.server.SPacketSetSlot;
|
|
+import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.stats.StatList;
|
|
import net.minecraft.util.ActionResult;
|
|
import net.minecraft.util.EnumActionResult;
|
|
@@ -21,6 +22,7 @@
|
|
import net.minecraft.util.text.TextFormatting;
|
|
import net.minecraft.util.text.translation.I18n;
|
|
import net.minecraft.world.World;
|
|
+import net.minecraft.world.WorldServer;
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
@@ -119,6 +121,24 @@
|
|
String s = nbttaglist.getStringTagAt(i);
|
|
ITextComponent itextcomponent;
|
|
|
|
+ // CraftBukkit start
|
|
+ // Some commands use the worldserver variable but we leave it full of null values,
|
|
+ // so we must temporarily populate it with the world of the commandsender
|
|
+ WorldServer[] prev = MinecraftServer.getServerInst().worlds;
|
|
+ MinecraftServer server = MinecraftServer.getServerInst();
|
|
+ server.worlds = new WorldServer[server.worldServerList.size()];
|
|
+ server.worlds[0] = (WorldServer) player.getEntityWorld();
|
|
+ int bpos = 0;
|
|
+ for (int pos = 1; pos < server.worlds.length; pos++) {
|
|
+ WorldServer world = server.worldServerList.get(bpos++);
|
|
+ if (server.worlds[0] == world) {
|
|
+ pos--;
|
|
+ continue;
|
|
+ }
|
|
+ server.worlds[pos] = world;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
try
|
|
{
|
|
itextcomponent = ITextComponent.Serializer.fromJsonLenient(s);
|
|
@@ -128,6 +148,9 @@
|
|
{
|
|
itextcomponent = new TextComponentString(s);
|
|
}
|
|
+ finally {
|
|
+ MinecraftServer.getServerInst().worlds = prev;
|
|
+ }
|
|
|
|
nbttaglist.set(i, new NBTTagString(ITextComponent.Serializer.componentToJson(itextcomponent)));
|
|
}
|