Fix block state iterator
This commit is contained in:
parent
17c624952b
commit
78da49da14
9 changed files with 30 additions and 17 deletions
|
|
@ -188,7 +188,7 @@ public class HDBlockModels {
|
||||||
/* Check mods to see if model files defined there: do these first, as they trump other sources */
|
/* Check mods to see if model files defined there: do these first, as they trump other sources */
|
||||||
for (String modid : core.getServer().getModList()) {
|
for (String modid : core.getServer().getModList()) {
|
||||||
File f = core.getServer().getModContainerFile(modid); // Get mod file
|
File f = core.getServer().getModContainerFile(modid); // Get mod file
|
||||||
if (f.isFile()) {
|
if ((f != null) && f.isFile()) {
|
||||||
zf = null;
|
zf = null;
|
||||||
in = null;
|
in = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
|
compile 'org.yaml:snakeyaml:1.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
|
compile 'org.yaml:snakeyaml:1.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||||
jcenter()
|
jcenter()
|
||||||
maven {
|
mavenCentral()
|
||||||
name = "forge"
|
|
||||||
url = "http://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
maven {url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
maven {url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
@ -17,6 +15,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
|
compile 'org.yaml:snakeyaml:1.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
maven { url = 'https://files.minecraftforge.net/maven' }
|
||||||
jcenter()
|
jcenter()
|
||||||
maven {
|
mavenCentral()
|
||||||
name = "forge"
|
|
||||||
url = "http://files.minecraftforge.net/maven"
|
|
||||||
}
|
|
||||||
maven {url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
maven {url = "https://oss.sonatype.org/content/repositories/snapshots/"}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package org.dynmap.forge_1_13_2;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import org.dynmap.DynmapCommonAPI;
|
import org.dynmap.DynmapCommonAPI;
|
||||||
import org.dynmap.DynmapCommonAPIListener;
|
import org.dynmap.DynmapCommonAPIListener;
|
||||||
import org.dynmap.Log;
|
import org.dynmap.Log;
|
||||||
import org.dynmap.forge_1_13_2.DynmapPlugin.OurLog;
|
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.common.MinecraftForge;
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import net.minecraftforge.fml.DistExecutor;
|
import net.minecraftforge.fml.DistExecutor;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||||
|
|
@ -71,7 +72,7 @@ public class DynmapMod
|
||||||
public void setup(final FMLCommonSetupEvent event)
|
public void setup(final FMLCommonSetupEvent event)
|
||||||
{
|
{
|
||||||
//TOOO
|
//TOOO
|
||||||
//jarfile = event.getSourceFile();
|
jarfile = ModList.get().getModFileById("dynmap").getFile().getFilePath().toFile();
|
||||||
//// Load configuration file - use suggested (config/WesterosBlocks.cfg)
|
//// Load configuration file - use suggested (config/WesterosBlocks.cfg)
|
||||||
//Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
//Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
|
||||||
//try {
|
//try {
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ public class DynmapPlugin
|
||||||
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
* Initialize block states (org.dynmap.blockstate.DynmapBlockState)
|
||||||
*/
|
*/
|
||||||
public void initializeBlockStates() {
|
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
|
Arrays.fill(stateByID, DynmapBlockState.AIR); // Default to air
|
||||||
|
|
||||||
ObjectIntIdentityMap<IBlockState> bsids = Block.BLOCK_STATE_IDS;
|
ObjectIntIdentityMap<IBlockState> bsids = Block.BLOCK_STATE_IDS;
|
||||||
|
|
@ -198,15 +198,16 @@ public class DynmapPlugin
|
||||||
Block b = bs.getBlock();
|
Block b = bs.getBlock();
|
||||||
// If this is new block vs last, it's the base block state
|
// If this is new block vs last, it's the base block state
|
||||||
if (b != baseb) {
|
if (b != baseb) {
|
||||||
basebs = b;
|
basebs = null;
|
||||||
baseidx = idx;
|
baseidx = idx;
|
||||||
|
baseb = b;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceLocation ui = b.getRegistryName();
|
ResourceLocation ui = b.getRegistryName();
|
||||||
if (ui == null) {
|
if (ui == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String bn = ui.getNamespace() + ":" + ui.getPath();
|
String bn = ui.getNamespace() + ":" + ui.getPath();
|
||||||
// Only do defined names, and not "air"
|
// Only do defined names, and not "air"
|
||||||
if (!bn.equals(DynmapBlockState.AIR_BLOCK)) {
|
if (!bn.equals(DynmapBlockState.AIR_BLOCK)) {
|
||||||
Material mat = bs.getMaterial();
|
Material mat = bs.getMaterial();
|
||||||
|
|
@ -217,8 +218,10 @@ public class DynmapPlugin
|
||||||
}
|
}
|
||||||
statename += p.getName() + "=" + bs.get(p).toString();
|
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);
|
DynmapBlockState dbs = new DynmapBlockState(basebs, idx - baseidx, bn, statename, mat.toString(), idx);
|
||||||
stateByID[idx] = dbs;
|
stateByID[idx] = dbs;
|
||||||
|
if (basebs == null) { basebs = dbs; }
|
||||||
if (mat.isSolid()) {
|
if (mat.isSolid()) {
|
||||||
dbs.setSolid();
|
dbs.setSolid();
|
||||||
}
|
}
|
||||||
|
|
@ -235,7 +238,7 @@ public class DynmapPlugin
|
||||||
}
|
}
|
||||||
for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
|
for (int gidx = 0; gidx < DynmapBlockState.getGlobalIndexMax(); gidx++) {
|
||||||
DynmapBlockState bs = DynmapBlockState.getStateByGlobalIndex(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) {
|
public File getModContainerFile(String name) {
|
||||||
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) {
|
||||||
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;
|
return null;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
|
compile 'org.yaml:snakeyaml:1.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ apply plugin: 'com.github.johnrengelman.shadow'
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ":DynmapCore", configuration: "shadow")
|
compile project(path: ":DynmapCore", configuration: "shadow")
|
||||||
|
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||||
|
compile 'org.yaml:snakeyaml:1.23'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue