diff --git a/bukkit0/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java b/bukkit0/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java index d7174123..669c5a1c 100644 --- a/bukkit0/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java +++ b/bukkit0/src/main/java/com/boydti/fawe/bukkit/FaweBukkit.java @@ -151,7 +151,7 @@ public class FaweBukkit implements IFawe, Listener { if (this.version == null) { try { this.version = new int[3]; - final String[] split = Bukkit.getBukkitVersion().split("-")[0].split("\\."); + final String[] split = plugin.getDescription().getVersion().split("-")[0].split("\\."); this.version[0] = Integer.parseInt(split[0]); this.version[1] = Integer.parseInt(split[1]); if (split.length == 3) { diff --git a/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java b/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java index d45737e5..7ed1ba9f 100644 --- a/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java +++ b/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java @@ -36,8 +36,6 @@ import net.minecraft.server.v1_10_R1.BlockPosition; import net.minecraft.server.v1_10_R1.Blocks; import net.minecraft.server.v1_10_R1.ChunkCoordIntPair; import net.minecraft.server.v1_10_R1.ChunkSection; -import net.minecraft.server.v1_10_R1.DataBits; -import net.minecraft.server.v1_10_R1.DataPalette; import net.minecraft.server.v1_10_R1.DataPaletteBlock; import net.minecraft.server.v1_10_R1.Entity; import net.minecraft.server.v1_10_R1.EntityHuman; @@ -666,13 +664,6 @@ public class BukkitQueue_1_10 extends BukkitQueue_0 runPart) { + m = color(m); + String color = "GRAY"; + boolean newline = false; + for (String line : m.split("\n")) { + boolean hasColor = line.charAt(0) == '\u00A7'; + String[] splitColor = line.split("\u00A7"); + for (String part : splitColor) { + if (hasColor) { + color = getColorName(part.charAt(0)); + part = part.substring(1); + } + runPart.run(part, color, newline); + hasColor = true; + } + newline = true; + } + } } diff --git a/core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java b/core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java index 620a8051..db4b5ef5 100644 --- a/core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java +++ b/core/src/main/java/com/boydti/fawe/example/MappedFaweQueue.java @@ -3,10 +3,10 @@ package com.boydti.fawe.example; import com.boydti.fawe.Fawe; import com.boydti.fawe.config.Settings; import com.boydti.fawe.object.FaweChunk; +import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.object.IntegerPair; import com.boydti.fawe.object.RunnableVal; import com.boydti.fawe.object.exception.FaweException; -import com.boydti.fawe.object.FaweQueue; import com.boydti.fawe.util.MainUtil; import com.boydti.fawe.util.SetQueue; import com.boydti.fawe.util.TaskManager; diff --git a/forge110/build.gradle b/forge110/build.gradle index 31ad1fa2..00506cf9 100644 --- a/forge110/build.gradle +++ b/forge110/build.gradle @@ -18,7 +18,6 @@ apply plugin: 'com.github.johnrengelman.shadow' dependencies { compile project(':core') compile 'org.spongepowered:spongeapi:4.+' - compile 'org.mcstats.sponge:metrics:R8-SNAPSHOT' compile 'com.sk89q.worldedit:worldedit-forge-mc1.8.9:6.1.1' } diff --git a/forge110/src/main/java/com/boydti/fawe/forge/FaweForge.java b/forge110/src/main/java/com/boydti/fawe/forge/FaweForge.java index 7382c121..58846960 100644 --- a/forge110/src/main/java/com/boydti/fawe/forge/FaweForge.java +++ b/forge110/src/main/java/com/boydti/fawe/forge/FaweForge.java @@ -17,12 +17,15 @@ import com.sk89q.worldedit.world.World; import java.io.File; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import java.util.UUID; import javax.management.InstanceAlreadyExistsException; import net.minecraft.command.ServerCommandManager; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraftforge.fml.common.FMLCommonHandler; +import net.minecraftforge.fml.common.ModMetadata; import org.apache.logging.log4j.Logger; public class FaweForge implements IFawe { @@ -30,11 +33,13 @@ public class FaweForge implements IFawe { private final ForgeMain parent; private final File directory; private final Logger logger; + private final ModMetadata mod; - public FaweForge(ForgeMain plugin, Logger logger, File directory) { + public FaweForge(ForgeMain plugin, Logger logger, ModMetadata mod, File directory) { this.parent = plugin; this.logger = logger; this.directory = directory; + this.mod = mod; try { Fawe.set(this); } catch (InstanceAlreadyExistsException e) { @@ -52,16 +57,17 @@ public class FaweForge implements IFawe { return directory; } + private HashMap commands = new HashMap<>(); + @Override public void setupCommand(String label, FaweCommand cmd) { - if (TaskManager.IMP != null) { - TaskManager.IMP.task(new Runnable() { - @Override - public void run() { - ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); - scm.registerCommand(new ForgeCommand(label, cmd)); - } - }); + this.commands.put(label, cmd); + } + + public void insertCommands() { + for (Map.Entry entry : commands.entrySet()) { + ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); + scm.registerCommand(new ForgeCommand(entry.getKey(), entry.getValue())); } } @@ -96,7 +102,7 @@ public class FaweForge implements IFawe { @Override public int[] getVersion() { - String[] version = FMLCommonHandler.instance().getMinecraftServerInstance().getMinecraftVersion().split("\\."); + String[] version = this.mod.version.split("\\."); return new int[] {Integer.parseInt(version[0]), Integer.parseInt(version[1]), Integer.parseInt(version[2])}; } diff --git a/forge110/src/main/java/com/boydti/fawe/forge/ForgeMain.java b/forge110/src/main/java/com/boydti/fawe/forge/ForgeMain.java index c9faabe4..e478f99f 100644 --- a/forge110/src/main/java/com/boydti/fawe/forge/ForgeMain.java +++ b/forge110/src/main/java/com/boydti/fawe/forge/ForgeMain.java @@ -12,6 +12,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -29,7 +30,12 @@ public class ForgeMain { File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit"); MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); - this.IMP = new com.boydti.fawe.forge.FaweForge(this, event.getModLog(), directory); + this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory); + } + + @Mod.EventHandler + public void serverLoad(FMLServerStartingEvent event) { + IMP.insertCommands(); } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/forge110/src/main/java/com/boydti/fawe/forge/ForgePlayer.java b/forge110/src/main/java/com/boydti/fawe/forge/ForgePlayer.java index dab16474..fcde99c3 100644 --- a/forge110/src/main/java/com/boydti/fawe/forge/ForgePlayer.java +++ b/forge110/src/main/java/com/boydti/fawe/forge/ForgePlayer.java @@ -10,7 +10,6 @@ import com.sk89q.worldedit.forge.ForgeWorldEdit; import java.util.UUID; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentBase; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; @@ -52,10 +51,9 @@ public class ForgePlayer extends FawePlayer { @Override public void sendMessage(String msg) { - for (String part : msg.split("\n")) { - part = BBC.color(part); - TextComponentBase text = new TextComponentString(part); - this.parent.addChatMessage(text); + msg = BBC.color(msg); + for (String line : msg.split("\n")) { + this.parent.addChatMessage(new TextComponentString(line)); } } diff --git a/forge110/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java b/forge110/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java index 7134fbaa..42db99c1 100644 --- a/forge110/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java +++ b/forge110/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java @@ -42,7 +42,6 @@ import net.minecraft.network.play.server.SPacketDestroyEntities; import net.minecraft.server.management.PlayerChunkMap; import net.minecraft.server.management.PlayerChunkMapEntry; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BitArray; import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.IntHashMap; import net.minecraft.util.math.BlockPos; @@ -51,7 +50,6 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.BlockStateContainer; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IBlockStatePalette; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.NibbleArray; @@ -61,20 +59,23 @@ import net.minecraftforge.fml.common.FMLCommonHandler; public class ForgeQueue_All extends NMSMappedFaweQueue { - private Method methodFromNative; - private Method methodToNative; + private static Method methodFromNative; + private static Method methodToNative; public ForgeQueue_All(String world) { super(world); - try { - Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); - this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); - this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); - methodFromNative.setAccessible(true); - methodToNative.setAccessible(true); - } catch (Throwable e) { - throw new RuntimeException(e); + if (methodFromNative == null) { + try { + Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); + this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); + this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); + methodFromNative.setAccessible(true); + methodToNative.setAccessible(true); + } catch (Throwable e) { + throw new RuntimeException(e); + } } + getImpWorld(); } private BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(0, 0, 0); @@ -300,7 +301,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue= 4096) { if (fs.sectionPalettes != null && fs.sectionPalettes[j] != null) { @@ -421,17 +423,10 @@ public class ForgeQueue_All extends NMSMappedFaweQueue) field.get(tracker); + break; } } for (ClassInheritanceMultiMap slice : entitieSlices) { @@ -619,7 +615,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue commands = new HashMap<>(); + @Override - public void setupCommand(final String label, final FaweCommand cmd) { - if (TaskManager.IMP != null) { - TaskManager.IMP.task(new Runnable() { - @Override - public void run() { - ServerCommandManager scm = (ServerCommandManager) MinecraftServer.getServer().getCommandManager(); - scm.registerCommand(new ForgeCommand(label, cmd)); - } - }); + public void setupCommand(String label, FaweCommand cmd) { + this.commands.put(label, cmd); + } + + public void insertCommands() { + for (Map.Entry entry : commands.entrySet()) { + ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); + scm.registerCommand(new ForgeCommand(entry.getKey(), entry.getValue())); } } @@ -92,7 +99,7 @@ public class FaweForge implements IFawe { @Override public int[] getVersion() { - String[] version = MinecraftServer.getServer().getMinecraftVersion().split("\\."); + String[] version = this.mod.version.split("\\."); return new int[] {Integer.parseInt(version[0]), Integer.parseInt(version[1]), Integer.parseInt(version[2])}; } diff --git a/forge1710/src/main/java/com/boydti/fawe/forge/ForgeMain.java b/forge1710/src/main/java/com/boydti/fawe/forge/ForgeMain.java index b49efea9..b55802bc 100644 --- a/forge1710/src/main/java/com/boydti/fawe/forge/ForgeMain.java +++ b/forge1710/src/main/java/com/boydti/fawe/forge/ForgeMain.java @@ -6,6 +6,7 @@ import com.boydti.fawe.object.FawePlayer; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.event.FMLPreInitializationEvent; +import cpw.mods.fml.common.event.FMLServerStartingEvent; import cpw.mods.fml.common.event.FMLServerStoppingEvent; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; @@ -30,7 +31,12 @@ public class ForgeMain { File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit"); MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); - this.IMP = new FaweForge(this, event.getModLog(), directory); + this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory); + } + + @Mod.EventHandler + public void serverLoad(FMLServerStartingEvent event) { + IMP.insertCommands(); } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/forge1710/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java b/forge1710/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java index fbad5c97..937263e2 100644 --- a/forge1710/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java +++ b/forge1710/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java @@ -54,20 +54,23 @@ import net.minecraft.world.gen.ChunkProviderServer; public class ForgeQueue_All extends NMSMappedFaweQueue { - private Method methodFromNative; - private Method methodToNative; + private static Method methodFromNative; + private static Method methodToNative; public ForgeQueue_All(String world) { super(world); - try { - Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); - this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); - this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); - methodFromNative.setAccessible(true); - methodToNative.setAccessible(true); - } catch (Throwable e) { - throw new RuntimeException(e); + if (methodFromNative == null) { + try { + Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); + this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); + this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); + methodFromNative.setAccessible(true); + methodToNative.setAccessible(true); + } catch (Throwable e) { + throw new RuntimeException(e); + } } + getImpWorld(); } @Override @@ -242,6 +245,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue slice : entitieSlices) { @@ -605,7 +609,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue commands = new HashMap<>(); + @Override public void setupCommand(String label, FaweCommand cmd) { - if (TaskManager.IMP != null) { - TaskManager.IMP.task(new Runnable() { - @Override - public void run() { - ServerCommandManager scm = (ServerCommandManager) MinecraftServer.getServer().getCommandManager(); - scm.registerCommand(new ForgeCommand(label, cmd)); - } - }); + this.commands.put(label, cmd); + } + + public void insertCommands() { + for (Map.Entry entry : commands.entrySet()) { + ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); + scm.registerCommand(new ForgeCommand(entry.getKey(), entry.getValue())); } } @@ -96,7 +102,7 @@ public class FaweForge implements IFawe { @Override public int[] getVersion() { - String[] version = MinecraftServer.getServer().getMinecraftVersion().split("\\."); + String[] version = this.mod.version.split("\\."); return new int[] {Integer.parseInt(version[0]), Integer.parseInt(version[1]), Integer.parseInt(version[2])}; } diff --git a/forge189/src/main/java/com/boydti/fawe/forge/ForgeMain.java b/forge189/src/main/java/com/boydti/fawe/forge/ForgeMain.java index 38633cdb..730d635c 100644 --- a/forge189/src/main/java/com/boydti/fawe/forge/ForgeMain.java +++ b/forge189/src/main/java/com/boydti/fawe/forge/ForgeMain.java @@ -13,6 +13,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -30,7 +31,12 @@ public class ForgeMain { File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit"); MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); - this.IMP = new com.boydti.fawe.forge.FaweForge(this, event.getModLog(), directory); + this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory); + } + + @Mod.EventHandler + public void serverLoad(FMLServerStartingEvent event) { + IMP.insertCommands(); } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/forge189/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java b/forge189/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java index 85e6baa6..ea755950 100644 --- a/forge189/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java +++ b/forge189/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java @@ -52,20 +52,23 @@ import net.minecraft.world.gen.ChunkProviderServer; public class ForgeQueue_All extends NMSMappedFaweQueue { - private Method methodFromNative; - private Method methodToNative; + private static Method methodFromNative; + private static Method methodToNative; public ForgeQueue_All(String world) { super(world); - try { - Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); - this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); - this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); - methodFromNative.setAccessible(true); - methodToNative.setAccessible(true); - } catch (Throwable e) { - throw new RuntimeException(e); + if (methodFromNative == null) { + try { + Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); + this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); + this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); + methodFromNative.setAccessible(true); + methodToNative.setAccessible(true); + } catch (Throwable e) { + throw new RuntimeException(e); + } } + getImpWorld(); } private BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(0, 0, 0); @@ -481,6 +484,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue) field.get(tracker); + break; } } for (ClassInheritanceMultiMap slice : entitieSlices) { @@ -567,7 +571,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue commands = new HashMap<>(); + @Override public void setupCommand(String label, FaweCommand cmd) { - if (TaskManager.IMP != null) { - TaskManager.IMP.task(new Runnable() { - @Override - public void run() { - ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); - scm.registerCommand(new ForgeCommand(label, cmd)); - } - }); + this.commands.put(label, cmd); + } + + public void insertCommands() { + for (Map.Entry entry : commands.entrySet()) { + ServerCommandManager scm = (ServerCommandManager) FMLCommonHandler.instance().getMinecraftServerInstance().getCommandManager(); + scm.registerCommand(new ForgeCommand(entry.getKey(), entry.getValue())); } } @@ -96,7 +102,7 @@ public class FaweForge implements IFawe { @Override public int[] getVersion() { - String[] version = FMLCommonHandler.instance().getMinecraftServerInstance().getMinecraftVersion().split("\\."); + String[] version = this.mod.version.split("\\."); return new int[] {Integer.parseInt(version[0]), Integer.parseInt(version[1]), Integer.parseInt(version[2])}; } diff --git a/forge194/src/main/java/com/boydti/fawe/forge/ForgeMain.java b/forge194/src/main/java/com/boydti/fawe/forge/ForgeMain.java index c9faabe4..e478f99f 100644 --- a/forge194/src/main/java/com/boydti/fawe/forge/ForgeMain.java +++ b/forge194/src/main/java/com/boydti/fawe/forge/ForgeMain.java @@ -12,6 +12,7 @@ import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.fml.common.FMLCommonHandler; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; import net.minecraftforge.fml.common.event.FMLServerStoppingEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -29,7 +30,12 @@ public class ForgeMain { File directory = new File(event.getModConfigurationDirectory() + File.separator + "FastAsyncWorldEdit"); MinecraftForge.EVENT_BUS.register(this); FMLCommonHandler.instance().bus().register(this); - this.IMP = new com.boydti.fawe.forge.FaweForge(this, event.getModLog(), directory); + this.IMP = new FaweForge(this, event.getModLog(), event.getModMetadata(), directory); + } + + @Mod.EventHandler + public void serverLoad(FMLServerStartingEvent event) { + IMP.insertCommands(); } @SubscribeEvent(priority = EventPriority.HIGHEST) diff --git a/forge194/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java b/forge194/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java index 7134fbaa..a89bbb07 100644 --- a/forge194/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java +++ b/forge194/src/main/java/com/boydti/fawe/forge/v0/ForgeQueue_All.java @@ -42,7 +42,6 @@ import net.minecraft.network.play.server.SPacketDestroyEntities; import net.minecraft.server.management.PlayerChunkMap; import net.minecraft.server.management.PlayerChunkMapEntry; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BitArray; import net.minecraft.util.ClassInheritanceMultiMap; import net.minecraft.util.IntHashMap; import net.minecraft.util.math.BlockPos; @@ -51,7 +50,6 @@ import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraft.world.chunk.BlockStateContainer; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IBlockStatePalette; import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.NibbleArray; @@ -61,20 +59,23 @@ import net.minecraftforge.fml.common.FMLCommonHandler; public class ForgeQueue_All extends NMSMappedFaweQueue { - private Method methodFromNative; - private Method methodToNative; + private static Method methodFromNative; + private static Method methodToNative; public ForgeQueue_All(String world) { super(world); - try { - Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); - this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); - this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); - methodFromNative.setAccessible(true); - methodToNative.setAccessible(true); - } catch (Throwable e) { - throw new RuntimeException(e); + if (methodFromNative == null) { + try { + Class converter = Class.forName("com.sk89q.worldedit.forge.NBTConverter"); + this.methodFromNative = converter.getDeclaredMethod("toNative", Tag.class); + this.methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class); + methodFromNative.setAccessible(true); + methodToNative.setAccessible(true); + } catch (Throwable e) { + throw new RuntimeException(e); + } } + getImpWorld(); } private BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(0, 0, 0); @@ -412,8 +413,9 @@ public class ForgeQueue_All extends NMSMappedFaweQueue= 4096) { if (fs.sectionPalettes != null && fs.sectionPalettes[j] != null) { @@ -421,17 +423,10 @@ public class ForgeQueue_All extends NMSMappedFaweQueue) field.get(tracker); + break; } } for (ClassInheritanceMultiMap slice : entitieSlices) { @@ -619,7 +615,7 @@ public class ForgeQueue_All extends NMSMappedFaweQueue