diff options
author | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-25 18:17:40 +0900 |
---|---|---|
committer | syeyoung <42869671+cyoung06@users.noreply.github.com> | 2020-11-25 18:17:40 +0900 |
commit | a34fa2c68fd4a1c47fd22d5de5b87959210eceab (patch) | |
tree | fb776f9d272f2dbec049777caf405b46ea3cf1f0 /src/main/java/kr/syeyoung/dungeonsguide/roomprocessor | |
parent | bfe86d4c79582bb708525ab7b7c433009948d0b8 (diff) | |
download | Skyblock-Dungeons-Guide-a34fa2c68fd4a1c47fd22d5de5b87959210eceab.tar.gz Skyblock-Dungeons-Guide-a34fa2c68fd4a1c47fd22d5de5b87959210eceab.tar.bz2 Skyblock-Dungeons-Guide-a34fa2c68fd4a1c47fd22d5de5b87959210eceab.zip |
Render stuff and stuff
Diffstat (limited to 'src/main/java/kr/syeyoung/dungeonsguide/roomprocessor')
4 files changed, 46 insertions, 9 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/DefaultRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/DefaultRoomProcessor.java index 9edbcae9..596ebb74 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/DefaultRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/DefaultRoomProcessor.java @@ -14,7 +14,7 @@ public class DefaultRoomProcessor implements RoomProcessor { } @Override - public void drawScreen() { + public void drawScreen(float partialTicks) { } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java index d404a1e4..3f65c642 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/ProcessorFactory.java @@ -23,5 +23,6 @@ public class ProcessorFactory { static { registerRoomProcessor("default", new DefaultRoomProcessor.Generator()); + registerRoomProcessor("puzzle_blaze_solver", new RoomProcessorBlazeSolver.Generator()); } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java index 24e29332..ed8a89f7 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessor.java @@ -4,5 +4,5 @@ import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; public interface RoomProcessor { void tick(); - void drawScreen(); + void drawScreen(float partialTicks); }
\ No newline at end of file diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java index 7574b79c..ec1ed164 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorBlazeSolver.java @@ -2,11 +2,16 @@ package kr.syeyoung.dungeonsguide.roomprocessor; import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; +import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import kr.syeyoung.dungeonsguide.utils.TextUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.util.BlockPos; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -20,7 +25,8 @@ public class RoomProcessorBlazeSolver implements RoomProcessor { private DungeonRoom dungeonRoom; private boolean highToLow = false; - private List<Entity> entityList = new ArrayList<Entity>(); + private List<EntityArmorStand> entityList = new ArrayList<EntityArmorStand>(); + private EntityArmorStand next; public RoomProcessorBlazeSolver(DungeonRoom dungeonRoom) { this.dungeonRoom = dungeonRoom; Object highToLow = dungeonRoom.getDungeonRoomInfo().getProperties().get("order"); @@ -33,19 +39,49 @@ public class RoomProcessorBlazeSolver implements RoomProcessor { World w = dungeonRoom.getContext().getWorld(); final BlockPos low = dungeonRoom.getMin(); final BlockPos high = dungeonRoom.getMax(); - entityList = new ArrayList<Entity>(w.getEntities(EntityBlaze.class, new Predicate<EntityBlaze>() { + entityList = new ArrayList<EntityArmorStand>(w.getEntities(EntityArmorStand.class, new Predicate<EntityArmorStand>() { @Override - public boolean apply(@Nullable EntityBlaze input) { + public boolean apply(@Nullable EntityArmorStand input) { BlockPos pos = input.getPosition(); return low.getX() < pos.getX() && pos.getX() < high.getX() - && low.getZ() < pos.getZ() && pos.getZ() < high.getZ(); + && low.getZ() < pos.getZ() && pos.getZ() < high.getZ() && input.getName().toLowerCase().contains("blaze"); } })); + + EntityArmorStand semi_target = null; + int health = (highToLow ? Integer.MIN_VALUE : Integer.MAX_VALUE); + for (EntityArmorStand ea : entityList) { + String name = ea.getName(); + String colorGone = TextUtils.stripColor(name); + String health2 = colorGone.split("/")[1]; + try { + int heal = Integer.parseInt(health2); + if (highToLow && heal > health) { + health = heal; + semi_target = ea; + } else if (!highToLow && heal < health) { + health = heal; + semi_target = ea; + } + } catch (Exception e){} + + } + + next = semi_target; } @Override - public void drawScreen() { - FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; - fr.drawString("hehe blaze solver here", 100, 100, 0xFFFFFFFF); + public void drawScreen(float partialTicks) { + if (next == null) return; + Vec3 pos = next.getPositionEyes(partialTicks); + RenderUtils.drawTextAtWorld("NEXT", (float)pos.xCoord, (float)pos.yCoord, (float)pos.zCoord, 0xFFFF0000, 3, true, false, partialTicks); + } + + public static class Generator implements RoomProcessorGenerator<RoomProcessorBlazeSolver> { + @Override + public RoomProcessorBlazeSolver createNew(DungeonRoom dungeonRoom) { + RoomProcessorBlazeSolver defaultRoomProcessor = new RoomProcessorBlazeSolver(dungeonRoom); + return defaultRoomProcessor; + } } } |