Skip to content

Commit 9da566e

Browse files
committed
Initial commit
0 parents  commit 9da566e

29 files changed

Lines changed: 2045 additions & 0 deletions

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release Mod
2+
3+
on:
4+
push:
5+
branches:
6+
- 1.20.1
7+
8+
jobs:
9+
build-and-release:
10+
if: "startsWith(github.event.head_commit.message, 'v1') || startsWith(github.event.head_commit.message, 'v2') || startsWith(github.event.head_commit.message, 'v3')"
11+
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up JDK 17
22+
uses: actions/setup-java@v4
23+
with:
24+
java-version: '17'
25+
distribution: 'temurin'
26+
27+
- name: Setup Gradle
28+
uses: gradle/actions/setup-gradle@v3
29+
30+
- name: Make gradlew executable
31+
run: chmod +x ./gradlew
32+
33+
- name: Run Spotless Check
34+
run: ./gradlew spotlessCheck
35+
36+
- name: Build with Gradle
37+
run: ./gradlew build
38+
39+
- name: Create Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
files: build/libs/*.jar
43+
44+
tag_name: ${{ github.event.head_commit.message }}
45+
46+
name: ${{ github.event.head_commit.message }}
47+
48+
body: |
49+
Automated release based on commit message.
50+
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# User-specific stuff
2+
.idea/
3+
4+
*.iml
5+
*.ipr
6+
*.iws
7+
8+
# IntelliJ
9+
out/
10+
# mpeltonen/sbt-idea plugin
11+
.idea_modules/
12+
13+
# JIRA plugin
14+
atlassian-ide-plugin.xml
15+
16+
# Compiled class file
17+
*.class
18+
19+
# Log file
20+
*.log
21+
22+
# BlueJ files
23+
*.ctxt
24+
25+
# Package Files #
26+
*.jar
27+
*.war
28+
*.nar
29+
*.ear
30+
*.zip
31+
*.tar.gz
32+
*.rar
33+
34+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
35+
hs_err_pid*
36+
37+
*~
38+
39+
# temporary files which can be created if a process still has a handle open of a deleted file
40+
.fuse_hidden*
41+
42+
# KDE directory preferences
43+
.directory
44+
45+
# Linux trash folder which might appear on any partition or disk
46+
.Trash-*
47+
48+
# .nfs files are created when an open file is removed but is still being accessed
49+
.nfs*
50+
51+
# General
52+
.DS_Store
53+
.AppleDouble
54+
.LSOverride
55+
56+
# Icon must end with two \r
57+
Icon
58+
59+
# Thumbnails
60+
._*
61+
62+
# Files that might appear in the root of a volume
63+
.DocumentRevisions-V100
64+
.fseventsd
65+
.Spotlight-V100
66+
.TemporaryItems
67+
.Trashes
68+
.VolumeIcon.icns
69+
.com.apple.timemachine.donotpresent
70+
71+
# Directories potentially created on remote AFP share
72+
.AppleDB
73+
.AppleDesktop
74+
Network Trash Folder
75+
Temporary Items
76+
.apdisk
77+
78+
# Windows thumbnail cache files
79+
Thumbs.db
80+
Thumbs.db:encryptable
81+
ehthumbs.db
82+
ehthumbs_vista.db
83+
84+
# Dump file
85+
*.stackdump
86+
87+
# Folder config file
88+
[Dd]esktop.ini
89+
90+
# Recycle Bin used on file shares
91+
$RECYCLE.BIN/
92+
93+
# Windows Installer files
94+
*.cab
95+
*.msi
96+
*.msix
97+
*.msm
98+
*.msp
99+
100+
# Windows shortcuts
101+
*.lnk
102+
103+
.gradle
104+
build/
105+
106+
# Ignore Gradle GUI config
107+
gradle-app.setting
108+
109+
# Cache of project
110+
.gradletasknamecache
111+
112+
**/build/
113+
114+
# Common working directory
115+
run/
116+
runs/
117+
118+
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
119+
!gradle-wrapper.jar

README.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<div >
2+
3+
**English** | [简体中文](README_zh_CN.md)
4+
5+
</div>
6+
7+
# ExtendedPick
8+
9+
**ExtendedPick** is a Minecraft Forge mod that significantly upgrades the standard "Pick Block" (Middle-Click) functionality. It allows players to find items in their inventory more intelligently, even if the item is buried inside a backpack or has slightly different NBT data.
10+
11+
## Features
12+
13+
### 1. Smart / Fuzzy Matching
14+
The vanilla Pick Block function requires an exact item match. ExtendedPick introduces `ISearchHelper`, allowing for "best match" scoring.
15+
- If you try to pick a block and don't have the *exact* item, the mod searches your inventory for the most similar item based on registered logic.
16+
- It prioritizes the Hotbar but will swap items from the main inventory if necessary.
17+
18+
### 2. Deep Search (Container Support)
19+
If the item isn't found in your main inventory, ExtendedPick can search **inside** item containers (like Backpacks, Shulker Boxes, or Bundles) that you are carrying.
20+
- This is handled via the `IDeepSearchProvider` API.
21+
- If the item is found inside a container, the mod communicates with the server to extract it automatically (configurable).
22+
23+
### 3. Advanced Creative Entity Picking
24+
Enhances Creative Mode picking for entities:
25+
- **Ctrl + Pick Block (Middle Click)** on an Entity will copy the Entity with its full NBT data (excluding position/UUID), allowing you to place down an exact copy of that mob.
26+
27+
### 4. Configurable
28+
The mod allows customization via `ExtendedPickClientConfig`:
29+
- Toggle Deep Search.
30+
- Enable/Disable debug logging for picking actions.
31+
- Toggle Creative NBT picking behavior.
32+
33+
## For Developers (API)
34+
35+
ExtendedPick provides an API for other mods to integrate their items and containers.
36+
37+
### `ISearchHelper`
38+
Implement this interface to define how two items should be compared (Fuzzy Search).
39+
```java
40+
public class MyISearchHelper implements ISearchHelper {
41+
@Override
42+
int getMatchScore(@NotNull ItemStack target, @NotNull ItemStack candidate){
43+
//Logic to Match Score
44+
}
45+
}
46+
```
47+
48+
### `IDeepSearchProvider`
49+
Implement this interface to allow ExtendedPick to look inside your mod's containers (e.g., backpacks).
50+
```java
51+
public class MyBackpackProvider implements IDeepSearchProvider {
52+
@Override
53+
public void forEachItem(ItemStack container, Consumer<IndexedStack> action) {
54+
// Logic to iterate container contents
55+
}
56+
57+
@Override
58+
public ItemStack extract(ServerPlayer player, ItemStack container, int index) {
59+
// Logic to remove item from container and give to player
60+
}
61+
}
62+
```

README_zh_CN.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# ExtendedPick (中文说明)
2+
3+
**ExtendedPick** 是一个 Minecraft Forge模组,它极大地增强了原版“选取方块”(Pick Block / 中键选取)的功能。即使物品藏在背包中或 NBT 数据略有不同,它也能帮助玩家智能地在物品栏中找到目标物品。
4+
5+
## 主要功能
6+
7+
### 1. 智能/模糊匹配 (Smart Matching)
8+
原版的选取方块功能通常需要物品完全一致才能选中。ExtendedPick 引入了 `ISearchHelper` 机制,支持评分制的“最佳匹配”。
9+
- 当你尝试选取一个方块,且身上没有完全一样的物品时,模组会搜索你的物品栏,寻找最相似的替代品。
10+
- 优先检索快捷栏,如果物品在背包主栏中,会自动切换到快捷栏。
11+
12+
### 2. 深度搜索 (Deep Search)
13+
如果物品不在你的主物品栏中,ExtendedPick 可以搜索你携带的**容器物品内部**(例如背包、潜影盒或收纳袋)。
14+
- 这是通过 `IDeepSearchProvider` API 实现的。
15+
- 如果在容器内找到了目标物品,模组会向服务器发送数据包,自动将其提取出来(此功能可配置)。
16+
17+
### 3. 创造模式实体增强
18+
增强了创造模式下对实体的选取功能:
19+
- **Ctrl + 中键** 点击实体:将复制该实体及其完整的 NBT 数据(排除坐标/UUID),让你能生成一个属性完全相同的生物副本。
20+
21+
### 4. 高度可配置
22+
可以通过 `ExtendedPickClientConfig` 进行自定义:
23+
- 开启/关闭深度搜索。
24+
- 开启/关闭选取操作的调试日志 (Debug Log)。
25+
- 切换创造模式 NBT 选取行为。
26+
27+
## 开发者接口 (API)
28+
29+
ExtendedPick 提供了简单的 API,允许其他模组兼容其物品和容器。
30+
31+
### `ISearchHelper`
32+
实现此接口以定义两个物品之间的相似度比较逻辑(模糊搜索)。
33+
```java
34+
public class MyISearchHelper implements ISearchHelper {
35+
@Override
36+
int getMatchScore(@NotNull ItemStack target, @NotNull ItemStack candidate){
37+
//打分逻辑
38+
}
39+
}
40+
```
41+
42+
### `IDeepSearchProvider`
43+
实现此接口以允许 ExtendedPick 搜索你模组中的容器(如背包)。
44+
```java
45+
public class MyBackpackProvider implements IDeepSearchProvider {
46+
@Override
47+
public void forEachItem(ItemStack container, Consumer<IndexedStack> action) {
48+
// 遍历容器内容的逻辑
49+
}
50+
51+
@Override
52+
public ItemStack extract(ServerPlayer player, ItemStack container, int index) {
53+
// 从容器中提取物品并交给玩家的逻辑
54+
}
55+
}
56+
```

0 commit comments

Comments
 (0)