mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 18:57:32 +00:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
ef276b8145
5 files changed
+32
-34
No files matched your search
@@ -15,6 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import noppes.npcs.client.ClientProxy;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionInterface;
|
||||
import noppes.npcs.controllers.MagicController;
|
||||
import noppes.npcs.controllers.data.Magic;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@@ -230,12 +231,12 @@ public class AttributeItemUtil {
|
||||
* Returns the item tooltip.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static List<String> getToolTip(List<String> original, NBTTagCompound compound) {
|
||||
public static List<String> getToolTip(List<String> original, NBTTagCompound compound, boolean override) {
|
||||
List<String> tooltip = new ArrayList<>(original);
|
||||
// Get the RPGCore compound and then the Attributes compound.
|
||||
NBTTagCompound rpgCore = compound.hasKey(TAG_RPGCORE) ? compound.getCompoundTag(TAG_RPGCORE) : new NBTTagCompound();
|
||||
NBTTagCompound attrTag = rpgCore.hasKey(TAG_ATTRIBUTES) ? rpgCore.getCompoundTag(TAG_ATTRIBUTES) : new NBTTagCompound();
|
||||
if (Keyboard.isKeyDown(ClientProxy.NPCButton.getKeyCode())) {
|
||||
if (Keyboard.isKeyDown(ClientProxy.NPCButton.getKeyCode()) || override) {
|
||||
List<String> newTooltips = new ArrayList<>();
|
||||
if (!tooltip.isEmpty()) {
|
||||
newTooltips.add(tooltip.get(0));
|
||||
|
||||
@@ -127,7 +127,7 @@ public class SubGuiEffectGeneral extends SubGuiInterface implements ITextfieldLi
|
||||
int iconWidth = effect.getWidth();
|
||||
int iconHeight = effect.getHeight();
|
||||
int width = data.getTotalWidth();
|
||||
int height = data.getTotalWidth();
|
||||
int height = data.getTotalHeight();
|
||||
|
||||
|
||||
func_152125_a(x, y, iconX, iconY, iconWidth, iconHeight, iconRenderSize, iconRenderSize, width, height);
|
||||
|
||||
@@ -88,10 +88,16 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
AuctionListing listing = tradesContainer.getListingAt(slot);
|
||||
AuctionClaim claim = tradesContainer.getClaimAt(slot);
|
||||
|
||||
if (listing != null && tradesContainer.isSellingAt(slot) && mouseButton == 1) {
|
||||
// Right-click on own listing = show cancel
|
||||
setPending(slot, PendingOp.CANCEL);
|
||||
NoppesUtil.clickSound();
|
||||
if (listing != null && tradesContainer.isSellingAt(slot)) {
|
||||
if (mouseButton == 0) {
|
||||
// Left-click on own listing = view details
|
||||
AuctionActionPacket.openBidding(listing.id);
|
||||
NoppesUtil.clickSound();
|
||||
} else if (mouseButton == 1) {
|
||||
// Right-click on own listing = show cancel
|
||||
setPending(slot, PendingOp.CANCEL);
|
||||
NoppesUtil.clickSound();
|
||||
}
|
||||
} else if (listing != null && tradesContainer.isBiddingAt(slot) && mouseButton == 0) {
|
||||
// Left-click on active bid = open bidding GUI to increase bid
|
||||
AuctionActionPacket.openBidding(listing.id);
|
||||
@@ -315,16 +321,13 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
AuctionListing listing = tradesContainer.getListingAt(slot);
|
||||
AuctionClaim claim = tradesContainer.getClaimAt(slot);
|
||||
|
||||
if (listing != null) {
|
||||
if (tradesContainer.isSellingAt(slot)) {
|
||||
tooltip.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("auction.trades.activeListing"));
|
||||
tooltip.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("auction.trades.rightClickToCancel"));
|
||||
} else if (tradesContainer.isBiddingAt(slot)) {
|
||||
tooltip.add(EnumChatFormatting.AQUA + StatCollector.translateToLocal("auction.trades.activeBid"));
|
||||
tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("auction.trades.winningBid"));
|
||||
tooltip.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("auction.trades.leftClickToIncrease"));
|
||||
}
|
||||
} else if (claim != null) {
|
||||
// Slots with items have tooltips handled by AuctionTooltipHandler via ItemTooltipEvent
|
||||
if (listing != null) return;
|
||||
if (claim != null && (claim.type == EnumClaimType.ITEM ||
|
||||
(claim.type == EnumClaimType.REFUND && claim.item != null))) return;
|
||||
|
||||
// Non-item slots (currency claims, refund without item, unavailable)
|
||||
if (claim != null) {
|
||||
switch (claim.type) {
|
||||
case CURRENCY:
|
||||
tooltip.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("auction.trades.soldClaim"));
|
||||
@@ -342,20 +345,6 @@ public class GuiAuctionTrades extends GuiAuctionInterface implements IGuiData {
|
||||
tooltip.add(EnumChatFormatting.GRAY + StatCollector.translateToLocal("auction.trades.outbidBy") + ": " + EnumChatFormatting.AQUA + claim.otherPlayerName);
|
||||
}
|
||||
tooltip.add(EnumChatFormatting.GOLD + String.format("%,d", claim.currency) + " " + AuctionClientConfig.getCurrencyName());
|
||||
// Show rebid option if item is present (active listing)
|
||||
if (claim.item != null) {
|
||||
tooltip.add("");
|
||||
tooltip.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("auction.trades.leftClickRebid"));
|
||||
tooltip.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("auction.trades.rightClickRefund"));
|
||||
return; // Skip the generic claim message
|
||||
}
|
||||
break;
|
||||
case ITEM:
|
||||
if (claim.isReturned) {
|
||||
tooltip.add(EnumChatFormatting.RED + StatCollector.translateToLocal("auction.trades.expiredClaim"));
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.GREEN + StatCollector.translateToLocal("auction.trades.wonClaim"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
tooltip.add(EnumChatFormatting.YELLOW + StatCollector.translateToLocal("auction.trades.leftClickToClaim"));
|
||||
|
||||
@@ -80,9 +80,10 @@ public class GuiEffectBar extends GuiScreen {
|
||||
int iconWidth = entry.effect.getWidth();
|
||||
int iconHeight = entry.effect.getHeight();
|
||||
int texWidth = imageData.getTotalWidth();
|
||||
int texHeight = imageData.getTotalHeight();
|
||||
|
||||
// Use iconYOffset to vertically center the icon
|
||||
func_152125_a(x + 2, drawY + iconYOffset, iconU, iconV, iconWidth, iconHeight, iconRenderSize, iconRenderSize, texWidth, texWidth);
|
||||
func_152125_a(x + 2, drawY + iconYOffset, iconU, iconV, iconWidth, iconHeight, iconRenderSize, iconRenderSize, texWidth, texHeight);
|
||||
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(specialIcons);
|
||||
@@ -190,7 +191,7 @@ public class GuiEffectBar extends GuiScreen {
|
||||
if (imageData != null && imageData.imageLoaded()) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
imageData.bindTexture();
|
||||
func_152125_a(tooltipX + (maxWidth - iconSize) / 2, textY + 4, hoveredEffect.iconX, hoveredEffect.iconY, hoveredEffect.getWidth(), hoveredEffect.getHeight(), iconSize, iconSize, imageData.getTotalWidth(), imageData.getTotalWidth());
|
||||
func_152125_a(tooltipX + (maxWidth - iconSize) / 2, textY + 4, hoveredEffect.iconX, hoveredEffect.iconY, hoveredEffect.getWidth(), hoveredEffect.getHeight(), iconSize, iconSize, imageData.getTotalWidth(), imageData.getTotalHeight());
|
||||
}
|
||||
|
||||
textureManager.bindTexture(specialIcons);
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package noppes.npcs.mixin;
|
||||
|
||||
import kamkeel.npcs.util.AttributeItemUtil;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import noppes.npcs.client.gui.player.GuiAuctionInterface;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -28,9 +30,14 @@ public abstract class MixinItemStack {
|
||||
|
||||
@Inject(method = "getTooltip", at = @At("TAIL"), cancellable = true)
|
||||
public void getAttributeTooltip(EntityPlayer player, boolean advanced, CallbackInfoReturnable<List<String>> cir) {
|
||||
boolean override = false;
|
||||
if (Minecraft.getMinecraft().currentScreen instanceof GuiAuctionInterface) {
|
||||
override = true;
|
||||
}
|
||||
|
||||
List<String> tooltip = cir.getReturnValue();
|
||||
if (hasTagCompound() && getTagCompound().hasKey(TAG_RPGCORE)) {
|
||||
cir.setReturnValue(AttributeItemUtil.getToolTip(tooltip, getTagCompound()));
|
||||
cir.setReturnValue(AttributeItemUtil.getToolTip(tooltip, getTagCompound(), override));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user