Merge remote-tracking branch 'origin' into fix1renderer

Conflicts:
	src/net/mosstest/servercore/RenderProcessor.java
master
Aaron Chan 2013-11-01 18:30:06 -04:00
commit a589734645
120 changed files with 7752 additions and 7734 deletions

View File

@ -5,10 +5,14 @@ import net.mosstest.scripting.Position;
public interface IRenderPreparator { public interface IRenderPreparator {
public void setRenderProcessor(RenderProcessor rend);
public abstract MapChunk requestChunk(Position pos) public abstract MapChunk requestChunk(Position pos)
throws MapGeneratorException, InterruptedException; throws MapGeneratorException, InterruptedException;
public abstract void recvOutstandingChunk(Position pos, MapChunk chk); public abstract void recvOutstandingChunk(Position pos, MapChunk chk);
public abstract void shutdown(); public abstract void shutdown();
public abstract void start();
} }

View File

@ -19,7 +19,7 @@ public class LocalRenderPreparator implements IRenderPreparator {
MapChunk chk = LocalRenderPreparator.this.nc MapChunk chk = LocalRenderPreparator.this.nc
.getChunk(requested); .getChunk(requested);
chk.pos = requested; chk.pos = requested;
LocalRenderPreparator.this.rp.renderEventQueue LocalRenderPreparator.this.rend.renderEventQueue
.put(new MossRenderChunkEvent(chk)); .put(new MossRenderChunkEvent(chk));
} catch (InterruptedException e) { } catch (InterruptedException e) {
// pass // pass
@ -32,7 +32,7 @@ public class LocalRenderPreparator implements IRenderPreparator {
} }
private RenderProcessor rp; private RenderProcessor rend;
private NodeCache nc; private NodeCache nc;
private volatile boolean run = true; private volatile boolean run = true;
public ArrayBlockingQueue<Position> chunkRequests = new ArrayBlockingQueue<>( public ArrayBlockingQueue<Position> chunkRequests = new ArrayBlockingQueue<>(
@ -59,9 +59,8 @@ public class LocalRenderPreparator implements IRenderPreparator {
} }
public LocalRenderPreparator(RenderProcessor rp, NodeCache nc) { public LocalRenderPreparator(RenderProcessor rp, NodeCache nc) {
this.rp = rp; this.rend = rp;
this.nc = nc; this.nc = nc;
this.lookupThread.start();
} }
@Override @Override
@ -71,8 +70,19 @@ public class LocalRenderPreparator implements IRenderPreparator {
@Override @Override
public void recvOutstandingChunk(Position pos, MapChunk chk) { public void recvOutstandingChunk(Position pos, MapChunk chk) {
// TODO Auto-generated method stub // pass
}
@Override
public void start() {
System.out.println("<<< START LOCAL RENDER PREPARATOR >>>");
this.lookupThread.start();
}
@Override
public void setRenderProcessor(RenderProcessor rend) {
this.rend = rend;
} }
// TODO: Handle player movement, other server->client events affecting // TODO: Handle player movement, other server->client events affecting

View File

@ -24,6 +24,7 @@ public class NodeManager {
"sys:unknown", "An unknown piece of the world", 1); "sys:unknown", "An unknown piece of the world", 1);
{ {
this.unknownFallbackNode.setNodeId((short) -1); this.unknownFallbackNode.setNodeId((short) -1);
definedNodes.add(this.unknownFallbackNode);
} }
public MapNode getNode(short nodeId) { public MapNode getNode(short nodeId) {
@ -35,6 +36,7 @@ public class NodeManager {
node.setNodeId(this.pending.inverse().get(node.nodeName)); node.setNodeId(this.pending.inverse().get(node.nodeName));
this.definedNodes.set(this.pending.inverse().get(node.nodeName), this.definedNodes.set(this.pending.inverse().get(node.nodeName),
node); node);
this.defNodeByName.put(node.nodeName, node);
} else { } else {
if (this.definedNodes.size() > 16384) if (this.definedNodes.size() > 16384)
throw new MossWorldLoadException("Too many nodedefs"); //$NON-NLS-1$ throw new MossWorldLoadException("Too many nodedefs"); //$NON-NLS-1$
@ -42,10 +44,11 @@ public class NodeManager {
node.setNodeId((short) this.definedNodes.size()); node.setNodeId((short) this.definedNodes.size());
this.definedNodes.add(node); this.definedNodes.add(node);
this.defNodeByName.put(node.nodeName, node);
this.nodeDb.put(new byte[] { (byte) (node.getNodeId() >>> 8), this.nodeDb.put(new byte[] { (byte) (node.getNodeId() >>> 8),
(byte) (node.getNodeId() & 0xFF) }, bytes(node.nodeName)); (byte) (node.getNodeId() & 0xFF) }, bytes(node.nodeName));
} }
this.defNodeByName.put(node.nodeName, node);
return node.getNodeId(); return node.getNodeId();
} }

View File

@ -1,3 +1,4 @@
package net.mosstest.servercore; package net.mosstest.servercore;
import java.util.HashMap; import java.util.HashMap;