From 0147690eba859b59da2b469f420452ff3021062c Mon Sep 17 00:00:00 2001 From: MattBDev Date: Thu, 2 Jun 2016 19:38:35 -0400 Subject: [PATCH] Make Sponge compile It doesn't work but it allows the project to compile. --- .../sponge/generator/SpongePlotGenerator.java | 16 ++++---- .../sponge/listener/MainListener.java | 11 ++++-- .../sponge/object/SpongePlayer.java | 24 ++++++------ .../sponge/util/SpongeCommand.java | 31 ++++++++------- .../sponge/util/SpongeMetrics.java | 4 +- .../sponge/util/SpongeSchematicHandler.java | 8 ++-- .../sponge/util/SpongeSetupUtils.java | 38 ++++++++++++------- .../plotsquared/sponge/util/SpongeUtil.java | 19 ++++++---- .../sponge/util/block/FastQueue.java | 27 +++++++------ .../sponge/util/block/SendChunk.java | 6 +-- 10 files changed, 104 insertions(+), 80 deletions(-) diff --git a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java index 3c919120a..47e0e2a7b 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java @@ -10,7 +10,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.ReflectionUtils; import com.plotsquared.sponge.util.SpongeUtil; import org.spongepowered.api.data.DataContainer; -import org.spongepowered.api.world.WorldCreationSettings; import org.spongepowered.api.world.biome.BiomeGenerationSettings; import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeTypes; @@ -19,6 +18,7 @@ import org.spongepowered.api.world.gen.BiomeGenerator; import org.spongepowered.api.world.gen.GenerationPopulator; import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; +import org.spongepowered.api.world.storage.WorldProperties; import java.util.ArrayList; import java.util.List; @@ -69,10 +69,10 @@ public class SpongePlotGenerator implements WorldGeneratorModifier, GeneratorWra } @Override - public void modifyWorldGenerator(WorldCreationSettings settings, DataContainer data, WorldGenerator wg) { - String worldName = settings.getWorldName(); - wg.setBaseGenerationPopulator(new SpongeTerrainGen(this, this.plotGenerator)); - wg.setBiomeGenerator(new BiomeGenerator() { + public void modifyWorldGenerator(WorldProperties world, DataContainer settings, WorldGenerator worldGenerator) { + String worldName = world.getWorldName(); + worldGenerator.setBaseGenerationPopulator(new SpongeTerrainGen(this, this.plotGenerator)); + worldGenerator.setBiomeGenerator(new BiomeGenerator() { @Override public void generateBiomes(MutableBiomeArea buffer) { PlotArea area = PS.get().getPlotArea(worldName, null); @@ -89,13 +89,13 @@ public class SpongePlotGenerator implements WorldGeneratorModifier, GeneratorWra } }); for (BiomeType type : ReflectionUtils. getStaticFields(BiomeTypes.class)) { - BiomeGenerationSettings biomeSettings = wg.getBiomeSettings(type); + BiomeGenerationSettings biomeSettings = worldGenerator.getBiomeSettings(type); biomeSettings.getGenerationPopulators().clear(); biomeSettings.getPopulators().clear(); biomeSettings.getGroundCoverLayers().clear(); } - wg.getGenerationPopulators().clear(); - wg.getPopulators().clear(); + worldGenerator.getGenerationPopulators().clear(); + worldGenerator.getPopulators().clear(); PS.get().loadWorld(worldName, this); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java index 4f92abd6a..c4d9709c7 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/listener/MainListener.java @@ -41,7 +41,7 @@ import org.spongepowered.api.event.block.ChangeBlockEvent; import org.spongepowered.api.event.block.NotifyNeighborBlockEvent; import org.spongepowered.api.event.command.SendCommandEvent; import org.spongepowered.api.event.entity.BreedEntityEvent; -import org.spongepowered.api.event.entity.DisplaceEntityEvent; +import org.spongepowered.api.event.entity.MoveEntityEvent; import org.spongepowered.api.event.entity.SpawnEntityEvent; import org.spongepowered.api.event.message.MessageEvent; import org.spongepowered.api.event.network.ClientConnectionEvent; @@ -643,12 +643,15 @@ public class MainListener { } @Listener - public void onMove(DisplaceEntityEvent.TargetPlayer event) { + public void onMove(MoveEntityEvent event) { + if (!(event.getTargetEntity() instanceof Player)) { + return; + } org.spongepowered.api.world.Location from = event.getFromTransform().getLocation(); org.spongepowered.api.world.Location to = event.getToTransform().getLocation(); int x2; if (MathMan.roundInt(from.getX()) != (x2 = MathMan.roundInt(to.getX()))) { - Player player = event.getTargetEntity(); + Player player = (Player) event.getTargetEntity(); PlotPlayer pp = SpongeUtil.getPlayer(player); // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); @@ -697,7 +700,7 @@ public class MainListener { } int z2; if (MathMan.roundInt(from.getZ()) != (z2 = MathMan.roundInt(to.getZ()))) { - Player player = event.getTargetEntity(); + Player player = (Player) event.getTargetEntity(); PlotPlayer pp = SpongeUtil.getPlayer(player); // Cancel teleport TaskManager.TELEPORT_QUEUE.remove(pp.getName()); diff --git a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index b59cc2b0c..2b9c2674d 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -185,40 +185,40 @@ public class SpongePlayer extends PlotPlayer { this.player.playSound(null, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2256: - this.player.playSound(SoundTypes.RECORDS_11, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_11, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2257: - this.player.playSound(SoundTypes.RECORDS_13, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_13, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2258: - this.player.playSound(SoundTypes.RECORDS_BLOCKS, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_BLOCKS, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2259: - this.player.playSound(SoundTypes.RECORDS_CAT, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_CAT, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2260: - this.player.playSound(SoundTypes.RECORDS_CHIRP, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_CHIRP, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2261: - this.player.playSound(SoundTypes.RECORDS_FAR, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_FAR, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2262: - this.player.playSound(SoundTypes.RECORDS_MALL, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_MALL, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2263: - this.player.playSound(SoundTypes.RECORDS_MELLOHI, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_MELLOHI, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2264: - this.player.playSound(SoundTypes.RECORDS_STAL, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_STAL, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2265: - this.player.playSound(SoundTypes.RECORDS_STRAD, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_STRAD, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2266: - this.player.playSound(SoundTypes.RECORDS_WAIT, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_WAIT, SpongeUtil.getLocation(location).getPosition(), 1); break; case 2267: - this.player.playSound(SoundTypes.RECORDS_WARD, SpongeUtil.getLocation(location).getPosition(), 1); + this.player.playSound(SoundTypes.RECORD_WARD, SpongeUtil.getLocation(location).getPosition(), 1); break; } } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java index cb2e0e60c..f40c18853 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java @@ -22,33 +22,36 @@ import java.util.UUID; public class SpongeCommand implements CommandCallable { @Override - public CommandResult process(CommandSource cmd, String string) throws CommandException { + public CommandResult process(CommandSource source, String arguments) throws CommandException { TaskManager.runTask(() -> { - String id = cmd.getIdentifier(); - PlotPlayer pp; + String id = source.getIdentifier(); + PlotPlayer plotPlayer = null; try { UUID uuid = UUID.fromString(id); - Player player = SpongeMain.THIS.getServer().getPlayer(uuid).get(); - pp = SpongeUtil.getPlayer(player); + + Optional player = SpongeMain.THIS.getServer().getPlayer(uuid); + if (player.isPresent()) { + plotPlayer = SpongeUtil.getPlayer(player.get()); + } } catch (Exception ignored) { - pp = ConsolePlayer.getConsole(); + plotPlayer = ConsolePlayer.getConsole(); } - MainCommand.onCommand(pp, string.isEmpty() ? new String[]{} : string.split(" ")); + MainCommand.onCommand(plotPlayer, arguments.isEmpty() ? new String[]{} : arguments.split(" ")); }); return CommandResult.success(); } @Override - public List getSuggestions(CommandSource source, String s) throws CommandException { + public List getSuggestions(CommandSource source, String arguments) throws CommandException { if (!(source instanceof Player)) { return null; } PlotPlayer player = SpongeUtil.getPlayer((Player) source); - String[] args = s.split(" "); + String[] args = arguments.split(" "); if (args.length == 0) { return Collections.singletonList(MainCommand.getInstance().toString()); } - Collection objects = MainCommand.getInstance().tab(player, args, s.endsWith(" ")); + Collection objects = MainCommand.getInstance().tab(player, args, arguments.endsWith(" ")); if (objects == null) { return null; } @@ -60,22 +63,22 @@ public class SpongeCommand implements CommandCallable { } @Override - public boolean testPermission(CommandSource cmd) { + public boolean testPermission(CommandSource source) { return true; } @Override - public Optional getShortDescription(CommandSource cmd) { + public Optional getShortDescription(CommandSource source) { return Optional.of(Text.of("Shows plot help")); } @Override - public Optional getHelp(CommandSource cmd) { + public Optional getHelp(CommandSource source) { return Optional.of(Text.of("/plot")); } @Override - public Text getUsage(CommandSource cmd) { + public Text getUsage(CommandSource source) { return Text.of("/plot "); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java index fc69dc60a..3627a3902 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java @@ -402,9 +402,7 @@ public class SpongeMetrics { // Server software specific section final String pluginName = plugin.getName(); final boolean onlineMode = game.getServer().getOnlineMode(); // TRUE if online mode is enabled - final String pluginVersion = plugin.getVersion().get(); - // TODO no visible way to get MC version at the moment - // TODO added by game.getPlatform().getMinecraftVersion() -- impl in 2.1 + final String pluginVersion = plugin.getVersion().orElse("unknown"); final String serverVersion = String.format("%s %s", "Sponge", game.getPlatform().getMinecraftVersion()); final int playersOnline = game.getServer().getOnlinePlayers().size(); diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSchematicHandler.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSchematicHandler.java index e23f40d56..3b8fda321 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSchematicHandler.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSchematicHandler.java @@ -64,7 +64,7 @@ public class SpongeSchematicHandler extends SchematicHandler { schematic.put("WEOffsetY", new IntTag("WEOffsetY", 0)); schematic.put("WEOffsetZ", new IntTag("WEOffsetZ", 0)); // Arrays of data types - List tileEntities = new ArrayList(); + List tileEntities = new ArrayList<>(); byte[] blocks = new byte[width * height * length]; byte[] blockData = new byte[width * height * length]; // Queue @@ -78,7 +78,7 @@ public class SpongeSchematicHandler extends SchematicHandler { public void run() { schematic.put("Blocks", new ByteArrayTag("Blocks", blocks)); schematic.put("Data", new ByteArrayTag("Data", blockData)); - schematic.put("Entities", new ListTag("Entities", CompoundTag.class, new ArrayList())); + schematic.put("Entities", new ListTag("Entities", CompoundTag.class, new ArrayList<>())); schematic.put("TileEntities", new ListTag("TileEntities", CompoundTag.class, tileEntities)); whenDone.value = new CompoundTag("Schematic", schematic); TaskManager.runTask(whenDone); @@ -105,7 +105,7 @@ public class SpongeSchematicHandler extends SchematicHandler { int sy = pos1.getY(); int ey = pos2.getY(); // Generate list of chunks - ArrayList chunks = new ArrayList(); + ArrayList chunks = new ArrayList<>(); for (int x = bcx; x <= tcx; x++) { for (int z = bcz; z <= tcz; z++) { chunks.add(new ChunkLoc(x, z)); @@ -270,7 +270,7 @@ public class SpongeSchematicHandler extends SchematicHandler { rawTag = null; } if (rawTag != null) { - Map values = new HashMap(); + Map values = new HashMap<>(); for (Entry entry : rawTag.getValue().entrySet()) { values.put(entry.getKey(), entry.getValue()); } diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java index 47f7617bc..9b37548e5 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeSetupUtils.java @@ -13,8 +13,7 @@ import org.spongepowered.api.Sponge; import org.spongepowered.api.world.DimensionTypes; import org.spongepowered.api.world.GeneratorTypes; import org.spongepowered.api.world.World; -import org.spongepowered.api.world.WorldCreationSettings; -import org.spongepowered.api.world.WorldCreationSettings.Builder; +import org.spongepowered.api.world.WorldArchetype; import org.spongepowered.api.world.gen.WorldGenerator; import org.spongepowered.api.world.gen.WorldGeneratorModifier; import org.spongepowered.api.world.storage.WorldProperties; @@ -24,6 +23,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Map.Entry; import java.util.Objects; +import java.util.Optional; public class SpongeSetupUtils extends SetupUtils { @@ -140,32 +140,44 @@ public class SpongeSetupUtils extends SetupUtils { if (object.setupGenerator != null) { // create world with generator GeneratorWrapper gw = SetupUtils.generators.get(object.setupGenerator); - WorldGeneratorModifier wgm = (WorldGeneratorModifier) gw.getPlatformGenerator(); + WorldArchetype wgm = (WorldArchetype) gw.getPlatformGenerator(); - WorldCreationSettings settings = Sponge.getRegistry().createBuilder(Builder.class) - .name(object.world) + WorldArchetype settings = WorldArchetype.builder() .loadsOnStartup(true) .keepsSpawnLoaded(true) .dimension(DimensionTypes.OVERWORLD) .generator(GeneratorTypes.OVERWORLD) .usesMapFeatures(false) .enabled(true) - .generatorModifiers(wgm) - .build(); - WorldProperties properties = Sponge.getServer().createWorldProperties(settings).get(); - World worldObj = Sponge.getServer().loadWorld(properties).get(); + //.generatorModifiers(wgm) + .build("PS",object.world); + WorldProperties properties = null; + try { + properties = Sponge.getServer().createWorldProperties(object.world, settings); + } catch (IOException e) { + e.printStackTrace(); + } + World worldObj; + Optional world1 = Sponge.getServer().loadWorld(properties); + if (world1.isPresent()) { + worldObj = world1.get(); + } } else { // create vanilla world - WorldCreationSettings settings = Sponge.getRegistry().createBuilder(Builder.class) - .name(object.world) + WorldArchetype settings = WorldArchetype.builder() .loadsOnStartup(true) .keepsSpawnLoaded(true) .dimension(DimensionTypes.OVERWORLD) .generator(GeneratorTypes.OVERWORLD) .usesMapFeatures(true) .enabled(true) - .build(); - WorldProperties properties = Sponge.getServer().createWorldProperties(settings).get(); + .build("PS",object.world); + WorldProperties properties = null; + try { + properties = Sponge.getServer().createWorldProperties(object.world, settings); + } catch (IOException e) { + e.printStackTrace(); + } World worldObj = Sponge.getServer().loadWorld(properties).get(); } return object.world; diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java index a750627a7..482530170 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java @@ -18,8 +18,7 @@ import com.intellectualcrafters.plot.util.WorldUtil; import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.object.SpongePlayer; import net.minecraft.block.Block; -import net.minecraft.world.biome.BiomeGenBase; -import org.apache.commons.lang3.NotImplementedException; +import net.minecraft.world.biome.Biome; import org.spongepowered.api.Sponge; import org.spongepowered.api.block.BlockState; import org.spongepowered.api.block.BlockType; @@ -42,6 +41,7 @@ import org.spongepowered.api.world.biome.BiomeType; import org.spongepowered.api.world.biome.BiomeTypes; import org.spongepowered.api.world.extent.Extent; +import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -113,7 +113,7 @@ public class SpongeUtil extends WorldUtil { } public static BiomeType getBiome(int index) { - return (BiomeType) BiomeGenBase.getBiome(index); + return (BiomeType) Biome.getBiome(index); } public static Text getText(String m) { @@ -349,9 +349,9 @@ public class SpongeUtil extends WorldUtil { } @Override - public Location getSpawn(PlotPlayer pp) { - throw new NotImplementedException("TODO IMPLEMENT THIS"); // TODO FIXME - // Probably can call a respawn event and get the location from there + public Location getSpawn(PlotPlayer plotPlayer) { + World world = getWorld(plotPlayer.getLocation().getWorld()); + return SpongeUtil.getLocation(world.getSpawnLocation()); } @Override @@ -371,7 +371,12 @@ public class SpongeUtil extends WorldUtil { @Override public void saveWorld(String worldName) { - throw new NotImplementedException("TODO WIP"); // TODO FIXME + try { + SpongeUtil.getWorld(worldName).save(); + } catch (IOException e) { + e.printStackTrace(); + PS.debug("Failed to save world."); + } } @Override diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/FastQueue.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/FastQueue.java index 10c7b3e27..791443e43 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/FastQueue.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/FastQueue.java @@ -8,11 +8,11 @@ import com.intellectualcrafters.plot.util.SetQueue; import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper; import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.sponge.util.SpongeUtil; -import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.ClassInheritanceMultiMap; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.chunk.BlockStateContainer; import net.minecraft.world.chunk.storage.ExtendedBlockStorage; import org.spongepowered.api.world.Chunk; import org.spongepowered.api.world.World; @@ -132,11 +132,11 @@ public class FastQueue extends SlowQueue { ExtendedBlockStorage section = sections[j]; if ((section == null) || (fs.getCount(j) >= 4096)) { section = new ExtendedBlockStorage(j << 4, flag); - section.setData(newArray); + //section.setData(newArray); //todo sections[j] = section; continue; } - char[] currentArray = section.getData(); + BlockStateContainer currentArray = section.getData(); boolean fill = true; for (int k = 0; k < newArray.length; k++) { char n = newArray[k]; @@ -146,10 +146,10 @@ public class FastQueue extends SlowQueue { continue; case 1: fill = false; - currentArray[k] = 0; + //currentArray[k] = 0; //todo continue; default: - currentArray[k] = n; + //currentArray[k] = n; //todo continue; } } @@ -226,10 +226,11 @@ public class FastQueue extends SlowQueue { if ((bc.getRelight(j) == 0 && !fixAll) || bc.getCount(j) == 0 || (bc.getCount(j) >= 4096 && bc.getAir(j) == 0)) { continue; } - char[] array = section.getData(); + BlockStateContainer array = section.getData(); int l = PseudoRandom.random.random(2); - for (int k = 0; k < array.length; k++) { - int i = array[k]; + for (int k = 0; k < array.getSerializedSize(); k++) { + int i = 0; + //i = array[k]; //todo if (i < 16) { continue; } @@ -285,7 +286,8 @@ public class FastQueue extends SlowQueue { } public boolean isSolid(int i) { - return i != 0 && Block.getBlockById(i).isOpaqueCube(); + //return i != 0 && Block.getBlockById(i).isOpaqueCube(); + throw new UnsupportedOperationException("Unsupported"); } public int getId(ExtendedBlockStorage[] sections, int x, int y, int z) { @@ -300,9 +302,10 @@ public class FastQueue extends SlowQueue { if (section == null) { return 0; } - char[] array = section.getData(); + BlockStateContainer array = section.getData(); int j = MainUtil.CACHE_J[y][x][z]; - return array[j] >> 4; + //return array[j] >> 4; //todo: fix for 1.9.4 + return 0; } /** diff --git a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SendChunk.java b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SendChunk.java index 9cde50e31..1cc330b34 100644 --- a/Sponge/src/main/java/com/plotsquared/sponge/util/block/SendChunk.java +++ b/Sponge/src/main/java/com/plotsquared/sponge/util/block/SendChunk.java @@ -13,7 +13,7 @@ import com.plotsquared.sponge.util.SpongeUtil; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.network.NetHandlerPlayServer; -import net.minecraft.network.play.server.S21PacketChunkData; +import net.minecraft.network.play.server.SPacketChunkData; import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.world.Chunk; import org.spongepowered.api.world.World; @@ -81,9 +81,9 @@ public class SendChunk { continue; } chunks.remove(chunk); - NetHandlerPlayServer con = nmsPlayerMP.playerNetServerHandler; + NetHandlerPlayServer con = nmsPlayerMP.connection; net.minecraft.world.chunk.Chunk nmsChunk = (net.minecraft.world.chunk.Chunk) chunk; - S21PacketChunkData packet = new S21PacketChunkData(nmsChunk, true, 65535); + SPacketChunkData packet = new SPacketChunkData(nmsChunk, 65535); con.sendPacket(packet); } }