mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-27 20:58:40 +01:00
Clean up 1.14.4 compile errors
This commit is contained in:
parent
86619a1d0d
commit
747ec85a0c
@ -33,10 +33,15 @@ import net.minecraft.command.CommandException;
|
|||||||
import net.minecraft.command.CommandSource;
|
import net.minecraft.command.CommandSource;
|
||||||
import net.minecraft.command.Commands;
|
import net.minecraft.command.Commands;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.play.ServerPlayNetHandler;
|
||||||
import net.minecraft.particles.IParticleData;
|
import net.minecraft.particles.IParticleData;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.server.management.BanList;
|
||||||
|
import net.minecraft.server.management.IPBanList;
|
||||||
import net.minecraft.server.management.PlayerProfileCache;
|
import net.minecraft.server.management.PlayerProfileCache;
|
||||||
import net.minecraft.util.ObjectIntIdentityMap;
|
import net.minecraft.util.ObjectIntIdentityMap;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
@ -44,7 +49,9 @@ import net.minecraft.util.SoundCategory;
|
|||||||
import net.minecraft.util.SoundEvent;
|
import net.minecraft.util.SoundEvent;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -52,8 +59,14 @@ import net.minecraft.world.biome.Biome;
|
|||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkSection;
|
import net.minecraft.world.chunk.ChunkSection;
|
||||||
import net.minecraft.world.chunk.IChunk;
|
import net.minecraft.world.chunk.IChunk;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.event.ServerChatEvent;
|
import net.minecraftforge.event.ServerChatEvent;
|
||||||
|
import net.minecraftforge.event.TickEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerChangedDimensionEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedOutEvent;
|
||||||
|
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerRespawnEvent;
|
||||||
import net.minecraftforge.event.world.ChunkEvent;
|
import net.minecraftforge.event.world.ChunkEvent;
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
import net.minecraftforge.fml.ModList;
|
import net.minecraftforge.fml.ModList;
|
||||||
@ -145,7 +158,6 @@ public class DynmapPlugin
|
|||||||
private long perTickLimit = (50000000); // 50 ms
|
private long perTickLimit = (50000000); // 50 ms
|
||||||
private boolean isMCPC = false;
|
private boolean isMCPC = false;
|
||||||
private boolean useSaveFolder = true;
|
private boolean useSaveFolder = true;
|
||||||
private Field displayName = null; // MCPC+ display name
|
|
||||||
|
|
||||||
private static final int SIGNPOST_ID = 63;
|
private static final int SIGNPOST_ID = 63;
|
||||||
private static final int WALLSIGN_ID = 68;
|
private static final int WALLSIGN_ID = 68;
|
||||||
@ -178,7 +190,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
Iterator<BlockState> iter = bsids.iterator();
|
Iterator<BlockState> iter = bsids.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
IBlockState bs = iter.next();
|
BlockState bs = iter.next();
|
||||||
int idx = bsids.get(bs);
|
int idx = bsids.get(bs);
|
||||||
if (idx >= stateByID.length) {
|
if (idx >= stateByID.length) {
|
||||||
int plen = stateByID.length;
|
int plen = stateByID.length;
|
||||||
@ -248,7 +260,7 @@ public class DynmapPlugin
|
|||||||
Iterator<Biome> iter = ForgeRegistries.BIOMES.iterator();
|
Iterator<Biome> iter = ForgeRegistries.BIOMES.iterator();
|
||||||
while (iter.hasNext()) {
|
while (iter.hasNext()) {
|
||||||
Biome b = iter.next();
|
Biome b = iter.next();
|
||||||
int bidx = RegistryNamespaced.BIOME.getId(b);
|
int bidx = Registry.BIOME.getId(b);
|
||||||
if (bidx >= biomelist.length) {
|
if (bidx >= biomelist.length) {
|
||||||
biomelist = Arrays.copyOf(biomelist, bidx + biomelist.length);
|
biomelist = Arrays.copyOf(biomelist, bidx + biomelist.length);
|
||||||
}
|
}
|
||||||
@ -257,11 +269,11 @@ public class DynmapPlugin
|
|||||||
}
|
}
|
||||||
return biomelist;
|
return biomelist;
|
||||||
}
|
}
|
||||||
public static final NetworkManager getNetworkManager(NetHandlerPlayServer nh) {
|
public static final NetworkManager getNetworkManager(ServerPlayNetHandler nh) {
|
||||||
return nh.netManager;
|
return nh.netManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ForgePlayer getOrAddPlayer(EntityPlayer p) {
|
private ForgePlayer getOrAddPlayer(PlayerEntity p) {
|
||||||
String name = p.getEntity().getName().getString();
|
String name = p.getEntity().getName().getString();
|
||||||
ForgePlayer fp = players.get(name);
|
ForgePlayer fp = players.get(name);
|
||||||
if(fp != null) {
|
if(fp != null) {
|
||||||
@ -309,7 +321,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
private class ChatMessage {
|
private class ChatMessage {
|
||||||
String message;
|
String message;
|
||||||
EntityPlayer sender;
|
PlayerEntity sender;
|
||||||
}
|
}
|
||||||
private ConcurrentLinkedQueue<ChatMessage> msgqueue = new ConcurrentLinkedQueue<ChatMessage>();
|
private ConcurrentLinkedQueue<ChatMessage> msgqueue = new ConcurrentLinkedQueue<ChatMessage>();
|
||||||
|
|
||||||
@ -419,13 +431,6 @@ public class DynmapPlugin
|
|||||||
{
|
{
|
||||||
plugin = this;
|
plugin = this;
|
||||||
this.server = srv;
|
this.server = srv;
|
||||||
|
|
||||||
displayName = null;
|
|
||||||
try {
|
|
||||||
displayName = EntityPlayerMP.class.getField("displayName");
|
|
||||||
} catch (SecurityException e) {
|
|
||||||
} catch (NoSuchFieldException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOp(String player) {
|
public boolean isOp(String player) {
|
||||||
@ -438,7 +443,7 @@ public class DynmapPlugin
|
|||||||
return (server.isSinglePlayer() && player.equalsIgnoreCase(server.getServerOwner()));
|
return (server.isSinglePlayer() && player.equalsIgnoreCase(server.getServerOwner()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasPerm(EntityPlayer psender, String permission) {
|
private boolean hasPerm(PlayerEntity psender, String permission) {
|
||||||
PermissionsHandler ph = PermissionsHandler.getHandler();
|
PermissionsHandler ph = PermissionsHandler.getHandler();
|
||||||
if((psender != null) && ph.hasPermission(psender.getEntity().getName().getString(), permission)) {
|
if((psender != null) && ph.hasPermission(psender.getEntity().getName().getString(), permission)) {
|
||||||
return true;
|
return true;
|
||||||
@ -446,7 +451,7 @@ public class DynmapPlugin
|
|||||||
return permissions.has(psender, permission);
|
return permissions.has(psender, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasPermNode(EntityPlayer psender, String permission) {
|
private boolean hasPermNode(PlayerEntity psender, String permission) {
|
||||||
PermissionsHandler ph = PermissionsHandler.getHandler();
|
PermissionsHandler ph = PermissionsHandler.getHandler();
|
||||||
if((psender != null) && ph.hasPermissionNode(psender.getEntity().getName().getString(), permission)) {
|
if((psender != null) && ph.hasPermissionNode(psender.getEntity().getName().getString(), permission)) {
|
||||||
return true;
|
return true;
|
||||||
@ -536,7 +541,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
for (int i = 0; i < pcnt; i++)
|
for (int i = 0; i < pcnt; i++)
|
||||||
{
|
{
|
||||||
EntityPlayer p = (EntityPlayer)playlist.get(i);
|
PlayerEntity p = (PlayerEntity)playlist.get(i);
|
||||||
dplay[i] = getOrAddPlayer(p);
|
dplay[i] = getOrAddPlayer(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -556,7 +561,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
for (Object o : players)
|
for (Object o : players)
|
||||||
{
|
{
|
||||||
EntityPlayer p = (EntityPlayer)o;
|
PlayerEntity p = (PlayerEntity)o;
|
||||||
|
|
||||||
if (p.getEntity().getName().getString().equalsIgnoreCase(name))
|
if (p.getEntity().getName().getString().equalsIgnoreCase(name))
|
||||||
{
|
{
|
||||||
@ -569,7 +574,7 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public Set<String> getIPBans()
|
public Set<String> getIPBans()
|
||||||
{
|
{
|
||||||
UserListIPBans bl = server.getPlayerList().getBannedIPs();
|
IPBanList bl = server.getPlayerList().getBannedIPs();
|
||||||
Set<String> ips = new HashSet<String>();
|
Set<String> ips = new HashSet<String>();
|
||||||
|
|
||||||
for (String s : bl.getKeys()) {
|
for (String s : bl.getKeys()) {
|
||||||
@ -612,7 +617,7 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public boolean isPlayerBanned(String pid)
|
public boolean isPlayerBanned(String pid)
|
||||||
{
|
{
|
||||||
UserListBans bl = server.getPlayerList().getBannedPlayers();
|
BanList bl = server.getPlayerList().getBannedPlayers();
|
||||||
return bl.isBanned(getProfileByName(pid));
|
return bl.isBanned(getProfileByName(pid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +729,7 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void broadcastMessage(String msg)
|
public void broadcastMessage(String msg)
|
||||||
{
|
{
|
||||||
ITextComponent component = new TextComponentString(msg);
|
ITextComponent component = new StringTextComponent(msg);
|
||||||
server.getPlayerList().sendMessage(component);
|
server.getPlayerList().sendMessage(component);
|
||||||
Log.info(stripChatColor(msg));
|
Log.info(stripChatColor(msg));
|
||||||
}
|
}
|
||||||
@ -775,7 +780,7 @@ public class DynmapPlugin
|
|||||||
{
|
{
|
||||||
net.minecraft.server.management.PlayerList scm = server.getPlayerList();
|
net.minecraft.server.management.PlayerList scm = server.getPlayerList();
|
||||||
if (scm == null) return Collections.emptySet();
|
if (scm == null) return Collections.emptySet();
|
||||||
UserListBans bl = scm.getBannedPlayers();
|
BanList bl = scm.getBannedPlayers();
|
||||||
if (bl == null) return Collections.emptySet();
|
if (bl == null) return Collections.emptySet();
|
||||||
if(bl.isBanned(getProfileByName(player))) {
|
if(bl.isBanned(getProfileByName(player))) {
|
||||||
return Collections.emptySet();
|
return Collections.emptySet();
|
||||||
@ -794,7 +799,7 @@ public class DynmapPlugin
|
|||||||
{
|
{
|
||||||
net.minecraft.server.management.PlayerList scm = server.getPlayerList();
|
net.minecraft.server.management.PlayerList scm = server.getPlayerList();
|
||||||
if (scm == null) return false;
|
if (scm == null) return false;
|
||||||
UserListBans bl = scm.getBannedPlayers();
|
BanList bl = scm.getBannedPlayers();
|
||||||
if (bl == null) return false;
|
if (bl == null) return false;
|
||||||
if(bl.isBanned(getProfileByName(player))) {
|
if(bl.isBanned(getProfileByName(player))) {
|
||||||
return false;
|
return false;
|
||||||
@ -908,7 +913,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
while(!blockupdatequeue.isEmpty()) {
|
while(!blockupdatequeue.isEmpty()) {
|
||||||
BlockUpdateRec r = blockupdatequeue.remove();
|
BlockUpdateRec r = blockupdatequeue.remove();
|
||||||
IBlockState bs = r.w.getBlockState(new BlockPos(r.x, r.y, r.z));
|
BlockState bs = r.w.getBlockState(new BlockPos(r.x, r.y, r.z));
|
||||||
int idx = Block.BLOCK_STATE_IDS.get(bs);
|
int idx = Block.BLOCK_STATE_IDS.get(bs);
|
||||||
if(!org.dynmap.hdmap.HDBlockModels.isChangeIgnoredBlock(stateByID[idx])) {
|
if(!org.dynmap.hdmap.HDBlockModels.isChangeIgnoredBlock(stateByID[idx])) {
|
||||||
if(onblockchange_with_id)
|
if(onblockchange_with_id)
|
||||||
@ -1079,12 +1084,12 @@ public class DynmapPlugin
|
|||||||
*/
|
*/
|
||||||
public class ForgePlayer extends ForgeCommandSender implements DynmapPlayer
|
public class ForgePlayer extends ForgeCommandSender implements DynmapPlayer
|
||||||
{
|
{
|
||||||
private EntityPlayer player;
|
private PlayerEntity player;
|
||||||
private final String skinurl;
|
private final String skinurl;
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
|
|
||||||
|
|
||||||
public ForgePlayer(EntityPlayer p)
|
public ForgePlayer(PlayerEntity p)
|
||||||
{
|
{
|
||||||
player = p;
|
player = p;
|
||||||
String url = null;
|
String url = null;
|
||||||
@ -1120,8 +1125,10 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
if(player != null)
|
if(player != null) {
|
||||||
return player.getEntity().getName().getString();
|
String n = player.getEntity().getName().getString();;
|
||||||
|
return n;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return "[Server]";
|
return "[Server]";
|
||||||
}
|
}
|
||||||
@ -1129,14 +1136,8 @@ public class DynmapPlugin
|
|||||||
public String getDisplayName()
|
public String getDisplayName()
|
||||||
{
|
{
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
if (displayName != null) {
|
String n = player.getDisplayName().getString();
|
||||||
try {
|
return n;
|
||||||
return (String) displayName.get(player);
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return player.getDisplayName().getUnformattedComponentText();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return "[Server]";
|
return "[Server]";
|
||||||
@ -1174,8 +1175,8 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public InetSocketAddress getAddress()
|
public InetSocketAddress getAddress()
|
||||||
{
|
{
|
||||||
if((player != null) && (player instanceof EntityPlayerMP)) {
|
if((player != null) && (player instanceof ServerPlayerEntity)) {
|
||||||
NetHandlerPlayServer nsh = ((EntityPlayerMP)player).connection;
|
ServerPlayNetHandler nsh = ((ServerPlayerEntity)player).connection;
|
||||||
if((nsh != null) && (getNetworkManager(nsh) != null)) {
|
if((nsh != null) && (getNetworkManager(nsh) != null)) {
|
||||||
SocketAddress sa = getNetworkManager(nsh).getRemoteAddress();
|
SocketAddress sa = getNetworkManager(nsh).getRemoteAddress();
|
||||||
if(sa instanceof InetSocketAddress) {
|
if(sa instanceof InetSocketAddress) {
|
||||||
@ -1251,7 +1252,7 @@ public class DynmapPlugin
|
|||||||
@Override
|
@Override
|
||||||
public void sendMessage(String msg)
|
public void sendMessage(String msg)
|
||||||
{
|
{
|
||||||
ITextComponent ichatcomponent = new TextComponentString(msg);
|
ITextComponent ichatcomponent = new StringTextComponent(msg);
|
||||||
player.sendMessage(ichatcomponent);
|
player.sendMessage(ichatcomponent);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
@ -1316,7 +1317,7 @@ public class DynmapPlugin
|
|||||||
public void sendMessage(String msg)
|
public void sendMessage(String msg)
|
||||||
{
|
{
|
||||||
if(sender != null) {
|
if(sender != null) {
|
||||||
ITextComponent ichatcomponent = new TextComponentString(msg);
|
ITextComponent ichatcomponent = new StringTextComponent(msg);
|
||||||
sender.sendFeedback(ichatcomponent, false);
|
sender.sendFeedback(ichatcomponent, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1484,7 +1485,7 @@ public class DynmapPlugin
|
|||||||
|
|
||||||
/* Initialized the currently loaded worlds */
|
/* Initialized the currently loaded worlds */
|
||||||
if(server.getWorlds() != null) {
|
if(server.getWorlds() != null) {
|
||||||
for (WorldServer world : server.getWorlds()) {
|
for (ServerWorld world : server.getWorlds()) {
|
||||||
ForgeWorld w = this.getWorld(world);
|
ForgeWorld w = this.getWorld(world);
|
||||||
/*NOTYET - need rest of forge
|
/*NOTYET - need rest of forge
|
||||||
if(DimensionManager.getWorld(world.provider.getDimensionId()) == null) { // If not loaded
|
if(DimensionManager.getWorld(world.provider.getDimensionId()) == null) { // If not loaded
|
||||||
@ -1544,7 +1545,7 @@ public class DynmapPlugin
|
|||||||
void onCommand(CommandSource sender, String cmd, String[] args)
|
void onCommand(CommandSource sender, String cmd, String[] args)
|
||||||
{
|
{
|
||||||
DynmapCommandSender dsender;
|
DynmapCommandSender dsender;
|
||||||
EntityPlayer psender;
|
PlayerEntity psender;
|
||||||
try {
|
try {
|
||||||
psender = sender.asPlayer();
|
psender = sender.asPlayer();
|
||||||
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException x) {
|
} catch (com.mojang.brigadier.exceptions.CommandSyntaxException x) {
|
||||||
@ -1619,7 +1620,7 @@ public class DynmapPlugin
|
|||||||
public void handleWorldLoad(WorldEvent.Load event) {
|
public void handleWorldLoad(WorldEvent.Load event) {
|
||||||
if(!core_enabled) return;
|
if(!core_enabled) return;
|
||||||
IWorld w = event.getWorld();
|
IWorld w = event.getWorld();
|
||||||
if(!(w instanceof WorldServer)) return;
|
if(!(w instanceof ServerWorld)) return;
|
||||||
final ForgeWorld fw = getWorld(w);
|
final ForgeWorld fw = getWorld(w);
|
||||||
// This event can be called from off server thread, so push processing there
|
// This event can be called from off server thread, so push processing there
|
||||||
core.getServer().scheduleServerTask(new Runnable() {
|
core.getServer().scheduleServerTask(new Runnable() {
|
||||||
@ -1633,7 +1634,7 @@ public class DynmapPlugin
|
|||||||
public void handleWorldUnload(WorldEvent.Unload event) {
|
public void handleWorldUnload(WorldEvent.Unload event) {
|
||||||
if(!core_enabled) return;
|
if(!core_enabled) return;
|
||||||
IWorld w = event.getWorld();
|
IWorld w = event.getWorld();
|
||||||
if(!(w instanceof WorldServer)) return;
|
if(!(w instanceof ServerWorld)) return;
|
||||||
final ForgeWorld fw = getWorld(w);
|
final ForgeWorld fw = getWorld(w);
|
||||||
if(fw != null) {
|
if(fw != null) {
|
||||||
// This event can be called from off server thread, so push processing there
|
// This event can be called from off server thread, so push processing there
|
||||||
@ -1646,8 +1647,8 @@ public class DynmapPlugin
|
|||||||
// Set world unloaded (needs to be immediate, since it may be invalid after event)
|
// Set world unloaded (needs to be immediate, since it may be invalid after event)
|
||||||
fw.setWorldUnloaded();
|
fw.setWorldUnloaded();
|
||||||
// Clean up tracker
|
// Clean up tracker
|
||||||
WorldUpdateTracker wut = updateTrackers.remove(fw.getName());
|
//WorldUpdateTracker wut = updateTrackers.remove(fw.getName());
|
||||||
if(wut != null) wut.world = null;
|
//if(wut != null) wut.world = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1656,7 +1657,7 @@ public class DynmapPlugin
|
|||||||
if(!core_enabled) return;
|
if(!core_enabled) return;
|
||||||
if(!onchunkgenerate) return;
|
if(!onchunkgenerate) return;
|
||||||
IWorld w = event.getWorld();
|
IWorld w = event.getWorld();
|
||||||
if(!(w instanceof WorldServer)) return;
|
if(!(w instanceof ServerWorld)) return;
|
||||||
IChunk c = event.getChunk();
|
IChunk c = event.getChunk();
|
||||||
if((c != null) /*TODO && (!c.isTerrainPopulated())*/) { // If new chunk?
|
if((c != null) /*TODO && (!c.isTerrainPopulated())*/) { // If new chunk?
|
||||||
ForgeWorld fw = getWorld(w, false);
|
ForgeWorld fw = getWorld(w, false);
|
||||||
@ -1685,7 +1686,7 @@ public class DynmapPlugin
|
|||||||
if(!core_enabled) return;
|
if(!core_enabled) return;
|
||||||
if(!onchunkpopulate) return;
|
if(!onchunkpopulate) return;
|
||||||
World w = event.getWorld();
|
World w = event.getWorld();
|
||||||
if(!(w instanceof WorldServer)) return;
|
if(!(w instanceof ServerWorld)) return;
|
||||||
Chunk c = w.getChunkFromChunkCoords(event.getChunkX(), event.getChunkZ());
|
Chunk c = w.getChunkFromChunkCoords(event.getChunkX(), event.getChunkZ());
|
||||||
int ymin = 0, ymax = 0;
|
int ymin = 0, ymax = 0;
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
@ -1713,82 +1714,83 @@ public class DynmapPlugin
|
|||||||
private boolean onchunkgenerate = false;
|
private boolean onchunkgenerate = false;
|
||||||
private boolean onblockchange_with_id = false;
|
private boolean onblockchange_with_id = false;
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: Not in 1.14.4 - need to find equivalent
|
||||||
|
// public class WorldUpdateTracker implements IWorldEventListener {
|
||||||
|
// String worldid;
|
||||||
|
// IWorld world;
|
||||||
|
// @Override
|
||||||
|
// public void notifyLightSet(BlockPos pos) {
|
||||||
|
// if(sscache != null)
|
||||||
|
// sscache.invalidateSnapshot(worldid, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
// if(onlightingchange) {
|
||||||
|
// mapManager.touch(worldid, pos.getX(), pos.getY(), pos.getZ(), "lightingchange");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void onEntityAdded(Entity entityIn) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void onEntityRemoved(Entity entityIn) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void sendBlockBreakProgress(int breakerId, BlockPos pos,
|
||||||
|
// int progress) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void broadcastSound(int p_180440_1_, BlockPos p_180440_2_,
|
||||||
|
// int p_180440_3_) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void playSoundToAllNearExcept(PlayerEntity player,
|
||||||
|
// SoundEvent soundIn, SoundCategory category, double x, double y,
|
||||||
|
// double z, float volume, float pitch) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void playRecord(SoundEvent soundIn, BlockPos pos) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void playEvent(PlayerEntity arg0, int arg1, BlockPos arg2, int arg3) {
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void notifyBlockUpdate(IBlockReader worldIn, BlockPos pos, BlockState oldState, BlockState newState,
|
||||||
|
// int flags) {
|
||||||
|
// if(sscache != null)
|
||||||
|
// sscache.invalidateSnapshot(worldid, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
// if(onblockchange) {
|
||||||
|
// BlockUpdateRec r = new BlockUpdateRec();
|
||||||
|
// r.w = world;
|
||||||
|
// r.wid = worldid;
|
||||||
|
// r.x = pos.getX(); r.y = pos.getY(); r.z = pos.getZ();
|
||||||
|
// blockupdatequeue.add(r);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void addParticle(IParticleData particleData, boolean alwaysRender, double x, double y, double z,
|
||||||
|
// double xSpeed, double ySpeed, double zSpeed) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// @Override
|
||||||
|
// public void addParticle(IParticleData particleData, boolean ignoreRange, boolean minimizeLevel, double x,
|
||||||
|
// double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||||
|
// // TODO Auto-generated method stub
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
public class WorldUpdateTracker implements IWorldEventListener {
|
// private WorldTracker worldTracker = null;
|
||||||
String worldid;
|
// private HashMap<String, WorldUpdateTracker> updateTrackers = new HashMap<String, WorldUpdateTracker>();
|
||||||
IWorld world;
|
|
||||||
@Override
|
|
||||||
public void notifyLightSet(BlockPos pos) {
|
|
||||||
if(sscache != null)
|
|
||||||
sscache.invalidateSnapshot(worldid, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
if(onlightingchange) {
|
|
||||||
mapManager.touch(worldid, pos.getX(), pos.getY(), pos.getZ(), "lightingchange");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void markBlockRangeForRenderUpdate(int x1, int y1, int z1, int x2, int y2, int z2) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onEntityAdded(Entity entityIn) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onEntityRemoved(Entity entityIn) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void sendBlockBreakProgress(int breakerId, BlockPos pos,
|
|
||||||
int progress) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void broadcastSound(int p_180440_1_, BlockPos p_180440_2_,
|
|
||||||
int p_180440_3_) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void playSoundToAllNearExcept(EntityPlayer player,
|
|
||||||
SoundEvent soundIn, SoundCategory category, double x, double y,
|
|
||||||
double z, float volume, float pitch) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void playRecord(SoundEvent soundIn, BlockPos pos) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void playEvent(EntityPlayer arg0, int arg1, BlockPos arg2, int arg3) {
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void notifyBlockUpdate(IBlockReader worldIn, BlockPos pos, IBlockState oldState, IBlockState newState,
|
|
||||||
int flags) {
|
|
||||||
if(sscache != null)
|
|
||||||
sscache.invalidateSnapshot(worldid, pos.getX(), pos.getY(), pos.getZ());
|
|
||||||
if(onblockchange) {
|
|
||||||
BlockUpdateRec r = new BlockUpdateRec();
|
|
||||||
r.w = world;
|
|
||||||
r.wid = worldid;
|
|
||||||
r.x = pos.getX(); r.y = pos.getY(); r.z = pos.getZ();
|
|
||||||
blockupdatequeue.add(r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void addParticle(IParticleData particleData, boolean alwaysRender, double x, double y, double z,
|
|
||||||
double xSpeed, double ySpeed, double zSpeed) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void addParticle(IParticleData particleData, boolean ignoreRange, boolean minimizeLevel, double x,
|
|
||||||
double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WorldTracker worldTracker = null;
|
|
||||||
private HashMap<String, WorldUpdateTracker> updateTrackers = new HashMap<String, WorldUpdateTracker>();
|
|
||||||
|
|
||||||
private void registerEvents()
|
private void registerEvents()
|
||||||
{
|
{
|
||||||
if(worldTracker == null) {
|
// if(worldTracker == null) {
|
||||||
worldTracker = new WorldTracker();
|
// worldTracker = new WorldTracker();
|
||||||
MinecraftForge.EVENT_BUS.register(worldTracker);
|
// MinecraftForge.EVENT_BUS.register(worldTracker);
|
||||||
}
|
// }
|
||||||
// To trigger rendering.
|
// To trigger rendering.
|
||||||
onblockchange = core.isTrigger("blockupdate");
|
onblockchange = core.isTrigger("blockupdate");
|
||||||
onlightingchange = core.isTrigger("lightingupdate");
|
onlightingchange = core.isTrigger("lightingupdate");
|
||||||
@ -1820,11 +1822,11 @@ public class DynmapPlugin
|
|||||||
if(fw.isLoaded() == false) {
|
if(fw.isLoaded() == false) {
|
||||||
fw.setWorldLoaded(w);
|
fw.setWorldLoaded(w);
|
||||||
// Add tracker
|
// Add tracker
|
||||||
WorldUpdateTracker wit = new WorldUpdateTracker();
|
// WorldUpdateTracker wit = new WorldUpdateTracker();
|
||||||
wit.worldid = fw.getName();
|
// wit.worldid = fw.getName();
|
||||||
wit.world = w;
|
// wit.world = w;
|
||||||
updateTrackers.put(fw.getName(), wit);
|
// updateTrackers.put(fw.getName(), wit);
|
||||||
w.getWorld().addEventListener(wit);
|
// w.getWorld().addEventListener(wit);
|
||||||
}
|
}
|
||||||
return fw;
|
return fw;
|
||||||
}
|
}
|
||||||
@ -1835,11 +1837,11 @@ public class DynmapPlugin
|
|||||||
fw = new ForgeWorld(w);
|
fw = new ForgeWorld(w);
|
||||||
worlds.put(fw.getName(), fw);
|
worlds.put(fw.getName(), fw);
|
||||||
// Add tracker
|
// Add tracker
|
||||||
WorldUpdateTracker wit = new WorldUpdateTracker();
|
// WorldUpdateTracker wit = new WorldUpdateTracker();
|
||||||
wit.worldid = fw.getName();
|
// wit.worldid = fw.getName();
|
||||||
wit.world = w;
|
// wit.world = w;
|
||||||
updateTrackers.put(fw.getName(), wit);
|
// updateTrackers.put(fw.getName(), wit);
|
||||||
w.getWorld().addEventListener(wit);
|
// w.getWorld().addEventListener(wit);
|
||||||
}
|
}
|
||||||
last_world = w;
|
last_world = w;
|
||||||
last_fworld = fw;
|
last_fworld = fw;
|
||||||
|
@ -11,30 +11,30 @@ import java.util.ListIterator;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.ByteArrayNBT;
|
||||||
|
import net.minecraft.nbt.ByteNBT;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
import net.minecraft.nbt.INBTBase;
|
import net.minecraft.nbt.DoubleNBT;
|
||||||
import net.minecraft.nbt.NBTTagByte;
|
import net.minecraft.nbt.FloatNBT;
|
||||||
import net.minecraft.nbt.NBTTagByteArray;
|
import net.minecraft.nbt.INBT;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.IntArrayNBT;
|
||||||
import net.minecraft.nbt.NBTTagDouble;
|
import net.minecraft.nbt.IntNBT;
|
||||||
import net.minecraft.nbt.NBTTagFloat;
|
import net.minecraft.nbt.ListNBT;
|
||||||
import net.minecraft.nbt.NBTTagInt;
|
import net.minecraft.nbt.LongNBT;
|
||||||
import net.minecraft.nbt.NBTTagIntArray;
|
import net.minecraft.nbt.ShortNBT;
|
||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.StringNBT;
|
||||||
import net.minecraft.nbt.NBTTagLong;
|
|
||||||
import net.minecraft.nbt.NBTTagShort;
|
|
||||||
import net.minecraft.nbt.NBTTagString;
|
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import net.minecraft.world.biome.Biome;
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.chunk.AbstractChunkProvider;
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkStatus;
|
import net.minecraft.world.chunk.ChunkStatus;
|
||||||
import net.minecraft.world.chunk.IChunkProvider;
|
import net.minecraft.world.chunk.storage.ChunkSerializer;
|
||||||
import net.minecraft.world.chunk.storage.AnvilChunkLoader;
|
|
||||||
import net.minecraft.world.chunk.storage.IChunkLoader;
|
|
||||||
import net.minecraft.world.chunk.storage.RegionFileCache;
|
import net.minecraft.world.chunk.storage.RegionFileCache;
|
||||||
import net.minecraft.world.gen.ChunkProviderServer;
|
import net.minecraft.world.server.ChunkManager;
|
||||||
|
import net.minecraft.world.server.ServerChunkProvider;
|
||||||
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
import org.dynmap.DynmapChunk;
|
import org.dynmap.DynmapChunk;
|
||||||
import org.dynmap.DynmapCore;
|
import org.dynmap.DynmapCore;
|
||||||
@ -58,20 +58,19 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
{
|
{
|
||||||
private static boolean init = false;
|
private static boolean init = false;
|
||||||
private static Field unloadqueue = null;
|
private static Field unloadqueue = null;
|
||||||
private static Field currentchunkloader = null;
|
|
||||||
private static Field updateEntityTick = null;
|
private static Field updateEntityTick = null;
|
||||||
/* AnvilChunkLoader fields */
|
/* ChunkManager fields */
|
||||||
private static Field chunksToRemove = null; // Map
|
private static Field chunksToRemove = null; // Map
|
||||||
//private static Field pendingAnvilChunksCoordinates = null; // Set
|
//private static Field pendingAnvilChunksCoordinates = null; // Set
|
||||||
private static Method writechunktonbt = null; // writeChunkToNBT(Chunk c, World w, NBTTagCompound nbt)
|
private static Method writechunktonbt = null; // writeChunkToNBT(Chunk c, World w, CompoundNBT nbt)
|
||||||
|
|
||||||
/* AnvilChunkLoaderPending fields */
|
/* ChunjManager Pending fields */
|
||||||
private static Field chunkCoord = null;
|
private static Field chunkCoord = null;
|
||||||
private static Field nbtTag = null;
|
private static Field nbtTag = null;
|
||||||
|
|
||||||
private World w;
|
private World w;
|
||||||
private DynmapWorld dw;
|
private DynmapWorld dw;
|
||||||
private ChunkProviderServer cps;
|
private ServerChunkProvider cps;
|
||||||
private int nsect;
|
private int nsect;
|
||||||
private List<DynmapChunk> chunks;
|
private List<DynmapChunk> chunks;
|
||||||
private ListIterator<DynmapChunk> iterator;
|
private ListIterator<DynmapChunk> iterator;
|
||||||
@ -885,7 +884,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
public static void init() {
|
public static void init() {
|
||||||
if (!init)
|
if (!init)
|
||||||
{
|
{
|
||||||
Field[] f = ChunkProviderServer.class.getDeclaredFields();
|
Field[] f = ServerChunkProvider.class.getDeclaredFields();
|
||||||
|
|
||||||
for(int i = 0; i < f.length; i++) {
|
for(int i = 0; i < f.length; i++) {
|
||||||
if((unloadqueue == null) && f[i].getType().isAssignableFrom(it.unimi.dsi.fastutil.longs.LongSet.class)) {
|
if((unloadqueue == null) && f[i].getType().isAssignableFrom(it.unimi.dsi.fastutil.longs.LongSet.class)) {
|
||||||
@ -893,14 +892,9 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
//Log.info("Found unloadqueue - " + f[i].getName());
|
//Log.info("Found unloadqueue - " + f[i].getName());
|
||||||
unloadqueue.setAccessible(true);
|
unloadqueue.setAccessible(true);
|
||||||
}
|
}
|
||||||
else if((currentchunkloader == null) && f[i].getType().isAssignableFrom(IChunkLoader.class)) {
|
|
||||||
currentchunkloader = f[i];
|
|
||||||
//Log.info("Found currentchunkprovider - " + f[i].getName());
|
|
||||||
currentchunkloader.setAccessible(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
f = WorldServer.class.getDeclaredFields();
|
f = ServerWorld.class.getDeclaredFields();
|
||||||
for(int i = 0; i < f.length; i++) {
|
for(int i = 0; i < f.length; i++) {
|
||||||
if((updateEntityTick == null) && f[i].getType().isAssignableFrom(int.class)) {
|
if((updateEntityTick == null) && f[i].getType().isAssignableFrom(int.class)) {
|
||||||
updateEntityTick = f[i];
|
updateEntityTick = f[i];
|
||||||
@ -909,7 +903,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f = AnvilChunkLoader.class.getDeclaredFields();
|
f = ChunkManager.class.getDeclaredFields();
|
||||||
for(int i = 0; i < f.length; i++) {
|
for(int i = 0; i < f.length; i++) {
|
||||||
if((chunksToRemove == null) && (f[i].getType().equals(Map.class))) {
|
if((chunksToRemove == null) && (f[i].getType().equals(Map.class))) {
|
||||||
chunksToRemove = f[i];
|
chunksToRemove = f[i];
|
||||||
@ -923,10 +917,10 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
// Get writeChunkToNBT method
|
// Get writeChunkToNBT method
|
||||||
Method[] ma = AnvilChunkLoader.class.getDeclaredMethods();
|
Method[] ma = ChunkManager.class.getDeclaredMethods();
|
||||||
for (Method m : ma) {
|
for (Method m : ma) {
|
||||||
Class<?>[] p = m.getParameterTypes();
|
Class<?>[] p = m.getParameterTypes();
|
||||||
if ((p.length == 3) && (p[0].equals(Chunk.class)) && (p[1].equals(World.class)) && (p[2].equals(NBTTagCompound.class))) {
|
if ((p.length == 3) && (p[0].equals(Chunk.class)) && (p[1].equals(World.class)) && (p[2].equals(CompoundNBT.class))) {
|
||||||
writechunktonbt = m;
|
writechunktonbt = m;
|
||||||
Log.info("Found writechunktonbt- " + m.getName());
|
Log.info("Found writechunktonbt- " + m.getName());
|
||||||
m.setAccessible(true);
|
m.setAccessible(true);
|
||||||
@ -934,7 +928,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unloadqueue == null) || (currentchunkloader == null) || (writechunktonbt == null))
|
if ((unloadqueue == null) || (writechunktonbt == null))
|
||||||
{
|
{
|
||||||
Log.severe("ERROR: cannot find unload queue or chunk provider field - dynmap cannot load chunks");
|
Log.severe("ERROR: cannot find unload queue or chunk provider field - dynmap cannot load chunks");
|
||||||
}
|
}
|
||||||
@ -959,12 +953,12 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
this.dw = dw;
|
this.dw = dw;
|
||||||
this.w = dw.getWorld();
|
this.w = dw.getWorld();
|
||||||
if(dw.isLoaded()) {
|
if(dw.isLoaded()) {
|
||||||
/* Check if world's provider is ChunkProviderServer */
|
/* Check if world's provider is ServerChunkProvider */
|
||||||
IChunkProvider cp = this.w.getChunkProvider();
|
AbstractChunkProvider cp = this.w.getChunkProvider();
|
||||||
|
|
||||||
if (cp instanceof ChunkProviderServer)
|
if (cp instanceof ServerChunkProvider)
|
||||||
{
|
{
|
||||||
cps = (ChunkProviderServer)cp;
|
cps = (ServerChunkProvider)cp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1040,71 +1034,24 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
|
|
||||||
private static boolean didError = false;
|
private static boolean didError = false;
|
||||||
|
|
||||||
public NBTTagCompound readChunk(int x, int z) {
|
public CompoundNBT readChunk(int x, int z) {
|
||||||
if((cps == null) || (!(cps.chunkLoader instanceof AnvilChunkLoader)) ||
|
|
||||||
(((chunksToRemove == null) /*|| (pendingAnvilChunksCoordinates == null) */))) {
|
|
||||||
if (!didError) {
|
|
||||||
Log.severe("**** DYNMAP CANNOT READ CHUNKS (UNSUPPORTED CHUNK LOADER) ****");
|
|
||||||
didError = true;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
AnvilChunkLoader acl = (AnvilChunkLoader)cps.chunkLoader;
|
ChunkManager acl = cps.chunkManager;
|
||||||
Map<?,?> chunkstoremove = null;
|
|
||||||
//it.unimi.dsi.fastutil.longs.LongSet pendingcoords;
|
|
||||||
|
|
||||||
chunkstoremove = (Map<?,?>)chunksToRemove.get(acl);
|
|
||||||
//pendingcoords = (it.unimi.dsi.fastutil.longs.LongSet) pendingAnvilChunksCoordinates.get(acl);
|
|
||||||
|
|
||||||
NBTTagCompound rslt = null;
|
CompoundNBT rslt = null;
|
||||||
ChunkPos coord = new ChunkPos(x, z);
|
ChunkPos coord = new ChunkPos(x, z);
|
||||||
|
|
||||||
//}
|
|
||||||
// if (pendingcoords.contains(coord.asLong()) {
|
|
||||||
// for (Object o : chunkstoremove.values()) {
|
|
||||||
// if (chunkCoord == null) {
|
|
||||||
// Field[] f = o.getClass().getDeclaredFields();
|
|
||||||
// for(Field ff : f) {
|
|
||||||
// if((chunkCoord == null) && (ff.getType().equals(ChunkPos.class))) {
|
|
||||||
// chunkCoord = ff;
|
|
||||||
// chunkCoord.setAccessible(true);
|
|
||||||
// }
|
|
||||||
// else if((nbtTag == null) && (ff.getType().equals(NBTTagCompound.class))) {
|
|
||||||
// nbtTag = ff;
|
|
||||||
// nbtTag.setAccessible(true);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if ((chunkCoord == null) || (nbtTag == null)) {
|
|
||||||
// Log.severe("Error getting chunkCoord and nbtTag for Forge");
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// ChunkPos occ = (ChunkPos)chunkCoord.get(o);
|
|
||||||
|
|
||||||
// if (occ.equals(coord)) {
|
|
||||||
// rslt = (NBTTagCompound)nbtTag.get(o);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (rslt == null) {
|
if (rslt == null) {
|
||||||
DataInputStream str = RegionFileCache.getChunkInputStream(acl.chunkSaveLocation, x, z);
|
rslt = acl.readChunk(coord);
|
||||||
|
|
||||||
if (str == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
rslt = CompressedStreamTools.read(str);
|
|
||||||
}
|
}
|
||||||
if(rslt != null) {
|
if(rslt != null) {
|
||||||
rslt = rslt.getCompound("Level");
|
rslt = rslt.getCompound("Level");
|
||||||
// Don't load uncooked chunks
|
// Don't load uncooked chunks
|
||||||
String stat = rslt.getString("Status");
|
String stat = rslt.getString("Status");
|
||||||
ChunkStatus cs = ChunkStatus.getByName(stat);
|
ChunkStatus cs = ChunkStatus.byName(stat);
|
||||||
if ((stat == null) ||
|
if ((stat == null) ||
|
||||||
// Needs to be at least lighted
|
// Needs to be at least lighted
|
||||||
(!cs.isAtLeast(ChunkStatus.LIGHTED))) {
|
(!cs.isAtLeast(ChunkStatus.LIGHT))) {
|
||||||
rslt = null;
|
rslt = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1116,35 +1063,35 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object getNBTValue(INBTBase v) {
|
private Object getNBTValue(INBT v) {
|
||||||
Object val = null;
|
Object val = null;
|
||||||
switch(v.getId()) {
|
switch(v.getId()) {
|
||||||
case 1: // Byte
|
case 1: // Byte
|
||||||
val = Byte.valueOf(((NBTTagByte)v).getByte());
|
val = Byte.valueOf(((ByteNBT)v).getByte());
|
||||||
break;
|
break;
|
||||||
case 2: // Short
|
case 2: // Short
|
||||||
val = Short.valueOf(((NBTTagShort)v).getShort());
|
val = Short.valueOf(((ShortNBT)v).getShort());
|
||||||
break;
|
break;
|
||||||
case 3: // Int
|
case 3: // Int
|
||||||
val = Integer.valueOf(((NBTTagInt)v).getInt());
|
val = Integer.valueOf(((IntNBT)v).getInt());
|
||||||
break;
|
break;
|
||||||
case 4: // Long
|
case 4: // Long
|
||||||
val = Long.valueOf(((NBTTagLong)v).getLong());
|
val = Long.valueOf(((LongNBT)v).getLong());
|
||||||
break;
|
break;
|
||||||
case 5: // Float
|
case 5: // Float
|
||||||
val = Float.valueOf(((NBTTagFloat)v).getFloat());
|
val = Float.valueOf(((FloatNBT)v).getFloat());
|
||||||
break;
|
break;
|
||||||
case 6: // Double
|
case 6: // Double
|
||||||
val = Double.valueOf(((NBTTagDouble)v).getDouble());
|
val = Double.valueOf(((DoubleNBT)v).getDouble());
|
||||||
break;
|
break;
|
||||||
case 7: // Byte[]
|
case 7: // Byte[]
|
||||||
val = ((NBTTagByteArray)v).getByteArray();
|
val = ((ByteArrayNBT)v).getByteArray();
|
||||||
break;
|
break;
|
||||||
case 8: // String
|
case 8: // String
|
||||||
val = ((NBTTagString)v).getString();
|
val = ((StringNBT)v).getString();
|
||||||
break;
|
break;
|
||||||
case 9: // List
|
case 9: // List
|
||||||
NBTTagList tl = (NBTTagList) v;
|
ListNBT tl = (ListNBT) v;
|
||||||
ArrayList<Object> vlist = new ArrayList<Object>();
|
ArrayList<Object> vlist = new ArrayList<Object>();
|
||||||
int type = tl.getTagType();
|
int type = tl.getTagType();
|
||||||
for (int i = 0; i < tl.size(); i++) {
|
for (int i = 0; i < tl.size(); i++) {
|
||||||
@ -1162,7 +1109,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
vlist.add(sv);
|
vlist.add(sv);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
NBTTagCompound tc = tl.getCompound(i);
|
CompoundNBT tc = tl.getCompound(i);
|
||||||
vlist.add(getNBTValue(tc));
|
vlist.add(getNBTValue(tc));
|
||||||
break;
|
break;
|
||||||
case 11:
|
case 11:
|
||||||
@ -1174,17 +1121,17 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
val = vlist;
|
val = vlist;
|
||||||
break;
|
break;
|
||||||
case 10: // Map
|
case 10: // Map
|
||||||
NBTTagCompound tc = (NBTTagCompound) v;
|
CompoundNBT tc = (CompoundNBT) v;
|
||||||
HashMap<String, Object> vmap = new HashMap<String, Object>();
|
HashMap<String, Object> vmap = new HashMap<String, Object>();
|
||||||
for (Object t : tc.keySet()) {
|
for (Object t : tc.keySet()) {
|
||||||
String st = (String) t;
|
String st = (String) t;
|
||||||
INBTBase tg = tc.get(st);
|
INBT tg = tc.get(st);
|
||||||
vmap.put(st, getNBTValue(tg));
|
vmap.put(st, getNBTValue(tg));
|
||||||
}
|
}
|
||||||
val = vmap;
|
val = vmap;
|
||||||
break;
|
break;
|
||||||
case 11: // Int[]
|
case 11: // Int[]
|
||||||
val = ((NBTTagIntArray)v).getIntArray();
|
val = ((IntArrayNBT)v).getIntArray();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return val;
|
return val;
|
||||||
@ -1252,16 +1199,16 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prep snapshot and add to cache
|
// Prep snapshot and add to cache
|
||||||
private SnapshotRec prepChunkSnapshot(DynmapChunk chunk, NBTTagCompound nbt) {
|
private SnapshotRec prepChunkSnapshot(DynmapChunk chunk, CompoundNBT nbt) {
|
||||||
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
||||||
DynIntHashMap tileData = new DynIntHashMap();
|
DynIntHashMap tileData = new DynIntHashMap();
|
||||||
|
|
||||||
NBTTagList tiles = nbt.getList("TileEntities", 10);
|
ListNBT tiles = nbt.getList("TileEntities", 10);
|
||||||
if(tiles == null) tiles = new NBTTagList();
|
if(tiles == null) tiles = new ListNBT();
|
||||||
/* Get tile entity data */
|
/* Get tile entity data */
|
||||||
List<Object> vals = new ArrayList<Object>();
|
List<Object> vals = new ArrayList<Object>();
|
||||||
for(int tid = 0; tid < tiles.size(); tid++) {
|
for(int tid = 0; tid < tiles.size(); tid++) {
|
||||||
NBTTagCompound tc = tiles.getCompound(tid);
|
CompoundNBT tc = tiles.getCompound(tid);
|
||||||
int tx = tc.getInt("x");
|
int tx = tc.getInt("x");
|
||||||
int ty = tc.getInt("y");
|
int ty = tc.getInt("y");
|
||||||
int tz = tc.getInt("z");
|
int tz = tc.getInt("z");
|
||||||
@ -1272,7 +1219,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
if(te_fields != null) {
|
if(te_fields != null) {
|
||||||
vals.clear();
|
vals.clear();
|
||||||
for(String id: te_fields) {
|
for(String id: te_fields) {
|
||||||
INBTBase v = tc.get(id); /* Get field */
|
INBT v = tc.get(id); /* Get field */
|
||||||
if(v != null) {
|
if(v != null) {
|
||||||
Object val = getNBTValue(v);
|
Object val = getNBTValue(v);
|
||||||
if(val != null) {
|
if(val != null) {
|
||||||
@ -1325,13 +1272,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
ChunkSnapshot ss;
|
ChunkSnapshot ss;
|
||||||
DynIntHashMap tileData;
|
DynIntHashMap tileData;
|
||||||
if (vis) { // If visible
|
if (vis) { // If visible
|
||||||
NBTTagCompound nbt = new NBTTagCompound();
|
CompoundNBT nbt = ChunkSerializer.write((ServerWorld)w, cps.getChunk(chunk.x, chunk.z, false));
|
||||||
try {
|
|
||||||
writechunktonbt.invoke(cps.chunkLoader, cps.getChunk(chunk.x, chunk.z, false, false), w, nbt);
|
|
||||||
} catch (IllegalAccessException e) {
|
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
} catch (InvocationTargetException e) {
|
|
||||||
}
|
|
||||||
SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
||||||
ss = ssr.ss;
|
ss = ssr.ss;
|
||||||
tileData = ssr.tileData;
|
tileData = ssr.tileData;
|
||||||
@ -1399,7 +1340,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
|||||||
endChunkLoad(startTime, ChunkStats.CACHED_SNAPSHOT_HIT);
|
endChunkLoad(startTime, ChunkStats.CACHED_SNAPSHOT_HIT);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NBTTagCompound nbt = readChunk(chunk.x, chunk.z);
|
CompoundNBT nbt = readChunk(chunk.x, chunk.z);
|
||||||
// If read was good
|
// If read was good
|
||||||
if (nbt != null) {
|
if (nbt != null) {
|
||||||
ChunkSnapshot ss;
|
ChunkSnapshot ss;
|
||||||
|
@ -10,8 +10,8 @@ import net.minecraft.world.dimension.DimensionType;
|
|||||||
import net.minecraft.world.dimension.EndDimension;
|
import net.minecraft.world.dimension.EndDimension;
|
||||||
import net.minecraft.world.dimension.NetherDimension;
|
import net.minecraft.world.dimension.NetherDimension;
|
||||||
import net.minecraft.world.gen.Heightmap.Type;
|
import net.minecraft.world.gen.Heightmap.Type;
|
||||||
import net.minecraft.world.EnumLightType;
|
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
|
import net.minecraft.world.LightType;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.border.WorldBorder;
|
import net.minecraft.world.border.WorldBorder;
|
||||||
|
|
||||||
@ -124,10 +124,9 @@ public class ForgeWorld extends DynmapWorld
|
|||||||
public DynmapLocation getSpawnLocation()
|
public DynmapLocation getSpawnLocation()
|
||||||
{
|
{
|
||||||
if(world != null) {
|
if(world != null) {
|
||||||
BlockPos sloc = world.getSpawnPoint();
|
spawnloc.x = world.getWorldInfo().getSpawnX();
|
||||||
spawnloc.x = sloc.getX();
|
spawnloc.y = world.getWorldInfo().getSpawnY();
|
||||||
spawnloc.y = sloc.getY();
|
spawnloc.z = world.getWorldInfo().getSpawnZ();
|
||||||
spawnloc.z = sloc.getZ();
|
|
||||||
spawnloc.world = this.getName();
|
spawnloc.world = this.getName();
|
||||||
}
|
}
|
||||||
return spawnloc;
|
return spawnloc;
|
||||||
@ -196,7 +195,7 @@ public class ForgeWorld extends DynmapWorld
|
|||||||
public int getHighestBlockYAt(int x, int z)
|
public int getHighestBlockYAt(int x, int z)
|
||||||
{
|
{
|
||||||
if(world != null) {
|
if(world != null) {
|
||||||
return world.getWorld().getChunk(x >> 4, z >> 4).getHeightmap(Type.LIGHT_BLOCKING).getHeight(x & 15, z & 15);
|
return world.getWorld().getChunk(x >> 4, z >> 4).func_217303_b(Type.MOTION_BLOCKING).getHeight(x & 15, z & 15);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
@ -212,7 +211,7 @@ public class ForgeWorld extends DynmapWorld
|
|||||||
public int getSkyLightLevel(int x, int y, int z)
|
public int getSkyLightLevel(int x, int y, int z)
|
||||||
{
|
{
|
||||||
if(world != null) {
|
if(world != null) {
|
||||||
return world.getLightFor(EnumLightType.SKY, new BlockPos(x, y, z));
|
return world.getLightFor(LightType.SKY, new BlockPos(x, y, z));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -6,7 +6,7 @@ import java.util.HashSet;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
import org.dynmap.ConfigurationNode;
|
import org.dynmap.ConfigurationNode;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
@ -84,7 +84,7 @@ public class FilePermissions implements PermissionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(EntityPlayer psender, String permission) {
|
public boolean has(PlayerEntity psender, String permission) {
|
||||||
if(psender != null) {
|
if(psender != null) {
|
||||||
String n = psender.getName().getString().toLowerCase();
|
String n = psender.getName().getString().toLowerCase();
|
||||||
return hasPerm(n, permission);
|
return hasPerm(n, permission);
|
||||||
@ -92,7 +92,7 @@ public class FilePermissions implements PermissionProvider {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermissionNode(EntityPlayer psender, String permission) {
|
public boolean hasPermissionNode(PlayerEntity psender, String permission) {
|
||||||
if(psender != null) {
|
if(psender != null) {
|
||||||
String player = psender.getName().getString().toLowerCase();
|
String player = psender.getName().getString().toLowerCase();
|
||||||
return DynmapPlugin.plugin.isOp(player);
|
return DynmapPlugin.plugin.isOp(player);
|
||||||
|
@ -3,7 +3,7 @@ package org.dynmap.forge_1_14_4.permissions;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
import org.dynmap.forge_1_14_4.DynmapPlugin;
|
import org.dynmap.forge_1_14_4.DynmapPlugin;
|
||||||
@ -32,7 +32,7 @@ public class OpPermissions implements PermissionProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean has(EntityPlayer psender, String permission) {
|
public boolean has(PlayerEntity psender, String permission) {
|
||||||
if(psender != null) {
|
if(psender != null) {
|
||||||
if(usrCommands.contains(permission)) {
|
if(usrCommands.contains(permission)) {
|
||||||
return true;
|
return true;
|
||||||
@ -42,7 +42,7 @@ public class OpPermissions implements PermissionProvider {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean hasPermissionNode(EntityPlayer psender, String permission) {
|
public boolean hasPermissionNode(PlayerEntity psender, String permission) {
|
||||||
if(psender != null) {
|
if(psender != null) {
|
||||||
return DynmapPlugin.plugin.isOp(psender.getEntity().getName().getString());
|
return DynmapPlugin.plugin.isOp(psender.getEntity().getName().getString());
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ package org.dynmap.forge_1_14_4.permissions;
|
|||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
public interface PermissionProvider {
|
public interface PermissionProvider {
|
||||||
boolean has(EntityPlayer sender, String permission);
|
boolean has(PlayerEntity sender, String permission);
|
||||||
boolean hasPermissionNode(EntityPlayer sender, String permission);
|
boolean hasPermissionNode(PlayerEntity sender, String permission);
|
||||||
|
|
||||||
Set<String> hasOfflinePermissions(String player, Set<String> perms);
|
Set<String> hasOfflinePermissions(String player, Set<String> perms);
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ include ':bukkit-helper'
|
|||||||
include ':dynmap-api'
|
include ':dynmap-api'
|
||||||
include ':DynmapCore'
|
include ':DynmapCore'
|
||||||
include ':DynmapCoreAPI'
|
include ':DynmapCoreAPI'
|
||||||
//include ':forge-1.14.4'
|
include ':forge-1.14.4'
|
||||||
include ':forge-1.13.2'
|
include ':forge-1.13.2'
|
||||||
include ':forge-1.12.2'
|
include ':forge-1.12.2'
|
||||||
include ':forge-1.11.2'
|
include ':forge-1.11.2'
|
||||||
@ -23,7 +23,7 @@ project(':bukkit-helper').projectDir = "$rootDir/bukkit-helper" as File
|
|||||||
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
project(':dynmap-api').projectDir = "$rootDir/dynmap-api" as File
|
||||||
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
project(':DynmapCore').projectDir = "$rootDir/DynmapCore" as File
|
||||||
project(':DynmapCoreAPI').projectDir = "$rootDir/DynmapCoreAPI" as File
|
project(':DynmapCoreAPI').projectDir = "$rootDir/DynmapCoreAPI" as File
|
||||||
//project(':forge-1.14.4').projectDir = "$rootDir/forge-1.14.4" as File
|
project(':forge-1.14.4').projectDir = "$rootDir/forge-1.14.4" as File
|
||||||
project(':forge-1.13.2').projectDir = "$rootDir/forge-1.13.2" as File
|
project(':forge-1.13.2').projectDir = "$rootDir/forge-1.13.2" as File
|
||||||
project(':forge-1.12.2').projectDir = "$rootDir/forge-1.12.2" as File
|
project(':forge-1.12.2').projectDir = "$rootDir/forge-1.12.2" as File
|
||||||
project(':forge-1.11.2').projectDir = "$rootDir/forge-1.11.2" as File
|
project(':forge-1.11.2').projectDir = "$rootDir/forge-1.11.2" as File
|
||||||
|
Loading…
Reference in New Issue
Block a user