mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-28 11:16:02 +00:00
Reformat Code
This commit is contained in:
1 parent
21e920426e
commit
1de1c4e710
169 files changed
+3967
-1556
No files matched your search
@@ -71,6 +71,7 @@ public class ContainerAuction extends ContainerNpcInterface {
|
||||
|
||||
/**
|
||||
* Get the ItemStack in a player inventory slot.
|
||||
*
|
||||
* @param containerSlotIndex The container slot index (0-35 for player inv)
|
||||
*/
|
||||
public ItemStack getPlayerInventoryStack(int containerSlotIndex) {
|
||||
|
||||
@@ -28,9 +28,14 @@ public class ContainerAuctionBidding extends ContainerAuction {
|
||||
// Display slot (read-only)
|
||||
addSlotToContainer(new Slot(displayInventory, 0, ITEM_SLOT_X, ITEM_SLOT_Y) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) { return false; }
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) { return false; }
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -27,9 +27,14 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
// Sell slot blocks direct interaction
|
||||
addSlotToContainer(new Slot(sellInventory, 0, SELL_SLOT_X, SELL_SLOT_Y) {
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack stack) { return false; }
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer player) { return false; }
|
||||
public boolean canTakeStack(EntityPlayer player) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -44,8 +49,9 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
/**
|
||||
* Add items from inventory to sell slot.
|
||||
* Not limited by inventory - just stages items for sale. Validation on submit.
|
||||
*
|
||||
* @param sourceSlot Inventory slot index
|
||||
* @param fullStack True=full stack, False=1 item
|
||||
* @param fullStack True=full stack, False=1 item
|
||||
*/
|
||||
public void addToSellSlot(int sourceSlot, boolean fullStack) {
|
||||
if (!isPlayerInventorySlot(sourceSlot)) return;
|
||||
@@ -78,6 +84,7 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
|
||||
/**
|
||||
* Remove items from sell slot.
|
||||
*
|
||||
* @param removeAll True=clear slot, False=remove 1 item
|
||||
*/
|
||||
public void removeFromSellSlot(boolean removeAll) {
|
||||
@@ -91,12 +98,16 @@ public class ContainerAuctionSell extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if sell slot is this container slot index */
|
||||
/**
|
||||
* Check if sell slot is this container slot index
|
||||
*/
|
||||
public boolean isSellSlot(int slotIndex) {
|
||||
return slotIndex == SELL_SLOT_INDEX;
|
||||
}
|
||||
|
||||
/** Check if two stacks match using NoppesUtilPlayer.compareItems (same item, damage, and NBT) */
|
||||
/**
|
||||
* Check if two stacks match using NoppesUtilPlayer.compareItems (same item, damage, and NBT)
|
||||
*/
|
||||
private boolean itemsMatch(ItemStack a, ItemStack b) {
|
||||
return NoppesUtilPlayer.compareItems(a, b, false, false);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import noppes.npcs.constants.EnumClaimType;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import noppes.npcs.constants.EnumTradeSlotType;
|
||||
import noppes.npcs.controllers.AuctionController;
|
||||
import noppes.npcs.controllers.data.AuctionClaim;
|
||||
import noppes.npcs.controllers.data.AuctionListing;
|
||||
import noppes.npcs.entity.EntityNPCInterface;
|
||||
@@ -55,7 +55,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
refreshData();
|
||||
}
|
||||
|
||||
/** Refresh data from controller (server-side only) */
|
||||
/**
|
||||
* Refresh data from controller (server-side only)
|
||||
*/
|
||||
public void refreshData() {
|
||||
// Clear existing data
|
||||
clearData();
|
||||
@@ -70,7 +72,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
populateDisplay(newListings, newBids, newClaims);
|
||||
}
|
||||
|
||||
/** Set data from NBT received from server (client-side) */
|
||||
/**
|
||||
* Set data from NBT received from server (client-side)
|
||||
*/
|
||||
public void setTradesData(NBTTagCompound compound) {
|
||||
// Clear existing data
|
||||
clearData();
|
||||
@@ -111,7 +115,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
populateDisplay(newListings, newBids, newClaims);
|
||||
}
|
||||
|
||||
/** Clear all data and reset display */
|
||||
/**
|
||||
* Clear all data and reset display
|
||||
*/
|
||||
private void clearData() {
|
||||
activeListings.clear();
|
||||
activeBids.clear();
|
||||
@@ -125,7 +131,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Populate display from provided data lists */
|
||||
/**
|
||||
* Populate display from provided data lists
|
||||
*/
|
||||
private void populateDisplay(List<AuctionListing> newListings, List<AuctionListing> newBids, List<AuctionClaim> allClaims) {
|
||||
activeListings = new ArrayList<>(newListings);
|
||||
activeBids = new ArrayList<>(newBids);
|
||||
@@ -218,7 +226,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
|
||||
// ========== Slot Data Accessors ==========
|
||||
|
||||
/** Get listing at slot (or null if claim/empty) */
|
||||
/**
|
||||
* Get listing at slot (or null if claim/empty)
|
||||
*/
|
||||
public AuctionListing getListingAt(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return null;
|
||||
EnumTradeSlotType type = slotTypes[slot];
|
||||
@@ -233,7 +243,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Get claim at slot (or null if listing/empty) */
|
||||
/**
|
||||
* Get claim at slot (or null if listing/empty)
|
||||
*/
|
||||
public AuctionClaim getClaimAt(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return null;
|
||||
if (slotTypes[slot] == EnumTradeSlotType.CLAIM) {
|
||||
@@ -245,17 +257,23 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Check if slot is player's active listing */
|
||||
/**
|
||||
* Check if slot is player's active listing
|
||||
*/
|
||||
public boolean isSellingAt(int slot) {
|
||||
return slot >= 0 && slot < SLOT_COUNT && slotTypes[slot] == EnumTradeSlotType.SELLING;
|
||||
}
|
||||
|
||||
/** Check if slot is player's active bid */
|
||||
/**
|
||||
* Check if slot is player's active bid
|
||||
*/
|
||||
public boolean isBiddingAt(int slot) {
|
||||
return slot >= 0 && slot < SLOT_COUNT && slotTypes[slot] == EnumTradeSlotType.BIDDING;
|
||||
}
|
||||
|
||||
/** Find listing matching item (searches both selling and bidding) */
|
||||
/**
|
||||
* Find listing matching item (searches both selling and bidding)
|
||||
*/
|
||||
public AuctionListing getListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing listing : activeListings) {
|
||||
@@ -267,7 +285,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find listing in selling list */
|
||||
/**
|
||||
* Find listing in selling list
|
||||
*/
|
||||
public AuctionListing getSellingListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing listing : activeListings) {
|
||||
@@ -276,7 +296,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find listing in bidding list */
|
||||
/**
|
||||
* Find listing in bidding list
|
||||
*/
|
||||
public AuctionListing getBiddingListingForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionListing bid : activeBids) {
|
||||
@@ -285,7 +307,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
return null;
|
||||
}
|
||||
|
||||
/** Find claim matching item */
|
||||
/**
|
||||
* Find claim matching item
|
||||
*/
|
||||
public AuctionClaim getClaimForItem(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (AuctionClaim claim : claims) {
|
||||
@@ -296,14 +320,27 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
|
||||
// ========== List Getters ==========
|
||||
|
||||
public List<AuctionListing> getActiveListings() { return activeListings; }
|
||||
public List<AuctionListing> getActiveBids() { return activeBids; }
|
||||
public List<AuctionClaim> getClaims() { return claims; }
|
||||
public int getTotalTradeCount() { return activeListings.size() + activeBids.size() + claims.size(); }
|
||||
public List<AuctionListing> getActiveListings() {
|
||||
return activeListings;
|
||||
}
|
||||
|
||||
public List<AuctionListing> getActiveBids() {
|
||||
return activeBids;
|
||||
}
|
||||
|
||||
public List<AuctionClaim> getClaims() {
|
||||
return claims;
|
||||
}
|
||||
|
||||
public int getTotalTradeCount() {
|
||||
return activeListings.size() + activeBids.size() + claims.size();
|
||||
}
|
||||
|
||||
// ========== Slot Hiding (for pending operations) ==========
|
||||
|
||||
/** Hide slot for pending operation display */
|
||||
/**
|
||||
* Hide slot for pending operation display
|
||||
*/
|
||||
public void setHiddenSlot(int slot) {
|
||||
if (hiddenSlot >= 0 && hiddenSlot < SLOT_COUNT) {
|
||||
restoreSlotItem(hiddenSlot);
|
||||
@@ -314,7 +351,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
/** Restore hidden slot */
|
||||
/**
|
||||
* Restore hidden slot
|
||||
*/
|
||||
public void clearHiddenSlot() {
|
||||
if (hiddenSlot >= 0 && hiddenSlot < SLOT_COUNT) {
|
||||
restoreSlotItem(hiddenSlot);
|
||||
@@ -322,7 +361,9 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
hiddenSlot = -1;
|
||||
}
|
||||
|
||||
/** Restore item at slot from data using slot tracking */
|
||||
/**
|
||||
* Restore item at slot from data using slot tracking
|
||||
*/
|
||||
private void restoreSlotItem(int slot) {
|
||||
if (slot < 0 || slot >= SLOT_COUNT) return;
|
||||
|
||||
@@ -348,8 +389,14 @@ public class ContainerAuctionTrades extends ContainerAuction {
|
||||
}
|
||||
}
|
||||
|
||||
public int getHiddenSlot() { return hiddenSlot; }
|
||||
public int getHiddenSlot() {
|
||||
return hiddenSlot;
|
||||
}
|
||||
|
||||
/** Get player's max trade slots (synced from server based on permissions) */
|
||||
public int getMaxTradeSlots() { return maxTradeSlots; }
|
||||
/**
|
||||
* Get player's max trade slots (synced from server based on permissions)
|
||||
*/
|
||||
public int getMaxTradeSlots() {
|
||||
return maxTradeSlots;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user