Skip to content

Commit

Permalink
Merge branch 'main' into guidelib
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
  • Loading branch information
shartte committed Jan 21, 2025
2 parents 26d8e37 + 481413e commit dc74848
Show file tree
Hide file tree
Showing 55 changed files with 280 additions and 432 deletions.
4 changes: 4 additions & 0 deletions src/main/java/appeng/api/stacks/KeyCounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ public void removeZeros() {
}
}

public void removeEmptySubmaps() {
lists.values().removeIf(VariantCounter::isEmpty);
}

public void addAll(KeyCounter other) {
for (var entry : other.lists.entrySet()) {
var ourSubIndex = lists.get(entry.getKey());
Expand Down
10 changes: 2 additions & 8 deletions src/main/java/appeng/block/orientation/SpinMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@ public static int getSpinFromUp(Direction facing, Direction up) {
return 0; // Degenerated up direction just falls back to no spin
}

public static int getUpFromSpin(Direction facing, Direction up) {
var spinDirs = SPIN_DIRECTIONS[facing.ordinal()];
for (int i = 0; i < spinDirs.length; i++) {
if (spinDirs[i] == up) {
return i;
}
}
return 0; // Degenerated up direction just falls back to no spin
public static Direction getUpFromSpin(Direction facing, int spin) {
return SPIN_DIRECTIONS[facing.ordinal()][spin];
}
}
76 changes: 0 additions & 76 deletions src/main/java/appeng/hooks/UnlitQuadHooks.java

This file was deleted.

22 changes: 9 additions & 13 deletions src/main/java/appeng/me/service/StorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public class StorageService implements IStorageService, IGridServiceProvider {
/**
* Publicly exposed cached available stacks.
*/
private KeyCounter cachedAvailableStacks = new KeyCounter();
private KeyCounter cachedAvailableStacksBackBuffer = new KeyCounter();
private final KeyCounter cachedAvailableStacks = new KeyCounter();
/**
* Private cached amounts, to ensure that we send correct change notifications even if
* {@link #cachedAvailableStacks} is modified by mistake.
Expand Down Expand Up @@ -113,17 +112,14 @@ private void updateCachedStacks() {
try {
cachedStacksNeedUpdate = false;

// Update cache
var previousStacks = cachedAvailableStacks;
var currentStacks = cachedAvailableStacksBackBuffer;
cachedAvailableStacks = currentStacks;
cachedAvailableStacksBackBuffer = previousStacks;

currentStacks.clear();
storage.getAvailableStacks(currentStacks);
cachedAvailableStacks.clear();
storage.getAvailableStacks(cachedAvailableStacks);
// clear() only clears the inner maps,
// so ensure that the outer map gets cleaned up too
cachedAvailableStacks.removeEmptySubmaps();

// Post watcher update for currently available stacks
for (var entry : currentStacks) {
for (var entry : cachedAvailableStacks) {
var what = entry.getKey();
var newAmount = entry.getLongValue();
if (newAmount != cachedAvailableAmounts.getLong(what)) {
Expand All @@ -133,15 +129,15 @@ private void updateCachedStacks() {
// Post watcher update for removed stacks
for (var entry : cachedAvailableAmounts.object2LongEntrySet()) {
var what = entry.getKey();
var newAmount = currentStacks.get(what);
var newAmount = cachedAvailableStacks.get(what);
if (newAmount == 0) {
postWatcherUpdate(what, newAmount);
}
}

// Update private amounts
cachedAvailableAmounts.clear();
for (var entry : currentStacks) {
for (var entry : cachedAvailableStacks) {
cachedAvailableAmounts.put(entry.getKey(), entry.getLongValue());
}
} finally {
Expand Down

This file was deleted.

55 changes: 0 additions & 55 deletions src/main/java/appeng/mixins/unlitquad/ModelManagerMixin.java

This file was deleted.

11 changes: 9 additions & 2 deletions src/main/java/appeng/util/ConfigInventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,15 @@ public void setStack(int slot, @Nullable GenericStack stack) {
// force amount to 0 in types-only mode
stack = new GenericStack(stack.what(), 0);
} else if (!typesOnly && stack.amount() <= 0) {
// in stack mode, amounts of 0 or less clear the slot
stack = null;
if (mode == Mode.CONFIG_STACKS && getStack(slot) == null) {
// filter the slot to a minimum of 1 of that stack, if currently empty
// This allows setting a filter using empty containers that are limited to one resource,
// e.g. empty mana tablet.
stack = new GenericStack(stack.what(), 1);
} else {
// in stack mode, amounts of 0 or less clear the slot
stack = null;
}
}
}
super.setStack(slot, stack);
Expand Down
2 changes: 0 additions & 2 deletions src/main/resources/ae2.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
"StructureTemplateMixin"
],
"client": [
"unlitquad.ModelManagerMixin",
"unlitquad.BlockPartFaceDeserializerMixin",
"AbstractContainerScreenMixin",
"GuiGraphicsMixin",
"WrappedGenericStackTooltipModIdMixin",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/ae2/lang/en_gb.etag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5bbf17d620ce4de6e6bdcd55ad9f976f
6204549afc4c41643ada63ca9fc090ac
1 change: 1 addition & 0 deletions src/main/resources/assets/ae2/lang/en_gb.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"achievement.ae2.Compass": "Meteorite Hunter",
"achievement.ae2.Compass.desc": "Craft a Meteorite Compass",
"achievement.ae2.Controller": "Networking Switchboard",
"achievement.ae2.NetworkTool": "Network Diagnostics",
"gui.ae2.Gray": "Grey",
"gui.ae2.LightGray": "Light Grey",
"gui.ae2.inWorldCraftingPresses": "Crafting Presses are obtained by breaking a Mysterious Cube. Mysterious Cubes are in the centre of meteorites which can be found in around the world. They can be located by using a meteorite compass.",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/ae2/lang/es_es.etag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5bbf17d620ce4de6e6bdcd55ad9f976f
159822c1dd1382c489006c685431879d
1 change: 1 addition & 0 deletions src/main/resources/assets/ae2/lang/es_es.json
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,7 @@
"gui.tooltips.ae2.SchedulingModeRoundRobin": "Exportar usando el modo robin redondo.",
"gui.tooltips.ae2.SearchSettingsTooltip": "Mostrar Ajustes de Búsqueda",
"gui.tooltips.ae2.Serial": "Serial: %d",
"gui.tooltips.ae2.SetAction": "%s: Establecer %s",
"gui.tooltips.ae2.ShowAllProviders": "Mostrar todos los proveedores de patrones",
"gui.tooltips.ae2.ShowNonFullProviders": "Mostrar Proveedores de Patrones visibles con ranuras vacías",
"gui.tooltips.ae2.ShowVisibleProviders": "Mostrar proveedores de patrones visibles",
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/assets/ae2/lang/pt_br.etag
Original file line number Diff line number Diff line change
@@ -1 +1 @@
298e56808ad8f653183fab914fc81d85
61e5f6acb1403d6b63a3442b98805d54
Loading

0 comments on commit dc74848

Please sign in to comment.