forked from fr1kin/ForgeHax
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74175c3
commit 40d18b8
Showing
1 changed file
with
42 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.matt.forgehax.mods; | ||
|
||
import com.matt.forgehax.events.RenderEvent; | ||
import com.matt.forgehax.util.color.Colors; | ||
import com.matt.forgehax.util.mod.Category; | ||
import com.matt.forgehax.util.mod.ToggleMod; | ||
import com.matt.forgehax.util.mod.loader.RegisterMod; | ||
import com.matt.forgehax.util.tesselation.GeometryMasks; | ||
import com.matt.forgehax.util.tesselation.GeometryTessellator; | ||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; | ||
import org.lwjgl.opengl.GL11; | ||
|
||
@RegisterMod | ||
public class ChunkBorder extends ToggleMod { | ||
|
||
|
||
|
||
public ChunkBorder() { | ||
super(Category.RENDER, "ChunkBorder", false, "Shows a border at the border around the chunk you are in."); | ||
} | ||
|
||
/** | ||
* to draw the border | ||
* @param event | ||
*/ | ||
@SubscribeEvent | ||
public void onRender(RenderEvent event) { | ||
event.getBuffer().begin(GL11.GL_LINES, DefaultVertexFormats.POSITION_COLOR); | ||
|
||
BlockPos from = new BlockPos(MC.player.chunkCoordX * 16, 0, MC.player.chunkCoordZ * 16); | ||
BlockPos to = new BlockPos(from.getX() + 15, 256, from.getZ() + 15); | ||
|
||
int color = Colors.YELLOW.toBuffer(); | ||
GeometryTessellator.drawCuboid(event.getBuffer(), from, to, GeometryMasks.Line.ALL, color); | ||
|
||
event.getTessellator().draw(); | ||
} | ||
|
||
} | ||
|