Skip to content

Commit

Permalink
Merge branch 'master' into hide_stored_items_in_crafting_cpu_gui_button
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Dec 18, 2024
2 parents 5e238fc + e1d47e9 commit 2111c5b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 36 deletions.
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ dependencies {
implementation('com.github.GTNewHorizons:NotEnoughItems:2.6.51-GTNH:dev')
implementation('curse.maven:cofh-core-69162:2388751')

compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta25:api')
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-beta26:api')
compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.22:dev") {transitive = false}
compileOnly('com.github.GTNewHorizons:ThaumicTinkerer:2.10.2:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.19:dev') {transitive = false} // required to compile CraftingV2Tests.java now
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.5.0:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.04:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.10:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Jabba:1.4.6:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.0:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.27-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.1-GTNH:api') {transitive = false}
compileOnly('com.github.GTNewHorizons:waila:1.8.2:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.15:api') {transitive = false}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') {transitive = false }
Expand All @@ -34,7 +34,7 @@ dependencies {
functionalTestImplementation('org.junit.platform:junit-platform-engine')
functionalTestImplementation('org.junit.platform:junit-platform-launcher')
functionalTestImplementation('org.junit.platform:junit-platform-reporting')
functionalTestImplementation('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.04:dev') {
functionalTestImplementation('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.10:dev') {
exclude module: "Applied-Energistics-2-Unofficial"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -909,11 +909,13 @@ private static boolean itemStackMatchesSearchTerm(final ItemStack itemStack, fin

final NBTTagList tags = encodedValue.getTagList(in ? "in" : "out", NBT.TAG_COMPOUND);
final boolean containsInvalidDisplayName = GuiText.UnknownItem.getLocal().toLowerCase().contains(searchTerm);
Predicate<ItemStack> itemFilter = (is) -> Platform
.getItemDisplayName(AEApi.instance().storage().createItemStack(is)).toLowerCase().contains(searchTerm);
Predicate<ItemStack> itemFilter;

if (NEI.searchField.existsSearchField()) {
itemFilter = NEI.searchField.getFilter(searchTerm);
} else {
itemFilter = is -> Platform.getItemDisplayName(AEApi.instance().storage().createItemStack(is)).toLowerCase()
.contains(searchTerm);
}

for (int i = 0; i < tags.tagCount(); i++) {
Expand Down
62 changes: 34 additions & 28 deletions src/main/java/appeng/client/me/ItemRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
package appeng.client.me;

import java.util.ArrayList;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.function.BiPredicate;
import java.util.function.Predicate;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -52,6 +54,7 @@ public class ItemRepo implements IDisplayRepo {
private int rowSize = 9;

private String searchString = "";
private Map<IAEItemStack, Boolean> searchCache = new WeakHashMap<>();
private IPartitionList<IAEItemStack> myPartitionList;
private boolean hasPower;

Expand Down Expand Up @@ -108,48 +111,47 @@ public void updateView() {

final Enum viewMode = this.sortSrc.getSortDisplay();
final Enum typeFilter = this.sortSrc.getTypeFilter();
Predicate<IAEItemStack> itemFilter;

if (NEI.searchField.existsSearchField()) {
final Predicate<ItemStack> neiFilter = NEI.searchField.getFilter(this.searchString);
itemFilter = is -> neiFilter.test(is.getItemStack());
} else {
itemFilter = getFilter(this.searchString);
}

if (itemFilter == null) {
return;
Predicate<IAEItemStack> itemFilter = null;

if (!this.searchString.trim().isEmpty()) {
if (NEI.searchField.existsSearchField()) {
final Predicate<ItemStack> neiFilter = NEI.searchField.getFilter(this.searchString);
itemFilter = is -> neiFilter.test(is.getItemStack());
} else {
itemFilter = getFilter(this.searchString);
}
}

IItemDisplayRegistry registry = AEApi.instance().registries().itemDisplay();

out: for (IAEItemStack is : this.list) {
if (registry.isBlacklisted(is.getItem()) || registry.isBlacklisted(is.getItem().getClass())) {
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}

for (final BiPredicate<TypeFilter, IAEItemStack> filter : registry.getItemFilters()) {
if (!filter.test((TypeFilter) typeFilter, is)) continue out;
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}

if (this.myPartitionList != null && !this.myPartitionList.isListed(is)) {
continue;
}

if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
if (registry.isBlacklisted(is.getItem()) || registry.isBlacklisted(is.getItem().getClass())) {
continue;
}

if (viewMode == ViewItems.CRAFTABLE) {
is = is.copy();
is.setStackSize(0);
for (final BiPredicate<TypeFilter, IAEItemStack> filter : registry.getItemFilters()) {
if (!filter.test((TypeFilter) typeFilter, is)) continue out;
}

if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
if (itemFilter == null || Boolean.TRUE.equals(this.searchCache.computeIfAbsent(is, itemFilter::test))) {

if (viewMode == ViewItems.CRAFTABLE) {
is = is.copy();
is.setStackSize(0);
}

if (itemFilter.test(is)) {
this.view.add(is);
}
}
Expand Down Expand Up @@ -262,13 +264,17 @@ public String getSearchString() {

@Override
public void setSearchString(@Nonnull final String searchString) {
this.searchString = searchString;

if (NEI.searchField.existsSearchField()) {
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
NEI.searchField.setText(this.searchString);
if (!searchString.equals(this.searchString)) {
this.searchString = searchString;
this.searchCache.clear();

if (NEI.searchField.existsSearchField()) {
final Enum searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
NEI.searchField.setText(this.searchString);
}
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public Predicate<ItemStack> getFilter(String filterText) {

if (searchField != null) {
final ItemFilter filter = searchField.getFilter(filterText);
return stack -> filter.matches(stack);
return filter::matches;
}

return null;
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/appeng/tile/storage/TileChest.java
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ public boolean readFromStream_TileChest(final ByteBuf data) {
this.type = data.readByte() & 0b11;
final AEColor oldPaintedColor = this.paintedColor;
this.paintedColor = AEColor.values()[data.readByte()];
this.getProxy().setColor(this.paintedColor);

final int item = data.readInt();

Expand All @@ -433,6 +434,7 @@ public void readFromNBT_TileChest(final NBTTagCompound data) {
this.priority = data.getInteger("priority");
if (data.hasKey("paintedColor")) {
this.paintedColor = AEColor.values()[data.getByte("paintedColor")];
this.getProxy().setColor(this.paintedColor);
}
}

Expand Down Expand Up @@ -715,8 +717,11 @@ public boolean recolourBlock(final ForgeDirection side, final AEColor newPainted
if (this.paintedColor == newPaintedColor) {
return false;
}

this.paintedColor = newPaintedColor;
this.getProxy().setColor(this.paintedColor);
if (getGridNode(side) != null) {
getGridNode(side).updateState();
}
this.markDirty();
this.markForUpdate();
return true;
Expand Down

0 comments on commit 2111c5b

Please sign in to comment.