Skip to content

Commit

Permalink
Added Hide Non-Starred Mobs Nametags and Hide Terracota Nametags (#4)
Browse files Browse the repository at this point in the history
* Added Hide Terracotta Nametags
* Added Hide Non-Starred Mobs Nametags
* Hide tooltips while in Terminals
* Feature to stop clicking on Non-Salvageable items in the Salvage menu
  • Loading branch information
AzuredBlue authored Mar 14, 2021
1 parent e48c3ff commit bea8b2c
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 21 deletions.
27 changes: 27 additions & 0 deletions src/main/java/skytils/skytilsmod/core/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,24 @@ public class Config extends Vigilant {
)
public boolean hideWitherMinerNametags = false;

@Property(
type = PropertyType.SWITCH,
name = "Hide Terracotta Nametags",
description = "Hides the nametags of the Terracotta while in Dungeons",
category = "Dungeons",
subcategory = "Quality of Life"
)
public boolean hideTerracotaNametags = false;

@Property(
type = PropertyType.SWITCH,
name = "Hide Non-Starred Mobs Nametags",
description = "Hides the nametags of non-starred mobs while in Dungeons",
category = "Dungeons",
subcategory = "Quality of Life"
)
public boolean hideNonStarredNametags = false;

@Property(
type = PropertyType.SWITCH,
name = "Larger Bat Models",
Expand Down Expand Up @@ -853,6 +871,15 @@ public class Config extends Vigilant {
)
public boolean showArachneHP = false;

@Property(
type = PropertyType.SWITCH,
name = "Stop Clicking Non-Salvageable Items",
description = "Stops you from clicking Non-Salvageable items while in the Salvage menu",
category = "Miscellaneous",
subcategory = "Quality of Life"
)
public boolean stopClickingNonSalvageable = false;

@Property(
type = PropertyType.SWITCH,
name = "View Relic Waypoints",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public void onSendChatMessage(SendChatMessageEvent event) {
event.setCanceled(true);
}
}

// Show hidden fels
@SubscribeEvent
public void onRenderLivingPre(RenderLivingEvent.Pre event) {
Expand Down Expand Up @@ -205,10 +205,21 @@ public void onRenderLivingPre(RenderLivingEvent.Pre event) {
}
}
}


if (Skytils.config.hideNonStarredNametags && event.entity instanceof EntityArmorStand && event.entity.hasCustomName()) {
String name = StringUtils.stripControlCodes(event.entity.getCustomNameTag());
if (!name.startsWith("✯ ") && name.contains("❤"))
if (name.contains("Lurker") || name.contains("Dreadlord") || name.contains("Souleater") || name.contains("Zombie") || name.contains("Skeleton") || name.contains("Skeletor") || name.contains("Sniper") || name.contains("Super Archer") || name.contains("Spider") || name.contains("Fels") || name.contains("Withermancer"))
mc.theWorld.removeEntity(event.entity);
}
}
if (Skytils.config.hideTerracotaNametags && event.entity instanceof EntityArmorStand && event.entity.hasCustomName()) {
String name = StringUtils.stripControlCodes(event.entity.getCustomNameTag());
if (name.contains("Terracotta "))
mc.theWorld.removeEntity(event.entity);
}
if (event.entity instanceof EntityBat && Skytils.config.showBatHitboxes && !mc.getRenderManager().isDebugBoundingBox() && !event.entity.isInvisible()) {
RenderUtil.drawOutlinedBoundingBox(event.entity.getEntityBoundingBox(), new Color(0, 255, 255, 255), 3, 1f);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public class ClickInOrderSolver {
@SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event) {

if (event.phase != TickEvent.Phase.START || !Utils.inDungeons || mc.thePlayer == null || mc.theWorld == null) return;
if (event.phase != TickEvent.Phase.START || !Utils.inDungeons || mc.thePlayer == null || mc.theWorld == null)
return;

if (!Skytils.config.clickInOrderTerminalSolver) return;

Expand Down Expand Up @@ -110,7 +111,7 @@ public void onDrawSlot(GuiContainerEvent.DrawSlotEvent.Pre event) {
GlStateManager.disableLighting();
GlStateManager.disableDepth();
GlStateManager.disableBlend();
fr.drawStringWithShadow(String.valueOf(item.stackSize), (float)(slot.xDisplayPosition + 9 - fr.getStringWidth(String.valueOf(item.stackSize)) / 2), (float)(slot.yDisplayPosition + 4), 16777215);
fr.drawStringWithShadow(String.valueOf(item.stackSize), (float) (slot.xDisplayPosition + 9 - fr.getStringWidth(String.valueOf(item.stackSize)) / 2), (float) (slot.yDisplayPosition + 4), 16777215);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
event.setCanceled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import skytils.skytilsmod.Skytils;
Expand Down Expand Up @@ -55,7 +59,8 @@ public void onTick(TickEvent.ClientTickEvent event) {
ItemStack item = slot.getStack();
if (item == null) continue;
if (item.isItemEnchanted()) continue;
if (slot.slotNumber < 9 || slot.slotNumber > 44 || slot.slotNumber % 9 == 0 || slot.slotNumber % 9 == 8) continue;
if (slot.slotNumber < 9 || slot.slotNumber > 44 || slot.slotNumber % 9 == 0 || slot.slotNumber % 9 == 8)
continue;
if (item.getUnlocalizedName().contains(colorNeeded)) {
shouldClick.add(slot.slotNumber);
}
Expand Down Expand Up @@ -112,4 +117,24 @@ public void onDrawSlot(GuiContainerEvent.DrawSlotEvent.Pre event) {
}
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onTooltip(ItemTooltipEvent event) {
if (!Utils.inDungeons) return;
if (!Skytils.config.selectAllColorTerminalSolver) return;
if (event.toolTip == null) return;

Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.thePlayer;

if (mc.currentScreen instanceof GuiChest) {
ContainerChest chest = (ContainerChest) player.openContainer;
IInventory inv = chest.getLowerChestInventory();
String chestName = inv.getDisplayName().getUnformattedText();

if (chestName.startsWith("Select all the")) {
event.toolTip.clear();
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

import com.google.common.collect.ImmutableList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StringUtils;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import skytils.skytilsmod.Skytils;
Expand Down Expand Up @@ -110,4 +114,24 @@ public void onDrawSlot(GuiContainerEvent.DrawSlotEvent.Pre event) {
}
}
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onTooltip(ItemTooltipEvent event) {
if (!Utils.inDungeons) return;
if (!Skytils.config.startsWithSequenceTerminalSolver) return;
if (event.toolTip == null) return;

Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.thePlayer;

if (mc.currentScreen instanceof GuiChest) {
ContainerChest chest = (ContainerChest) player.openContainer;
IInventory inv = chest.getLowerChestInventory();
String chestName = inv.getDisplayName().getUnformattedText();

if (chestName.startsWith("What starts with:")) {
event.toolTip.clear();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
package skytils.skytilsmod.features.impl.dungeons.solvers.terminals;

import net.minecraft.client.Minecraft;
import net.minecraft.init.Blocks;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.inventory.ContainerChest;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StringUtils;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import skytils.skytilsmod.Skytils;
import skytils.skytilsmod.events.GuiContainerEvent;
Expand Down Expand Up @@ -32,4 +36,23 @@ public void onSlotClick(GuiContainerEvent.SlotClickEvent event) {
}
}
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onTooltip(ItemTooltipEvent event) {
if (!Utils.inDungeons) return;
if (event.toolTip == null) return;

Minecraft mc = Minecraft.getMinecraft();
EntityPlayerSP player = mc.thePlayer;

if (mc.currentScreen instanceof GuiChest) {
ContainerChest chest = (ContainerChest) player.openContainer;
IInventory inv = chest.getLowerChestInventory();
String chestName = inv.getDisplayName().getUnformattedText();

if (chestName.equals("Navigate the maze!") || chestName.equals("Correct all the panes!")) {
event.toolTip.clear();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void onCloseWindow(GuiContainerEvent.CloseWindowEvent event) {
ItemStack item = mc.thePlayer.inventory.getItemStack();
NBTTagCompound extraAttr = ItemUtil.getExtraAttributes(item);
if (Skytils.config.protectStarredItems && extraAttr != null) {
if ((item.getDisplayName().contains("✪") || extraAttr.hasKey("dungeon_item_level"))) {
if (extraAttr.hasKey("dungeon_item_level")) {
notifyAndMoveToFreeSlot(event.container);
return;
}
Expand Down Expand Up @@ -114,23 +114,33 @@ public void onSlotClick(GuiContainerEvent.SlotClickEvent event) {
item = salvageItem;
inSalvageGui = true;
}
if ((item.getDisplayName().contains("✪") || extraAttr.hasKey("dungeon_item_level")) && (event.slot.inventory == mc.thePlayer.inventory || inSalvageGui)) {
if (extraAttr.hasKey("dungeon_item_level") && (event.slot.inventory == mc.thePlayer.inventory || inSalvageGui)) {
mc.thePlayer.playSound("note.bass", 1, 0.5f);
mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Skytils has stopped you from salvaging that item!"));
event.setCanceled(true);
return;
}
}
if (!chestName.equals("Large Chest") && !chestName.contains("Auction") && inv.getSizeInventory() == 54 && extraAttr != null) {
ItemStack sellItem = inv.getStackInSlot(49);
if (sellItem != null) {
if ((sellItem.getItem() == Item.getItemFromBlock(Blocks.hopper) && sellItem.getDisplayName().contains("Sell Item")) || ItemUtil.getItemLore(sellItem).stream().anyMatch(s -> s.contains("buyback"))) {
if ((item.getDisplayName().contains("✪") || extraAttr.hasKey("dungeon_item_level")) && (event.slot.inventory == mc.thePlayer.inventory && event.slotId != 49)) {
mc.thePlayer.playSound("note.bass", 1, 0.5f);
mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Skytils has stopped you from selling that item!"));
event.setCanceled(true);
return;
}
}
if (Skytils.config.stopClickingNonSalvageable) {
String itemId = ItemUtil.getSkyBlockItemID(item);
if (chestName.startsWith("Salvage") && extraAttr != null) {
if (!extraAttr.hasKey("baseStatBoostPercentage") && !item.getDisplayName().contains("Salvage") && !item.getDisplayName().contains("Essence")) {
event.setCanceled(true);
if (itemId.contains("BACKPACK") && !itemId.equals("JUMBO_BACKPACK_UPGRADE"))
event.setCanceled(false);
}
}
}
if (!chestName.equals("Large Chest") && !chestName.contains("Auction") && inv.getSizeInventory() == 54 && extraAttr != null) {
ItemStack sellItem = inv.getStackInSlot(49);
if (sellItem != null) {
if ((sellItem.getItem() == Item.getItemFromBlock(Blocks.hopper) && sellItem.getDisplayName().contains("Sell Item")) || ItemUtil.getItemLore(sellItem).stream().anyMatch(s -> s.contains("buyback"))) {
if (extraAttr.hasKey("dungeon_item_level") && (event.slot.inventory == mc.thePlayer.inventory && event.slotId != 49)) {
mc.thePlayer.playSound("note.bass", 1, 0.5f);
mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Skytils has stopped you from selling that item!"));
event.setCanceled(true);
return;
}
}
}
Expand All @@ -141,7 +151,7 @@ public void onSlotClick(GuiContainerEvent.SlotClickEvent event) {
ItemStack item = mc.thePlayer.inventory.getItemStack();
NBTTagCompound extraAttr = ItemUtil.getExtraAttributes(item);
if (Skytils.config.protectStarredItems && extraAttr != null) {
if ((item.getDisplayName().contains("✪") || extraAttr.hasKey("dungeon_item_level"))) {
if (extraAttr.hasKey("dungeon_item_level")) {
notifyAndMoveToFreeSlot(event.container);
event.setCanceled(true);
return;
Expand All @@ -152,7 +162,7 @@ public void onSlotClick(GuiContainerEvent.SlotClickEvent event) {
ItemStack item = event.slot.getStack();
NBTTagCompound extraAttr = ItemUtil.getExtraAttributes(item);
if (Skytils.config.protectStarredItems && extraAttr != null) {
if ((item.getDisplayName().contains("✪") || extraAttr.hasKey("dungeon_item_level"))) {
if (extraAttr.hasKey("dungeon_item_level")) {
mc.thePlayer.playSound("note.bass", 1, 0.5f);
mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Skytils has stopped you from dropping that item!"));
event.setCanceled(true);
Expand Down

0 comments on commit bea8b2c

Please sign in to comment.