mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
nodespace bullshit
This commit is contained in:
parent
1b24a1d860
commit
43d3d03df5
@ -25,13 +25,38 @@ public class Nodespace {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void createNode(World world, PowerNode node) {
|
||||||
|
NodeWorld nodeWorld = worlds.get(world);
|
||||||
|
if(nodeWorld == null) {
|
||||||
|
nodeWorld = new NodeWorld();
|
||||||
|
worlds.put(world, nodeWorld);
|
||||||
|
}
|
||||||
|
nodeWorld.pushNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void destroyNode(World world, int x, int y, int z) {
|
||||||
|
PowerNode node = getNode(world, x, y, z);
|
||||||
|
if(node != null) worlds.get(world).popNode(node);
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateNodespace() {
|
public static void updateNodespace() {
|
||||||
|
|
||||||
for(World world : MinecraftServer.getServer().worldServers) {
|
for(World world : MinecraftServer.getServer().worldServers) {
|
||||||
NodeWorld nodes = worlds.get(world);
|
NodeWorld nodes = worlds.get(world);
|
||||||
|
|
||||||
|
for(Entry<BlockPos, PowerNode> entry : nodes.nodes.entrySet()) {
|
||||||
|
PowerNode node = entry.getValue();
|
||||||
|
if(node.net == null || !node.net.isValid()) {
|
||||||
|
tryConnectNode(world, node);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void tryConnectNode(World world, PowerNode node) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static class NodeWorld {
|
public static class NodeWorld {
|
||||||
|
|
||||||
/** Contains a map showing where each node is, a node is every spot that a cable exists at.
|
/** Contains a map showing where each node is, a node is every spot that a cable exists at.
|
||||||
@ -47,6 +72,7 @@ public class Nodespace {
|
|||||||
|
|
||||||
/** Removes the specified node from all positions from nodespace */
|
/** Removes the specified node from all positions from nodespace */
|
||||||
public void popNode(PowerNode node) {
|
public void popNode(PowerNode node) {
|
||||||
|
if(node.net != null) node.net.destroy();
|
||||||
for(BlockPos pos : node.positions) {
|
for(BlockPos pos : node.positions) {
|
||||||
nodes.remove(pos);
|
nodes.remove(pos);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,7 @@ public class WavefrontObjDisplayList implements IModelCustom {
|
|||||||
@Override
|
@Override
|
||||||
public void renderAll() {
|
public void renderAll() {
|
||||||
for(Pair<String, Integer> p : nameToCallList)
|
for(Pair<String, Integer> p : nameToCallList)
|
||||||
GL11.glCallList(p.getRight());
|
callList(p.getRight());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -64,7 +64,7 @@ public class WavefrontObjDisplayList implements IModelCustom {
|
|||||||
for(Pair<String, Integer> p : nameToCallList){
|
for(Pair<String, Integer> p : nameToCallList){
|
||||||
for(String name : groupNames){
|
for(String name : groupNames){
|
||||||
if(p.getLeft().equalsIgnoreCase(name)){
|
if(p.getLeft().equalsIgnoreCase(name)){
|
||||||
GL11.glCallList(p.getRight());
|
callList(p.getRight());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class WavefrontObjDisplayList implements IModelCustom {
|
|||||||
public void renderPart(String partName) {
|
public void renderPart(String partName) {
|
||||||
for(Pair<String, Integer> p : nameToCallList){
|
for(Pair<String, Integer> p : nameToCallList){
|
||||||
if(p.getLeft().equalsIgnoreCase(partName)){
|
if(p.getLeft().equalsIgnoreCase(partName)){
|
||||||
GL11.glCallList(p.getRight());
|
callList(p.getRight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -91,8 +91,16 @@ public class WavefrontObjDisplayList implements IModelCustom {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!skip){
|
if(!skip){
|
||||||
GL11.glCallList(p.getRight());
|
callList(p.getRight());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static void callList(int i) {
|
||||||
|
boolean prevBlend = GL11.glIsEnabled(GL11.GL_BLEND);
|
||||||
|
GL11.glCallList(i);
|
||||||
|
boolean newBlend = GL11.glIsEnabled(GL11.GL_BLEND);
|
||||||
|
if(prevBlend && !newBlend) GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
if(!prevBlend && newBlend) GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user