mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-21 12:32:09 +00:00
Fix node and drain rendering
This commit is contained in:
1 parent
50fe31ad2c
commit
6344bfb4fd
3 files changed
+103
-25
No files matched your search
@@ -34,6 +34,7 @@ import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects;
|
||||
import makeo.gadomancy.client.util.ExtendedTypeDisplayManager;
|
||||
import makeo.gadomancy.client.util.FamiliarHandlerClient;
|
||||
import makeo.gadomancy.client.util.MultiTickEffectDispatcher;
|
||||
import makeo.gadomancy.client.util.NodeRenderQueue;
|
||||
import makeo.gadomancy.common.CommonProxy;
|
||||
import makeo.gadomancy.common.Gadomancy;
|
||||
import makeo.gadomancy.common.blocks.tiles.TileExtendedNode;
|
||||
@@ -190,6 +191,7 @@ public final class RenderEventHandler {
|
||||
public void worldRenderEvent(RenderWorldLastEvent event) {
|
||||
ExtendedTypeDisplayManager.notifyRenderTick();
|
||||
MultiTickEffectDispatcher.notifyRenderTick(Minecraft.getMinecraft().theWorld, event.partialTicks);
|
||||
NodeRenderQueue.flush(event.partialTicks);
|
||||
}
|
||||
|
||||
private EntityPlayer current;
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.minecraft.util.Vec3;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import makeo.gadomancy.client.util.NodeRenderQueue;
|
||||
import makeo.gadomancy.common.events.EventHandlerRedirect;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
@@ -234,19 +235,19 @@ public class RenderTileNodeBasic {
|
||||
}
|
||||
}
|
||||
// Gadomancy: Changed from tile.xCoord, ... to x, y, z to make it dependent from params
|
||||
RenderTileNodeBasic.renderNode(
|
||||
viewer,
|
||||
viewDistance,
|
||||
condition,
|
||||
depthIgnore,
|
||||
size,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
partialTicks,
|
||||
((INode) tile).getAspects(),
|
||||
((INode) tile).getNodeType(),
|
||||
((INode) tile).getNodeModifier());
|
||||
NodeRenderQueue.nodeQueue.add(
|
||||
new NodeRenderQueue.QueuedNode(
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
viewDistance,
|
||||
condition,
|
||||
depthIgnore,
|
||||
size,
|
||||
((INode) tile).getAspects(),
|
||||
((INode) tile).getNodeType(),
|
||||
((INode) tile).getNodeModifier()));
|
||||
|
||||
if (((tile instanceof TileNode)) && (((TileNode) tile).drainEntity != null)
|
||||
&& (((TileNode) tile).drainCollision != null)) {
|
||||
Entity drainEntity = ((TileNode) tile).drainEntity;
|
||||
@@ -282,18 +283,17 @@ public class RenderTileNodeBasic {
|
||||
double d5 = drainEntity.prevPosZ + (drainEntity.posZ - drainEntity.prevPosZ) * partialTicks + vec3.zCoord;
|
||||
double d6 = drainEntity == Minecraft.getMinecraft().thePlayer ? 0.0D : drainEntity.getEyeHeight();
|
||||
|
||||
UtilsFX.drawFloatyLine(
|
||||
d3,
|
||||
d4 + d6,
|
||||
d5,
|
||||
drainCollision.blockX + 0.5D,
|
||||
drainCollision.blockY + 0.5D,
|
||||
drainCollision.blockZ + 0.5D,
|
||||
partialTicks,
|
||||
((TileNode) tile).color.getRGB(),
|
||||
"textures/misc/wispy.png",
|
||||
-0.02F,
|
||||
Math.min(iiud, 10) / 10.0F);
|
||||
NodeRenderQueue.drainQueue.add(
|
||||
new NodeRenderQueue.QueuedDrainBeam(
|
||||
d3,
|
||||
d4 + d6,
|
||||
d5,
|
||||
drainCollision.blockX + 0.5D,
|
||||
drainCollision.blockY + 0.5D,
|
||||
drainCollision.blockZ + 0.5D,
|
||||
((TileNode) tile).color.getRGB(),
|
||||
Math.min(iiud, 10) / 10.0F,
|
||||
partialTicks));
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package makeo.gadomancy.client.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.github.bsideup.jabel.Desugar;
|
||||
|
||||
import makeo.gadomancy.client.renderers.tile.RenderTileNodeBasic;
|
||||
import thaumcraft.api.aspects.AspectList;
|
||||
import thaumcraft.api.nodes.NodeModifier;
|
||||
import thaumcraft.api.nodes.NodeType;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
public class NodeRenderQueue {
|
||||
|
||||
public static final List<QueuedNode> nodeQueue = new ArrayList<>();
|
||||
public static final List<QueuedDrainBeam> drainQueue = new ArrayList<>();
|
||||
|
||||
@Desugar
|
||||
public record QueuedNode(double x, double y, double z, double viewDistance, boolean visible, boolean depthIgnore,
|
||||
float size, AspectList aspects, NodeType type, NodeModifier mod) {}
|
||||
|
||||
@Desugar
|
||||
public record QueuedDrainBeam(double fromX, double fromY, double fromZ, double toX, double toY, double toZ,
|
||||
int color, float alpha, float partialTicks) {}
|
||||
|
||||
public static void flush(float partialTicks) {
|
||||
EntityLivingBase viewer = Minecraft.getMinecraft().renderViewEntity;
|
||||
|
||||
if (!nodeQueue.isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
for (QueuedNode qn : nodeQueue) {
|
||||
RenderTileNodeBasic.renderNode(
|
||||
viewer,
|
||||
qn.viewDistance(),
|
||||
qn.visible(),
|
||||
qn.depthIgnore(),
|
||||
qn.size(),
|
||||
qn.x(),
|
||||
qn.y(),
|
||||
qn.z(),
|
||||
partialTicks,
|
||||
qn.aspects(),
|
||||
qn.type(),
|
||||
qn.mod());
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
nodeQueue.clear();
|
||||
}
|
||||
|
||||
if (!drainQueue.isEmpty()) {
|
||||
GL11.glPushMatrix();
|
||||
for (QueuedDrainBeam qdb : drainQueue) {
|
||||
UtilsFX.drawFloatyLine(
|
||||
qdb.fromX(),
|
||||
qdb.fromY(),
|
||||
qdb.fromZ(),
|
||||
qdb.toX(),
|
||||
qdb.toY(),
|
||||
qdb.toZ(),
|
||||
qdb.partialTicks(),
|
||||
qdb.color(),
|
||||
"textures/misc/wispy.png",
|
||||
-0.02F,
|
||||
qdb.alpha());
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
drainQueue.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user