mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-26 08:41:33 +01:00
More 1.13.2 fixes
This commit is contained in:
parent
b61b5ca39a
commit
9d7878c530
@ -67,8 +67,8 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerChangedDimensionEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedOutEvent;
|
||||
@ -1012,10 +1012,8 @@ public class DynmapPlugin
|
||||
ModFileInfo mfi = ModList.get().getModFileById(name); // Try case sensitive lookup
|
||||
if (mfi != null) {
|
||||
File f = mfi.getFile().getFilePath().toFile();
|
||||
Log.info("getModContainferFile(" + name + ")=" + f.getAbsolutePath());
|
||||
return f;
|
||||
}
|
||||
Log.info("getModContainferFile(" + name + ")=null");
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
@ -1037,8 +1035,8 @@ public class DynmapPlugin
|
||||
@Override
|
||||
public InputStream openResource(String modid, String rname) {
|
||||
if (modid != null) {
|
||||
ModContainer mc = ModList.get().getModContainerById(modid).get();
|
||||
Object mod = (mc != null) ? mc.getMod() : null;
|
||||
Optional<? extends ModContainer> mc = ModList.get().getModContainerById(modid);
|
||||
Object mod = (mc.isPresent()) ? mc.get().getMod() : null;
|
||||
if (mod != null) {
|
||||
InputStream is = mod.getClass().getClassLoader().getResourceAsStream(rname);
|
||||
if (is != null) {
|
||||
@ -1048,8 +1046,8 @@ public class DynmapPlugin
|
||||
}
|
||||
List<ModInfo> mcl = ModList.get().getMods();
|
||||
for (ModInfo mci : mcl) {
|
||||
ModContainer mc = ModList.get().getModContainerById(mci.getModId()).get();
|
||||
Object mod = (mc != null) ? mc.getMod() : null;
|
||||
Optional<? extends ModContainer> mc = ModList.get().getModContainerById(mci.getModId());
|
||||
Object mod = (mc.isPresent()) ? mc.get().getMod() : null;
|
||||
if (mod == null) continue;
|
||||
InputStream is = mod.getClass().getClassLoader().getResourceAsStream(rname);
|
||||
if (is != null) {
|
||||
|
@ -61,7 +61,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
private static Field updateEntityTick = null;
|
||||
/* AnvilChunkLoader fields */
|
||||
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)
|
||||
|
||||
/* AnvilChunkLoaderPending fields */
|
||||
@ -87,7 +87,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
private byte[][] sameneighborbiomecnt;
|
||||
private BiomeMap[][] biomemap;
|
||||
private boolean[][] isSectionNotEmpty; /* Indexed by snapshot index, then by section index */
|
||||
private Set<?> queue = null;
|
||||
private it.unimi.dsi.fastutil.longs.LongSet queue = null;
|
||||
|
||||
private static final BlockStep unstep[] = { BlockStep.X_MINUS, BlockStep.Y_MINUS, BlockStep.Z_MINUS,
|
||||
BlockStep.X_PLUS, BlockStep.Y_PLUS, BlockStep.Z_PLUS
|
||||
@ -887,7 +887,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
Field[] f = ChunkProviderServer.class.getDeclaredFields();
|
||||
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
if((unloadqueue == null) && f[i].getType().isAssignableFrom(java.util.Set.class)) {
|
||||
if((unloadqueue == null) && f[i].getType().isAssignableFrom(it.unimi.dsi.fastutil.longs.LongSet.class)) {
|
||||
unloadqueue = f[i];
|
||||
//Log.info("Found unloadqueue - " + f[i].getName());
|
||||
unloadqueue.setAccessible(true);
|
||||
@ -911,13 +911,15 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
f = AnvilChunkLoader.class.getDeclaredFields();
|
||||
for(int i = 0; i < f.length; i++) {
|
||||
if((chunksToRemove == null) && (f[i].getType().equals(Map.class))) {
|
||||
chunksToRemove = f[i];
|
||||
chunksToRemove = f[i];
|
||||
//Log.info("Found chunksToRemove - " + f[i].getName());
|
||||
chunksToRemove.setAccessible(true);
|
||||
}
|
||||
else if((pendingAnvilChunksCoordinates == null) && (f[i].getType().equals(Set.class))) {
|
||||
pendingAnvilChunksCoordinates = f[i];
|
||||
pendingAnvilChunksCoordinates.setAccessible(true);
|
||||
}
|
||||
// else if((pendingAnvilChunksCoordinates == null) && (f[i].getType().equals(it.unimi.dsi.fastutil.longs.LongSet.class))) {
|
||||
// //Log.info("Found pendingAnvilChunksCoordinates - " + f[i].getName());
|
||||
// pendingAnvilChunksCoordinates = f[i];
|
||||
// pendingAnvilChunksCoordinates.setAccessible(true);
|
||||
// }
|
||||
}
|
||||
// Get writeChunkToNBT method
|
||||
Method[] ma = AnvilChunkLoader.class.getDeclaredMethods();
|
||||
@ -925,6 +927,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
Class<?>[] p = m.getParameterTypes();
|
||||
if ((p.length == 3) && (p[0].equals(Chunk.class)) && (p[1].equals(World.class)) && (p[2].equals(NBTTagCompound.class))) {
|
||||
writechunktonbt = m;
|
||||
//Log.info("Found writechunktonbt- " + m.getName());
|
||||
m.setAccessible(true);
|
||||
break;
|
||||
}
|
||||
@ -961,7 +964,6 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
if (cp instanceof ChunkProviderServer)
|
||||
{
|
||||
cps = (ChunkProviderServer)cp;
|
||||
Log.info("World " + dw.getName() + " has chunk provider " + cps.getClass().getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1023,7 +1025,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
{
|
||||
if ((unloadqueue != null) && (cps != null))
|
||||
{
|
||||
queue = (Set<?>)unloadqueue.get(cps);
|
||||
queue = (it.unimi.dsi.fastutil.longs.LongSet) unloadqueue.get(cps);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException iax)
|
||||
@ -1039,7 +1041,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
|
||||
public NBTTagCompound readChunk(int x, int z) {
|
||||
if((cps == null) || (!(cps.chunkLoader instanceof AnvilChunkLoader)) ||
|
||||
(((chunksToRemove == null) || (pendingAnvilChunksCoordinates == null)))) {
|
||||
(((chunksToRemove == null) /*|| (pendingAnvilChunksCoordinates == null) */))) {
|
||||
if (!didError) {
|
||||
Log.severe("**** DYNMAP CANNOT READ CHUNKS (UNSUPPORTED CHUNK LOADER) ****");
|
||||
didError = true;
|
||||
@ -1049,41 +1051,41 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
try {
|
||||
AnvilChunkLoader acl = (AnvilChunkLoader)cps.chunkLoader;
|
||||
Map<?,?> chunkstoremove = null;
|
||||
Set<?> pendingcoords = null;
|
||||
//it.unimi.dsi.fastutil.longs.LongSet pendingcoords;
|
||||
|
||||
chunkstoremove = (Map<?,?>)chunksToRemove.get(acl);
|
||||
pendingcoords = (Set<?>)pendingAnvilChunksCoordinates.get(acl);
|
||||
//pendingcoords = (it.unimi.dsi.fastutil.longs.LongSet) pendingAnvilChunksCoordinates.get(acl);
|
||||
|
||||
NBTTagCompound rslt = null;
|
||||
ChunkPos coord = new ChunkPos(x, z);
|
||||
|
||||
if (pendingcoords.contains(coord)) {
|
||||
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 (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 (occ.equals(coord)) {
|
||||
// rslt = (NBTTagCompound)nbtTag.get(o);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
if (rslt == null) {
|
||||
DataInputStream str = RegionFileCache.getChunkInputStream(acl.chunkSaveLocation, x, z);
|
||||
@ -1232,7 +1234,7 @@ public class ForgeMapChunkCache extends MapChunkCache
|
||||
if (queue != null)
|
||||
{
|
||||
long coord = ChunkPos.asLong(chunk.x, chunk.z);
|
||||
isunloadpending = queue.contains(Long.valueOf(coord));
|
||||
isunloadpending = queue.contains(coord);
|
||||
}
|
||||
return isunloadpending;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user