Fix block state iterator
This commit is contained in:
parent
745f8bc947
commit
27d767ac35
9 changed files with 30 additions and 17 deletions
|
|
@ -2,7 +2,7 @@ package org.dynmap.forge_1_13_2;
|
|||
|
||||
import java.io.File;
|
||||
|
||||
import org.dynmap.DynmapCommonAPI;
|
||||
import org.dynmap.DynmapCommonAPI;
|
||||
import org.dynmap.DynmapCommonAPIListener;
|
||||
import org.dynmap.Log;
|
||||
import org.dynmap.forge_1_13_2.DynmapPlugin.OurLog;
|
||||
|
|
@ -12,6 +12,7 @@ import net.minecraftforge.fml.common.Mod;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
|
|
@ -71,7 +72,7 @@ public class DynmapMod
|
|||
public void setup(final FMLCommonSetupEvent event)
|
||||
{
|
||||
//TOOO
|
||||
//jarfile = event.getSourceFile();
|
||||
jarfile = ModList.get().getModFileById("dynmap").getFile().getFilePath().toFile();
|
||||
//// Load configuration file - use suggested (config/WesterosBlocks.cfg)
|
||||
//Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
||||
//try {
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ public class DynmapPlugin
|
|||
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
||||
*/
|
||||
public void initializeBlockStates() {
|
||||
stateByID = new DynmapBlockState[512*16]; // Simple map - scale as needed
|
||||
stateByID = new DynmapBlockState[512*32]; // Simple map - scale as needed
|
||||
Arrays.fill(stateByID, DynmapBlockState.AIR); // Default to air
|
||||
|
||||
ObjectIntIdentityMap<IBlockState> bsids = Block.BLOCK_STATE_IDS;
|
||||
|
|
@ -198,15 +198,16 @@ public class DynmapPlugin
|
|||
Block b = bs.getBlock();
|
||||
// If this is new block vs last, it's the base block state
|
||||
if (b != baseb) {
|
||||
basebs = b;
|
||||
baseidx = idx;
|
||||
basebs = null;
|
||||
baseidx = idx;
|
||||
baseb = b;
|
||||
}
|
||||
|
||||
ResourceLocation ui = b.getRegistryName();
|
||||
if (ui == null) {
|
||||
continue;
|
||||
}
|
||||
String bn = ui.getNamespace() + ":" + ui.getPath();
|
||||
String bn = ui.getNamespace() + ":" + ui.getPath();
|
||||
// Only do defined names, and not "air"
|
||||
if (!bn.equals(DynmapBlockState.AIR_BLOCK)) {
|
||||
Material mat = bs.getMaterial();
|
||||
|
|
@ -217,8 +218,10 @@ public class DynmapPlugin
|
|||
}
|
||||
statename += p.getName() + "=" + bs.get(p).toString();
|
||||
}
|
||||
//Log.info("bn=" + bn + ", statenme=" + statename + ",idx=" + idx + ",baseidx=" + baseidx);
|
||||
DynmapBlockState dbs = new DynmapBlockState(basebs, idx - baseidx, bn, statename, mat.toString(), idx);
|
||||
stateByID[idx] = dbs;
|
||||
if (basebs == null) { basebs = dbs; }
|
||||
if (mat.isSolid()) {
|
||||
dbs.setSolid();
|
||||
}
|
||||
|
|
@ -235,7 +238,7 @@ public class DynmapPlugin
|
|||
}
|
||||
for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
|
||||
DynmapBlockState bs = DynmapBlockState.getStateByGlobalIndex(gidx);
|
||||
Log.info(gidx + ":" + bs.toString() + ", gidx=" + bs.globalStateIndex + ", sidx=" + bs.stateIndex);
|
||||
//Log.info(gidx + ":" + bs.toString() + ", gidx=" + bs.globalStateIndex + ", sidx=" + bs.stateIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1008,8 +1011,11 @@ public class DynmapPlugin
|
|||
public File getModContainerFile(String name) {
|
||||
ModFileInfo mfi = ModList.get().getModFileById(name); // Try case sensitive lookup
|
||||
if (mfi != null) {
|
||||
return mfi.getFile().getFilePath().toFile();
|
||||
File f = mfi.getFile().getFilePath().toFile();
|
||||
Log.info("getModContainferFile(" + name + ")=" + f.getAbsolutePath());
|
||||
return f;
|
||||
}
|
||||
Log.info("getModContainferFile(" + name + ")=null");
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue