mirror of
https://github.com/BG-Software-LLC/WildLoaders.git
synced 2025-01-07 19:18:03 +01:00
Added the ability of chunk loaders to load more than one chunk at a time
This commit is contained in:
parent
1468eda8c1
commit
019ae2492c
@ -1,6 +1,7 @@
|
|||||||
package com.bgsoftware.wildloaders.api.loaders;
|
package com.bgsoftware.wildloaders.api.loaders;
|
||||||
|
|
||||||
import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
|
import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -29,6 +30,11 @@ public interface ChunkLoader {
|
|||||||
*/
|
*/
|
||||||
Location getLocation();
|
Location getLocation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the chunks that this chunk-loader is loading.
|
||||||
|
*/
|
||||||
|
Chunk[] getLoadedChunks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the NPC of this chunk loader.
|
* Get the NPC of this chunk loader.
|
||||||
*/
|
*/
|
||||||
|
@ -19,4 +19,19 @@ public interface LoaderData {
|
|||||||
*/
|
*/
|
||||||
ItemStack getLoaderItem();
|
ItemStack getLoaderItem();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the radius of chunks that the chunk loader will load.
|
||||||
|
* If the radius is 0, it means only one chunk is loaded. A radius of 1, will load 3x3 chunks, etc.
|
||||||
|
* Please note: In some versions, when loading one chunk, the nearby chunks are also being loaded!
|
||||||
|
* @param chunksRadius The chunk radius to set.
|
||||||
|
*/
|
||||||
|
void setChunksRadius(int chunksRadius);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the radius of chunks that the chunk loader will load.
|
||||||
|
* If the radius is 0, it means only one chunk is loaded. A radius of 1, will load 3x3 chunks, etc.
|
||||||
|
* Please note: In some versions, when loading one chunk, the nearby chunks are also being loaded!
|
||||||
|
*/
|
||||||
|
int getChunksRadius();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public interface LoadersManager {
|
|||||||
* @param timeLeft The default amount of time to run.
|
* @param timeLeft The default amount of time to run.
|
||||||
* @param itemStack The item stack to drop upon break.
|
* @param itemStack The item stack to drop upon break.
|
||||||
*/
|
*/
|
||||||
void createLoaderData(String name, long timeLeft, ItemStack itemStack);
|
LoaderData createLoaderData(String name, long timeLeft, ItemStack itemStack);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all the chunk loaders data from cache.
|
* Remove all the chunk loaders data from cache.
|
||||||
|
@ -72,9 +72,11 @@ public final class LoadersHandler implements LoadersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WChunkLoader addChunkLoader(LoaderData loaderData, UUID placer, Location location, long timeLeft){
|
public WChunkLoader addChunkLoader(LoaderData loaderData, UUID placer, Location location, long timeLeft){
|
||||||
WChunkLoader chunkLoader = new WChunkLoader(loaderData.getName(), placer, location, timeLeft);
|
WChunkLoader chunkLoader = new WChunkLoader(loaderData, placer, location, timeLeft);
|
||||||
chunkLoaders.put(location, chunkLoader);
|
chunkLoaders.put(location, chunkLoader);
|
||||||
chunkLoadersByChunks.put(ChunkPosition.of(location), chunkLoader);
|
for (Chunk loadedChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
chunkLoadersByChunks.put(ChunkPosition.of(loadedChunk), chunkLoader);
|
||||||
|
}
|
||||||
plugin.getNPCs().createNPC(location);
|
plugin.getNPCs().createNPC(location);
|
||||||
return chunkLoader;
|
return chunkLoader;
|
||||||
}
|
}
|
||||||
@ -83,7 +85,9 @@ public final class LoadersHandler implements LoadersManager {
|
|||||||
public void removeChunkLoader(ChunkLoader chunkLoader) {
|
public void removeChunkLoader(ChunkLoader chunkLoader) {
|
||||||
Location location = chunkLoader.getLocation();
|
Location location = chunkLoader.getLocation();
|
||||||
chunkLoaders.remove(location);
|
chunkLoaders.remove(location);
|
||||||
chunkLoadersByChunks.remove(ChunkPosition.of(location));
|
for (Chunk loadedChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
chunkLoadersByChunks.remove(ChunkPosition.of(loadedChunk));
|
||||||
|
}
|
||||||
chunkLoader.getNPC().ifPresent(npc -> plugin.getNPCs().killNPC(npc));
|
chunkLoader.getNPC().ifPresent(npc -> plugin.getNPCs().killNPC(npc));
|
||||||
|
|
||||||
Query.DELETE_CHUNK_LOADER.insertParameters()
|
Query.DELETE_CHUNK_LOADER.insertParameters()
|
||||||
@ -92,9 +96,10 @@ public final class LoadersHandler implements LoadersManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLoaderData(String name, long timeLeft, ItemStack itemStack) {
|
public LoaderData createLoaderData(String name, long timeLeft, ItemStack itemStack) {
|
||||||
LoaderData loaderData = new WLoaderData(name, timeLeft, itemStack);
|
LoaderData loaderData = new WLoaderData(name, timeLeft, itemStack);
|
||||||
loadersData.put(name, loaderData);
|
loadersData.put(name, loaderData);
|
||||||
|
return loaderData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
package com.bgsoftware.wildloaders.handlers;
|
package com.bgsoftware.wildloaders.handlers;
|
||||||
|
|
||||||
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
import com.bgsoftware.wildloaders.WildLoadersPlugin;
|
||||||
|
import com.bgsoftware.wildloaders.api.loaders.LoaderData;
|
||||||
import com.bgsoftware.wildloaders.utils.items.ItemBuilder;
|
import com.bgsoftware.wildloaders.utils.items.ItemBuilder;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -34,39 +35,40 @@ public final class SettingsHandler {
|
|||||||
plugin.getLoaders().removeLoadersData();
|
plugin.getLoaders().removeLoadersData();
|
||||||
|
|
||||||
for (String name : cfg.getConfigurationSection("chunkloaders").getKeys(false)) {
|
for (String name : cfg.getConfigurationSection("chunkloaders").getKeys(false)) {
|
||||||
long timeLeft = cfg.getLong("chunkloaders." + name + ".time", 0);
|
ConfigurationSection loaderSection = cfg.getConfigurationSection("chunkloaders." + name);
|
||||||
|
|
||||||
|
long timeLeft = loaderSection.getLong("time", 0);
|
||||||
|
|
||||||
ItemBuilder itemBuilder = null;
|
ItemBuilder itemBuilder = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
Material type = Material.valueOf(cfg.getString("chunkloaders." + name + ".type", ""));
|
Material type = Material.valueOf(loaderSection.getString("type", ""));
|
||||||
short data = (short) cfg.getInt("chunkloaders." + name + ".data", 0);
|
short data = (short) loaderSection.getInt("data", 0);
|
||||||
|
|
||||||
itemBuilder = new ItemBuilder(type, data);
|
itemBuilder = new ItemBuilder(type, data);
|
||||||
|
|
||||||
if(cfg.contains("chunkloaders." + name + ".name"))
|
if(loaderSection.contains("name"))
|
||||||
itemBuilder.setDisplayName(ChatColor.translateAlternateColorCodes('&',
|
itemBuilder.setDisplayName(ChatColor.translateAlternateColorCodes('&', loaderSection.getString("name")));
|
||||||
cfg.getString("chunkloaders." + name + ".name")));
|
|
||||||
|
|
||||||
if(cfg.contains("chunkloaders." + name + ".lore")) {
|
if(loaderSection.contains("lore")) {
|
||||||
List<String> lore = new ArrayList<>();
|
List<String> lore = new ArrayList<>();
|
||||||
|
|
||||||
cfg.getStringList("chunkloaders." + name + ".lore")
|
loaderSection.getStringList("lore").forEach(line ->
|
||||||
.forEach(line -> lore.add(ChatColor.translateAlternateColorCodes('&', line)));
|
lore.add(ChatColor.translateAlternateColorCodes('&', line)));
|
||||||
|
|
||||||
itemBuilder.setLore(lore);
|
itemBuilder.setLore(lore);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfg.contains("chunkloaders." + name + ".enchants")) {
|
if(loaderSection.contains("enchants")) {
|
||||||
for(String line : cfg.getStringList("chunkloaders." + name + ".enchants")){
|
for(String line : loaderSection.getStringList("enchants")){
|
||||||
Enchantment enchantment = Enchantment.getByName(line.split(":")[0]);
|
Enchantment enchantment = Enchantment.getByName(line.split(":")[0]);
|
||||||
int level = Integer.parseInt(line.split(":")[1]);
|
int level = Integer.parseInt(line.split(":")[1]);
|
||||||
itemBuilder.addEnchant(enchantment, level);
|
itemBuilder.addEnchant(enchantment, level);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cfg.contains("chunkloaders." + name + ".skull")) {
|
if(loaderSection.contains("skull")) {
|
||||||
itemBuilder.setTexture(cfg.getString("chunkloaders." + name + ".skull"));
|
itemBuilder.setTexture(loaderSection.getString("skull"));
|
||||||
}
|
}
|
||||||
} catch(Exception ignored){}
|
} catch(Exception ignored){}
|
||||||
|
|
||||||
@ -75,7 +77,11 @@ public final class SettingsHandler {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getLoaders().createLoaderData(name, timeLeft, itemBuilder.build());
|
LoaderData loaderData = plugin.getLoaders().createLoaderData(name, timeLeft, itemBuilder.build());
|
||||||
|
|
||||||
|
if(loaderSection.contains("chunks-radius"))
|
||||||
|
loaderData.setChunksRadius(loaderSection.getInt("chunks-radius"));
|
||||||
|
|
||||||
loadersAmount++;
|
loadersAmount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,15 +89,4 @@ public final class SettingsHandler {
|
|||||||
WildLoadersPlugin.log("Loading configuration done (Took " + (System.currentTimeMillis() - startTime) + "ms)");
|
WildLoadersPlugin.log("Loading configuration done (Took " + (System.currentTimeMillis() - startTime) + "ms)");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void reload(){
|
|
||||||
try{
|
|
||||||
WildLoadersPlugin plugin = WildLoadersPlugin.getPlugin();
|
|
||||||
Field settings = WildLoadersPlugin.class.getDeclaredField("settingsHandler");
|
|
||||||
settings.setAccessible(true);
|
|
||||||
settings.set(plugin, new SettingsHandler(plugin));
|
|
||||||
} catch(NoSuchFieldException | IllegalAccessException ex){
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,14 @@ import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
|
|||||||
import com.bgsoftware.wildloaders.utils.database.Query;
|
import com.bgsoftware.wildloaders.utils.database.Query;
|
||||||
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
import com.bgsoftware.wildloaders.utils.threads.Executor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -21,15 +24,17 @@ public final class WChunkLoader implements ChunkLoader {
|
|||||||
|
|
||||||
private final UUID whoPlaced;
|
private final UUID whoPlaced;
|
||||||
private final Location location;
|
private final Location location;
|
||||||
|
private final Chunk[] loadedChunks;
|
||||||
private final String loaderName;
|
private final String loaderName;
|
||||||
|
|
||||||
private boolean active = true;
|
private boolean active = true;
|
||||||
private long timeLeft;
|
private long timeLeft;
|
||||||
|
|
||||||
public WChunkLoader(String loaderName, UUID whoPlaced, Location location, long timeLeft){
|
public WChunkLoader(LoaderData loaderData, UUID whoPlaced, Location location, long timeLeft){
|
||||||
this.loaderName = loaderName;
|
this.loaderName = loaderData.getName();
|
||||||
this.whoPlaced = whoPlaced;
|
this.whoPlaced = whoPlaced;
|
||||||
this.location = location.clone();
|
this.location = location.clone();
|
||||||
|
this.loadedChunks = calculateChunks(loaderData, this.location);
|
||||||
this.timeLeft = timeLeft;
|
this.timeLeft = timeLeft;
|
||||||
plugin.getNMSAdapter().createLoader(this);
|
plugin.getNMSAdapter().createLoader(this);
|
||||||
}
|
}
|
||||||
@ -73,6 +78,11 @@ public final class WChunkLoader implements ChunkLoader {
|
|||||||
return location.clone();
|
return location.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Chunk[] getLoadedChunks() {
|
||||||
|
return loadedChunks;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Optional<ChunkLoaderNPC> getNPC() {
|
public Optional<ChunkLoaderNPC> getNPC() {
|
||||||
return plugin.getNPCs().getNPC(location);
|
return plugin.getNPCs().getNPC(location);
|
||||||
@ -97,4 +107,16 @@ public final class WChunkLoader implements ChunkLoader {
|
|||||||
return plugin.getNMSAdapter().setTag(itemStack, "loader-time", getTimeLeft());
|
return plugin.getNMSAdapter().setTag(itemStack, "loader-time", getTimeLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Chunk[] calculateChunks(LoaderData loaderData, Location original){
|
||||||
|
List<Chunk> chunkList = new ArrayList<>();
|
||||||
|
|
||||||
|
int chunkX = original.getBlockX() >> 4, chunkZ = original.getBlockZ() >> 4;
|
||||||
|
|
||||||
|
for(int x = -loaderData.getChunksRadius(); x <= loaderData.getChunksRadius(); x++)
|
||||||
|
for(int z = -loaderData.getChunksRadius(); z <= loaderData.getChunksRadius(); z++)
|
||||||
|
chunkList.add(original.getWorld().getChunkAt(chunkX + x, chunkZ + z));
|
||||||
|
|
||||||
|
return chunkList.toArray(new Chunk[0]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,13 @@ public final class WLoaderData implements LoaderData {
|
|||||||
private final long timeLeft;
|
private final long timeLeft;
|
||||||
private final ItemStack loaderItem;
|
private final ItemStack loaderItem;
|
||||||
|
|
||||||
|
private int chunksRadius;
|
||||||
|
|
||||||
public WLoaderData(String name, long timeLeft, ItemStack loaderItem){
|
public WLoaderData(String name, long timeLeft, ItemStack loaderItem){
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.timeLeft = timeLeft;
|
this.timeLeft = timeLeft;
|
||||||
this.loaderItem = plugin.getNMSAdapter().setTag(loaderItem, "loader-name", name);
|
this.loaderItem = plugin.getNMSAdapter().setTag(loaderItem, "loader-name", name);
|
||||||
|
this.chunksRadius = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -32,4 +35,15 @@ public final class WLoaderData implements LoaderData {
|
|||||||
public ItemStack getLoaderItem() {
|
public ItemStack getLoaderItem() {
|
||||||
return loaderItem.clone();
|
return loaderItem.clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setChunksRadius(int chunksRadius) {
|
||||||
|
this.chunksRadius = chunksRadius;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getChunksRadius() {
|
||||||
|
return chunksRadius;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ package com.bgsoftware.wildloaders.nms;
|
|||||||
|
|
||||||
import com.bgsoftware.wildloaders.api.loaders.ChunkLoader;
|
import com.bgsoftware.wildloaders.api.loaders.ChunkLoader;
|
||||||
import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
|
import com.bgsoftware.wildloaders.api.npc.ChunkLoaderNPC;
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package com.bgsoftware.wildloaders.utils.chunks;
|
|||||||
|
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@ -56,4 +57,8 @@ public final class ChunkPosition {
|
|||||||
return new ChunkPosition(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
|
return new ChunkPosition(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ChunkPosition of(World world, int chunkX, int chunkZ){
|
||||||
|
return new ChunkPosition(world.getName(), chunkX, chunkZ);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,3 +19,11 @@ chunkloaders:
|
|||||||
lore:
|
lore:
|
||||||
- '&7Place this chunk loader to keep'
|
- '&7Place this chunk loader to keep'
|
||||||
- '&7the chunk loaded in the next 24 hours!'
|
- '&7the chunk loaded in the next 24 hours!'
|
||||||
|
large_loader:
|
||||||
|
time: 86400
|
||||||
|
type: BEACON
|
||||||
|
chunks-radius: 2 # This will load all chunks in a radius of 2, aka 5x5 chunks
|
||||||
|
name: '&6Large Chunk Loader &7(Place to load)'
|
||||||
|
lore:
|
||||||
|
- '&7Place this chunk loader to keep all chunks'
|
||||||
|
- '&7in a radius of 2 loaded in the next 24 hours!'
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_10_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_11_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -132,7 +132,8 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -145,6 +146,7 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -163,7 +165,8 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -176,6 +179,7 @@ public final class NMSAdapter_v1_12_R1 implements NMSAdapter {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -125,10 +125,12 @@ public final class NMSAdapter_v1_13_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -147,10 +149,12 @@ public final class NMSAdapter_v1_13_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -125,10 +125,12 @@ public final class NMSAdapter_v1_13_R2 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -147,10 +149,12 @@ public final class NMSAdapter_v1_13_R2 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -128,12 +128,14 @@ public final class NMSAdapter_v1_14_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -153,12 +155,14 @@ public final class NMSAdapter_v1_14_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -128,12 +128,14 @@ public final class NMSAdapter_v1_15_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -153,12 +155,14 @@ public final class NMSAdapter_v1_15_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -129,12 +129,14 @@ public final class NMSAdapter_v1_16_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -154,12 +156,14 @@ public final class NMSAdapter_v1_16_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -129,12 +129,14 @@ public final class NMSAdapter_v1_16_R2 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = -1);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -154,12 +156,14 @@ public final class NMSAdapter_v1_16_R2 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner)
|
||||||
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
.forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
|
||||||
|
|
||||||
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -118,7 +118,8 @@ public final class NMSAdapter_v1_7_R3 implements NMSAdapter {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
world.tileEntityList.add(tileEntityChunkLoader);
|
world.tileEntityList.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()){
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -127,6 +128,7 @@ public final class NMSAdapter_v1_7_R3 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -144,7 +146,8 @@ public final class NMSAdapter_v1_7_R3 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, x, y, z, Block.b(world.getType(x, y, z)) + (world.getData(x, y, z) << 12));
|
world.a(null, 2001, x, y, z, Block.b(world.getType(x, y, z)) + (world.getData(x, y, z) << 12));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()){
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -153,6 +156,7 @@ public final class NMSAdapter_v1_7_R3 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -118,7 +118,8 @@ public final class NMSAdapter_v1_7_R4 implements NMSAdapter {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
world.tileEntityList.add(tileEntityChunkLoader);
|
world.tileEntityList.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -127,6 +128,7 @@ public final class NMSAdapter_v1_7_R4 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -144,7 +146,8 @@ public final class NMSAdapter_v1_7_R4 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, x, y, z, Block.getId(world.getType(x, y, z)) + (world.getData(x, y, z) << 12));
|
world.a(null, 2001, x, y, z, Block.getId(world.getType(x, y, z)) + (world.getData(x, y, z) << 12));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -153,6 +156,7 @@ public final class NMSAdapter_v1_7_R4 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -124,7 +124,8 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
|||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
world.tileEntityList.add(tileEntityChunkLoader);
|
world.tileEntityList.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -133,6 +134,7 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -151,7 +153,8 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
//noinspection unchecked
|
//noinspection unchecked
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
@ -160,6 +163,7 @@ public final class NMSAdapter_v1_8_R1 implements NMSAdapter {
|
|||||||
((TileEntity) tileEntity).a(nbtTagCompound);
|
((TileEntity) tileEntity).a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityList.add(tileEntityChunkLoader);
|
world.tileEntityList.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.b(nbtTagCompound);
|
tileEntity.b(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.b(nbtTagCompound);
|
tileEntity.b(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_8_R2 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityList.add(tileEntityChunkLoader);
|
world.tileEntityList.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.b(nbtTagCompound);
|
tileEntity.b(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.b(nbtTagCompound);
|
tileEntity.b(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_8_R3 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_9_R1 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
@ -123,7 +123,8 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
|||||||
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
TileEntityChunkLoader tileEntityChunkLoader = new TileEntityChunkLoader(chunkLoader, world, blockPosition);
|
||||||
world.tileEntityListTick.add(tileEntityChunkLoader);
|
world.tileEntityListTick.add(tileEntityChunkLoader);
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -131,6 +132,7 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
|
||||||
@ -149,7 +151,8 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
|||||||
if(spawnParticle)
|
if(spawnParticle)
|
||||||
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
|
||||||
|
|
||||||
Chunk chunk = ((CraftChunk) loaderLoc.getChunk()).getHandle();
|
for(org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
|
||||||
|
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
|
||||||
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> {
|
||||||
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
NBTTagCompound nbtTagCompound = new NBTTagCompound();
|
||||||
tileEntity.save(nbtTagCompound);
|
tileEntity.save(nbtTagCompound);
|
||||||
@ -157,6 +160,7 @@ public final class NMSAdapter_v1_9_R2 implements NMSAdapter {
|
|||||||
tileEntity.a(nbtTagCompound);
|
tileEntity.a(nbtTagCompound);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSpawner(Location location, boolean reset) {
|
public void updateSpawner(Location location, boolean reset) {
|
||||||
|
Loading…
Reference in New Issue
Block a user