mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-02-15 11:21:58 +01:00
Scrub more 4096 block ID limits
This commit is contained in:
parent
4a5a85c995
commit
ff36c50e06
@ -26,7 +26,6 @@ import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@ -34,7 +33,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
import org.dynmap.blockstate.BlockStateManager;
|
||||
import org.dynmap.common.DynmapCommandSender;
|
||||
import org.dynmap.common.DynmapListenerManager;
|
||||
import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
@ -80,8 +78,6 @@ import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
public class DynmapCore implements DynmapCommonAPI {
|
||||
// Current architectural limit for Minecraft block IDs
|
||||
public static final int BLOCKTABLELEN = 4096;
|
||||
/**
|
||||
* Callbacks for core initialization - subclassed by platform plugins
|
||||
*/
|
||||
@ -138,8 +134,6 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
private String[] biomenames = new String[0];
|
||||
private Map<String, Integer> blockmap = null;
|
||||
private Map<String, Integer> itemmap = null;
|
||||
private static String[] blocknames = null;
|
||||
private BlockStateManager blkstateman = new BlockStateManager();
|
||||
|
||||
private boolean loginRequired;
|
||||
|
||||
@ -216,10 +210,6 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
return blockmap;
|
||||
}
|
||||
|
||||
public static final String getBlockName(int id) {
|
||||
return blocknames[id];
|
||||
}
|
||||
|
||||
public final void setBiomeNames(String[] names) {
|
||||
biomenames = names;
|
||||
}
|
||||
@ -474,13 +464,7 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
/* Get block and item maps */
|
||||
blockmap = server.getBlockUniqueIDMap();
|
||||
itemmap = server.getItemUniqueIDMap();
|
||||
|
||||
/* Build block name list */
|
||||
blocknames = new String[DynmapCore.BLOCKTABLELEN];
|
||||
for (Entry<String, Integer> v : blockmap.entrySet()) {
|
||||
blocknames[v.getValue()] = v.getKey();
|
||||
}
|
||||
|
||||
|
||||
/* Process mod support */
|
||||
ModSupportImpl.complete(this.dataDirectory);
|
||||
/* Load block models */
|
||||
@ -2413,9 +2397,5 @@ public class DynmapCore implements DynmapCommonAPI {
|
||||
public MapStorage getDefaultMapStorage() {
|
||||
return defaultStorage;
|
||||
}
|
||||
|
||||
public BlockStateManager getBlockStateManager() {
|
||||
return blkstateman;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
package org.dynmap.blockstate;
|
||||
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.renderer.DynmapBlockState;
|
||||
import org.dynmap.renderer.MapDataContext;
|
||||
|
||||
// Handler for managing mapping of block states
|
||||
public class BlockStateManager {
|
||||
private static IBlockStateHandler DEFAULT = new MetadataBlockStateHandler();
|
||||
|
||||
private IBlockStateHandler[] blockHandlers = new IBlockStateHandler[DynmapCore.BLOCKTABLELEN];
|
||||
|
||||
public BlockStateManager() {
|
||||
// Default to all meta for now
|
||||
for (int i = 0; i < blockHandlers.length; i++) {
|
||||
blockHandlers[i] = DEFAULT;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get state count for given block ID
|
||||
* @param blkid - Block ID
|
||||
* @return state cnt
|
||||
*/
|
||||
public int getBlockStateCount(int blkid) {
|
||||
if ((blkid >= 0) && (blkid < blockHandlers.length)) {
|
||||
return blockHandlers[blkid].getBlockStateCount();
|
||||
}
|
||||
return DEFAULT.getBlockStateCount();
|
||||
}
|
||||
/**
|
||||
* Get state for current block
|
||||
* @param blkctx = block context
|
||||
* @return state index
|
||||
*/
|
||||
public int getBlockStateIndex(MapDataContext mdc) {
|
||||
DynmapBlockState blk = mdc.getBlockType();
|
||||
return (blk != null) ? blk.stateIndex : 0;
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package org.dynmap.blockstate;
|
||||
|
||||
import org.dynmap.renderer.MapDataContext;
|
||||
|
||||
/**
|
||||
* Interface for block state handlers
|
||||
*/
|
||||
public interface IBlockStateHandler {
|
||||
/**
|
||||
* Return number of distinct blocks states
|
||||
* @return state count
|
||||
*/
|
||||
public int getBlockStateCount();
|
||||
/**
|
||||
* Map current block to state
|
||||
* @param mdc - current map data context
|
||||
* @return state index
|
||||
*/
|
||||
public int getBlockStateIndex(MapDataContext mdc);
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package org.dynmap.blockstate;
|
||||
|
||||
import org.dynmap.renderer.MapDataContext;
|
||||
|
||||
public class MetadataBlockStateHandler implements IBlockStateHandler {
|
||||
@Override
|
||||
public int getBlockStateCount() {
|
||||
return 16; // Always 16 for metadata
|
||||
}
|
||||
@Override
|
||||
public int getBlockStateIndex(MapDataContext mdc) {
|
||||
return mdc.getBlockType().stateIndex;
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package org.dynmap.modsupport.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.modsupport.BlockModel;
|
||||
|
||||
public abstract class BlockModelImpl implements BlockModel {
|
||||
@ -26,7 +25,7 @@ public abstract class BlockModelImpl implements BlockModel {
|
||||
*/
|
||||
@Override
|
||||
public void addBlockID(int blockID) {
|
||||
if ((blockID > 0) && (blockID < DynmapCore.BLOCKTABLELEN)) {
|
||||
if (blockID > 0) {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (ids[i] == blockID) {
|
||||
return;
|
||||
|
@ -3,7 +3,6 @@ package org.dynmap.modsupport.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.dynmap.DynmapCore;
|
||||
import org.dynmap.hdmap.TexturePack;
|
||||
import org.dynmap.modsupport.BlockSide;
|
||||
import org.dynmap.modsupport.BlockTextureRecord;
|
||||
@ -117,7 +116,7 @@ public class BlockTextureRecordImpl implements BlockTextureRecord {
|
||||
*/
|
||||
@Override
|
||||
public void addBlockID(int blockID) {
|
||||
if ((blockID > 0) && (blockID < DynmapCore.BLOCKTABLELEN)) {
|
||||
if (blockID > 0) {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (ids[i] == blockID) {
|
||||
return;
|
||||
|
@ -50,7 +50,7 @@ public class CopyBlockTextureRecordImpl implements CopyBlockTextureRecord {
|
||||
*/
|
||||
@Override
|
||||
public void addBlockID(int blockID) {
|
||||
if ((blockID > 0) && (blockID < DynmapCore.BLOCKTABLELEN)) {
|
||||
if (blockID > 0) {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
if (ids[i] == blockID) {
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user