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