Skip to content
This repository has been archived by the owner on Apr 22, 2021. It is now read-only.

Commit

Permalink
change color for holeesp #85. note there is only one color for now
Browse files Browse the repository at this point in the history
  • Loading branch information
5HT2 committed Nov 21, 2019
1 parent 6beaa75 commit 99627ba
Showing 1 changed file with 60 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,97 @@

import me.zeroeightsix.kami.event.events.RenderEvent;
import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
import me.zeroeightsix.kami.util.GeometryMasks;
import me.zeroeightsix.kami.util.KamiTessellator;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import org.lwjgl.opengl.GL11;
import sun.awt.image.PixelConverter;

import java.util.ArrayList;

/***
* @author Waizy
* S-B99 added modes
*/
@Module.Info(name = "HoleESP", category = Module.Category.RENDER)
public class HoleESP
extends Module {
private ArrayList<BlockPos> holes = new ArrayList();

BlockPos pos;

public void onUpdate() {
this.holes = new ArrayList();
//private Setting<Integer> range = register(Settings.i("Range", 15));
private Setting<Distance> distance = register(Settings.e("Distance", Distance.CLOSE));
// private Setting<Distance> color = register(Settings.e("Color", Color.KAMI));

Iterable<BlockPos> blocks = BlockPos.getAllInBox(mc.player
.getPosition().add(-15, -15, -15), mc.player
.getPosition().add(15, 15, 15));

private enum Distance {
CLOSE, FAR
}

for (BlockPos pos : blocks) {

if (!mc.world.getBlockState(pos).getMaterial().blocksMovement() && !mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial().blocksMovement()) {

// private enum Color {
// WHITE, KAMI
// }

boolean solidNeighbours = (
mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 2, 0)).getMaterial() == Material.AIR);
BlockPos pos;

public void onUpdate() {
this.holes = new ArrayList();

if (solidNeighbours) {
this.holes.add(pos);
if (distance.getValue().equals(Distance.CLOSE)) {
Iterable<BlockPos> blocks = BlockPos.getAllInBox(mc.player.getPosition().add(-5, -5, -5), mc.player.getPosition().add(5, 5, 5));
for (BlockPos pos : blocks) {
if (!mc.world.getBlockState(pos).getMaterial().blocksMovement() && !mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial().blocksMovement()) {
boolean solidNeighbours = (
mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 2, 0)).getMaterial() == Material.AIR);
if (solidNeighbours) {
this.holes.add(pos);
}
}
}
}
if (distance.getValue().equals(Distance.FAR)) {
Iterable<BlockPos> blocks = BlockPos.getAllInBox(mc.player.getPosition().add(-20, -20, -20), mc.player.getPosition().add(20, 20, 20));
for (BlockPos pos : blocks) {
if (!mc.world.getBlockState(pos).getMaterial().blocksMovement() && !mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial().blocksMovement()) {
boolean solidNeighbours = (
mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, -1, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, 1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(-1, 0, 0)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.BEDROCK | mc.world.getBlockState(pos.add(0, 0, -1)).getBlock() == Blocks.OBSIDIAN
&& mc.world.getBlockState(pos.add(0, 0, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 1, 0)).getMaterial() == Material.AIR
&& mc.world.getBlockState(pos.add(0, 2, 0)).getMaterial() == Material.AIR);
if (solidNeighbours) {
this.holes.add(pos);
}
}
}
}
}


public void onWorldRender(RenderEvent event) {
// int realColor = 0;
// if (color.getValue().equals(Color.WHITE)) {
// realColor = 0x33ffffff;
// }
// if (color.getValue().equals(Color.KAMI)) {
// realColor = 0x339B90FF;
// }
// int finalRealColor = realColor;
KamiTessellator.prepare(GL11.GL_QUADS);
this.holes.forEach(blockPos -> KamiTessellator.drawBox((BlockPos) blockPos, 0x33ffffff, GeometryMasks.Quad.ALL));
this.holes.forEach(blockPos -> KamiTessellator.drawBox((BlockPos) blockPos, 0x339B90FF, GeometryMasks.Quad.ALL));
KamiTessellator.release();
}
}

0 comments on commit 99627ba

Please sign in to comment.