diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-04 19:27:22 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-04 19:27:22 +0900 |
commit | ea945d7be62aab1d143b79adc20f243fec673f08 (patch) | |
tree | 2b04ef1dd666216c697b0b3b8e516c54f852569a /mod | |
parent | 7bc262cbfa173fb0a31fb58d6f1d55fa0cac3b08 (diff) | |
download | Skyblock-Dungeons-Guide-ea945d7be62aab1d143b79adc20f243fec673f08.tar.gz Skyblock-Dungeons-Guide-ea945d7be62aab1d143b79adc20f243fec673f08.tar.bz2 Skyblock-Dungeons-Guide-ea945d7be62aab1d143b79adc20f243fec673f08.zip |
- Remove some stupid features
- Fix PredicateArmorStand
- WidgetMechanicBrowser now actually works
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
8 files changed, 24 insertions, 14 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java index 864b1330..85cca2ba 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/DungeonFairySoul.java @@ -53,7 +53,7 @@ public class DungeonFairySoul implements DungeonMechanic { Set<AbstractAction> base = new HashSet<>(); ActionInteract actionClick = new ActionInteract(secretPoint); - actionClick.setPredicate((Predicate<Entity>) PredicateArmorStand.INSTANCE); + actionClick.setPredicate(PredicateArmorStand.INSTANCE); actionClick.setRadius(3); base.add(actionClick); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java index a4eddefe..e13376ee 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/dungeon/mechanics/predicates/PredicateArmorStand.java @@ -18,18 +18,20 @@ package kr.syeyoung.dungeonsguide.dungeon.mechanics.predicates; -import com.google.common.base.Predicate; import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityArmorStand; import org.jetbrains.annotations.Nullable; +import java.util.function.Predicate; + public class PredicateArmorStand implements Predicate<Entity> { public static final PredicateArmorStand INSTANCE = new PredicateArmorStand(); + @Override - public boolean apply(@Nullable Entity input) { + public boolean test(@Nullable Entity input) { return input instanceof EntityArmorStand; } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java index 4b142e17..15a5bbe0 100755 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/dungeon/actions/ActionMove.java @@ -70,14 +70,11 @@ public class ActionMove extends AbstractAction { float scale = 0.45f * multiplier; scale *= 25.0 / 6.0; if (actionRouteProperties.isBeacon()) { - if(!FeatureRegistry.RENDER_BREACONS.isEnabled()){ - RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks); - } + RenderUtils.renderBeaconBeam(pos.getX(), pos.getY(), pos.getZ(), actionRouteProperties.getBeaconBeamColor(), partialTicks); RenderUtils.highlightBlock(pos, actionRouteProperties.getBeaconColor(), partialTicks); } - if(!FeatureRegistry.RENDER_DESTENATION_TEXT.isEnabled()){ - RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 1f, true, false, partialTicks); - } + RenderUtils.drawTextAtWorld("Destination", pos.getX() + 0.5f, pos.getY() + 0.5f + scale, pos.getZ() + 0.5f, 0xFF00FF00, flag ? 2f : 1f, true, false, partialTicks); + RenderUtils.drawTextAtWorld(String.format("%.2f",MathHelper.sqrt_double(pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())))+"m", pos.getX() + 0.5f, pos.getY() + 0.5f - scale, pos.getZ() + 0.5f, 0xFFFFFF00, flag ? 2f : 1f, true, false, partialTicks); if (!FeatureRegistry.SECRET_TOGGLE_KEY.isEnabled() || !FeatureRegistry.SECRET_TOGGLE_KEY.togglePathfindStatus) { diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java index ee977619..3b009181 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/FeatureRegistry.java @@ -161,9 +161,7 @@ public class FeatureRegistry { public static final FeatureEpicCountdown EPIC_COUNTDOWN = register(new FeatureEpicCountdown()); - public static final SimpleFeature RENDER_BREACONS = register(new SimpleFeature("Dungeon.Secrets.Preferences", "Render beacons", "Should the mod not render beacons on secret", "secret.beacons", false)); public static final SimpleFeature DEBUG_BLOCK_CACHING = register(new SimpleFeature("Debug","Enable block getBlockCaching", "Cache all world.getBlockState callls", "debug.blockcache")); - public static final SimpleFeature RENDER_DESTENATION_TEXT = register(new SimpleFeature("Dungeon.Secrets.Preferences", "Render Destination text", "Should the mod not render \"destination\" on secrets", "secret.desttext", false)); public static final SimpleFeature SECRET_AUTO_START = register(new SimpleFeature("Dungeon.Secrets.Legacy AutoPathfind", "Auto pathfind to new secret", "Auto browse best secret upon entering the room.", "secret.autouponenter", false)); public static final SimpleFeature SECRET_AUTO_BROWSE_NEXT = register(new SimpleFeature("Dungeon.Secrets.Legacy AutoPathfind", "Auto Pathfind to next secret", "Auto browse best next secret after current one completes.\nthe first pathfinding of first secret needs to be triggered first in order for this option to work", "secret.autobrowse", false)); public static final FeatureWarningOnPortal BOSSFIGHT_WARNING_ON_PORTAL = register(new FeatureWarningOnPortal()); diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetMechanicBrowser.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetMechanicBrowser.java index 7e58cff1..c6fba2d5 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetMechanicBrowser.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/secret/mechanicbrowser/WidgetMechanicBrowser.java @@ -29,6 +29,7 @@ import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement; import kr.syeyoung.dungeonsguide.mod.guiv2.Widget; import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox; +import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect; import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size; import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget; import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind; @@ -121,7 +122,17 @@ public class WidgetMechanicBrowser extends AnnotatedWidget implements Layouter { public Size layout(DomElement buildContext, ConstraintBox constraintBox) { FeatureMechanicBrowse featureMechanicBrowse = FeatureRegistry.SECRET_BROWSE; Double ratio = featureMechanicBrowse.getRatio(); - return new Size(featureMechanicBrowse.getFeatureRect().getWidth(), + Size size= new Size(featureMechanicBrowse.getFeatureRect().getWidth(), ratio != null ? featureMechanicBrowse.getFeatureRect().getWidth() * ratio : featureMechanicBrowse.getFeatureRect().getHeight()); + + if (buildContext.getChildren().isEmpty()) { + return size; + } + + DomElement childCtx = buildContext.getChildren().get(0); + + Size dim = childCtx.getLayouter().layout(childCtx, new ConstraintBox(size.getWidth(), size.getWidth(), size.getHeight(), size.getHeight())); + childCtx.setRelativeBound(new Rect(0,0, dim.getWidth(), dim.getHeight())); + return dim; } } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/GUIRectPositioner.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/GUIRectPositioner.java index bd16bd6f..1cc76616 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/GUIRectPositioner.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/GUIRectPositioner.java @@ -34,6 +34,7 @@ public class GUIRectPositioner implements Positioner { @Override public Rect position(DomElement domElement, double screenWidth, double screenHeight) { GUIPosition posSize = rectSupplier.get(); + Size size = domElement.getLayouter().layout(domElement, new ConstraintBox(0, screenWidth, 0, screenHeight)); return posSize.position(screenWidth, screenHeight, size); } diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java index 818bb363..c088fc2c 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManager.java @@ -271,7 +271,8 @@ public class OverlayManager { int wheel = Mouse.getEventDWheel(); if (wheel != 0) { - view.mouseScrolled0(i, j, i, j, wheel); + boolean cancel = view.mouseScrolled0(i, j, i, j, wheel); + if (cancel) mouseInputEvent.setCanceled(true); } lastX = i; lastY = j; diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayWidget.java index 920a9317..3bfa26e9 100644 --- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayWidget.java +++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayWidget.java @@ -80,6 +80,6 @@ public class OverlayWidget extends Widget implements Renderer, Layouter { @Override public boolean canCutRequest() { - return true; + return false; } } |