Skip to content

Commit

Permalink
feat: smithing table pattern encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulvdberge committed Aug 6, 2024
1 parent a4bd22d commit 4435285
Show file tree
Hide file tree
Showing 44 changed files with 780 additions and 329 deletions.
1 change: 1 addition & 0 deletions .idea/dictionaries/refinedstorage.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- The Pattern now shows the crafting recipe in the tooltip.
- When a Pattern is created for a crafting recipe, the Pattern will have a different texture and name to differentiate between empty patterns.
- The Pattern Grid now has additional support for stonecutter recipes.
- The Pattern Grid now has additional support for encoding stonecutter and smithing table recipes.

### Fixed

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.refinedmods.refinedstorage.common.autocrafting.PatternItem;
import com.refinedmods.refinedstorage.common.autocrafting.PatternState;
import com.refinedmods.refinedstorage.common.autocrafting.ProcessingPatternState;
import com.refinedmods.refinedstorage.common.autocrafting.SmithingTablePatternState;
import com.refinedmods.refinedstorage.common.autocrafting.StonecutterPatternState;
import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardItem;
import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardState;
Expand Down Expand Up @@ -880,6 +881,12 @@ protected final void registerDataComponents(final RegistryCallback<DataComponent
.persistent(StonecutterPatternState.CODEC)
.networkSynchronized(StonecutterPatternState.STREAM_CODEC)
.build()));
DataComponents.INSTANCE.setSmithingTablePatternState(
callback.register(createIdentifier("smithing_table_pattern_state"),
() -> DataComponentType.<SmithingTablePatternState>builder()
.persistent(SmithingTablePatternState.CODEC)
.networkSynchronized(SmithingTablePatternState.STREAM_CODEC)
.build()));
}

protected final void registerInventorySlotReference() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.refinedmods.refinedstorage.common.autocrafting;

import com.refinedmods.refinedstorage.api.resource.ResourceAmount;
import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern;
import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey;

import java.util.List;

record CraftingPattern(List<List<PlatformResourceKey>> inputs, ResourceAmount output, List<ResourceAmount> byproducts)
implements Pattern {
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.refinedmods.refinedstorage.common.autocrafting;

import com.refinedmods.refinedstorage.common.api.RefinedStorageApi;
import com.refinedmods.refinedstorage.common.api.autocrafting.CraftingPattern;
import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey;
import com.refinedmods.refinedstorage.common.support.resource.ItemResource;

Expand All @@ -23,7 +22,7 @@
import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier;
import static java.util.Objects.requireNonNullElse;

public class CraftingPatternClientTooltipComponent implements ClientTooltipComponent {
class CraftingPatternClientTooltipComponent implements ClientTooltipComponent {
private static final long CYCLE_MS = 1000;
private static final int ARROW_SPACING = 8;
private static final ResourceLocation LARGE_SLOT = createIdentifier("large_slot");
Expand All @@ -42,9 +41,7 @@ public class CraftingPatternClientTooltipComponent implements ClientTooltipCompo
private long cycleStart = 0;
private int currentCycle = 0;

public CraftingPatternClientTooltipComponent(final int width,
final int height,
final CraftingPattern craftingPattern) {
CraftingPatternClientTooltipComponent(final int width, final int height, final CraftingPattern craftingPattern) {
this.width = width;
this.height = height;
this.craftingPattern = craftingPattern;
Expand Down
Loading

0 comments on commit 4435285

Please sign in to comment.