diff options
author | syeyoung <cyoung06@naver.com> | 2021-10-04 14:06:32 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2021-10-04 14:06:32 +0900 |
commit | a98c778b6e3398f265eeb56e1984c28aadb153bd (patch) | |
tree | bb8812236ae51b7a3077e4327820897cca1b99a1 /src/main/java/kr | |
parent | dcd661c9108005b43f595d010c92d3221f866fb8 (diff) | |
download | Skyblock-Dungeons-Guide-a98c778b6e3398f265eeb56e1984c28aadb153bd.tar.gz Skyblock-Dungeons-Guide-a98c778b6e3398f265eeb56e1984c28aadb153bd.tar.bz2 Skyblock-Dungeons-Guide-a98c778b6e3398f265eeb56e1984c28aadb153bd.zip |
- Blood rush mode
Diffstat (limited to 'src/main/java/kr')
14 files changed, 222 insertions, 54 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java index 918aedca..d5fe082e 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandDungeonsGuide.java @@ -474,7 +474,7 @@ public class CommandDungeonsGuide extends CommandBase { mapProcessor.setTopLeftMapPoint(new Point(0, 0)); fakeContext.setDungeonMin(new BlockPos(0, 70, 0)); - DungeonRoom dungeonRoom = new DungeonRoom(Arrays.asList(new Point(0, 0)), ShortUtils.topLeftifyInt((short) 1), (byte) 63, new BlockPos(0, 70, 0), new BlockPos(31, 70, 31), fakeContext); + DungeonRoom dungeonRoom = new DungeonRoom(Arrays.asList(new Point(0, 0)), ShortUtils.topLeftifyInt((short) 1), (byte) 63, new BlockPos(0, 70, 0), new BlockPos(31, 70, 31), fakeContext, Collections.emptySet()); fakeContext.getDungeonRoomList().add(dungeonRoom); for (Point p : Arrays.asList(new Point(0, 0))) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java index 3bea78f8..aed2f2a1 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/MapProcessor.java @@ -22,9 +22,11 @@ import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.collect.Sets; import kr.syeyoung.dungeonsguide.DungeonsGuide; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonMapUpdateEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonNodataEvent; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonRoomDiscoverEvent; +import kr.syeyoung.dungeonsguide.dungeon.events.SerializableBlockPos; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProviderRegistry; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonSpecificDataProvider; @@ -36,14 +38,12 @@ import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.Vec3; -import net.minecraft.util.Vec4b; +import net.minecraft.util.*; import net.minecraft.world.storage.MapData; import net.minecraftforge.common.MinecraftForge; import javax.vecmath.Vector2d; +import javax.vecmath.Vector2f; import java.awt.*; import java.util.*; import java.util.List; @@ -250,7 +250,7 @@ public class MapProcessor { MapUtils.record(mapData, mapPoint.x, mapPoint.y, new Color(0,255,255,80)); DungeonRoom rooms = buildRoom(mapData, new Point(x,y)); if (rooms == null) continue; - context.createEvent(new DungeonRoomDiscoverEvent(rooms.getUnitPoints().get(0), rooms.getRoomMatcher().getRotation(), rooms.getMin(), rooms.getShape(),rooms.getColor(), rooms.getDungeonRoomInfo().getUuid(), rooms.getDungeonRoomInfo().getName(), rooms.getDungeonRoomInfo().getProcessorId())); + context.createEvent(new DungeonRoomDiscoverEvent(rooms.getUnitPoints().get(0), rooms.getRoomMatcher().getRotation(), new SerializableBlockPos(rooms.getMin()), new SerializableBlockPos(rooms.getMax()), rooms.getShape(),rooms.getColor(), rooms.getDungeonRoomInfo().getUuid(), rooms.getDungeonRoomInfo().getName(), rooms.getDungeonRoomInfo().getProcessorId())); DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! shape: "+rooms.getShape()+ " color: "+rooms.getColor()+" unitPos: "+x+","+y)); DungeonsGuide.sendDebugChat(new ChatComponentText("New Map discovered! mapMin: "+rooms.getMin() + " mapMx: "+rooms.getMax())); StringBuilder builder = new StringBuilder(); @@ -278,6 +278,7 @@ public class MapProcessor { } } + private static final Set<Vector2d> door_dirs = Sets.newHashSet(new Vector2d(0,0.5), new Vector2d(0, -0.5), new Vector2d(0.5, 0), new Vector2d(-0.5 , 0)); private DungeonRoom buildRoom(byte[] mapData, Point unitPoint) { Queue<Point[]> toCheck = new LinkedList<Point[]>(); toCheck.add(new Point[] {unitPoint, unitPoint}); // requestor, target @@ -309,12 +310,44 @@ public class MapProcessor { int localX = p.x - minX, localY = p.y - minY; shape |= 1 <<(localY *4 + localX); } - + Set<Vector2d> doors = new HashSet<>(); + for (Point p: ayConnected) { + for (Vector2d v: door_dirs) { + Vector2d v2 = new Vector2d(p.x + v.x , p.y + v.y ); + if (doors.contains(v2)) doors.remove(v2); + else doors.add(v2); + } + } Point pt2 = roomPointToMapPoint(ayConnected.get(0)); byte unit1 = MapUtils.getMapColorAt(mapData, pt2.x, pt2.y); + // 0: none 1: open door door 2. unopen door 3: wither door 4. red door + Set<Tuple<Vector2d, EDungeonDoorType>> doorsAndStates = new HashSet<>(); + final int halfWidth = unitRoomDimension.width + 4; + for (Vector2d door : doors) { + int floorX = (int)Math.floor(door.x), floorY = (int)Math.floor(door.y); + Point mapPt = roomPointToMapPoint(new Point(floorX, floorY)); + Point target = new Point(mapPt.x+ unitRoomDimension.width/2 + (int)(halfWidth*(door.x - floorX)), mapPt.y + unitRoomDimension.height/2 + (int)(halfWidth*(door.y - floorY)) ); + MapUtils.record(mapData, target.x, target.y, Color.green); + byte color = MapUtils.getMapColorAt(mapData, target.x, target.y); + + Vector2d vector2d = new Vector2d(door.x - minX, door.y - minY); + if (color == 0) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.NONE)); + } else if (color == 85) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.UNOPEN)); + } else if (color == 119) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.WITHER)); + } else if (color == 18 && unit1 != 18) { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.BLOOD)); + } else { + doorsAndStates.add(new Tuple<>(vector2d, EDungeonDoorType.ENTRANCE)); + } + } + + try{ - return new DungeonRoom(ayConnected, shape, unit1, roomPointToWorldPoint(new Point(minX, minY)), roomPointToWorldPoint(new Point(maxX+1, maxY+1)).add(-1, 0, -1), context); + return new DungeonRoom(ayConnected, shape, unit1, roomPointToWorldPoint(new Point(minX, minY)), roomPointToWorldPoint(new Point(maxX+1, maxY+1)).add(-1, 0, -1), context, doorsAndStates); } catch (IllegalStateException ex) { DungeonsGuide.sendDebugChat(new ChatComponentText("Failed to load room, retrying later :: "+ex.getLocalizedMessage())); return null; @@ -373,7 +406,7 @@ public class MapProcessor { stabilizationTick++; } - if (stabilizationTick > 5) { + if (stabilizationTick > 20) { if (doorDimension == null) buildMap(mapData); else processMap(mapData); } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java index d841bb65..9a52dad8 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/DungeonDoor.java @@ -31,22 +31,20 @@ import java.util.Set; public class DungeonDoor { private final World w; private final BlockPos position; - private boolean exist = true; + private EDungeonDoorType type; private boolean isZDir; private static final Set<Block> legalBlocks = Sets.newHashSet(Blocks.coal_block, Blocks.barrier, Blocks.monster_egg, Blocks.air, Blocks.stained_hardened_clay); - private boolean requiresKey = false; - private boolean opened = false; - - public DungeonDoor(World world, BlockPos pos) { + public DungeonDoor(World world, BlockPos pos, EDungeonDoorType type) { this.w = world; this.position = pos; Block itshouldbeall = world.getChunkFromBlockCoords(pos).getBlock(pos); - if (!legalBlocks.contains(itshouldbeall)) { - exist = false; - return; - } + + if (type == EDungeonDoorType.WITHER && itshouldbeall == Blocks.air) type = EDungeonDoorType.WITHER_FAIRY; + this.type = type; + boolean exist = type.isExist(); + for (int x = -1; x<=1; x++) for (int y = -1; y<=1; y++) for (int z = -1; z<=1; z++) { @@ -78,13 +76,6 @@ public class DungeonDoor { } if (!exist) { isZDir = false; - return; - } - - if (itshouldbeall == Blocks.stained_hardened_clay || itshouldbeall == Blocks.coal_block) { - requiresKey = true; - } else if (itshouldbeall == Blocks.barrier) { - opened = true; } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/EDungeonDoorType.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/EDungeonDoorType.java new file mode 100644 index 00000000..3a07629e --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/doorfinder/EDungeonDoorType.java @@ -0,0 +1,33 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.dungeon.doorfinder; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@AllArgsConstructor +@Getter +public enum EDungeonDoorType { + NONE(false, false, false,"?"), ENTRANCE(true, false, false, "entrance"), WITHER(true, true,true,"withergate"),WITHER_FAIRY(true, false,true,"wither-fairy-gate"), BLOOD(true, true,true, "bloodgate"), UNOPEN(true, false, false,"gate"); + + private boolean exist; + private boolean keyRequired; + private boolean headToBlood; + private String name; +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java index 05a48262..9e8b74ce 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/DungeonRoomDiscoverEvent.java @@ -30,7 +30,8 @@ import java.util.UUID; public class DungeonRoomDiscoverEvent implements DungeonEventData { private Point unitPt; private int rotation; - private BlockPos min; + private SerializableBlockPos min; + private SerializableBlockPos max; private int shape; private int color; private UUID roomUID; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/SerializableBlockPos.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/SerializableBlockPos.java new file mode 100644 index 00000000..ab1031e7 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/events/SerializableBlockPos.java @@ -0,0 +1,36 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2021 cyoung06 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.dungeon.events; + +import lombok.AllArgsConstructor; +import lombok.Data; +import net.minecraft.util.BlockPos; + +import java.io.Serializable; + +@Data @AllArgsConstructor +public class SerializableBlockPos implements Serializable { + private int x, y, z; + + public SerializableBlockPos(BlockPos pos) { + this.x = pos.getX(); + this.y = pos.getY(); + this.z = pos.getZ(); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java index 80e10365..5ff85a13 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonRoomDoor.java @@ -25,6 +25,8 @@ import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.utils.RenderUtils; +import lombok.Getter; +import net.minecraft.init.Blocks; import net.minecraft.util.BlockPos; import java.awt.*; @@ -32,10 +34,26 @@ import java.util.HashSet; import java.util.Set; public class DungeonRoomDoor implements DungeonMechanic { + @Getter private final DungeonDoor doorfinder; + private OffsetPoint offsetPoint; - public DungeonRoomDoor(DungeonDoor doorfinder) { + public DungeonRoomDoor(DungeonRoom dungeonRoom, DungeonDoor doorfinder) { this.doorfinder = doorfinder; + if (doorfinder.isZDir()) { + if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,2))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,2)); + else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(0,0,-2))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(0,0,-2)); + } else { + if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(2,0,0))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(2,0,0)); + else if (dungeonRoom.canAccessAbsolute(doorfinder.getPosition().add(-2,0,0))) + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition().add(-2,0,0)); + } + if (offsetPoint == null) { + offsetPoint = new OffsetPoint(dungeonRoom, doorfinder.getPosition()); + } } @Override @@ -44,7 +62,7 @@ public class DungeonRoomDoor implements DungeonMechanic { Set<Action> base; Set<Action> preRequisites = base = new HashSet<Action>(); { - ActionMove actionMove = new ActionMove(new OffsetPoint(dungeonRoom, doorfinder.getPosition())); + ActionMove actionMove = new ActionMove(offsetPoint); preRequisites.add(actionMove); preRequisites = actionMove.getPreRequisite(); } @@ -53,7 +71,7 @@ public class DungeonRoomDoor implements DungeonMechanic { @Override public void highlight(Color color, String name, DungeonRoom dungeonRoom, float partialTicks) { - BlockPos pos = doorfinder.getPosition(); + BlockPos pos = offsetPoint.getBlockPos(dungeonRoom); RenderUtils.highlightBlock(pos, color,partialTicks); RenderUtils.drawTextAtWorld(name, pos.getX() +0.5f, pos.getY()+0.75f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); RenderUtils.drawTextAtWorld(getCurrentState(dungeonRoom), pos.getX() +0.5f, pos.getY()+0.25f, pos.getZ()+0.5f, 0xFFFFFFFF, 0.03f, false, true, partialTicks); @@ -61,7 +79,7 @@ public class DungeonRoomDoor implements DungeonMechanic { @Override public String getCurrentState(DungeonRoom dungeonRoom) { - return doorfinder.isRequiresKey() ?"key" : "normal"; + return doorfinder.getType().isKeyRequired() ? "key" : "normal"; } @Override @@ -76,6 +94,6 @@ public class DungeonRoomDoor implements DungeonMechanic { @Override public OffsetPoint getRepresentingPoint(DungeonRoom dungeonRoom) { - return new OffsetPoint(dungeonRoom, doorfinder.getPosition()); + return offsetPoint; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java index f92d21c5..a5a1f5d7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/dungeon/roomfinder/DungeonRoom.java @@ -19,10 +19,12 @@ package kr.syeyoung.dungeonsguide.dungeon.roomfinder; import com.google.common.collect.Sets; +import kr.syeyoung.dungeonsguide.DungeonsGuide; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.dungeon.MapProcessor; import kr.syeyoung.dungeonsguide.dungeon.data.DungeonRoomInfo; import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.EDungeonDoorType; import kr.syeyoung.dungeonsguide.dungeon.events.DungeonStateChangeEvent; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonRoomDoor; @@ -43,10 +45,7 @@ import net.minecraft.entity.Entity; import net.minecraft.pathfinding.PathEntity; import net.minecraft.pathfinding.PathFinder; import net.minecraft.pathfinding.PathPoint; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.ChunkCache; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -92,7 +91,7 @@ public class DungeonRoom { cached = new HashMap<String, DungeonMechanic>(dungeonRoomInfo.getMechanics()); int index = 0; for (DungeonDoor door : doors) { - if (door.isExist()) cached.put((door.isRequiresKey() ? "withergate" : "gate")+"-"+(++index), new DungeonRoomDoor(door)); + if (door.getType().isExist()) cached.put((door.getType().getName())+"-"+(++index), new DungeonRoomDoor(this, door)); } } return cached; @@ -147,7 +146,7 @@ public class DungeonRoom { private RoomProcessor roomProcessor; - public DungeonRoom(List<Point> points, short shape, byte color, BlockPos min, BlockPos max, DungeonContext context) { + public DungeonRoom(List<Point> points, short shape, byte color, BlockPos min, BlockPos max, DungeonContext context, Set<Tuple<Vector2d, EDungeonDoorType>> doorsAndStates) { this.unitPoints = points; this.shape = shape; this.color = color; @@ -177,7 +176,7 @@ public class DungeonRoom { lenz = maxz - minz; arr = new long[lenx *leny * lenz * 2 / 8];; - buildDoors(); + buildDoors(doorsAndStates); buildRoom(); nodeProcessorDungeonRoom = new NodeProcessorDungeonRoom(this); updateRoomProcessor(); @@ -187,19 +186,17 @@ public class DungeonRoom { private static final Set<Vector2d> directions = Sets.newHashSet(new Vector2d(0,16), new Vector2d(0, -16), new Vector2d(16, 0), new Vector2d(-16 , 0)); - private void buildDoors() { - Set<BlockPos> positions = new HashSet<BlockPos>(); - for (Point p:unitPoints) { - BlockPos pos = context.getMapProcessor().roomPointToWorldPoint(p).add(16,0,16); - for (Vector2d vector2d : directions){ - BlockPos doorLoc = pos.add(vector2d.x, 0, vector2d.y); - if (positions.contains(doorLoc)) positions.remove(doorLoc); - else positions.add(doorLoc); - } + private void buildDoors(Set<Tuple<Vector2d, EDungeonDoorType>> doorsAndStates) { + Set<Tuple<BlockPos, EDungeonDoorType>> positions = new HashSet<>(); + BlockPos pos = context.getMapProcessor().roomPointToWorldPoint(minRoomPt).add(16,0,16); + for (Tuple<Vector2d, EDungeonDoorType> doorsAndState : doorsAndStates) { + Vector2d vector2d = doorsAndState.getFirst(); + BlockPos neu = pos.add(vector2d.x * 32, 0, vector2d.y * 32); + positions.add(new Tuple<>(neu, doorsAndState.getSecond())); } - for (BlockPos door : positions) { - doors.add(new DungeonDoor(context.getWorld(), door)); + for (Tuple<BlockPos, EDungeonDoorType> door : positions) { + doors.add(new DungeonDoor(context.getWorld(), door.getFirst(), door.getSecond())); } } @@ -270,6 +267,8 @@ public class DungeonRoom { Point roomPt = mapProcessor.worldPointToRoomPoint(pos); roomPt.translate(-minRoomPt.x, -minRoomPt.y); + DungeonsGuide.sendDebugChat(new ChatComponentText(pos+"? "+((shape >>(roomPt.y *4 +roomPt.x) & 0x1) > 0))); + return (shape >>(roomPt.y *4 +roomPt.x) & 0x1) > 0; } public boolean canAccessRelative(int x, int z) { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java index a9281c1d..e970789c 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/FeatureRegistry.java @@ -199,6 +199,10 @@ public class FeatureRegistry { } }); + public static final SimpleFeature SECRET_BLOOD_RUSH = register(new SimpleFeature("Dungeon Secrets.Blood Rush", "Blood Rush Mode", "Auto pathfind to witherdoors. \nCan be toggled with key set in settings", "secret.bloodrush", false)); + public static final PathfindLineProperties SECRET_BLOOD_RUSH_LINE_PROPERTIES = register(new PathfindLineProperties("Dungeon Secrets.Blood Rush", "Bloodrush Line Settings", "Line Settings to be used", "secret.lineproperties.bloodrush", false, SECRET_LINE_PROPERTIES_GLOBAL)); + + public static final PathfindLineProperties SECRET_LINE_PROPERTIES_AUTOPATHFIND = register(new PathfindLineProperties("Dungeon Secrets.Legacy AutoPathfind", "Line Settings", "Line Settings when pathfinding using above features", "secret.lineproperties.autopathfind", true, SECRET_LINE_PROPERTIES_GLOBAL)); public static final FeaturePathfindToAll SECRET_PATHFIND_ALL = register(new FeaturePathfindToAll()); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java index d474f62c..e211462f 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/advanced/FeatureDebuggableMap.java @@ -23,19 +23,26 @@ import kr.syeyoung.dungeonsguide.SkyblockStatus; import kr.syeyoung.dungeonsguide.dungeon.DungeonContext; import kr.syeyoung.dungeonsguide.features.FeatureRegistry; import kr.syeyoung.dungeonsguide.features.GuiFeature; +import kr.syeyoung.dungeonsguide.features.listener.GuiPostRenderListener; import kr.syeyoung.dungeonsguide.utils.MapUtils; import kr.syeyoung.dungeonsguide.utils.RenderUtils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.client.gui.GuiNewChat; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.event.GuiScreenEvent; +import net.minecraftforge.fml.client.config.GuiUtils; +import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; import java.awt.*; +import java.util.Arrays; -public class FeatureDebuggableMap extends GuiFeature { +public class FeatureDebuggableMap extends GuiFeature { public FeatureDebuggableMap() { super("Advanced", "Display Debug info included map", "ONLY WORKS WITH SECRET SETTING", "advanced.debug.map", true, 128, 128); this.setEnabled(false); @@ -61,6 +68,16 @@ public class FeatureDebuggableMap extends GuiFeature { GlStateManager.enableAlpha(); GuiScreen.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 128, 128, 128, 128); GlStateManager.popMatrix(); + + + if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChat)) return; + Rectangle featureRect = this.getFeatureRect().getRectangleNoScale(); + + int i = (int) (Mouse.getEventX() - featureRect.getX()); + int j = (int) (Minecraft.getMinecraft().displayHeight - Mouse.getEventY() - featureRect.getY()); + if (i >= 0 && j>= 0 && i <= 128 && j <= 128 && MapUtils.getColors() != null) { + GuiUtils.drawHoveringText(Arrays.asList("Color: "+MapUtils.getColors()[j * 128 + i]),i, j, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj); + } } @Override diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java index 0ec0dd83..8b2b5933 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/GeneralRoomProcessor.java @@ -27,7 +27,9 @@ import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMove; import kr.syeyoung.dungeonsguide.dungeon.actions.ActionMoveNearestAir; import kr.syeyoung.dungeonsguide.dungeon.actions.tree.ActionRoute; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; +import kr.syeyoung.dungeonsguide.dungeon.doorfinder.DungeonDoor; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonMechanic; +import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonRoomDoor; import kr.syeyoung.dungeonsguide.dungeon.mechanics.DungeonSecret; import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoom; import kr.syeyoung.dungeonsguide.events.BlockUpdateEvent; @@ -93,6 +95,16 @@ public class GeneralRoomProcessor implements RoomProcessor { } } } + if (!ticked && FeatureRegistry.SECRET_BLOOD_RUSH.isEnabled()) { + for (Map.Entry<String, DungeonMechanic> value : getDungeonRoom().getMechanics().entrySet()) { + if (value.getValue() instanceof DungeonRoomDoor) { + DungeonRoomDoor dungeonDoor = (DungeonRoomDoor) value.getValue(); + if (dungeonDoor.getDoorfinder().getType().isHeadToBlood()) { + pathfind(value.getKey(), "navigate", FeatureRegistry.SECRET_BLOOD_RUSH_LINE_PROPERTIES.getRouteProperties()); + } + } + } + } ticked = true; Set<String> toRemove = new HashSet<>(); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java index 0ae66bf7..311d5de9 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomprocessor/RoomProcessorRedRoom.java @@ -55,7 +55,7 @@ public class RoomProcessorRedRoom extends GeneralRoomProcessor { this.basePt = new Vec3(basePt.getX() / 2.0f, basePt.getY() / 2.0f + 4, basePt.getZ() / 2.0f); DungeonDoor real = null; for (DungeonDoor door : getDungeonRoom().getDoors()) { - if (door.isExist()) { + if (door.getType().isExist()) { real = door;break; } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java index b8450870..f3bf6065 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/MapUtils.java @@ -18,6 +18,7 @@ package kr.syeyoung.dungeonsguide.utils; +import lombok.Getter; import net.minecraft.block.material.MapColor; import org.w3c.dom.css.Rect; @@ -28,6 +29,7 @@ import java.awt.image.BufferedImage; public class MapUtils { private static Color[] colorMasks = new Color[128 * 128]; + @Getter private static byte[] colors; public static void clearMap() { diff --git a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java index 9efb7a78..21c30b78 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/utils/RenderUtils.java @@ -482,7 +482,7 @@ public class RenderUtils { GlStateManager.disableCull(); GlStateManager.enableAlpha(); - if (dungeonDoor.isExist()) + if (dungeonDoor.getType().isExist()) GlStateManager.color(0,1,0,1); else GlStateManager.color(1,0,0,1); @@ -499,7 +499,7 @@ public class RenderUtils { GL11.glEnd(); - if (dungeonDoor.isExist()) { + if (dungeonDoor.getType().isExist()) { GL11.glBegin(GL11.GL_QUADS); GlStateManager.color(0,0,1,1); @@ -539,8 +539,30 @@ public class RenderUtils { GlStateManager.enableCull(); - GlStateManager.popMatrix(); + RenderManager renderManager = Minecraft.getMinecraft().getRenderManager(); + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRendererObj; + + GlStateManager.translate( dungeonDoor.getPosition().getX(), dungeonDoor.getPosition().getY(), dungeonDoor.getPosition().getZ()); + GlStateManager.rotate(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f); + GlStateManager.rotate(renderManager.playerViewX, 1.0f, 0.0f, 0.0f); + + float lScale = 0.02f; + GlStateManager.scale(-lScale, -lScale, lScale); + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + String text = "Type: "+dungeonDoor.getType(); + int textWidth = fontRenderer.getStringWidth(text); + + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + fontRenderer.drawString(text, -textWidth / 2, 0, 0xFF00FFFF); + GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f); + GlStateManager.popMatrix(); } public static void drawLine(Vec3 pos1, Vec3 pos2, Color colour, float partialTicks , boolean depth) { |