aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorheyngra <heyngra.wspolpraca@gmail.com>2022-12-11 01:12:03 +0100
committerGitHub <noreply@github.com>2022-12-11 11:12:03 +1100
commit7603f56ca7b2d2654fdde2f7a81bdd97f1b66a61 (patch)
tree4c771368ee1e3196ea37ff1b4635772c5a02b9b5 /src/main
parent337b77aa50db6b4a159795827623d36acccbdcc4 (diff)
downloadNotEnoughUpdates-7603f56ca7b2d2654fdde2f7a81bdd97f1b66a61.tar.gz
NotEnoughUpdates-7603f56ca7b2d2654fdde2f7a81bdd97f1b66a61.tar.bz2
NotEnoughUpdates-7603f56ca7b2d2654fdde2f7a81bdd97f1b66a61.zip
Add Frozen Treasure Highlighter (#477)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java74
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java27
3 files changed, 103 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 286f667a..bc2666d3 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -70,6 +70,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.Dwarve
import io.github.moulberry.notenoughupdates.miscfeatures.item.enchants.EnchantStyleCustomizer;
import io.github.moulberry.notenoughupdates.miscfeatures.updater.AutoUpdater;
import io.github.moulberry.notenoughupdates.miscfeatures.world.EnderNodeHighlighter;
+import io.github.moulberry.notenoughupdates.miscfeatures.world.FrozenTreasuresHighlighter;
import io.github.moulberry.notenoughupdates.miscfeatures.world.GlowingMushroomHighlighter;
import io.github.moulberry.notenoughupdates.miscgui.CalendarOverlay;
import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector;
@@ -345,6 +346,7 @@ public class NotEnoughUpdates {
MinecraftForge.EVENT_BUS.register(EnchantStyleCustomizer.INSTANCE);
MinecraftForge.EVENT_BUS.register(TitleUtil.getInstance());
MinecraftForge.EVENT_BUS.register(EnderNodeHighlighter.getInstance());
+ MinecraftForge.EVENT_BUS.register(FrozenTreasuresHighlighter.getInstance());
MinecraftForge.EVENT_BUS.register(AbiphoneFavourites.getInstance());
MinecraftForge.EVENT_BUS.register(AbiphoneContactHelper.getInstance());
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java
new file mode 100644
index 00000000..a7a8706a
--- /dev/null
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/world/FrozenTreasuresHighlighter.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2022 NotEnoughUpdates contributors
+ *
+ * This file is part of NotEnoughUpdates.
+ *
+ * NotEnoughUpdates is free software: you can redistribute it
+ * and/or modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * NotEnoughUpdates 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package io.github.moulberry.notenoughupdates.miscfeatures.world;
+
+import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
+import io.github.moulberry.notenoughupdates.util.SBInfo;
+import io.github.moulberry.notenoughupdates.util.SpecialColour;
+import net.minecraft.block.Block;
+import net.minecraft.client.Minecraft;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.item.EntityArmorStand;
+import net.minecraft.init.Blocks;
+import net.minecraft.util.BlockPos;
+import net.minecraft.world.World;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.TickEvent;
+
+import java.util.List;
+
+public class FrozenTreasuresHighlighter extends GenericBlockHighlighter {
+
+ private static final FrozenTreasuresHighlighter INSTANCE = new FrozenTreasuresHighlighter();
+
+ public static FrozenTreasuresHighlighter getInstance() {return INSTANCE;}
+
+ @Override
+ protected boolean isEnabled() {
+ return SBInfo.getInstance().getScoreboardLocation().equals("Glacial Cave")
+ && NotEnoughUpdates.INSTANCE.config.world.highlightFrozenTreasures;
+ }
+
+ @Override
+ protected boolean isValidHighlightSpot(BlockPos key) {
+ World w = Minecraft.getMinecraft().theWorld;
+ if (w == null) return false;
+ Block b = w.getBlockState(key).getBlock();
+ return b == Blocks.ice;
+ }
+
+ @SubscribeEvent
+ public void onTickNew(TickEvent.ClientTickEvent event) {
+ if (event.phase != TickEvent.Phase.END || !isEnabled()) return;
+ World w = Minecraft.getMinecraft().theWorld;
+ if (w == null) return;
+ List<Entity> entities = w.getLoadedEntityList();
+ for (Entity e : entities) {
+ if ((e instanceof EntityArmorStand) && ((EntityArmorStand) e).getCurrentArmor(3) != null) highlightedBlocks.add(e
+ .getPosition()
+ .add(0, 1, 0));
+ }
+ }
+
+ @Override
+ protected int getColor(BlockPos blockPos) {
+ return SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.world.frozenTreasuresColor);
+ }
+}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java
index e8c822b2..fa39c2ef 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/WorldConfig.java
@@ -79,4 +79,31 @@ public class WorldConfig {
@ConfigEditorColour
@ConfigAccordionId(id = 2)
public String enderNodeColor = "0:255:0:255:0";
+
+ @Expose
+ @ConfigOption(
+ name = "Frozen Treasures",
+ desc = ""
+ )
+ @ConfigEditorAccordion(id = 3)
+ public boolean frozenTreasuresAccordion = true;
+
+ @Expose
+ @ConfigOption(
+ name = "Highlight Frozen Treasures",
+ desc = "Highlight frozen treasures in a glacial cave"
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 3)
+ public boolean highlightFrozenTreasures = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Frozen Treasures Color",
+ desc = "In which color should frozen treasures be highlighted"
+ )
+ @ConfigEditorColour
+ @ConfigAccordionId(id = 3)
+ public String frozenTreasuresColor = "0:255:0:255:0";
+
}