aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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";
+
}