forked from AppliedEnergistics/Applied-Energistics-2
-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
highlight interfaces from interface terminal.
- Loading branch information
1 parent
b4ba1af
commit bc2e4c8
Showing
7 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/java/appeng/client/render/BlockPosHighlighter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package appeng.client.render; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
|
||
// taken from McJty's McJtyLib | ||
public class BlockPosHighlighter | ||
{ | ||
private static BlockPos hilightedBlock; | ||
private static long expireHilight; | ||
|
||
public static void hilightBlock( BlockPos c, long expireHilight ) { | ||
hilightedBlock = c; | ||
BlockPosHighlighter.expireHilight = expireHilight; | ||
} | ||
|
||
public static BlockPos getHilightedBlock() { | ||
return hilightedBlock; | ||
} | ||
|
||
public static long getExpireHilight() { | ||
return expireHilight; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package appeng.helpers; | ||
|
||
import appeng.client.render.BlockPosHighlighter; | ||
import net.minecraft.client.Minecraft; | ||
import net.minecraft.client.entity.EntityPlayerSP; | ||
import net.minecraft.client.renderer.BufferBuilder; | ||
import net.minecraft.client.renderer.GlStateManager; | ||
import net.minecraft.client.renderer.Tessellator; | ||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraftforge.client.event.RenderWorldLastEvent; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
// taken from McJty's McJtyLib | ||
|
||
public class HighlighterHandler | ||
{ | ||
|
||
public static void tick( RenderWorldLastEvent event ) { | ||
renderHilightedBlock(event); | ||
} | ||
|
||
private static void renderHilightedBlock( RenderWorldLastEvent event ) { | ||
BlockPos c = BlockPosHighlighter.getHilightedBlock(); | ||
if (c == null) { | ||
return; | ||
} | ||
Minecraft mc = Minecraft.getMinecraft(); | ||
long time = System.currentTimeMillis(); | ||
|
||
if (time > BlockPosHighlighter.getExpireHilight()) { | ||
BlockPosHighlighter.hilightBlock(null, -1); | ||
return; | ||
} | ||
|
||
if (((time / 500) & 1) == 0) { | ||
return; | ||
} | ||
|
||
EntityPlayerSP p = mc.player; | ||
double doubleX = p.lastTickPosX + (p.posX - p.lastTickPosX) * event.getPartialTicks(); | ||
double doubleY = p.lastTickPosY + (p.posY - p.lastTickPosY) * event.getPartialTicks(); | ||
double doubleZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * event.getPartialTicks(); | ||
|
||
GlStateManager.pushMatrix(); | ||
GlStateManager.color(1.0f, 0, 0); | ||
GlStateManager.glLineWidth(3); | ||
GlStateManager.translate(-doubleX, -doubleY, -doubleZ); | ||
|
||
GlStateManager.disableDepth(); | ||
GlStateManager.disableTexture2D(); | ||
|
||
Tessellator tessellator = Tessellator.getInstance(); | ||
BufferBuilder buffer = tessellator.getBuffer(); | ||
float mx = c.getX(); | ||
float my = c.getY(); | ||
float mz = c.getZ(); | ||
buffer.begin( GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR); | ||
renderHighLightedBlocksOutline(buffer, mx, my, mz, 1.0f, 0.0f, 0.0f, 1.0f); | ||
|
||
tessellator.draw(); | ||
|
||
GlStateManager.enableTexture2D(); | ||
GlStateManager.popMatrix(); | ||
} | ||
|
||
public static void renderHighLightedBlocksOutline(BufferBuilder buffer, float mx, float my, float mz, float r, float g, float b, float a) { | ||
buffer.pos(mx, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my + 1, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz).color(r, g, b, a).endVertex(); | ||
|
||
buffer.pos(mx, my + 1, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my + 1, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz).color(r, g, b, a).endVertex(); | ||
|
||
buffer.pos(mx + 1, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my, mz).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my + 1, mz).color(r, g, b, a).endVertex(); | ||
|
||
buffer.pos(mx, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx + 1, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my, mz + 1).color(r, g, b, a).endVertex(); | ||
buffer.pos(mx, my + 1, mz + 1).color(r, g, b, a).endVertex(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package appeng.util; | ||
|
||
import net.minecraft.util.math.BlockPos; | ||
|
||
|
||
public class BlockPosUtils | ||
{ | ||
public static long getDistance( BlockPos blockPos, BlockPos blockPos2 ) | ||
{ | ||
int x; | ||
if( (blockPos.getX() > 0 && blockPos2.getX() > 0) || (blockPos.getX() < 0 && blockPos2.getX() < 0)) | ||
{ | ||
x = blockPos.getX() - blockPos2.getX(); | ||
} | ||
else | ||
{ | ||
x = blockPos.getX() + blockPos2.getX(); | ||
} | ||
|
||
int y; | ||
if( (blockPos.getY() > 0 && blockPos2.getY() > 0) || (blockPos.getY() < 0 && blockPos2.getY() < 0) ) | ||
{ | ||
y = blockPos.getY() - blockPos2.getY(); | ||
} | ||
else | ||
{ | ||
y = blockPos.getY() + blockPos2.getY(); | ||
} | ||
|
||
int z; | ||
if( (blockPos.getZ() > 0 && blockPos2.getZ() > 0) || (blockPos.getZ() < 0 && blockPos2.getZ() < 0) ) | ||
{ | ||
z = blockPos.getZ() - blockPos2.getZ(); | ||
} | ||
else | ||
{ | ||
z = blockPos.getZ() + blockPos2.getZ(); | ||
} | ||
return Math.abs( x ) + Math.abs( y ) + Math.abs( z ); | ||
} | ||
} |
Binary file removed
BIN
-10.8 KB
src/main/resources/assets/appliedenergistics2/textures/guis/interfaceterminal.png
Binary file not shown.
Binary file added
BIN
+11.1 KB
...ain/resources/assets/appliedenergistics2/textures/guis/newinterfaceterminal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.