diff --git a/CHANGELOG.md b/CHANGELOG.md index 367afbe1d..01f7e9fa4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,22 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Added + +- Pattern Grid +- Pattern + +### Changed + +- 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 support for more pattern types. + +### Fixed + +- Clicking on a scrollbar no longer makes a clicking sound. +- Incorrect and outdated (mentioning NBT tags) help explanations for fuzzy mode. + ## [2.0.0-milestone.4.5] - 2024-07-26 ### Added diff --git a/build.gradle.kts b/build.gradle.kts index d99f52400..e7891180d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,12 +21,3 @@ project.extensions.getByType().apply { ) } } - -allprojects { - apply(plugin = "maven-publish") - publishing { - repositories { - mavenLocal() - } - } -} \ No newline at end of file diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java index 4afc37e7b..7d2ac7548 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApi.java @@ -7,6 +7,7 @@ import com.refinedmods.refinedstorage.api.network.node.NetworkNode; import com.refinedmods.refinedstorage.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage.api.resource.ResourceKey; +import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; import com.refinedmods.refinedstorage.common.api.constructordestructor.ConstructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.constructordestructor.DestructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.exporter.ExporterTransferStrategyFactory; @@ -200,4 +201,6 @@ EnergyStorage asBlockItemEnergyStorage( void sendNoPermissionMessage(ServerPlayer player, Component message); boolean canPlaceNetworkNode(ServerPlayer player, Level level, BlockPos pos, BlockState state); + + Optional getPattern(ItemStack stack, Level level); } diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java index 9f9553678..d30707043 100644 --- a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/RefinedStorageApiProxy.java @@ -7,6 +7,7 @@ import com.refinedmods.refinedstorage.api.network.node.NetworkNode; import com.refinedmods.refinedstorage.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage.api.resource.ResourceKey; +import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; import com.refinedmods.refinedstorage.common.api.constructordestructor.ConstructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.constructordestructor.DestructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.exporter.ExporterTransferStrategyFactory; @@ -395,6 +396,11 @@ public boolean canPlaceNetworkNode(final ServerPlayer player, return ensureLoaded().canPlaceNetworkNode(player, level, pos, state); } + @Override + public Optional getPattern(final ItemStack stack, final Level level) { + return ensureLoaded().getPattern(stack, level); + } + private RefinedStorageApi ensureLoaded() { if (delegate == null) { throw new IllegalStateException("API not loaded yet"); diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/CraftingPattern.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/CraftingPattern.java new file mode 100644 index 000000000..714a018fa --- /dev/null +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/CraftingPattern.java @@ -0,0 +1,19 @@ +package com.refinedmods.refinedstorage.common.api.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; + +import java.util.Collection; +import java.util.List; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.6") +public record CraftingPattern(List> inputs, + ResourceAmount output, + List byproducts) implements Pattern { + @Override + public Collection getOutputs() { + return List.of(output); + } +} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/Pattern.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/Pattern.java new file mode 100644 index 000000000..c055585f4 --- /dev/null +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/Pattern.java @@ -0,0 +1,12 @@ +package com.refinedmods.refinedstorage.common.api.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; + +import java.util.Collection; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.6") +public interface Pattern { + Collection getOutputs(); +} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/PatternProviderItem.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/PatternProviderItem.java new file mode 100644 index 000000000..3a5796e15 --- /dev/null +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/PatternProviderItem.java @@ -0,0 +1,17 @@ +package com.refinedmods.refinedstorage.common.api.autocrafting; + +import java.util.Optional; +import java.util.UUID; +import javax.annotation.Nullable; + +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.6") +public interface PatternProviderItem { + @Nullable + UUID getId(ItemStack stack); + + Optional getPattern(ItemStack stack, Level level); +} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/ProcessingPattern.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/ProcessingPattern.java new file mode 100644 index 000000000..ff9d33173 --- /dev/null +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/ProcessingPattern.java @@ -0,0 +1,16 @@ +package com.refinedmods.refinedstorage.common.api.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; + +import java.util.Collection; +import java.util.List; + +import org.apiguardian.api.API; + +@API(status = API.Status.STABLE, since = "2.0.0-milestone.4.6") +public record ProcessingPattern(List> inputs, List outputs) implements Pattern { + @Override + public Collection getOutputs() { + return outputs; + } +} diff --git a/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/package-info.java b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/package-info.java new file mode 100644 index 000000000..8075977d5 --- /dev/null +++ b/refinedstorage-common-api/src/main/java/com/refinedmods/refinedstorage/common/api/autocrafting/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage.common.api.autocrafting; + +import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/black_pattern_grid.json new file mode 100644 index 000000000..7fa65e1c8 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/black_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/black", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/black", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/black", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/black", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/black", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/black" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/black", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/black", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/black", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/black", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/black", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/black", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/blue_pattern_grid.json new file mode 100644 index 000000000..705c04b2d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/blue_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/blue", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/blue" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/blue", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/blue", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/blue", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/brown_pattern_grid.json new file mode 100644 index 000000000..20af9ab41 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/brown_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/brown", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/brown" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/brown", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/brown", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/brown", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/cyan_pattern_grid.json new file mode 100644 index 000000000..f4f6e3c04 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/cyan_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/cyan", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/cyan" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/cyan", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/cyan", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/cyan", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/gray_pattern_grid.json new file mode 100644 index 000000000..b873667c3 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/gray_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/gray", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/gray" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/gray", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/gray", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/gray", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/green_pattern_grid.json new file mode 100644 index 000000000..61d42439a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/green_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/green", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/green", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/green", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/green", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/green", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/green" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/green", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/green", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/green", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/green", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/green", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/green", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/light_gray_pattern_grid.json new file mode 100644 index 000000000..bea3f24d1 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/light_gray_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/light_gray" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/light_gray", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/lime_pattern_grid.json new file mode 100644 index 000000000..95d0756e1 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/lime_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/lime", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/lime" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/lime", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/lime", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/lime", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/magenta_pattern_grid.json new file mode 100644 index 000000000..ce9bac108 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/magenta_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/magenta", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/magenta" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/magenta", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/magenta", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/magenta", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/orange_pattern_grid.json new file mode 100644 index 000000000..7464404c8 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/orange_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/orange", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/orange" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/orange", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/orange", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/orange", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pattern_grid.json new file mode 100644 index 000000000..5a4b1421a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/light_blue" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/light_blue", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pink_pattern_grid.json new file mode 100644 index 000000000..2ad8c0856 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/pink_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/pink", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/pink" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/pink", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/pink", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/pink", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/purple_pattern_grid.json new file mode 100644 index 000000000..f5e8e4e2d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/purple_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/purple", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/purple" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/purple", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/purple", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/purple", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/red_pattern_grid.json new file mode 100644 index 000000000..d2d3d92ec --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/red_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/red", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/red", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/red", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/red", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/red", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/red" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/red", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/red", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/red", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/red", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/red", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/red", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/white_pattern_grid.json new file mode 100644 index 000000000..c85a98486 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/white_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/white", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/white", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/white", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/white", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/white", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/white" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/white", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/white", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/white", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/white", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/white", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/white", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/yellow_pattern_grid.json new file mode 100644 index 000000000..dc5de3e73 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/blockstates/yellow_pattern_grid.json @@ -0,0 +1,110 @@ +{ + "variants": { + "active=false,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": -90 + }, + "active=false,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90 + }, + "active=false,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 180 + }, + "active=false,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": 90, + "y": 90 + }, + "active=false,direction=east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 90 + }, + "active=false,direction=north": { + "model": "refinedstorage:block/pattern_grid/inactive" + }, + "active=false,direction=south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 180 + }, + "active=false,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": -90 + }, + "active=false,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 180 + }, + "active=false,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90 + }, + "active=false,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "x": -90, + "y": 90 + }, + "active=false,direction=west": { + "model": "refinedstorage:block/pattern_grid/inactive", + "y": 270 + }, + "active=true,direction=down_east": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": 90, + "y": -90 + }, + "active=true,direction=down_north": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": 90 + }, + "active=true,direction=down_south": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": 90, + "y": 180 + }, + "active=true,direction=down_west": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": 90, + "y": 90 + }, + "active=true,direction=east": { + "model": "refinedstorage:block/pattern_grid/yellow", + "y": 90 + }, + "active=true,direction=north": { + "model": "refinedstorage:block/pattern_grid/yellow" + }, + "active=true,direction=south": { + "model": "refinedstorage:block/pattern_grid/yellow", + "y": 180 + }, + "active=true,direction=up_east": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": -90, + "y": -90 + }, + "active=true,direction=up_north": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": -90, + "y": 180 + }, + "active=true,direction=up_south": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": -90 + }, + "active=true,direction=up_west": { + "model": "refinedstorage:block/pattern_grid/yellow", + "x": -90, + "y": 90 + }, + "active=true,direction=west": { + "model": "refinedstorage:block/pattern_grid/yellow", + "y": 270 + } + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/black.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/black.json new file mode 100644 index 000000000..f873d09ba --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/black.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/black", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/blue.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/blue.json new file mode 100644 index 000000000..fcd91218f --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/blue.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/blue", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/brown.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/brown.json new file mode 100644 index 000000000..77d4ce11a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/brown.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/brown", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/cyan.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/cyan.json new file mode 100644 index 000000000..c6a75e40e --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/cyan.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/cyan", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/gray.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/gray.json new file mode 100644 index 000000000..63c22bf1f --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/gray.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/gray", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/green.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/green.json new file mode 100644 index 000000000..30d1d5c98 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/green.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/green", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/inactive.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/inactive.json new file mode 100644 index 000000000..5e8af6e71 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/inactive.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/inactive", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_blue.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_blue.json new file mode 100644 index 000000000..d7a41c3fe --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_blue.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/light_blue", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_gray.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_gray.json new file mode 100644 index 000000000..bb54937da --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/light_gray.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/light_gray", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/lime.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/lime.json new file mode 100644 index 000000000..5ea22a48d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/lime.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/lime", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/magenta.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/magenta.json new file mode 100644 index 000000000..2b855bbce --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/magenta.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/magenta", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/orange.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/orange.json new file mode 100644 index 000000000..ebfaff81e --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/orange.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/orange", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/pink.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/pink.json new file mode 100644 index 000000000..943cfd86d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/pink.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/pink", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/purple.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/purple.json new file mode 100644 index 000000000..e68139e47 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/purple.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/purple", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/red.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/red.json new file mode 100644 index 000000000..59a29d955 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/red.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/red", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/white.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/white.json new file mode 100644 index 000000000..3360dd7c6 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/white.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/white", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/yellow.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/yellow.json new file mode 100644 index 000000000..802dc8683 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/block/pattern_grid/yellow.json @@ -0,0 +1,13 @@ +{ + "parent": "refinedstorage:block/emissive_north_cutout", + "textures": { + "cutout": "refinedstorage:block/pattern_grid/cutouts/yellow", + "down": "refinedstorage:block/bottom", + "east": "refinedstorage:block/pattern_grid/right", + "north": "refinedstorage:block/pattern_grid/front", + "particle": "refinedstorage:block/pattern_grid/right", + "south": "refinedstorage:block/pattern_grid/back", + "up": "refinedstorage:block/pattern_grid/top", + "west": "refinedstorage:block/pattern_grid/left" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/black_pattern_grid.json new file mode 100644 index 000000000..810318a65 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/black_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/black" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/blue_pattern_grid.json new file mode 100644 index 000000000..8dda3bed0 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/blue_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/blue" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/brown_pattern_grid.json new file mode 100644 index 000000000..a5400dad4 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/brown_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/brown" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/cyan_pattern_grid.json new file mode 100644 index 000000000..89252445a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/cyan_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/cyan" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/gray_pattern_grid.json new file mode 100644 index 000000000..5e093515c --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/gray_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/gray" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/green_pattern_grid.json new file mode 100644 index 000000000..b3bd93505 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/green_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/green" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/light_gray_pattern_grid.json new file mode 100644 index 000000000..4c47549ff --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/light_gray_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/light_gray" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/lime_pattern_grid.json new file mode 100644 index 000000000..b35597270 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/lime_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/lime" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/magenta_pattern_grid.json new file mode 100644 index 000000000..23d885ae5 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/magenta_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/magenta" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/orange_pattern_grid.json new file mode 100644 index 000000000..845618ebd --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/orange_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/orange" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pattern_grid.json new file mode 100644 index 000000000..b1aec2515 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/light_blue" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pink_pattern_grid.json new file mode 100644 index 000000000..9358334f5 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/pink_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/pink" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/purple_pattern_grid.json new file mode 100644 index 000000000..2e63cdef3 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/purple_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/purple" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/red_pattern_grid.json new file mode 100644 index 000000000..e117d9ece --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/red_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/red" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/white_pattern_grid.json new file mode 100644 index 000000000..7073bd864 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/white_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/white" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/yellow_pattern_grid.json new file mode 100644 index 000000000..14d16648a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/assets/refinedstorage/models/item/yellow_pattern_grid.json @@ -0,0 +1,3 @@ +{ + "parent": "refinedstorage:block/pattern_grid/yellow" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/black_pattern_grid.json new file mode 100644 index 000000000..0c82b45aa --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/black_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/black_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/black_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/blue_pattern_grid.json new file mode 100644 index 000000000..3fc1dab5f --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/blue_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/blue_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/blue_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/brown_pattern_grid.json new file mode 100644 index 000000000..21c6be6e1 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/brown_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/brown_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/brown_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/cyan_pattern_grid.json new file mode 100644 index 000000000..6e672ca6d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/cyan_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/cyan_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/cyan_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/gray_pattern_grid.json new file mode 100644 index 000000000..26706f8de --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/gray_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/gray_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/gray_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/green_pattern_grid.json new file mode 100644 index 000000000..7ba2a5c12 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/green_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/green_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/green_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_blue_pattern_grid.json new file mode 100644 index 000000000..640a631d7 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_blue_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/light_blue_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/light_blue_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_gray_pattern_grid.json new file mode 100644 index 000000000..ba001806e --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/light_gray_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/light_gray_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/light_gray_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/lime_pattern_grid.json new file mode 100644 index 000000000..f12eeb903 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/lime_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/lime_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/lime_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/magenta_pattern_grid.json new file mode 100644 index 000000000..82f2879f7 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/magenta_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/magenta_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/magenta_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/orange_pattern_grid.json new file mode 100644 index 000000000..27f904e4b --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/orange_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/orange_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/orange_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/pink_pattern_grid.json new file mode 100644 index 000000000..358811ea4 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/pink_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/pink_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/pink_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/purple_pattern_grid.json new file mode 100644 index 000000000..8bfef78a4 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/purple_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/purple_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/purple_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/red_pattern_grid.json new file mode 100644 index 000000000..ba14eca80 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/red_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/red_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/red_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/white_pattern_grid.json new file mode 100644 index 000000000..107127bbe --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/white_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/white_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/white_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/yellow_pattern_grid.json new file mode 100644 index 000000000..6dc392741 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/advancement/recipes/misc/coloring/yellow_pattern_grid.json @@ -0,0 +1,32 @@ +{ + "parent": "minecraft:recipes/root", + "criteria": { + "has_pattern_grids": { + "conditions": { + "items": [ + { + "items": "#refinedstorage:pattern_grids" + } + ] + }, + "trigger": "minecraft:inventory_changed" + }, + "has_the_recipe": { + "conditions": { + "recipe": "refinedstorage:coloring/yellow_pattern_grid" + }, + "trigger": "minecraft:recipe_unlocked" + } + }, + "requirements": [ + [ + "has_the_recipe", + "has_pattern_grids" + ] + ], + "rewards": { + "recipes": [ + "refinedstorage:coloring/yellow_pattern_grid" + ] + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json new file mode 100644 index 000000000..1bbbc9cf6 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/black_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:black_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/black_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json new file mode 100644 index 000000000..1158b0064 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/blue_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:blue_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/blue_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json new file mode 100644 index 000000000..684d5e8c9 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/brown_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:brown_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/brown_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json new file mode 100644 index 000000000..1e3e94404 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/cyan_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:cyan_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/cyan_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json new file mode 100644 index 000000000..8d9660d5a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/gray_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:gray_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/gray_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json new file mode 100644 index 000000000..25e15cb87 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/green_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:green_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/green_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json new file mode 100644 index 000000000..9346120a7 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/light_gray_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:light_gray_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/light_gray_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json new file mode 100644 index 000000000..4c5fd5b37 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/lime_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:lime_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/lime_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json new file mode 100644 index 000000000..d6da01e5b --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/magenta_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:magenta_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/magenta_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json new file mode 100644 index 000000000..964916d38 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/orange_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:orange_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/orange_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json new file mode 100644 index 000000000..f395323e7 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json new file mode 100644 index 000000000..6bb450999 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/pink_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:pink_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/pink_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json new file mode 100644 index 000000000..42404be9c --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/purple_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:purple_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/purple_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json new file mode 100644 index 000000000..25237dce7 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/red_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:red_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/red_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json new file mode 100644 index 000000000..c059207d4 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/white_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:white_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/white_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json new file mode 100644 index 000000000..d2f5ce5e4 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/loot_table/blocks/yellow_pattern_grid.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "bonus_rolls": 0.0, + "conditions": [ + { + "condition": "minecraft:survives_explosion" + } + ], + "entries": [ + { + "type": "minecraft:item", + "name": "refinedstorage:yellow_pattern_grid" + } + ], + "rolls": 1.0 + } + ], + "random_sequence": "refinedstorage:blocks/yellow_pattern_grid" +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/black_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/black_pattern_grid.json new file mode 100644 index 000000000..c3944c15d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/black_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/black" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:black_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/blue_pattern_grid.json new file mode 100644 index 000000000..f1e6a8f61 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/blue_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/blue" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:blue_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/brown_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/brown_pattern_grid.json new file mode 100644 index 000000000..5491f4306 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/brown_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/brown" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:brown_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/cyan_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/cyan_pattern_grid.json new file mode 100644 index 000000000..86eee2818 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/cyan_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/cyan" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:cyan_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/gray_pattern_grid.json new file mode 100644 index 000000000..1fc0ca27a --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/gray_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/gray" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:gray_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/green_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/green_pattern_grid.json new file mode 100644 index 000000000..c1f31af5e --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/green_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/green" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:green_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_blue_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_blue_pattern_grid.json new file mode 100644 index 000000000..6d94a92cd --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_blue_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/light_blue" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_gray_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_gray_pattern_grid.json new file mode 100644 index 000000000..27e3a4a88 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/light_gray_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/light_gray" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:light_gray_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/lime_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/lime_pattern_grid.json new file mode 100644 index 000000000..4e6b647a8 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/lime_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/lime" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:lime_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/magenta_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/magenta_pattern_grid.json new file mode 100644 index 000000000..b9f7acce8 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/magenta_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/magenta" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:magenta_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/orange_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/orange_pattern_grid.json new file mode 100644 index 000000000..a87159606 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/orange_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/orange" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:orange_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/pink_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/pink_pattern_grid.json new file mode 100644 index 000000000..694be123d --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/pink_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/pink" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:pink_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/purple_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/purple_pattern_grid.json new file mode 100644 index 000000000..e87a3e35b --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/purple_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/purple" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:purple_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/red_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/red_pattern_grid.json new file mode 100644 index 000000000..342dbb45c --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/red_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/red" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:red_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/white_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/white_pattern_grid.json new file mode 100644 index 000000000..545d3147c --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/white_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/white" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:white_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/yellow_pattern_grid.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/yellow_pattern_grid.json new file mode 100644 index 000000000..1b910bad9 --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/recipe/coloring/yellow_pattern_grid.json @@ -0,0 +1,16 @@ +{ + "type": "minecraft:crafting_shapeless", + "category": "misc", + "ingredients": [ + { + "tag": "refinedstorage:pattern_grids" + }, + { + "tag": "c:dyes/yellow" + } + ], + "result": { + "count": 1, + "id": "refinedstorage:yellow_pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/generated/resources/data/refinedstorage/tags/item/pattern_grids.json b/refinedstorage-common/src/generated/resources/data/refinedstorage/tags/item/pattern_grids.json new file mode 100644 index 000000000..09212798c --- /dev/null +++ b/refinedstorage-common/src/generated/resources/data/refinedstorage/tags/item/pattern_grids.json @@ -0,0 +1,20 @@ +{ + "values": [ + "refinedstorage:white_pattern_grid", + "refinedstorage:orange_pattern_grid", + "refinedstorage:magenta_pattern_grid", + "refinedstorage:pattern_grid", + "refinedstorage:yellow_pattern_grid", + "refinedstorage:lime_pattern_grid", + "refinedstorage:pink_pattern_grid", + "refinedstorage:gray_pattern_grid", + "refinedstorage:light_gray_pattern_grid", + "refinedstorage:cyan_pattern_grid", + "refinedstorage:purple_pattern_grid", + "refinedstorage:blue_pattern_grid", + "refinedstorage:brown_pattern_grid", + "refinedstorage:green_pattern_grid", + "refinedstorage:red_pattern_grid", + "refinedstorage:black_pattern_grid" + ] +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java index b7a8be0fe..b9d9c997b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractClientModInitializer.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridScreen; import com.refinedmods.refinedstorage.common.constructordestructor.ConstructorScreen; import com.refinedmods.refinedstorage.common.constructordestructor.DestructorScreen; import com.refinedmods.refinedstorage.common.content.Items; @@ -55,6 +56,7 @@ protected static void registerScreens(final ScreenRegistration registration) { registration.register(Menus.INSTANCE.getDiskDrive(), DiskDriveScreen::new); registration.register(Menus.INSTANCE.getGrid(), GridScreen::new); registration.register(Menus.INSTANCE.getCraftingGrid(), CraftingGridScreen::new); + registration.register(Menus.INSTANCE.getPatternGrid(), PatternGridScreen::new); registration.register(Menus.INSTANCE.getWirelessGrid(), GridScreen::new); registration.register(Menus.INSTANCE.getController(), ControllerScreen::new); registration.register(Menus.INSTANCE.getItemStorage(), ItemStorageBlockScreen::new); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java index 5780792be..3a2ea3fe5 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/AbstractModInitializer.java @@ -12,6 +12,12 @@ import com.refinedmods.refinedstorage.common.api.RefinedStorageApiProxy; import com.refinedmods.refinedstorage.common.api.security.PlatformSecurityNetworkComponent; import com.refinedmods.refinedstorage.common.api.upgrade.AbstractUpgradeItem; +import com.refinedmods.refinedstorage.common.autocrafting.CraftingPatternState; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridBlockEntity; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridData; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItem; +import com.refinedmods.refinedstorage.common.autocrafting.PatternState; import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardItem; import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardState; import com.refinedmods.refinedstorage.common.constructordestructor.BlockBreakDestructorStrategyFactory; @@ -312,6 +318,7 @@ protected final void registerBlocks( Blocks.INSTANCE.getCable().registerBlocks(callback); Blocks.INSTANCE.getGrid().registerBlocks(callback); Blocks.INSTANCE.getCraftingGrid().registerBlocks(callback); + Blocks.INSTANCE.getPatternGrid().registerBlocks(callback); Blocks.INSTANCE.getDetector().registerBlocks(callback); Blocks.INSTANCE.getImporter().registerBlocks(callback); Blocks.INSTANCE.getExporter().registerBlocks(callback); @@ -341,6 +348,7 @@ protected final void registerItems(final RegistryCallback callback) { registerSimpleItems(callback); Blocks.INSTANCE.getGrid().registerItems(callback); Blocks.INSTANCE.getCraftingGrid().registerItems(callback); + Blocks.INSTANCE.getPatternGrid().registerItems(callback); Blocks.INSTANCE.getCable().registerItems(callback, Items.INSTANCE::addCable); Blocks.INSTANCE.getController().registerItems(callback, Items.INSTANCE::addController); Blocks.INSTANCE.getCreativeController().registerItems(callback, Items.INSTANCE::addCreativeController); @@ -389,6 +397,7 @@ private void registerSimpleItems(final RegistryCallback callback) { ConfigurationCardItem::new )); Items.INSTANCE.setNetworkCard(callback.register(ContentIds.NETWORK_CARD, NetworkCardItem::new)); + Items.INSTANCE.setPattern(callback.register(ContentIds.PATTERN, PatternItem::new)); } private void registerProcessor(final RegistryCallback callback, final ProcessorItem.Type type) { @@ -562,6 +571,10 @@ protected final void registerBlockEntities( ContentIds.CRAFTING_GRID, () -> typeFactory.create(CraftingGridBlockEntity::new, Blocks.INSTANCE.getCraftingGrid().toArray()) )); + BlockEntities.INSTANCE.setPatternGrid(callback.register( + ContentIds.PATTERN_GRID, + () -> typeFactory.create(PatternGridBlockEntity::new, Blocks.INSTANCE.getPatternGrid().toArray()) + )); for (final ItemStorageVariant variant : ItemStorageVariant.values()) { BlockEntities.INSTANCE.setItemStorageBlock(variant, callback.register( ContentIds.forItemStorageBlock(variant), @@ -679,6 +692,10 @@ protected final void registerMenus(final RegistryCallback> callback, ContentIds.CRAFTING_GRID, () -> extendedMenuTypeFactory.create(CraftingGridContainerMenu::new, GridData.STREAM_CODEC) )); + Menus.INSTANCE.setPatternGrid(callback.register( + ContentIds.PATTERN_GRID, + () -> extendedMenuTypeFactory.create(PatternGridContainerMenu::new, PatternGridData.STREAM_CODEC) + )); Menus.INSTANCE.setWirelessGrid(callback.register( ContentIds.WIRELESS_GRID, () -> extendedMenuTypeFactory.create(WirelessGridContainerMenu::new, WirelessGridData.STREAM_CODEC) @@ -837,6 +854,18 @@ protected final void registerDataComponents(final RegistryCallback DataComponentType.builder() + .persistent(PatternState.CODEC) + .networkSynchronized(PatternState.STREAM_CODEC) + .build())); + DataComponents.INSTANCE.setCraftingPatternState( + callback.register(createIdentifier("crafting_pattern_state"), + () -> DataComponentType.builder() + .persistent(CraftingPatternState.CODEC) + .networkSynchronized(CraftingPatternState.STREAM_CODEC) + .build())); } protected final void registerInventorySlotReference() { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Config.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Config.java index e828d1c07..6feeb0d92 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Config.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Config.java @@ -20,6 +20,8 @@ public interface Config { GridEntry getGrid(); + SimpleEnergyUsageEntry getPatternGrid(); + CraftingGridEntry getCraftingGrid(); ControllerEntry getController(); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java index b1b96a0ff..00b0accf0 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/Platform.java @@ -131,4 +131,6 @@ void saveSavedData(SavedData savedData, @Nullable NetworkNodeContainerProvider getContainerProviderSafely(Level level, BlockPos pos, @Nullable Direction direction); + + int getItemColor(ItemStack stack, int tintIndex); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java index 6c28ad8e5..00ff22c91 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/PlatformProxy.java @@ -254,6 +254,11 @@ public NetworkNodeContainerProvider getContainerProviderSafely(final Level level return ensureLoaded().getContainerProviderSafely(level, pos, direction); } + @Override + public int getItemColor(final ItemStack stack, final int tintIndex) { + return ensureLoaded().getItemColor(stack, tintIndex); + } + private Platform ensureLoaded() { if (platform == null) { throw new IllegalStateException("Platform not loaded yet"); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java index 8a38b03fb..6e0c4ebc5 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/RefinedStorageApiImpl.java @@ -11,6 +11,8 @@ import com.refinedmods.refinedstorage.api.network.security.SecurityPolicy; import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; +import com.refinedmods.refinedstorage.common.api.autocrafting.PatternProviderItem; import com.refinedmods.refinedstorage.common.api.constructordestructor.ConstructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.constructordestructor.DestructorStrategyFactory; import com.refinedmods.refinedstorage.common.api.exporter.ExporterTransferStrategyFactory; @@ -93,6 +95,7 @@ import java.util.PriorityQueue; import java.util.Queue; import java.util.Set; +import java.util.UUID; import java.util.stream.Collectors; import javax.annotation.Nullable; @@ -166,6 +169,7 @@ public class RefinedStorageApiImpl implements RefinedStorageApi { private final CompositeSlotReferenceProvider slotReferenceProvider = new CompositeSlotReferenceProvider(); private final PlatformRegistry permissionRegistry = new PlatformRegistryImpl<>(); private final List resourceExtractStrategies = new ArrayList<>(); + private final Map patternCache = new HashMap<>(); public RefinedStorageApiImpl() { gridSynchronizerRegistry.register(createIdentifier("off"), NoopGridSynchronizer.INSTANCE); @@ -573,4 +577,22 @@ public boolean canPlaceNetworkNode(final ServerPlayer player, } return true; } + + @Override + public Optional getPattern(final ItemStack stack, final Level level) { + if (patternCache.size() > 2000) { + patternCache.clear(); + } + if (!(stack.getItem() instanceof PatternProviderItem providerItem)) { + return Optional.empty(); + } + final UUID id = providerItem.getId(stack); + if (id == null) { + return Optional.empty(); + } + return Optional.ofNullable(patternCache.computeIfAbsent( + id, + i -> providerItem.getPattern(stack, level).orElse(null) + )); + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java new file mode 100644 index 000000000..be13f9548 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternClientTooltipComponent.java @@ -0,0 +1,132 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; +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; + +import java.util.List; +import java.util.Objects; + +import net.minecraft.ChatFormatting; +import net.minecraft.client.gui.Font; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +public class CraftingPatternClientTooltipComponent implements ClientTooltipComponent { + private static final long CYCLE_MS = 1000; + private static long cycleStart = 0; + private static int currentCycle = 0; + + private static final int ARROW_SPACING = 8; + + private static final ResourceLocation SLOT = createIdentifier("slot"); + private static final ResourceLocation LARGE_SLOT = createIdentifier("large_slot"); + private static final int LARGE_SLOT_WIDTH = 26; + private static final int LARGE_SLOT_HEIGHT = 26; + + private final int width; + private final int height; + private final CraftingPattern craftingPattern; + + public CraftingPatternClientTooltipComponent(final int width, + final int height, + final CraftingPattern craftingPattern) { + this.width = width; + this.height = height; + this.craftingPattern = craftingPattern; + } + + @Override + public int getHeight() { + return 9 + 2 + height * 18 + 3; + } + + @Override + public int getWidth(final Font font) { + return (width * 18) + ARROW_SPACING + LIGHT_ARROW_WIDTH + ARROW_SPACING + LARGE_SLOT_WIDTH; + } + + @Override + public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { + final long now = System.currentTimeMillis(); + if (cycleStart == 0) { + cycleStart = now; + } + if (now - cycleStart >= CYCLE_MS) { + currentCycle++; + cycleStart = now; + } + if (craftingPattern.output().getResource() instanceof ItemResource itemResource) { + graphics.drawString( + font, + Component.literal(String.format("%dx ", craftingPattern.output().getAmount())) + .append(itemResource.toItemStack().getHoverName()) + .withStyle(ChatFormatting.GRAY), + x, + y, + Objects.requireNonNullElse(ChatFormatting.GRAY.getColor(), 15) + ); + } + renderInputSlots(x, y + 9 + 2, graphics); + renderArrow(x, y + 9 + 2, graphics); + renderResultSlot(font, x, y + 9 + 2, graphics); + } + + private void renderInputSlots(final int x, final int y, final GuiGraphics graphics) { + for (int sx = 0; sx < width; ++sx) { + for (int sy = 0; sy < height; ++sy) { + renderInputSlot(x, y, graphics, sx, sy); + } + } + } + + private void renderInputSlot(final int x, final int y, final GuiGraphics graphics, final int sx, final int sy) { + graphics.blitSprite(SLOT, x + sx * 18, y + sy * 18, 18, 18); + final int index = sy * width + sx; + final List inputs = craftingPattern.inputs().get(index); + if (!inputs.isEmpty()) { + final int idx = currentCycle % inputs.size(); + final PlatformResourceKey resource = inputs.get(idx); + RefinedStorageApi.INSTANCE.getResourceRendering(resource).render( + resource, + graphics, + x + sx * 18 + 1, + y + sy * 18 + 1 + ); + } + } + + private void renderArrow(final int x, final int y, final GuiGraphics graphics) { + graphics.blitSprite( + LIGHT_ARROW, + x + width * 18 + ARROW_SPACING, + y + ((height * 18) / 2) - (LIGHT_ARROW_HEIGHT / 2), + LIGHT_ARROW_WIDTH, + LIGHT_ARROW_HEIGHT + ); + } + + private void renderResultSlot(final Font font, final int x, final int y, final GuiGraphics graphics) { + final int slotX = x + width * 18 + ARROW_SPACING + LIGHT_ARROW_WIDTH + ARROW_SPACING; + final int slotY = y + ((height * 18) / 2) - (LARGE_SLOT_HEIGHT / 2); + graphics.blitSprite(LARGE_SLOT, slotX, slotY, LARGE_SLOT_WIDTH, LARGE_SLOT_HEIGHT); + final ResourceAmount output = craftingPattern.output(); + if (output.getResource() instanceof ItemResource itemResource) { + final ItemStack resultItemStack = itemResource.toItemStack(output.getAmount()); + final int stackX = slotX + 5; + final int stackY = slotY + 5; + graphics.renderItem(resultItemStack, stackX, stackY); + graphics.renderItemDecorations(font, resultItemStack, stackX, stackY); + } + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternState.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternState.java new file mode 100644 index 000000000..ad87c630b --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/CraftingPatternState.java @@ -0,0 +1,52 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import java.util.ArrayList; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.ByteBufCodecs; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; + +public record CraftingPatternState(boolean fuzzyMode, CraftingInput.Positioned input) { + private static final Codec INPUT_CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.INT.fieldOf("width").forGetter(CraftingInput::width), + Codec.INT.fieldOf("height").forGetter(CraftingInput::height), + Codec.list(ItemStack.OPTIONAL_CODEC).fieldOf("items").forGetter(CraftingInput::items) + ).apply(instance, CraftingInput::of)); + + private static final Codec POSITIONED_INPUT_CODEC = + RecordCodecBuilder.create(instance -> instance.group( + INPUT_CODEC.fieldOf("input").forGetter(CraftingInput.Positioned::input), + Codec.INT.fieldOf("left").forGetter(CraftingInput.Positioned::left), + Codec.INT.fieldOf("top").forGetter(CraftingInput.Positioned::top) + ).apply(instance, CraftingInput.Positioned::new)); + + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + Codec.BOOL.fieldOf("fuzzyMode").forGetter(CraftingPatternState::fuzzyMode), + POSITIONED_INPUT_CODEC.fieldOf("input").forGetter(CraftingPatternState::input) + ).apply(instance, CraftingPatternState::new)); + + private static final StreamCodec INPUT_STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.INT, CraftingInput::width, + ByteBufCodecs.INT, CraftingInput::height, + ByteBufCodecs.collection(ArrayList::new, ItemStack.OPTIONAL_STREAM_CODEC), CraftingInput::items, + CraftingInput::of + ); + + private static final StreamCodec POSITIONED_INPUT_STREAM_CODEC = + StreamCodec.composite( + INPUT_STREAM_CODEC, CraftingInput.Positioned::input, + ByteBufCodecs.INT, CraftingInput.Positioned::left, + ByteBufCodecs.INT, CraftingInput.Positioned::top, + CraftingInput.Positioned::new + ); + + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.BOOL, CraftingPatternState::fuzzyMode, + POSITIONED_INPUT_STREAM_CODEC, CraftingPatternState::input, + CraftingPatternState::new + ); +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternBlockEntityWithoutLevelRenderer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternBlockEntityWithoutLevelRenderer.java new file mode 100644 index 000000000..96cc22c72 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternBlockEntityWithoutLevelRenderer.java @@ -0,0 +1,48 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import javax.annotation.Nullable; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.Minecraft; +import net.minecraft.client.model.geom.EntityModelSet; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; + +public class PatternBlockEntityWithoutLevelRenderer extends BlockEntityWithoutLevelRenderer { + @Nullable + private static PatternBlockEntityWithoutLevelRenderer instance; + + private PatternBlockEntityWithoutLevelRenderer( + final BlockEntityRenderDispatcher blockEntityRenderDispatcher, + final EntityModelSet entityModelSet + ) { + super(blockEntityRenderDispatcher, entityModelSet); + } + + @Override + public void renderByItem(final ItemStack stack, + final ItemDisplayContext displayContext, + final PoseStack poseStack, + final MultiBufferSource buffer, + final int packedLight, + final int packedOverlay) { + if (PatternRendering.canDisplayOutput(stack)) { + PatternRendering.getOutput(stack).ifPresent( + output -> super.renderByItem(output, displayContext, poseStack, buffer, packedLight, packedOverlay) + ); + } + } + + public static PatternBlockEntityWithoutLevelRenderer getInstance() { + if (instance == null) { + instance = new PatternBlockEntityWithoutLevelRenderer( + Minecraft.getInstance().getBlockEntityRenderDispatcher(), + Minecraft.getInstance().getEntityModels() + ); + } + return instance; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlock.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlock.java new file mode 100644 index 000000000..1315e9909 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlock.java @@ -0,0 +1,62 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.content.BlockColorMap; +import com.refinedmods.refinedstorage.common.content.BlockEntities; +import com.refinedmods.refinedstorage.common.content.Blocks; +import com.refinedmods.refinedstorage.common.grid.AbstractGridBlock; +import com.refinedmods.refinedstorage.common.support.AbstractBlockEntityTicker; +import com.refinedmods.refinedstorage.common.support.BaseBlockItem; +import com.refinedmods.refinedstorage.common.support.BlockItemProvider; +import com.refinedmods.refinedstorage.common.support.NetworkNodeBlockItem; +import com.refinedmods.refinedstorage.common.support.network.NetworkNodeBlockEntityTicker; + +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityTicker; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; + +public class PatternGridBlock extends AbstractGridBlock + implements BlockItemProvider { + private static final Component HELP = createTranslation("item", "pattern_grid.help"); + private static final AbstractBlockEntityTicker TICKER = new NetworkNodeBlockEntityTicker<>( + BlockEntities.INSTANCE::getPatternGrid, + ACTIVE + ); + + public PatternGridBlock(final DyeColor color, final MutableComponent name) { + super(name, color); + } + + @Override + public BlockColorMap getBlockColorMap() { + return Blocks.INSTANCE.getPatternGrid(); + } + + @Nullable + @Override + public BlockEntity newBlockEntity(final BlockPos pos, final BlockState state) { + return new PatternGridBlockEntity(pos, state); + } + + @Nullable + @Override + public BlockEntityTicker getTicker(final Level level, + final BlockState blockState, + final BlockEntityType type) { + return TICKER.get(level, type); + } + + @Override + public BaseBlockItem createBlockItem() { + return new NetworkNodeBlockItem(this, HELP); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java new file mode 100644 index 000000000..a9b26747a --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridBlockEntity.java @@ -0,0 +1,248 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.content.BlockEntities; +import com.refinedmods.refinedstorage.common.content.ContentNames; +import com.refinedmods.refinedstorage.common.content.DataComponents; +import com.refinedmods.refinedstorage.common.content.Items; +import com.refinedmods.refinedstorage.common.grid.AbstractGridBlockEntity; +import com.refinedmods.refinedstorage.common.grid.AbstractGridContainerMenu; +import com.refinedmods.refinedstorage.common.grid.CraftingState; +import com.refinedmods.refinedstorage.common.grid.GridData; +import com.refinedmods.refinedstorage.common.support.BlockEntityWithDrops; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; +import com.refinedmods.refinedstorage.common.support.FilteredContainer; +import com.refinedmods.refinedstorage.common.support.containermenu.NetworkNodeExtendedMenuProvider; +import com.refinedmods.refinedstorage.common.util.ContainerUtil; + +import java.util.UUID; +import javax.annotation.Nullable; + +import net.minecraft.core.BlockPos; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamEncoder; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; + +public class PatternGridBlockEntity extends AbstractGridBlockEntity implements BlockEntityWithDrops, + NetworkNodeExtendedMenuProvider { + private static final String TAG_PATTERN_INPUT = "pattern_input"; + private static final String TAG_PATTERN_OUTPUT = "pattern_output"; + private static final String TAG_FUZZY_MODE = "fuzzy_mode"; + private static final String TAG_PATTERN_TYPE = "processing"; + + private final CraftingState craftingState = new CraftingState(this::setChanged, this::getLevel); + private final FilteredContainer patternInput = new FilteredContainer(1, PatternGridBlockEntity::isValidPattern); + private final FilteredContainer patternOutput = new PatternOutputContainer(); + private boolean fuzzyMode; + private PatternType patternType = PatternType.CRAFTING; + + public PatternGridBlockEntity(final BlockPos pos, final BlockState state) { + super( + BlockEntities.INSTANCE.getPatternGrid(), + pos, + state, + Platform.INSTANCE.getConfig().getPatternGrid().getEnergyUsage() + ); + patternInput.addListener(container -> setChanged()); + patternOutput.addListener(container -> setChanged()); + } + + CraftingMatrix getCraftingMatrix() { + return craftingState.getCraftingMatrix(); + } + + ResultContainer getCraftingResult() { + return craftingState.getCraftingResult(); + } + + FilteredContainer getPatternInput() { + return patternInput; + } + + FilteredContainer getPatternOutput() { + return patternOutput; + } + + @Override + public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { + super.saveAdditional(tag, provider); + tag.put(TAG_PATTERN_INPUT, ContainerUtil.write(patternInput, provider)); + tag.put(TAG_PATTERN_OUTPUT, ContainerUtil.write(patternOutput, provider)); + tag.putBoolean(TAG_FUZZY_MODE, fuzzyMode); + tag.putInt(TAG_PATTERN_TYPE, PatternTypeSettings.getPatternType(patternType)); + craftingState.writeToTag(tag, provider); + } + + @Override + public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { + super.loadAdditional(tag, provider); + if (tag.contains(TAG_PATTERN_INPUT)) { + ContainerUtil.read(tag.getCompound(TAG_PATTERN_INPUT), patternInput, provider); + } + if (tag.contains(TAG_PATTERN_OUTPUT)) { + ContainerUtil.read(tag.getCompound(TAG_PATTERN_OUTPUT), patternOutput, provider); + } + fuzzyMode = tag.getBoolean(TAG_FUZZY_MODE); + patternType = PatternTypeSettings.getPatternType(tag.getInt(TAG_PATTERN_TYPE)); + craftingState.readFromTag(tag, provider); + } + + @Override + public void setLevel(final Level level) { + super.setLevel(level); + craftingState.updateResult(level); + } + + boolean isFuzzyMode() { + return fuzzyMode; + } + + PatternType getPatternType() { + return patternType; + } + + void setFuzzyMode(final boolean fuzzyMode) { + this.fuzzyMode = fuzzyMode; + setChanged(); + } + + void setPatternType(final PatternType patternType) { + this.patternType = patternType; + setChanged(); + } + + @Override + public Component getDisplayName() { + return ContentNames.PATTERN_GRID; + } + + @Override + @Nullable + public AbstractGridContainerMenu createMenu(final int syncId, final Inventory inventory, final Player player) { + return new PatternGridContainerMenu(syncId, inventory, this); + } + + @Override + public PatternGridData getMenuData() { + return new PatternGridData(GridData.of(this), patternType); + } + + @Override + public StreamEncoder getMenuCodec() { + return PatternGridData.STREAM_CODEC; + } + + @Override + public NonNullList getDrops() { + final NonNullList drops = NonNullList.create(); + drops.add(patternInput.getItem(0)); + drops.add(patternOutput.getItem(0)); + for (int i = 0; i < craftingState.getCraftingMatrix().getContainerSize(); ++i) { + drops.add(craftingState.getCraftingMatrix().getItem(i)); + } + return drops; + } + + void clear() { + if (level == null) { + return; + } + craftingState.getCraftingMatrix().clearContent(); + craftingState.updateResult(level); + } + + void createPattern() { + if (level == null || !isPatternAvailable()) { + return; + } + final ItemStack result = switch (patternType) { + case CRAFTING -> createCraftingPattern(); + default -> null; + }; + if (result != null) { + final boolean shouldExtractInputPattern = patternOutput.getItem(0).isEmpty(); + if (shouldExtractInputPattern) { + patternInput.removeItem(0, 1); + } + patternOutput.setItem(0, result); + } + } + + void copyPattern(final ItemStack stack) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return; + } + this.patternType = state.type(); + switch (state.type()) { + case CRAFTING -> { + final CraftingPatternState patternCraftingState = stack.get( + DataComponents.INSTANCE.getCraftingPatternState() + ); + if (patternCraftingState == null) { + return; + } + copyCraftingPattern(patternCraftingState); + } + } + setChanged(); + } + + private void copyCraftingPattern(final CraftingPatternState state) { + this.fuzzyMode = state.fuzzyMode(); + craftingState.getCraftingMatrix().clearContent(); + final CraftingInput.Positioned positionedInput = state.input(); + final int left = positionedInput.left(); + final int top = positionedInput.top(); + final CraftingInput input = positionedInput.input(); + for (int x = 0; x < input.width(); ++x) { + for (int y = 0; y < input.height(); ++y) { + final int matrixIndex = x + left + (y + top) * craftingState.getCraftingMatrix().getWidth(); + final int recipeIndex = x + y * input.width(); + final ItemStack stack = input.getItem(recipeIndex); + craftingState.getCraftingMatrix().setItem(matrixIndex, stack); + } + } + if (level != null) { + craftingState.updateResult(level); + } + } + + @Nullable + private ItemStack createCraftingPattern() { + if (!craftingState.hasCraftingResult()) { + return null; + } + final boolean shouldExtractInputPattern = patternOutput.getItem(0).isEmpty(); + if (shouldExtractInputPattern) { + patternInput.removeItem(0, 1); + } + final ItemStack result = new ItemStack(Items.INSTANCE.getPattern()); + final PatternState patternState = new PatternState(UUID.randomUUID(), PatternType.CRAFTING); + result.set(DataComponents.INSTANCE.getPatternState(), patternState); + final CraftingPatternState patternCraftingState = new CraftingPatternState( + fuzzyMode, + getCraftingMatrix().asPositionedCraftInput() + ); + result.set(DataComponents.INSTANCE.getCraftingPatternState(), patternCraftingState); + return result; + } + + private boolean isPatternAvailable() { + return !patternInput.getItem(0).isEmpty() || !patternOutput.getItem(0).isEmpty(); + } + + static boolean isValidPattern(final ItemStack stack) { + return stack.getItem() instanceof PatternItem; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridContainerMenu.java new file mode 100644 index 000000000..bbde55ebc --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridContainerMenu.java @@ -0,0 +1,220 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.content.Menus; +import com.refinedmods.refinedstorage.common.grid.AbstractGridContainerMenu; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; +import com.refinedmods.refinedstorage.common.support.FilteredContainer; +import com.refinedmods.refinedstorage.common.support.RedstoneMode; +import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; +import com.refinedmods.refinedstorage.common.support.containermenu.DisabledSlot; +import com.refinedmods.refinedstorage.common.support.containermenu.FilterSlot; +import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; +import com.refinedmods.refinedstorage.common.support.containermenu.ServerProperty; +import com.refinedmods.refinedstorage.common.support.containermenu.ValidatedSlot; +import com.refinedmods.refinedstorage.common.support.packet.c2s.C2SPackets; + +import javax.annotation.Nullable; + +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.item.ItemStack; + +public class PatternGridContainerMenu extends AbstractGridContainerMenu { + private static final int Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_PATTERN_INPUT_SLOT = 81; + private static final int SPACING_BETWEEN_PATTERN_INPUT_AND_PATTERN_OUTPUT_SLOTS = 36; + private static final int Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_FIRST_CRAFTING_MATRIX_SLOT = 86; + + private final Container patternInput; + private final Container patternOutput; + private final Container craftingMatrix; + private final Container craftingResult; + + @Nullable + private PatternGridListener listener; + @Nullable + private PatternGridBlockEntity patternGrid; + + public PatternGridContainerMenu(final int syncId, + final Inventory playerInventory, + final PatternGridData patternGridData) { + super(Menus.INSTANCE.getPatternGrid(), syncId, playerInventory, patternGridData.gridData()); + this.patternInput = new FilteredContainer(1, PatternGridBlockEntity::isValidPattern); + this.patternOutput = new PatternOutputContainer(); + this.craftingMatrix = new CraftingMatrix(null, 3, 3); + this.craftingResult = new ResultContainer(); + onScreenReady(0); + registerProperty(new ClientProperty<>(PropertyTypes.REDSTONE_MODE, RedstoneMode.IGNORE)); + registerProperty(new ClientProperty<>(PatternGridPropertyTypes.PATTERN_TYPE, patternGridData.patternType()) { + @Override + protected void onChangedOnClient(final PatternType newValue) { + super.onChangedOnClient(newValue); + if (listener != null) { + listener.patternTypeChanged(newValue); + } + } + }); + registerProperty(new ClientProperty<>(PropertyTypes.FUZZY_MODE, false) { + @Override + protected void onChangedOnClient(final Boolean newValue) { + super.onChangedOnClient(newValue); + if (listener != null) { + listener.fuzzyModeChanged(newValue); + } + } + }); + } + + PatternGridContainerMenu(final int syncId, + final Inventory playerInventory, + final PatternGridBlockEntity grid) { + super(Menus.INSTANCE.getPatternGrid(), syncId, playerInventory, grid); + this.patternInput = grid.getPatternInput(); + this.patternOutput = grid.getPatternOutput(); + this.craftingMatrix = grid.getCraftingMatrix(); + this.craftingResult = grid.getCraftingResult(); + this.patternGrid = grid; + onScreenReady(0); + registerProperty(new ServerProperty<>( + PropertyTypes.REDSTONE_MODE, + grid::getRedstoneMode, + grid::setRedstoneMode + )); + registerProperty(new ServerProperty<>( + PatternGridPropertyTypes.PATTERN_TYPE, + grid::getPatternType, + grid::setPatternType + )); + registerProperty(new ServerProperty<>( + PropertyTypes.FUZZY_MODE, + grid::isFuzzyMode, + grid::setFuzzyMode + )); + } + + void setListener(final PatternGridListener listener) { + this.listener = listener; + } + + PatternType getPatternType() { + return getProperty(PatternGridPropertyTypes.PATTERN_TYPE).getValue(); + } + + void setPatternType(final PatternType patternType) { + getProperty(PatternGridPropertyTypes.PATTERN_TYPE).setValue(patternType); + } + + boolean isFuzzyMode() { + return Boolean.TRUE.equals(getProperty(PropertyTypes.FUZZY_MODE).getValue()); + } + + void setFuzzyMode(final boolean fuzzyMode) { + getProperty(PropertyTypes.FUZZY_MODE).setValue(fuzzyMode); + } + + boolean canCreatePattern() { + if (patternInput.getItem(0).isEmpty() && patternOutput.getItem(0).isEmpty()) { + return false; + } + return switch (getPatternType()) { + case CRAFTING -> !craftingResult.getItem(0).isEmpty(); + default -> false; + }; + } + + @Override + public void onScreenReady(final int playerInventoryY) { + super.onScreenReady(playerInventoryY); + transferManager.clear(); + addPatternSlots(playerInventoryY); + addCraftingMatrixSlots(playerInventoryY); + } + + private void addPatternSlots(final int playerInventoryY) { + addSlot(new ValidatedSlot( + patternInput, + 0, + 152, + playerInventoryY - Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_PATTERN_INPUT_SLOT, + PatternGridBlockEntity::isValidPattern + )); + addSlot(new ValidatedSlot( + patternOutput, + 0, + 152, + playerInventoryY + - Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_PATTERN_INPUT_SLOT + + SPACING_BETWEEN_PATTERN_INPUT_AND_PATTERN_OUTPUT_SLOTS, + PatternGridBlockEntity::isValidPattern + ) { + @Override + public boolean mayPlace(final ItemStack stack) { + return patternOutput.canPlaceItem(0, stack); + } + + @Override + public void set(final ItemStack stack) { + super.set(stack); + if (patternGrid != null && !stack.isEmpty()) { + patternGrid.copyPattern(stack); + } + } + }); + transferManager.addBiTransfer(playerInventory, patternInput); + transferManager.addTransfer(patternOutput, playerInventory); + } + + private void addCraftingMatrixSlots(final int playerInventoryY) { + for (int y = 0; y < 3; ++y) { + for (int x = 0; x < 3; ++x) { + final int slotX = 12 + ((x % 3) * 18); + final int slotY = playerInventoryY + - Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_FIRST_CRAFTING_MATRIX_SLOT + + ((y % 3) * 18); + addSlot(new FilterSlot(craftingMatrix, x + y * 3, slotX, slotY) { + @Override + public boolean isActive() { + return getPatternType() == PatternType.CRAFTING; + } + }); + } + } + addSlot(new DisabledSlot( + craftingResult, + 0, + 116 + 4, + playerInventoryY - Y_OFFSET_BETWEEN_PLAYER_INVENTORY_AND_FIRST_CRAFTING_MATRIX_SLOT + 18 + ) { + @Override + public boolean isActive() { + return getPatternType() == PatternType.CRAFTING; + } + }); + } + + public void clear() { + if (patternGrid != null) { + patternGrid.clear(); + } + } + + void sendClear() { + C2SPackets.sendPatternGridClear(); + } + + public void createPattern() { + if (patternGrid != null) { + patternGrid.createPattern(); + } + } + + void sendCreatePattern() { + C2SPackets.sendPatternGridCreatePattern(); + } + + interface PatternGridListener { + void patternTypeChanged(PatternType value); + + void fuzzyModeChanged(boolean value); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridData.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridData.java new file mode 100644 index 000000000..a04c8c6e7 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridData.java @@ -0,0 +1,15 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.grid.GridData; +import com.refinedmods.refinedstorage.common.util.PacketUtil; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +public record PatternGridData(GridData gridData, PatternType patternType) { + public static final StreamCodec STREAM_CODEC = StreamCodec.composite( + GridData.STREAM_CODEC, PatternGridData::gridData, + PacketUtil.enumStreamCodec(PatternType.values()), PatternGridData::patternType, + PatternGridData::new + ); +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridPropertyTypes.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridPropertyTypes.java new file mode 100644 index 000000000..513cb0552 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridPropertyTypes.java @@ -0,0 +1,16 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.support.containermenu.PropertyType; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +final class PatternGridPropertyTypes { + static final PropertyType PATTERN_TYPE = new PropertyType<>( + createIdentifier("pattern_type"), + PatternTypeSettings::getPatternType, + PatternTypeSettings::getPatternType + ); + + private PatternGridPropertyTypes() { + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridScreen.java new file mode 100644 index 000000000..e3ee37662 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternGridScreen.java @@ -0,0 +1,174 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.grid.screen.AbstractGridScreen; +import com.refinedmods.refinedstorage.common.support.widget.CustomCheckboxWidget; +import com.refinedmods.refinedstorage.common.support.widget.HoveredImageButton; + +import java.util.EnumMap; +import java.util.Map; +import javax.annotation.Nullable; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Button; +import net.minecraft.client.gui.components.ImageButton; +import net.minecraft.client.gui.components.Tooltip; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; + +public class PatternGridScreen extends AbstractGridScreen { + private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/pattern_grid.png"); + private static final MutableComponent CREATE_PATTERN = createTranslation("gui", "pattern_grid.create_pattern"); + private static final MutableComponent CLEAR = createTranslation("gui", "pattern_grid.clear"); + private static final MutableComponent FUZZY_MODE = createTranslation("gui", "pattern_grid.fuzzy_mode"); + private static final MutableComponent FUZZY_MODE_ON_HELP = + createTranslation("gui", "pattern_grid.fuzzy_mode.on.help"); + private static final MutableComponent FUZZY_MODE_OFF_HELP = + createTranslation("gui", "pattern_grid.fuzzy_mode.off.help"); + private static final int CREATE_PATTERN_BUTTON_SIZE = 16; + + private static final WidgetSprites CREATE_PATTERN_BUTTON_SPRITES = new WidgetSprites( + createIdentifier("widget/create_pattern"), + createIdentifier("widget/create_pattern_disabled"), + createIdentifier("widget/create_pattern_focused"), + createIdentifier("widget/create_pattern_disabled") + ); + private static final WidgetSprites CLEAR_BUTTON_SPRITES = new WidgetSprites( + createIdentifier("widget/clear"), + createIdentifier("widget/clear_disabled"), + createIdentifier("widget/clear_focused"), + createIdentifier("widget/clear_disabled") + ); + private static final ResourceLocation CRAFTING = createIdentifier("pattern_grid/crafting"); + + @Nullable + private Button createPatternButton; + + private final Map patternTypeButtons = new EnumMap<>(PatternType.class); + + public PatternGridScreen(final PatternGridContainerMenu menu, final Inventory inventory, final Component title) { + super(menu, inventory, title, 177); + this.inventoryLabelY = 153; + this.imageWidth = 193; + this.imageHeight = 250; + } + + @Override + protected void init() { + super.init(); + createPatternButton = createCreatePatternButton(leftPos + 152, topPos + imageHeight - bottomHeight + 32); + addRenderableWidget(createPatternButton); + final ImageButton clearButton = createClearButton(leftPos + 68, topPos + imageHeight - bottomHeight + 8); + addRenderableWidget(clearButton); + addPatternTypeButtons(getMenu().getPatternType()); + final CustomCheckboxWidget fuzzyMode = createFuzzyModeCheckbox(); + addRenderableWidget(fuzzyMode); + menu.setListener(new PatternGridContainerMenu.PatternGridListener() { + @Override + public void patternTypeChanged(final PatternType value) { + patternTypeButtons.values().forEach(button -> button.setSelected(false)); + patternTypeButtons.get(value).setSelected(true); + fuzzyMode.visible = value == PatternType.CRAFTING; + clearButton.visible = value == PatternType.CRAFTING; + } + + @Override + public void fuzzyModeChanged(final boolean value) { + fuzzyMode.setSelected(value); + fuzzyMode.setTooltip(getFuzzyModeTooltip(value)); + } + }); + } + + private void addPatternTypeButtons(final PatternType currentPatternType) { + final PatternType[] patternTypes = PatternType.values(); + for (int i = 0; i < patternTypes.length; ++i) { + final PatternType patternType = patternTypes[i]; + final PatternTypeButton button = new PatternTypeButton( + leftPos + 172, + topPos + imageHeight - bottomHeight + 4 + (i * (16 + 3)), + btn -> getMenu().setPatternType(patternType), + patternType, + patternType == currentPatternType + ); + patternTypeButtons.put(patternType, button); + addRenderableWidget(button); + } + } + + @Override + protected void containerTick() { + super.containerTick(); + if (createPatternButton != null) { + createPatternButton.active = getMenu().canCreatePattern(); + } + } + + private CustomCheckboxWidget createFuzzyModeCheckbox() { + final CustomCheckboxWidget fuzzyMode = new CustomCheckboxWidget( + leftPos + 11, + topPos + imageHeight - bottomHeight + 65, + FUZZY_MODE, + font, + getMenu().isFuzzyMode(), + CustomCheckboxWidget.Size.SMALL + ); + fuzzyMode.setOnPressed((checkbox, selected) -> getMenu().setFuzzyMode(selected)); + fuzzyMode.setTooltip(getFuzzyModeTooltip(getMenu().isFuzzyMode())); + fuzzyMode.visible = getMenu().getPatternType() == PatternType.CRAFTING; + return fuzzyMode; + } + + private static Tooltip getFuzzyModeTooltip(final boolean fuzzyMode) { + return fuzzyMode ? Tooltip.create(FUZZY_MODE_ON_HELP) : Tooltip.create(FUZZY_MODE_OFF_HELP); + } + + private ImageButton createCreatePatternButton(final int x, final int y) { + final HoveredImageButton button = new HoveredImageButton( + x, + y, + CREATE_PATTERN_BUTTON_SIZE, + CREATE_PATTERN_BUTTON_SIZE, + CREATE_PATTERN_BUTTON_SPRITES, + b -> getMenu().sendCreatePattern(), + CREATE_PATTERN + ); + button.setTooltip(Tooltip.create(CREATE_PATTERN)); + button.active = getMenu().canCreatePattern(); + return button; + } + + private ImageButton createClearButton(final int x, final int y) { + final HoveredImageButton button = new HoveredImageButton( + x, + y, + CLEAR_BUTTON_SIZE, + CLEAR_BUTTON_SIZE, + CLEAR_BUTTON_SPRITES, + b -> getMenu().sendClear(), + CLEAR + ); + button.setTooltip(Tooltip.create(CLEAR)); + button.visible = getMenu().getPatternType() == PatternType.CRAFTING; + return button; + } + + @Override + protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { + super.renderBg(graphics, delta, mouseX, mouseY); + switch (getMenu().getPatternType()) { + case CRAFTING -> + graphics.blitSprite(CRAFTING, leftPos + 7 + 4, topPos + imageHeight - bottomHeight + 4 + 4, 130, 54); + } + } + + @Override + protected ResourceLocation getTexture() { + return TEXTURE; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java new file mode 100644 index 000000000..1f5faab19 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItem.java @@ -0,0 +1,220 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.api.autocrafting.CraftingPattern; +import com.refinedmods.refinedstorage.common.api.autocrafting.Pattern; +import com.refinedmods.refinedstorage.common.api.autocrafting.PatternProviderItem; +import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; +import com.refinedmods.refinedstorage.common.api.support.resource.PlatformResourceKey; +import com.refinedmods.refinedstorage.common.content.DataComponents; +import com.refinedmods.refinedstorage.common.content.Items; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; +import com.refinedmods.refinedstorage.common.util.PlatformUtil; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +import javax.annotation.Nullable; + +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.InteractionResultHolder; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.tooltip.TooltipComponent; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.TooltipFlag; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslationKey; + +public class PatternItem extends Item implements PatternProviderItem { + private static final Component HELP = createTranslation("item", "pattern.help"); + private static final MutableComponent FUZZY_MODE = createTranslation("item", "pattern.fuzzy_mode") + .withStyle(ChatFormatting.YELLOW); + + public PatternItem() { + super(new Item.Properties()); + } + + @Override + public String getDescriptionId(final ItemStack stack) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state != null) { + return createTranslationKey("misc", "pattern." + state.type().getSerializedName()); + } + return super.getDescriptionId(stack); + } + + @Override + public void appendHoverText(final ItemStack stack, + final TooltipContext context, + final List lines, + final TooltipFlag tooltipFlag) { + super.appendHoverText(stack, context, lines, tooltipFlag); + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return; + } + final CraftingPatternState craftingState = stack.get(DataComponents.INSTANCE.getCraftingPatternState()); + if (craftingState != null && craftingState.fuzzyMode()) { + lines.add(FUZZY_MODE); + } + } + + boolean hasMapping(final ItemStack stack) { + return stack.has(DataComponents.INSTANCE.getPatternState()); + } + + @Override + public Optional getTooltipImage(final ItemStack stack) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return Optional.of(new HelpTooltipComponent(HELP)); + } + return switch (state.type()) { + case CRAFTING -> { + final CraftingPatternState craftingState = stack.get(DataComponents.INSTANCE.getCraftingPatternState()); + final Level level = PlatformUtil.getClientLevel(); + if (craftingState == null || level == null) { + yield Optional.empty(); + } + yield RefinedStorageApi.INSTANCE.getPattern(stack, level) + .filter(CraftingPattern.class::isInstance) + .map(CraftingPattern.class::cast) + .map(craftingPattern -> new CraftingPatternTooltipComponent( + HELP, + craftingPattern, + craftingState.input().input().width(), + craftingState.input().input().height() + )); + } + default -> Optional.empty(); + }; + } + + @Nullable + @Override + public UUID getId(final ItemStack stack) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return null; + } + return state.id(); + } + + @Override + public Optional getPattern(final ItemStack stack, final Level level) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return Optional.empty(); + } + return switch (state.type()) { + case CRAFTING -> getCraftingPattern(stack, level); + default -> Optional.empty(); + }; + } + + private Optional getCraftingPattern(final ItemStack stack, final Level level) { + final CraftingPatternState craftingState = stack.get(DataComponents.INSTANCE.getCraftingPatternState()); + if (craftingState == null) { + return Optional.empty(); + } + return getCraftingPattern(level, craftingState); + } + + private Optional getCraftingPattern(final Level level, final CraftingPatternState state) { + final CraftingMatrix craftingMatrix = getFilledCraftingMatrix(state); + final CraftingInput.Positioned positionedCraftingInput = craftingMatrix.asPositionedCraftInput(); + final CraftingInput craftingInput = positionedCraftingInput.input(); + return level.getRecipeManager() + .getRecipeFor(RecipeType.CRAFTING, craftingInput, level) + .map(RecipeHolder::value) + .map(recipe -> toCraftingPattern(level, recipe, craftingInput, state)); + } + + private CraftingMatrix getFilledCraftingMatrix(final CraftingPatternState state) { + final CraftingInput.Positioned positionedInput = state.input(); + final CraftingInput input = positionedInput.input(); + final CraftingMatrix craftingMatrix = new CraftingMatrix(null, input.width(), input.height()); + for (int i = 0; i < input.size(); ++i) { + craftingMatrix.setItem(i, input.getItem(i)); + } + return craftingMatrix; + } + + private CraftingPattern toCraftingPattern(final Level level, + final CraftingRecipe recipe, + final CraftingInput craftingInput, + final CraftingPatternState state) { + final List> inputs = getInputs(recipe, state); + final ResourceAmount output = getOutput(level, recipe, craftingInput); + final List byproducts = getByproducts(recipe, craftingInput); + return new CraftingPattern(inputs, output, byproducts); + } + + private List> getInputs(final CraftingRecipe recipe, final CraftingPatternState state) { + final List> inputs = new ArrayList<>(); + for (int i = 0; i < state.input().input().size(); ++i) { + final ItemStack input = state.input().input().getItem(i); + if (input.isEmpty()) { + inputs.add(Collections.emptyList()); + } else if (state.fuzzyMode() && i < recipe.getIngredients().size()) { + final ItemStack[] ingredients = recipe.getIngredients().get(i).getItems(); + inputs.add(Arrays.stream(ingredients) + .map(item -> (PlatformResourceKey) ItemResource.ofItemStack(item)) + .toList()); + } else { + inputs.add(List.of(ItemResource.ofItemStack(input))); + } + } + return inputs; + } + + private ResourceAmount getOutput(final Level level, + final CraftingRecipe recipe, + final CraftingInput craftingInput) { + final ItemStack outputStack = recipe.assemble(craftingInput, level.registryAccess()); + return new ResourceAmount(ItemResource.ofItemStack(outputStack), outputStack.getCount()); + } + + private List getByproducts(final CraftingRecipe recipe, final CraftingInput craftingInput) { + return recipe.getRemainingItems(craftingInput) + .stream() + .filter(byproduct -> !byproduct.isEmpty()) + .map(byproduct -> new ResourceAmount(ItemResource.ofItemStack(byproduct), byproduct.getCount())) + .toList(); + } + + @Override + public InteractionResultHolder use(final Level level, final Player player, final InteractionHand hand) { + final ItemStack stack = player.getItemInHand(hand); + if (!level.isClientSide() && player.isCrouching()) { + return new InteractionResultHolder<>( + InteractionResult.CONSUME, + new ItemStack(Items.INSTANCE.getPattern(), stack.getCount()) + ); + } + return new InteractionResultHolder<>(InteractionResult.PASS, stack); + } + + public record CraftingPatternTooltipComponent(Component helpText, + CraftingPattern craftingPattern, + int width, + int height) + implements TooltipComponent { + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemColor.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemColor.java new file mode 100644 index 000000000..31a82255c --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemColor.java @@ -0,0 +1,18 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.Platform; + +import net.minecraft.client.color.item.ItemColor; +import net.minecraft.world.item.ItemStack; + +public class PatternItemColor implements ItemColor { + @Override + public int getColor(final ItemStack stack, final int tintIndex) { + if (PatternRendering.canDisplayOutput(stack)) { + return PatternRendering.getOutput(stack).map( + output -> Platform.INSTANCE.getItemColor(output, tintIndex) + ).orElse(-1); + } + return -1; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java new file mode 100644 index 000000000..faf433d82 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternItemOverrides.java @@ -0,0 +1,57 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.content.DataComponents; + +import java.util.List; +import java.util.Optional; +import javax.annotation.Nullable; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.item.ItemStack; + +public class PatternItemOverrides extends ItemOverrides { + private final BakedModel emptyModel; + private final BakedModel craftingModel; + + @SuppressWarnings({"DataFlowIssue"}) // null is allowed as long as we don't pass overrides + public PatternItemOverrides(final ModelBaker modelBaker, + final BakedModel emptyModel, + final BakedModel craftingModel) { + super(modelBaker, null, List.of()); + this.emptyModel = emptyModel; + this.craftingModel = craftingModel; + } + + @Override + public BakedModel resolve(final BakedModel model, + final ItemStack stack, + @Nullable final ClientLevel level, + @Nullable final LivingEntity entity, + final int seed) { + final PatternState state = stack.get(DataComponents.INSTANCE.getPatternState()); + if (state == null) { + return emptyModel; + } + if (state.type() == PatternType.CRAFTING) { + return getCraftingOutputModel(stack, level, entity, seed).orElse(craftingModel); + } + return emptyModel; + } + + private Optional getCraftingOutputModel(final ItemStack stack, + @Nullable final ClientLevel level, + @Nullable final LivingEntity entity, + final int seed) { + if (PatternRendering.canDisplayOutput(stack)) { + return PatternRendering.getOutput(stack).map( + output -> Minecraft.getInstance().getItemRenderer().getModel(output, level, entity, seed) + ); + } + return Optional.empty(); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternOutputContainer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternOutputContainer.java new file mode 100644 index 000000000..8a83d878a --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternOutputContainer.java @@ -0,0 +1,21 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.support.FilteredContainer; + +import net.minecraft.world.item.ItemStack; + +class PatternOutputContainer extends FilteredContainer { + PatternOutputContainer() { + super(1, PatternGridBlockEntity::isValidPattern); + } + + @Override + public int getMaxStackSize() { + return 1; + } + + @Override + public boolean canPlaceItem(final int slot, final ItemStack stack) { + return stack.getItem() instanceof PatternItem patternItem && patternItem.hasMapping(stack); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java new file mode 100644 index 000000000..16db1edf6 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternRendering.java @@ -0,0 +1,38 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.api.resource.ResourceAmount; +import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; +import com.refinedmods.refinedstorage.common.api.autocrafting.CraftingPattern; +import com.refinedmods.refinedstorage.common.api.autocrafting.PatternProviderItem; +import com.refinedmods.refinedstorage.common.support.resource.ItemResource; +import com.refinedmods.refinedstorage.common.util.PlatformUtil; + +import java.util.Optional; + +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; + +public final class PatternRendering { + private PatternRendering() { + } + + public static boolean canDisplayOutput(final ItemStack stack) { + return stack.getItem() instanceof PatternProviderItem && Screen.hasShiftDown(); + } + + public static Optional getOutput(final ItemStack stack) { + final Level level = PlatformUtil.getClientLevel(); + if (level == null) { + return Optional.empty(); + } + return RefinedStorageApi.INSTANCE.getPattern(stack, level) + .filter(CraftingPattern.class::isInstance) + .map(CraftingPattern.class::cast) + .map(CraftingPattern::output) + .map(ResourceAmount::getResource) + .filter(ItemResource.class::isInstance) + .map(ItemResource.class::cast) + .map(ItemResource::toItemStack); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternState.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternState.java new file mode 100644 index 000000000..1e8a7b3f4 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternState.java @@ -0,0 +1,25 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.util.PacketUtil; + +import java.util.UUID; + +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.minecraft.core.UUIDUtil; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; + +public record PatternState(UUID id, PatternType type) { + public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( + UUIDUtil.CODEC.fieldOf("id").forGetter(PatternState::id), + PatternType.CODEC.fieldOf("type").forGetter(PatternState::type) + ).apply(instance, PatternState::new)); + + public static final StreamCodec STREAM_CODEC = + StreamCodec.composite( + UUIDUtil.STREAM_CODEC, PatternState::id, + PacketUtil.enumStreamCodec(PatternType.values()), PatternState::type, + PatternState::new + ); +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternType.java new file mode 100644 index 000000000..da21cffd7 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternType.java @@ -0,0 +1,41 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.mojang.serialization.Codec; +import net.minecraft.network.chat.Component; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; + +public enum PatternType implements StringRepresentable { + CRAFTING(Items.CRAFTING_TABLE.getDefaultInstance(), "crafting"), + PROCESSING(Items.FURNACE.getDefaultInstance(), "processing"), + STONECUTTER(Items.STONECUTTER.getDefaultInstance(), "stonecutter"), + SMITHING_TABLE(Items.SMITHING_TABLE.getDefaultInstance(), "smithing_table"); + + public static final Codec CODEC = StringRepresentable.fromValues(PatternType::values); + + private final ItemStack stack; + private final String name; + private final Component translatedName; + + PatternType(final ItemStack stack, final String name) { + this.stack = stack; + this.name = name; + this.translatedName = createTranslation("misc", "pattern." + name); + } + + ItemStack getStack() { + return stack; + } + + Component getTranslatedName() { + return translatedName; + } + + @Override + public String getSerializedName() { + return name; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeButton.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeButton.java new file mode 100644 index 000000000..949c06284 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeButton.java @@ -0,0 +1,44 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.common.support.widget.HoveredImageButton; + +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.Tooltip; +import net.minecraft.client.gui.components.WidgetSprites; +import net.minecraft.resources.ResourceLocation; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +class PatternTypeButton extends HoveredImageButton { + private static final WidgetSprites SPRITES = new WidgetSprites( + createIdentifier("widget/generic_small_button"), + createIdentifier("widget/generic_small_button_disabled"), + createIdentifier("widget/generic_small_button_focused"), + createIdentifier("widget/generic_small_button_disabled") + ); + + private final PatternType patternType; + private boolean selected; + + PatternTypeButton(final int x, + final int y, + final OnPress onPress, + final PatternType patternType, + final boolean selected) { + super(x, y, 16, 16, SPRITES, onPress, patternType.getTranslatedName()); + this.patternType = patternType; + this.selected = selected; + this.setTooltip(Tooltip.create(patternType.getTranslatedName())); + } + + void setSelected(final boolean selected) { + this.selected = selected; + } + + @Override + public void renderWidget(final GuiGraphics graphics, final int x, final int y, final float partialTicks) { + final ResourceLocation location = sprites.get(isActive(), isHovered() || selected); + graphics.blitSprite(location, getX(), getY(), width, height); + graphics.renderItem(patternType.getStack(), getX(), getY()); + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeSettings.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeSettings.java new file mode 100644 index 000000000..3339b0ca4 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/PatternTypeSettings.java @@ -0,0 +1,29 @@ +package com.refinedmods.refinedstorage.common.autocrafting; + +class PatternTypeSettings { + private static final int CRAFTING = 0; + private static final int PROCESSING = 1; + private static final int STONECUTTER = 2; + private static final int SMITHING_TABLE = 3; + + private PatternTypeSettings() { + } + + public static PatternType getPatternType(final int patternType) { + return switch (patternType) { + case PROCESSING -> PatternType.PROCESSING; + case STONECUTTER -> PatternType.STONECUTTER; + case SMITHING_TABLE -> PatternType.SMITHING_TABLE; + default -> PatternType.CRAFTING; + }; + } + + public static int getPatternType(final PatternType patternType) { + return switch (patternType) { + case CRAFTING -> CRAFTING; + case PROCESSING -> PROCESSING; + case STONECUTTER -> STONECUTTER; + case SMITHING_TABLE -> SMITHING_TABLE; + }; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/package-info.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/package-info.java new file mode 100644 index 000000000..194c7d0ac --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/autocrafting/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage.common.autocrafting; + +import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java index 35b5a0801..52cbb5070 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/BlockEntities.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common.content; import com.refinedmods.refinedstorage.api.network.impl.node.SimpleNetworkNode; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridBlockEntity; import com.refinedmods.refinedstorage.common.constructordestructor.ConstructorBlockEntity; import com.refinedmods.refinedstorage.common.constructordestructor.DestructorBlockEntity; import com.refinedmods.refinedstorage.common.controller.ControllerBlockEntity; @@ -47,6 +48,8 @@ public final class BlockEntities { @Nullable private Supplier> craftingGrid; @Nullable + private Supplier> patternGrid; + @Nullable private Supplier> controller; @Nullable private Supplier> creativeController; @@ -124,6 +127,14 @@ public void setCraftingGrid(final Supplier getPatternGrid() { + return requireNonNull(patternGrid).get(); + } + + public void setPatternGrid(final Supplier> supplier) { + this.patternGrid = supplier; + } + public BlockEntityType getController() { return requireNonNull(controller).get(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java index 1ad8a5c1e..2f9eaf37f 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Blocks.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.common.content; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridBlock; import com.refinedmods.refinedstorage.common.constructordestructor.ConstructorBlock; import com.refinedmods.refinedstorage.common.constructordestructor.DestructorBlock; import com.refinedmods.refinedstorage.common.controller.AbstractControllerBlock; @@ -68,6 +69,12 @@ public final class Blocks { ContentNames.CRAFTING_GRID, COLOR ); + private final BlockColorMap patternGrid = new BlockColorMap<>( + PatternGridBlock::new, + ContentIds.PATTERN_GRID, + ContentNames.PATTERN_GRID, + COLOR + ); private final BlockColorMap detector = new BlockColorMap<>( DetectorBlock::new, ContentIds.DETECTOR, @@ -211,6 +218,10 @@ public BlockColorMap getCraftingGrid() { return craftingGrid; } + public BlockColorMap getPatternGrid() { + return patternGrid; + } + public BlockColorMap, ControllerBlockItem> getController() { return controller; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java index e49c5a4aa..644e76bb6 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentIds.java @@ -24,6 +24,7 @@ public final class ContentIds { public static final ResourceLocation STORAGE_HOUSING = createIdentifier("storage_housing"); public static final ResourceLocation GRID = createIdentifier("grid"); public static final ResourceLocation CRAFTING_GRID = createIdentifier("crafting_grid"); + public static final ResourceLocation PATTERN_GRID = createIdentifier("pattern_grid"); public static final ResourceLocation CONTROLLER = createIdentifier("controller"); public static final ResourceLocation CREATIVE_CONTROLLER = createIdentifier("creative_controller"); public static final ResourceLocation CONSTRUCTION_CORE = createIdentifier("construction_core"); @@ -63,6 +64,7 @@ public final class ContentIds { public static final ResourceLocation SECURITY_MANAGER = createIdentifier("security_manager"); public static final ResourceLocation RELAY = createIdentifier("relay"); public static final ResourceLocation DISK_INTERFACE = createIdentifier("disk_interface"); + public static final ResourceLocation PATTERN = createIdentifier("pattern"); private ContentIds() { } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentNames.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentNames.java index 15dbaf974..8eecbe198 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentNames.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/ContentNames.java @@ -14,6 +14,7 @@ public final class ContentNames { public static final MutableComponent CABLE = name("cable"); public static final MutableComponent GRID = name("grid"); public static final MutableComponent CRAFTING_GRID = name("crafting_grid"); + public static final MutableComponent PATTERN_GRID = name("pattern_grid"); public static final MutableComponent DETECTOR = name("detector"); public static final MutableComponent IMPORTER = name("importer"); public static final MutableComponent EXPORTER = name("exporter"); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/CreativeModeTabItems.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/CreativeModeTabItems.java index 25c381fca..8c2156f1b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/CreativeModeTabItems.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/CreativeModeTabItems.java @@ -37,6 +37,7 @@ private static void appendBlocks(final Consumer consumer) { itemConsumer.accept(Blocks.INSTANCE.getDiskDrive()); appendBlockColors(consumer, Blocks.INSTANCE.getGrid()); appendBlockColors(consumer, Blocks.INSTANCE.getCraftingGrid()); + appendBlockColors(consumer, Blocks.INSTANCE.getPatternGrid()); itemConsumer.accept(Items.INSTANCE.getPortableGrid()); consumer.accept(Items.INSTANCE.getPortableGrid().createAtEnergyCapacity()); itemConsumer.accept(Items.INSTANCE.getCreativePortableGrid()); @@ -110,5 +111,6 @@ private static void appendItems(final Consumer consumer) { itemConsumer.accept(Items.INSTANCE.getNetworkCard()); itemConsumer.accept(Items.INSTANCE.getSecurityCard()); itemConsumer.accept(Items.INSTANCE.getFallbackSecurityCard()); + itemConsumer.accept(Items.INSTANCE.getPattern()); } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java index 5f8746eb6..47dfd40fd 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DataComponents.java @@ -1,5 +1,7 @@ package com.refinedmods.refinedstorage.common.content; +import com.refinedmods.refinedstorage.common.autocrafting.CraftingPatternState; +import com.refinedmods.refinedstorage.common.autocrafting.PatternState; import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardState; import com.refinedmods.refinedstorage.common.security.SecurityCardBoundPlayer; import com.refinedmods.refinedstorage.common.security.SecurityCardPermissions; @@ -31,6 +33,10 @@ public final class DataComponents { private Supplier> securityCardPermissions; @Nullable private Supplier> configurationCardState; + @Nullable + private Supplier> patternState; + @Nullable + private Supplier> craftingPatternState; private DataComponents() { } @@ -96,4 +102,24 @@ public void setConfigurationCardState( ) { this.configurationCardState = supplier; } + + public DataComponentType getPatternState() { + return requireNonNull(patternState).get(); + } + + public void setPatternState( + @Nullable final Supplier> supplier + ) { + this.patternState = supplier; + } + + public DataComponentType getCraftingPatternState() { + return requireNonNull(craftingPatternState).get(); + } + + public void setCraftingPatternState( + @Nullable final Supplier> supplier + ) { + this.craftingPatternState = supplier; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DefaultEnergyUsage.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DefaultEnergyUsage.java index 01a3e8648..00b51eed3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DefaultEnergyUsage.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/DefaultEnergyUsage.java @@ -8,6 +8,7 @@ public final class DefaultEnergyUsage { public static final long EXTERNAL_STORAGE = 6; public static final long DETECTOR = 2; public static final long GRID = 10; + public static final long PATTERN_GRID = 14; public static final long CRAFTING_GRID = 14; public static final long DISK_DRIVE = 10; public static final long DISK_DRIVE_PER_DISK = 4; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Items.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Items.java index 48d1f51f9..ed2b1723e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Items.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Items.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common.content; import com.refinedmods.refinedstorage.common.api.upgrade.AbstractUpgradeItem; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItem; import com.refinedmods.refinedstorage.common.controller.ControllerBlockItem; import com.refinedmods.refinedstorage.common.controller.CreativeControllerBlockItem; import com.refinedmods.refinedstorage.common.grid.WirelessGridItem; @@ -103,6 +104,8 @@ public final class Items { private Supplier securityCard; @Nullable private Supplier fallbackSecurityCard; + @Nullable + private Supplier pattern; private Items() { } @@ -474,4 +477,12 @@ public FallbackSecurityCardItem getFallbackSecurityCard() { public void setFallbackSecurityCard(final Supplier fallbackSecurityCard) { this.fallbackSecurityCard = fallbackSecurityCard; } + + public PatternItem getPattern() { + return requireNonNull(pattern).get(); + } + + public void setPattern(final Supplier supplier) { + this.pattern = supplier; + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java index e314602ff..b4c7642a2 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Menus.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.common.content; +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; import com.refinedmods.refinedstorage.common.constructordestructor.ConstructorContainerMenu; import com.refinedmods.refinedstorage.common.constructordestructor.DestructorContainerMenu; import com.refinedmods.refinedstorage.common.controller.ControllerContainerMenu; @@ -43,6 +44,8 @@ public final class Menus { @Nullable private Supplier> craftingGrid; @Nullable + private Supplier> patternGrid; + @Nullable private Supplier> wirelessGrid; @Nullable private Supplier> controller; @@ -106,6 +109,14 @@ public void setCraftingGrid(final Supplier> this.craftingGrid = supplier; } + public MenuType getPatternGrid() { + return requireNonNull(patternGrid).get(); + } + + public void setPatternGrid(final Supplier> supplier) { + this.patternGrid = supplier; + } + public MenuType getWirelessGrid() { return requireNonNull(wirelessGrid).get(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Tags.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Tags.java index ce7b848c9..06509a2ba 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Tags.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/content/Tags.java @@ -13,6 +13,7 @@ public final class Tags { public static final TagKey FLUID_STORAGE_DISKS = createTag("fluid_storage_disks"); public static final TagKey GRIDS = createTag("grids"); public static final TagKey CRAFTING_GRIDS = createTag("crafting_grids"); + public static final TagKey PATTERN_GRIDS = createTag("pattern_grids"); public static final TagKey STORAGE_DISKS = createTag("storage_disks"); public static final TagKey IMPORTERS = createTag("importers"); public static final TagKey EXPORTERS = createTag("exporters"); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridBlockEntity.java index dc07da7c7..35872682a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridBlockEntity.java @@ -17,15 +17,12 @@ import com.refinedmods.refinedstorage.common.api.support.network.InWorldNetworkNodeContainer; import com.refinedmods.refinedstorage.common.api.support.resource.ResourceType; import com.refinedmods.refinedstorage.common.support.AbstractDirectionalBlock; -import com.refinedmods.refinedstorage.common.support.containermenu.NetworkNodeExtendedMenuProvider; import com.refinedmods.refinedstorage.common.support.network.AbstractRedstoneModeNetworkNodeContainerBlockEntity; import com.refinedmods.refinedstorage.common.support.network.ColoredConnectionStrategy; import java.util.List; import net.minecraft.core.BlockPos; -import net.minecraft.network.RegistryFriendlyByteBuf; -import net.minecraft.network.codec.StreamEncoder; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; @@ -34,7 +31,7 @@ public abstract class AbstractGridBlockEntity extends AbstractRedstoneModeNetworkNodeContainerBlockEntity - implements Grid, NetworkNodeExtendedMenuProvider { + implements Grid { protected AbstractGridBlockEntity(final BlockEntityType type, final BlockPos pos, final BlockState state, @@ -50,16 +47,6 @@ protected InWorldNetworkNodeContainer createMainContainer(final GridNetworkNode .build(); } - @Override - public GridData getMenuData() { - return GridData.of(this); - } - - @Override - public StreamEncoder getMenuCodec() { - return GridData.STREAM_CODEC; - } - @Override public List getResources(final Class actorType) { return requireNonNull(mainNetworkNode.getNetwork()) diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridContainerMenu.java index 9ef83b6c6..065c4f96e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridContainerMenu.java @@ -404,13 +404,15 @@ public boolean onTransfer(final int slotIndex) { @SuppressWarnings("resource") @Override public ItemStack quickMoveStack(final Player playerEntity, final int slotIndex) { - if (!playerEntity.level().isClientSide() && grid != null && grid.isGridActive()) { + if (transferManager.transfer(slotIndex)) { + return ItemStack.EMPTY; + } else if (!playerEntity.level().isClientSide() && grid != null && grid.isGridActive()) { final Slot slot = getSlot(slotIndex); if (slot.hasItem() && insertionStrategy != null && canTransferSlot(slot)) { insertionStrategy.onTransfer(slot.index); } } - return super.quickMoveStack(playerEntity, slotIndex); + return ItemStack.EMPTY; } protected boolean canTransferSlot(final Slot slot) { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java index 21490821d..92cfb70f8 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/AbstractGridSynchronizer.java @@ -8,7 +8,7 @@ public abstract class AbstractGridSynchronizer implements GridSynchronizer { @Override public ResourceLocation getTextureIdentifier() { - return TextureIds.ICONS; + return TextureIds.SIDE_BUTTON_ICONS; } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/ClientCraftingGridSource.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/ClientCraftingGridSource.java index 7a773bf5d..b86ac2e3a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/ClientCraftingGridSource.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/ClientCraftingGridSource.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.common.grid; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; import com.refinedmods.refinedstorage.common.support.packet.c2s.C2SPackets; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; @@ -16,7 +17,7 @@ class ClientCraftingGridSource implements CraftingGridSource { private final ResultContainer craftingResult; ClientCraftingGridSource() { - this.craftingMatrix = new CraftingMatrix(null); + this.craftingMatrix = new CraftingMatrix(null, 3, 3); this.craftingResult = new ResultContainer(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java index af272ec47..08c5595c1 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridBlockEntity.java @@ -9,8 +9,9 @@ import com.refinedmods.refinedstorage.common.content.BlockEntities; import com.refinedmods.refinedstorage.common.content.ContentNames; import com.refinedmods.refinedstorage.common.support.BlockEntityWithDrops; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; +import com.refinedmods.refinedstorage.common.support.containermenu.NetworkNodeExtendedMenuProvider; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; -import com.refinedmods.refinedstorage.common.util.ContainerUtil; import java.util.Optional; import javax.annotation.Nullable; @@ -19,26 +20,20 @@ import net.minecraft.core.HolderLookup; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamEncoder; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.ResultContainer; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.crafting.CraftingInput; -import net.minecraft.world.item.crafting.CraftingRecipe; -import net.minecraft.world.item.crafting.RecipeHolder; -import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; -public class CraftingGridBlockEntity extends AbstractGridBlockEntity implements BlockEntityWithDrops { - private static final String TAG_CRAFTING_MATRIX = "matrix"; - - @Nullable - private CraftingRecipe currentRecipe; - - private final CraftingMatrix craftingMatrix = new CraftingMatrix(this::setOutput); - private final ResultContainer craftingResult = new ResultContainer(); +public class CraftingGridBlockEntity extends AbstractGridBlockEntity implements BlockEntityWithDrops, + NetworkNodeExtendedMenuProvider { + private final CraftingState craftingState = new CraftingState(this::setChanged, this::getLevel); public CraftingGridBlockEntity(final BlockPos pos, final BlockState state) { super( @@ -49,55 +44,26 @@ public CraftingGridBlockEntity(final BlockPos pos, final BlockState state) { ); } - private void setOutput() { - if (level == null) { - return; - } - setOutputSilently(level); - setChanged(); - } - - private void setOutputSilently(final Level level) { - if (level.isClientSide()) { - return; - } - final CraftingInput input = craftingMatrix.asCraftInput(); - if (currentRecipe == null || !currentRecipe.matches(input, level)) { - currentRecipe = loadRecipe(level); - } - if (currentRecipe == null) { - setResult(ItemStack.EMPTY); - } else { - setResult(currentRecipe.assemble(input, level.registryAccess())); - } - } - - private void setResult(final ItemStack result) { - craftingResult.setItem(0, result); + CraftingMatrix getCraftingMatrix() { + return craftingState.getCraftingMatrix(); } - @Nullable - private CraftingRecipe loadRecipe(final Level level) { - return level - .getRecipeManager() - .getRecipeFor(RecipeType.CRAFTING, craftingMatrix.asCraftInput(), level) - .map(RecipeHolder::value) - .orElse(null); + ResultContainer getCraftingResult() { + return craftingState.getCraftingResult(); } - CraftingMatrix getCraftingMatrix() { - return craftingMatrix; + NonNullList getRemainingItems(final Player player, final CraftingInput input) { + return craftingState.getRemainingItems(level, player, input); } - ResultContainer getCraftingResult() { - return craftingResult; + @Override + public GridData getMenuData() { + return GridData.of(this); } - NonNullList getRemainingItems(final Player player, final CraftingInput input) { - if (level == null || currentRecipe == null) { - return NonNullList.create(); - } - return Platform.INSTANCE.getRemainingCraftingItems(player, currentRecipe, input); + @Override + public StreamEncoder getMenuCodec() { + return GridData.STREAM_CODEC; } @Override @@ -114,28 +80,26 @@ public AbstractGridContainerMenu createMenu(final int syncId, final Inventory in @Override public void saveAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { super.saveAdditional(tag, provider); - tag.put(TAG_CRAFTING_MATRIX, ContainerUtil.write(craftingMatrix, provider)); + craftingState.writeToTag(tag, provider); } @Override public void loadAdditional(final CompoundTag tag, final HolderLookup.Provider provider) { super.loadAdditional(tag, provider); - if (tag.contains(TAG_CRAFTING_MATRIX)) { - ContainerUtil.read(tag.getCompound(TAG_CRAFTING_MATRIX), craftingMatrix, provider); - } + craftingState.readFromTag(tag, provider); } @Override public void setLevel(final Level level) { super.setLevel(level); - setOutputSilently(level); + craftingState.updateResult(level); } @Override public NonNullList getDrops() { final NonNullList drops = NonNullList.create(); - for (int i = 0; i < craftingMatrix.getContainerSize(); ++i) { - drops.add(craftingMatrix.getItem(i)); + for (int i = 0; i < craftingState.getCraftingMatrix().getContainerSize(); ++i) { + drops.add(craftingState.getCraftingMatrix().getItem(i)); } return drops; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridContainerMenu.java index fd072e186..fd65608e6 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridContainerMenu.java @@ -75,7 +75,10 @@ public void onActiveChanged(final boolean newActive) { @Override public boolean canTakeItemForPickAll(final ItemStack stack, final Slot slot) { - return !(slot instanceof CraftingGridResultSlot); + if (slot instanceof CraftingGridResultSlot) { + return false; + } + return super.canTakeItemForPickAll(stack, slot); } @Override diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridResultSlot.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridResultSlot.java index 4887311c1..445c47a28 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridResultSlot.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridResultSlot.java @@ -1,6 +1,7 @@ package com.refinedmods.refinedstorage.common.grid; import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import java.util.List; @@ -58,7 +59,8 @@ private void doTake(final Player player, final CraftingGridRefillContext refillC for (int x = 0; x < input.width(); ++x) { final int index = x + left + (y + top) * source.getCraftingMatrix().getWidth(); final ItemStack matrixStack = source.getCraftingMatrix().getItem(index); - final ItemStack remainingItem = remainingItems.get(x + y * input.width()); + final int recipeIndex = x + y * input.width(); + final ItemStack remainingItem = remainingItems.get(recipeIndex); if (!remainingItem.isEmpty()) { useIngredientWithRemainingItem(player, index, remainingItem); } else if (!matrixStack.isEmpty()) { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSource.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSource.java index 9ed0828fe..220ce6463 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSource.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSource.java @@ -1,5 +1,6 @@ package com.refinedmods.refinedstorage.common.grid; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import java.util.List; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSourceImpl.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSourceImpl.java index 97632e507..60411e3ca 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSourceImpl.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingGridSourceImpl.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.api.resource.ResourceAmount; import com.refinedmods.refinedstorage.api.resource.list.ResourceList; import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import java.util.Comparator; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingState.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingState.java new file mode 100644 index 000000000..a58248ebe --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingState.java @@ -0,0 +1,106 @@ +package com.refinedmods.refinedstorage.common.grid; + +import com.refinedmods.refinedstorage.api.core.NullableType; +import com.refinedmods.refinedstorage.common.Platform; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; +import com.refinedmods.refinedstorage.common.util.ContainerUtil; + +import java.util.function.Supplier; +import javax.annotation.Nullable; + +import net.minecraft.core.HolderLookup; +import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.ResultContainer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingInput; +import net.minecraft.world.item.crafting.CraftingRecipe; +import net.minecraft.world.item.crafting.RecipeHolder; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.Level; + +public class CraftingState { + private static final String TAG_CRAFTING_MATRIX = "matrix"; + + private final Runnable listener; + private final Supplier<@NullableType Level> levelSupplier; + private final CraftingMatrix craftingMatrix = new CraftingMatrix(this::craftingMatrixChanged, 3, 3); + private final ResultContainer craftingResult = new ResultContainer(); + + @Nullable + private CraftingRecipe currentRecipe; + + public CraftingState(final Runnable listener, final Supplier<@NullableType Level> levelSupplier) { + this.listener = listener; + this.levelSupplier = levelSupplier; + } + + private void craftingMatrixChanged() { + final Level level = levelSupplier.get(); + if (level == null) { + return; + } + updateResult(level); + listener.run(); + } + + public void updateResult(final Level level) { + if (level.isClientSide()) { + return; + } + final CraftingInput input = craftingMatrix.asCraftInput(); + if (currentRecipe == null || !currentRecipe.matches(input, level)) { + currentRecipe = loadRecipe(level); + } + if (currentRecipe == null) { + setResult(ItemStack.EMPTY); + } else { + setResult(currentRecipe.assemble(input, level.registryAccess())); + } + } + + public CraftingMatrix getCraftingMatrix() { + return craftingMatrix; + } + + public ResultContainer getCraftingResult() { + return craftingResult; + } + + public boolean hasCraftingResult() { + return !craftingResult.getItem(0).isEmpty(); + } + + private void setResult(final ItemStack result) { + craftingResult.setItem(0, result); + } + + @Nullable + private CraftingRecipe loadRecipe(final Level level) { + return level + .getRecipeManager() + .getRecipeFor(RecipeType.CRAFTING, craftingMatrix.asCraftInput(), level) + .map(RecipeHolder::value) + .orElse(null); + } + + NonNullList getRemainingItems(@Nullable final Level level, + final Player player, + final CraftingInput input) { + if (level == null || currentRecipe == null) { + return NonNullList.create(); + } + return Platform.INSTANCE.getRemainingCraftingItems(player, currentRecipe, input); + } + + public void writeToTag(final CompoundTag tag, final HolderLookup.Provider provider) { + tag.put(TAG_CRAFTING_MATRIX, ContainerUtil.write(craftingMatrix, provider)); + } + + public void readFromTag(final CompoundTag tag, final HolderLookup.Provider provider) { + if (tag.contains(TAG_CRAFTING_MATRIX)) { + ContainerUtil.read(tag.getCompound(TAG_CRAFTING_MATRIX), craftingMatrix, provider); + } + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java index da2f4aed1..4f20e964f 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/GridBlockEntity.java @@ -3,20 +3,33 @@ import com.refinedmods.refinedstorage.common.Platform; import com.refinedmods.refinedstorage.common.content.BlockEntities; import com.refinedmods.refinedstorage.common.content.ContentNames; +import com.refinedmods.refinedstorage.common.support.containermenu.NetworkNodeExtendedMenuProvider; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; +import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; +import net.minecraft.network.codec.StreamEncoder; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Player; import net.minecraft.world.level.block.state.BlockState; -public class GridBlockEntity extends AbstractGridBlockEntity { +public class GridBlockEntity extends AbstractGridBlockEntity implements NetworkNodeExtendedMenuProvider { public GridBlockEntity(final BlockPos pos, final BlockState state) { super(BlockEntities.INSTANCE.getGrid(), pos, state, Platform.INSTANCE.getConfig().getGrid().getEnergyUsage()); } + @Override + public GridData getMenuData() { + return GridData.of(this); + } + + @Override + public StreamEncoder getMenuCodec() { + return GridData.STREAM_CODEC; + } + @Override public Component getDisplayName() { return ContentNames.GRID; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/SnapshotCraftingGridRefillContext.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/SnapshotCraftingGridRefillContext.java index 833bfa89c..5dbf3da73 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/SnapshotCraftingGridRefillContext.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/SnapshotCraftingGridRefillContext.java @@ -5,6 +5,7 @@ import com.refinedmods.refinedstorage.api.resource.list.ResourceListImpl; import com.refinedmods.refinedstorage.api.storage.root.RootStorage; import com.refinedmods.refinedstorage.common.api.storage.PlayerActor; +import com.refinedmods.refinedstorage.common.support.CraftingMatrix; import com.refinedmods.refinedstorage.common.support.resource.ItemResource; import net.minecraft.world.entity.player.Player; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java index 165eda4b4..90a62268e 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/AbstractGridScreen.java @@ -34,6 +34,7 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.Slot; import net.minecraft.world.item.ItemStack; @@ -41,12 +42,16 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslation; import static java.util.Objects.requireNonNullElse; public abstract class AbstractGridScreen extends AbstractStretchingScreen { + protected static final int CLEAR_BUTTON_SIZE = 7; + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractGridScreen.class); + private static final ResourceLocation ROW_TEXTURE = createIdentifier("grid_row"); private static final int MODIFIED_JUST_NOW_MAX_SECONDS = 10; private static final int COLUMNS = 9; private static final int DISABLED_SLOT_COLOR = 0xFF5B5B5B; @@ -193,7 +198,7 @@ private void renderRow(final GuiGraphics graphics, final int rowX, final int rowY, final int row) { - graphics.blit(getTexture(), rowX, rowY, 0, 238, 162, ROW_SIZE); + graphics.blitSprite(ROW_TEXTURE, rowX, rowY, 162, ROW_SIZE); for (int column = 0; column < COLUMNS; ++column) { renderCell(graphics, mouseX, mouseY, rowX, rowY, (row * COLUMNS) + column, column); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java index fdfb4a045..ba50b5b5a 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/CraftingGridScreen.java @@ -26,7 +26,6 @@ public class CraftingGridScreen extends AbstractGridScreen { private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/crafting_grid.png"); - private static final int CLEAR_BUTTON_SIZE = 7; private static final WidgetSprites CLEAR_BUTTON_TO_PLAYER_INVENTORY_SPRITES = new WidgetSprites( createIdentifier("widget/move_down"), @@ -57,8 +56,8 @@ public CraftingGridScreen(final CraftingGridContainerMenu menu, final Inventory protected void init() { super.init(); - final int clearToNetworkButtonX = leftPos + 82; - final int clearToInventoryButtonX = clearToNetworkButtonX + CLEAR_BUTTON_SIZE + 3; + final int clearToNetworkButtonX = getClearButtonX(0); + final int clearToInventoryButtonX = getClearButtonX(1); final int clearButtonY = topPos + imageHeight - bottomHeight + 4; clearToNetworkButton = createClearButton(clearToNetworkButtonX, clearButtonY, false); @@ -68,6 +67,10 @@ protected void init() { addRenderableWidget(createClearButton(clearToInventoryButtonX, clearButtonY, true)); } + private int getClearButtonX(final int i) { + return leftPos + 82 + ((CLEAR_BUTTON_SIZE + 3) * i); + } + @Override protected void renderBg(final GuiGraphics graphics, final float delta, final int mouseX, final int mouseY) { super.renderBg(graphics, delta, mouseX, mouseY); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/ResourceTypeSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/ResourceTypeSideButtonWidget.java index bb6295282..66740f31d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/ResourceTypeSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/screen/ResourceTypeSideButtonWidget.java @@ -31,7 +31,7 @@ private static OnPress createPressAction(final AbstractGridContainerMenu menu) { protected ResourceLocation getTextureIdentifier() { final ResourceType resourceType = menu.getResourceType(); if (resourceType == null) { - return TextureIds.ICONS; + return TextureIds.SIDE_BUTTON_ICONS; } return resourceType.getTextureIdentifier(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java index a7e208be0..cbdcf1a19 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/networking/NetworkTransmitterScreen.java @@ -1,7 +1,6 @@ package com.refinedmods.refinedstorage.common.networking; import com.refinedmods.refinedstorage.common.support.AbstractBaseScreen; -import com.refinedmods.refinedstorage.common.support.TextureIds; import com.refinedmods.refinedstorage.common.support.containermenu.PropertyTypes; import com.refinedmods.refinedstorage.common.support.widget.RedstoneModeSideButtonWidget; @@ -10,6 +9,8 @@ import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.player.Inventory; +import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING; +import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING_SIZE; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class NetworkTransmitterScreen extends AbstractBaseScreen { @@ -36,7 +37,7 @@ protected void renderLabels(final GuiGraphics graphics, final int mouseX, final final NetworkTransmitterData status = getMenu().getStatus(); final int displayTextX = 51; if (status.error()) { - graphics.blit(TextureIds.ICONS, displayTextX, 23, 246, 148, 10, 10); + graphics.blitSprite(WARNING, displayTextX, 23, WARNING_SIZE, WARNING_SIZE); } graphics.drawString(font, status.message(), displayTextX + (status.error() ? (10 + 4) : 0), 25, 4210752, false); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/AbstractSecurityCardScreen.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/AbstractSecurityCardScreen.java index 381c51cff..7d4352bab 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/AbstractSecurityCardScreen.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/security/AbstractSecurityCardScreen.java @@ -75,7 +75,8 @@ private CustomCheckboxWidget createPermissionCheckbox( y, getPermissionName(menuPermission), font, - menuPermission.allowed() + menuPermission.allowed(), + CustomCheckboxWidget.Size.REGULAR ); checkbox.visible = visible; checkbox.setTooltip(getPermissionTooltip(menuPermission)); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseContainerMenu.java index 857aafcc9..91eb1dea3 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/AbstractBaseContainerMenu.java @@ -4,6 +4,7 @@ import com.refinedmods.refinedstorage.common.api.support.slotreference.SlotReference; import com.refinedmods.refinedstorage.common.support.containermenu.ClientProperty; import com.refinedmods.refinedstorage.common.support.containermenu.DisabledSlot; +import com.refinedmods.refinedstorage.common.support.containermenu.FilterSlot; import com.refinedmods.refinedstorage.common.support.containermenu.Property; import com.refinedmods.refinedstorage.common.support.containermenu.PropertyType; import com.refinedmods.refinedstorage.common.support.containermenu.ServerProperty; @@ -98,12 +99,29 @@ public void clicked(final int id, final int dragType, final ClickType clickType, if (isSwappingDisabledSlotWithNumberKeys(dragType, clickType)) { return; } + if (slot instanceof FilterSlot) { + final ItemStack carried = player.containerMenu.getCarried(); + if (carried.isEmpty()) { + slot.set(ItemStack.EMPTY); + } else if (slot.mayPlace(carried)) { + slot.set(carried.copy()); + } + return; + } if (slot instanceof DisabledSlot) { return; } super.clicked(id, dragType, clickType, player); } + @Override + public boolean canTakeItemForPickAll(final ItemStack stack, final Slot slot) { + if (slot instanceof FilterSlot || slot instanceof DisabledSlot) { + return false; + } + return super.canTakeItemForPickAll(stack, slot); + } + private boolean isSwappingDisabledSlotWithNumberKeys(final int dragType, final ClickType clickType) { return disabledSlot != null && clickType == ClickType.SWAP diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrix.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrix.java similarity index 57% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrix.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrix.java index 805e53372..18db8e3ad 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrix.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrix.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.grid; +package com.refinedmods.refinedstorage.common.support; import javax.annotation.Nullable; @@ -8,12 +8,12 @@ public class CraftingMatrix extends TransientCraftingContainer { @Nullable private final Runnable listener; - public CraftingMatrix(@Nullable final Runnable listener) { - super(new CraftingMatrixContainerMenu(listener), 3, 3); + public CraftingMatrix(@Nullable final Runnable listener, final int width, final int height) { + super(new CraftingMatrixContainerMenu(listener), width, height); this.listener = listener; } - void changed() { + public void changed() { if (listener != null) { listener.run(); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrixContainerMenu.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrixContainerMenu.java similarity index 94% rename from refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrixContainerMenu.java rename to refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrixContainerMenu.java index 288b9c3e8..406c37706 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/grid/CraftingMatrixContainerMenu.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/CraftingMatrixContainerMenu.java @@ -1,4 +1,4 @@ -package com.refinedmods.refinedstorage.common.grid; +package com.refinedmods.refinedstorage.common.support; import javax.annotation.Nullable; diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java index e4fb3e004..7604a0fb7 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/TextureIds.java @@ -5,7 +5,12 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public final class TextureIds { - public static final ResourceLocation ICONS = createIdentifier("textures/icons.png"); + public static final ResourceLocation SIDE_BUTTON_ICONS = createIdentifier("textures/side_button_icons.png"); + public static final ResourceLocation LIGHT_ARROW = createIdentifier("light_arrow"); + public static final int LIGHT_ARROW_WIDTH = 22; + public static final int LIGHT_ARROW_HEIGHT = 15; + public static final ResourceLocation WARNING = createIdentifier("warning"); + public static final int WARNING_SIZE = 10; private TextureIds() { } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/FilterSlot.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/FilterSlot.java new file mode 100644 index 000000000..ff34f8f4f --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/FilterSlot.java @@ -0,0 +1,25 @@ +package com.refinedmods.refinedstorage.common.support.containermenu; + +import net.minecraft.world.Container; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +public class FilterSlot extends Slot { + public FilterSlot(final Container container, final int index, final int x, final int y) { + super(container, index, x, y); + } + + @Override + public void set(final ItemStack stack) { + if (!stack.isEmpty()) { + stack.setCount(1); + } + super.set(stack); + } + + @Override + public boolean mayPickup(final Player player) { + return false; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/TransferManager.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/TransferManager.java index 1aece6cbf..28705c39d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/TransferManager.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/containermenu/TransferManager.java @@ -46,23 +46,22 @@ public void addBiTransfer(final Container from, final Container to) { addTransfer(to, from); } - public void transfer(final int index) { + public boolean transfer(final int index) { final Slot slot = containerMenu.getSlot(index); if (slot.getItem().isEmpty()) { - return; + return false; } final TransferDestination key = destinationFactory.apply(slot.container); final List destinations = destinationMap.get(key); - if (destinations != null) { - transfer(slot, destinations); - } + return destinations != null && transfer(slot, destinations); } - private void transfer(final Slot slot, final List destinations) { + private boolean transfer(final Slot slot, final List destinations) { final ItemStack initial = slot.getItem().copy(); final ItemStack remainder = doTransfer(initial, destinations); slot.set(remainder); slot.setChanged(); + return initial.getCount() != remainder.getCount(); } private ItemStack doTransfer(final ItemStack initial, final List destinations) { @@ -79,4 +78,8 @@ private ItemStack doTransfer(final ItemStack initial, final List> recipe) { Platform.INSTANCE.sendPacketToServer(new CraftingGridRecipeTransferPacket(recipe)); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridClearPacket.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridClearPacket.java new file mode 100644 index 000000000..f4195ef1d --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridClearPacket.java @@ -0,0 +1,28 @@ +package com.refinedmods.refinedstorage.common.support.packet.c2s; + +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.support.packet.PacketContext; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +public record PatternGridClearPacket() implements CustomPacketPayload { + public static final Type PACKET_TYPE = new Type<>(createIdentifier("pattern_grid_clear")); + public static final PatternGridClearPacket INSTANCE = new PatternGridClearPacket(); + public static final StreamCodec STREAM_CODEC = + StreamCodec.unit(INSTANCE); + + public static void handle(final PacketContext ctx) { + if (ctx.getPlayer().containerMenu instanceof PatternGridContainerMenu patternGridContainerMenu) { + patternGridContainerMenu.clear(); + } + } + + @Override + public Type type() { + return PACKET_TYPE; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridCreatePatternPacket.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridCreatePatternPacket.java new file mode 100644 index 000000000..3225174f6 --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/packet/c2s/PatternGridCreatePatternPacket.java @@ -0,0 +1,29 @@ +package com.refinedmods.refinedstorage.common.support.packet.c2s; + +import com.refinedmods.refinedstorage.common.autocrafting.PatternGridContainerMenu; +import com.refinedmods.refinedstorage.common.support.packet.PacketContext; + +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.common.custom.CustomPacketPayload; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + +public record PatternGridCreatePatternPacket() implements CustomPacketPayload { + public static final Type PACKET_TYPE = + new Type<>(createIdentifier("pattern_grid_create_pattern")); + public static final PatternGridCreatePatternPacket INSTANCE = new PatternGridCreatePatternPacket(); + public static final StreamCodec STREAM_CODEC = + StreamCodec.unit(INSTANCE); + + public static void handle(final PacketContext ctx) { + if (ctx.getPlayer().containerMenu instanceof PatternGridContainerMenu patternGridContainerMenu) { + patternGridContainerMenu.createPattern(); + } + } + + @Override + public Type type() { + return PACKET_TYPE; + } +} diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java index 98cddc50f..30e19026d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/FluidResourceType.java @@ -25,7 +25,7 @@ class FluidResourceType extends AbstractResourceType { super( "FLUID", createTranslation("misc", "resource_type.fluid"), - TextureIds.ICONS, + TextureIds.SIDE_BUTTON_ICONS, 16, 128 ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java index 0588b9a0b..db994cb0b 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/resource/ItemResourceType.java @@ -25,7 +25,7 @@ class ItemResourceType extends AbstractResourceType { super( "ITEM", createTranslation("misc", "resource_type.item"), - TextureIds.ICONS, + TextureIds.SIDE_BUTTON_ICONS, 0, 128 ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java index 23cf658a8..e6f13f107 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/HelpClientTooltipComponent.java @@ -1,7 +1,5 @@ package com.refinedmods.refinedstorage.common.support.tooltip; -import com.refinedmods.refinedstorage.common.support.TextureIds; - import java.util.List; import net.minecraft.client.Minecraft; @@ -12,13 +10,16 @@ import net.minecraft.locale.Language; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; +import net.minecraft.resources.ResourceLocation; import net.minecraft.util.FormattedCharSequence; import org.joml.Matrix4f; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createTranslationAsHeading; import static net.minecraft.client.gui.screens.Screen.hasShiftDown; public class HelpClientTooltipComponent implements ClientTooltipComponent { + private static final ResourceLocation TEXTURE = createIdentifier("help"); private static final ClientTooltipComponent PRESS_SHIFT_FOR_HELP = new SmallTextClientTooltipComponent( createTranslationAsHeading("misc", "press_shift_for_help") ); @@ -76,7 +77,7 @@ public void renderText(final Font font, @Override public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { - graphics.blit(TextureIds.ICONS, x, y + 2, 236, 158, 20, 20); + graphics.blitSprite(TEXTURE, x, y + 2, 20, 20); } public static ClientTooltipComponent create(final Component text) { diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java index 2af039f4f..a835b7643 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/tooltip/MouseClientTooltipComponent.java @@ -3,7 +3,6 @@ import com.refinedmods.refinedstorage.api.resource.ResourceKey; import com.refinedmods.refinedstorage.common.Platform; import com.refinedmods.refinedstorage.common.api.RefinedStorageApi; -import com.refinedmods.refinedstorage.common.support.TextureIds; import com.refinedmods.refinedstorage.common.support.resource.FluidResource; import javax.annotation.Nullable; @@ -13,8 +12,14 @@ import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW; +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_HEIGHT; +import static com.refinedmods.refinedstorage.common.support.TextureIds.LIGHT_ARROW_WIDTH; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + public class MouseClientTooltipComponent implements ClientTooltipComponent { private static final int PADDING = 4; @@ -79,7 +84,7 @@ public static ClientTooltipComponent itemConversion(final Type type, @Override public void render(final GuiGraphics graphics, final int x, final int y) { graphics.renderItem(from, x, y); - graphics.blit(TextureIds.ICONS, x + 16 + 2, y, 234, 133, 22, 15); + graphics.blitSprite(LIGHT_ARROW, x + 16 + 2, y, LIGHT_ARROW_WIDTH, LIGHT_ARROW_HEIGHT); graphics.renderItem(to, x + 16 + 2 + 22 + 2, y); } @@ -115,7 +120,7 @@ public int getWidth(final Font font) { @Override public void renderImage(final Font font, final int x, final int y, final GuiGraphics graphics) { - graphics.blit(TextureIds.ICONS, x + type.leftPad, y, type.x, type.y, type.width, type.height); + graphics.blitSprite(type.texture, x + type.leftPad, y, type.width, type.height); iconRenderer.render(graphics, x + 9 + PADDING, y); if (amount != null) { final PoseStack poseStack = graphics.pose(); @@ -135,19 +140,17 @@ default int getWidth() { } public enum Type { - LEFT(247, 0, 180, 9, 13), - RIGHT(238, 2, 180, 9, 13); + LEFT(createIdentifier("left_mouse_button"), 0, 9, 13), + RIGHT(createIdentifier("right_mouse_button"), 2, 9, 13); - private final int x; + private final ResourceLocation texture; private final int leftPad; - private final int y; private final int width; private final int height; - Type(final int x, final int leftPad, final int y, final int width, final int height) { - this.x = x; + Type(final ResourceLocation texture, final int leftPad, final int width, final int height) { + this.texture = texture; this.leftPad = leftPad; - this.y = y; this.width = width; this.height = height; } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java index b91358499..4eae21cc4 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/AbstractSideButtonWidget.java @@ -21,10 +21,17 @@ import net.minecraft.resources.ResourceLocation; import org.lwjgl.opengl.GL11; +import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING; +import static com.refinedmods.refinedstorage.common.support.TextureIds.WARNING_SIZE; +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; + public abstract class AbstractSideButtonWidget extends Button { + private static final ResourceLocation TEXTURE = createIdentifier("widget/side_button"); + private static final ResourceLocation HOVERED_TEXTURE = createIdentifier("widget/side_button_hovered"); + private static final ResourceLocation HOVER_OVERLAY_TEXTURE = createIdentifier("widget/side_button_hover_overlay"); + private static final int WIDTH = 18; private static final int HEIGHT = 18; - private static final int WARNING_SIZE = 10; @Nullable private ClientTooltipComponent warning; @@ -38,7 +45,7 @@ protected AbstractSideButtonWidget(final OnPress pressAction) { protected abstract int getYTexture(); protected ResourceLocation getTextureIdentifier() { - return TextureIds.ICONS; + return TextureIds.SIDE_BUTTON_ICONS; } public void setWarning(@Nullable final Component text) { @@ -51,7 +58,7 @@ public void setWarning(@Nullable final Component text) { @Override public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) { - graphics.blit(getTextureIdentifier(), getX(), getY(), 238, isHovered ? 35 : 16, WIDTH, HEIGHT); + graphics.blitSprite(isHovered ? HOVERED_TEXTURE : TEXTURE, getX(), getY(), WIDTH, HEIGHT); graphics.blit( getTextureIdentifier(), getX() + 1, @@ -65,7 +72,7 @@ public void renderWidget(final GuiGraphics graphics, final int mouseX, final int RenderSystem.enableBlend(); RenderSystem.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); RenderSystem.setShaderColor(1.0f, 1.0f, 1.0f, 0.5f); - graphics.blit(getTextureIdentifier(), getX(), getY(), 238, 54, WIDTH, HEIGHT); + graphics.blitSprite(HOVER_OVERLAY_TEXTURE, getX(), getY(), WIDTH, HEIGHT); RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.disableBlend(); final Screen screen = Minecraft.getInstance().screen; @@ -81,12 +88,10 @@ public void renderWidget(final GuiGraphics graphics, final int mouseX, final int private void renderWarning(final GuiGraphics graphics) { graphics.pose().pushPose(); graphics.pose().translate(0, 0, 200); - graphics.blit( - TextureIds.ICONS, + graphics.blitSprite( + WARNING, getX() + WIDTH - WARNING_SIZE + 2, getY() + HEIGHT - WARNING_SIZE + 2, - 246, - 148, WARNING_SIZE, WARNING_SIZE ); diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/CustomCheckboxWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/CustomCheckboxWidget.java index aca5918a6..d7666c620 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/CustomCheckboxWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/CustomCheckboxWidget.java @@ -12,7 +12,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; -// A custom checkbox so that we can change the font color. +// A custom checkbox so that we can change the font color and size. public class CustomCheckboxWidget extends AbstractButton { private static final ResourceLocation CHECKBOX_SELECTED_HIGHLIGHTED_SPRITE = ResourceLocation.withDefaultNamespace( "widget/checkbox_selected_highlighted" @@ -25,8 +25,7 @@ public class CustomCheckboxWidget extends AbstractButton { ); private static final ResourceLocation CHECKBOX_SPRITE = ResourceLocation.withDefaultNamespace("widget/checkbox"); - private static final int BOX_SIZE = 9 + 8; - + private final Size size; @Nullable private OnPressed onPressed; private boolean selected; @@ -35,9 +34,11 @@ public CustomCheckboxWidget(final int x, final int y, final Component text, final Font font, - final boolean selected) { - super(x, y, BOX_SIZE + 4 + font.width(text), BOX_SIZE, text); + final boolean selected, + final Size size) { + super(x, y, size.widthHeight + 4 + font.width(text), size.widthHeight, text); this.selected = selected; + this.size = size; } public void setOnPressed(@Nullable final OnPressed onPressed) { @@ -79,15 +80,26 @@ public void renderWidget(final GuiGraphics graphics, final int mouseX, final int } else { sprite = isFocused() ? CHECKBOX_HIGHLIGHTED_SPRITE : CHECKBOX_SPRITE; } - final int x = getX() + BOX_SIZE + 4; - final int y = (getY() + (height >> 1)) - (9 >> 1); - graphics.blitSprite(sprite, getX(), getY(), BOX_SIZE, BOX_SIZE); + graphics.blitSprite(sprite, getX(), getY(), size.widthHeight, size.widthHeight); graphics.setColor(1.0F, 1.0F, 1.0F, 1.0F); - graphics.drawString(font, getMessage(), x, y, 4210752, false); + final int textX = getX() + size.widthHeight + 4; + final int textY = (getY() + (height >> 1)) - (9 >> 1); + graphics.drawString(font, getMessage(), textX, textY, 4210752, false); } @FunctionalInterface public interface OnPressed { void onPressed(CustomCheckboxWidget checkbox, boolean selected); } + + public enum Size { + REGULAR(9 + 8), + SMALL(9); + + private final int widthHeight; + + Size(final int widthHeight) { + this.widthHeight = widthHeight; + } + } } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java index 8cf60a071..59937b74f 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ProgressWidget.java @@ -8,13 +8,14 @@ import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarrationElementOutput; +import net.minecraft.client.sounds.SoundManager; import net.minecraft.network.chat.Component; import net.minecraft.resources.ResourceLocation; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class ProgressWidget extends AbstractWidget { - private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/widgets.png"); + private static final ResourceLocation TEXTURE = createIdentifier("widget/progress_bar"); private final DoubleSupplier progressSupplier; private final Supplier> tooltipSupplier; @@ -30,11 +31,18 @@ public ProgressWidget(final int x, this.tooltipSupplier = tooltipSupplier; } + @Override + public void playDownSound(final SoundManager handler) { + // intentionally empty + } + @Override public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) { final int correctedHeight = (int) (progressSupplier.getAsDouble() * height); - graphics.blit(TEXTURE, getX(), getY() + height - correctedHeight, 179, height - correctedHeight, width, - correctedHeight); + final int correctedY = getY() + height - correctedHeight; + final int u = 0; + final int v = height - correctedHeight; + graphics.blitSprite(TEXTURE, 16, 70, u, v, getX(), correctedY, width, correctedHeight); if (isHovered) { graphics.renderComponentTooltip(Minecraft.getInstance().font, tooltipSupplier.get(), mouseX, mouseY); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ScrollbarWidget.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ScrollbarWidget.java index 7f0e34a89..6073e437d 100644 --- a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ScrollbarWidget.java +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/support/widget/ScrollbarWidget.java @@ -14,7 +14,11 @@ import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; public class ScrollbarWidget extends AbstractWidget { - private static final ResourceLocation TEXTURE = createIdentifier("textures/gui/widgets.png"); + private static final ResourceLocation TEXTURE = createIdentifier("widget/scrollbar"); + private static final ResourceLocation CLICKED_TEXTURE = createIdentifier("widget/scrollbar_clicked"); + private static final ResourceLocation DISABLED_TEXTURE = createIdentifier("widget/scrollbar_disabled"); + + private static final int SCROLLER_WIDTH = 12; private static final int SCROLLER_HEIGHT = 15; private static final int ANIMATION_SCROLL_DURATION_IN_TICKS = 10; @@ -51,23 +55,24 @@ public void setEnabled(final boolean enabled) { this.enabled = enabled; } + private ResourceLocation getTexture() { + if (!enabled) { + return DISABLED_TEXTURE; + } + return clicked ? CLICKED_TEXTURE : TEXTURE; + } + @Override public void renderWidget(final GuiGraphics graphics, final int mouseX, final int mouseY, final float partialTicks) { if (isAnimatingScroll()) { updateScrollingAnimation(partialTicks); } - - final int enabledU = clicked ? 220 : 232; - final int u = enabled ? enabledU : 244; - - graphics.blit( - TEXTURE, + graphics.blitSprite( + getTexture(), getX(), getY() + (int) ((float) offset / (float) maxOffset * (height - SCROLLER_HEIGHT)), - u, - 0, - 12, - 15 + SCROLLER_WIDTH, + SCROLLER_HEIGHT ); } diff --git a/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java new file mode 100644 index 000000000..24072c78e --- /dev/null +++ b/refinedstorage-common/src/main/java/com/refinedmods/refinedstorage/common/util/PlatformUtil.java @@ -0,0 +1,16 @@ +package com.refinedmods.refinedstorage.common.util; + +import javax.annotation.Nullable; + +import net.minecraft.client.Minecraft; +import net.minecraft.world.level.Level; + +public final class PlatformUtil { + private PlatformUtil() { + } + + @Nullable + public static Level getClientLevel() { // avoids classloading issues + return Minecraft.getInstance().level; + } +} diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json b/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json index adf9fc563..e4522ab58 100644 --- a/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json +++ b/refinedstorage-common/src/main/resources/assets/refinedstorage/lang/en_us.json @@ -6,6 +6,7 @@ "block.refinedstorage.disk_drive": "Disk Drive", "block.refinedstorage.machine_casing": "Machine Casing", "block.refinedstorage.grid": "Grid", + "block.refinedstorage.pattern_grid": "Pattern Grid", "block.refinedstorage.crafting_grid": "Crafting Grid", "block.refinedstorage.controller": "Controller", "block.refinedstorage.creative_controller": "Creative Controller", @@ -61,6 +62,11 @@ "gui.refinedstorage.grid.resource_type.help": "Filter specific resource types.", "gui.refinedstorage.crafting_grid.move.network": "Move items to network", "gui.refinedstorage.crafting_grid.move.inventory": "Move items to inventory", + "gui.refinedstorage.pattern_grid.create_pattern": "Create pattern", + "gui.refinedstorage.pattern_grid.clear": "Clear", + "gui.refinedstorage.pattern_grid.fuzzy_mode": "Fuzzy mode", + "gui.refinedstorage.pattern_grid.fuzzy_mode.on.help": "Match the pattern inputs, ignoring components.", + "gui.refinedstorage.pattern_grid.fuzzy_mode.off.help": "Match the pattern inputs exactly.", "gui.refinedstorage.screen_size": "Screen size", "gui.refinedstorage.screen_size.stretch": "Stretch", "gui.refinedstorage.screen_size.small": "Small", @@ -109,15 +115,15 @@ "gui.refinedstorage.filter_mode.block": "Blocklist", "gui.refinedstorage.fuzzy_mode": "Fuzzy mode", "gui.refinedstorage.fuzzy_mode.on": "On", - "gui.refinedstorage.fuzzy_mode.on.storage_help": "Match the filters for the allowlist or blocklist exactly.", - "gui.refinedstorage.fuzzy_mode.on.generic_help": "Match the filter exactly.", - "gui.refinedstorage.fuzzy_mode.on.extracting_storage_network_help": "Match the filters when extracting from the storage network exactly.", - "gui.refinedstorage.fuzzy_mode.on.extracting_source_help": "Match the filters when extracting from the source exactly.", + "gui.refinedstorage.fuzzy_mode.on.storage_help": "Match the filters for the allowlist or blocklist, ignoring components.", + "gui.refinedstorage.fuzzy_mode.on.generic_help": "Match the filter, ignoring components.", + "gui.refinedstorage.fuzzy_mode.on.extracting_storage_network_help": "Match the filters when extracting from the storage network, ignoring components.", + "gui.refinedstorage.fuzzy_mode.on.extracting_source_help": "Match the filters when extracting from the source, ignoring components.", "gui.refinedstorage.fuzzy_mode.off": "Off", - "gui.refinedstorage.fuzzy_mode.off.storage_help": "Match the filters for the allowlist or blocklist without comparing NBT tags.", - "gui.refinedstorage.fuzzy_mode.off.generic_help": "Match the filter without comparing NBT tags.", - "gui.refinedstorage.fuzzy_mode.off.extracting_storage_network_help": "Match the filters when extracting from the storage network without comparing NBT tags.", - "gui.refinedstorage.fuzzy_mode.off.extracting_source_help": "Match the filters when extracting from the source without comparing NBT tags.", + "gui.refinedstorage.fuzzy_mode.off.storage_help": "Match the filters for the allowlist or blocklist exactly.", + "gui.refinedstorage.fuzzy_mode.off.generic_help": "Match the filter exactly.", + "gui.refinedstorage.fuzzy_mode.off.extracting_storage_network_help": "Match the filters when extracting from the storage network exactly.", + "gui.refinedstorage.fuzzy_mode.off.extracting_source_help": "Match the filters when extracting from the source exactly.", "gui.refinedstorage.access_mode": "Access mode", "gui.refinedstorage.access_mode.insert_extract": "Insert and extract", "gui.refinedstorage.access_mode.insert_extract.help": "The storage network will be able to insert or extract from this storage.", @@ -170,6 +176,7 @@ "item.refinedstorage.disk_interface.help": "Transfers resources between the storage network and provided storage disks.", "item.refinedstorage.grid.help": "Allows for interacting with the storage network.", "item.refinedstorage.crafting_grid.help": "Allows for interacting with the storage network, with crafting abilities.", + "item.refinedstorage.pattern_grid.help": "Allows for the creation of Patterns for use in autocrafting.", "item.refinedstorage.importer.help": "Imports resources from an external source to the storage network.", "item.refinedstorage.exporter.help": "Exports resources from the storage network to an external destination.", "item.refinedstorage.interface.help": "Acts as the combination of an Importer and Exporter.", @@ -271,6 +278,9 @@ "item.refinedstorage.fallback_security_card.help": "Acts as a fallback if no matching Security Card for a player is found. Right click to configure. Use while crouching to clear configuration.", "item.refinedstorage.portable_grid.help": "Allows to interact with a storage disk while not being connected to a storage network. Can be used as a block in world, or from your inventory.", "item.refinedstorage.storage_monitor.help": "A block that displays the current amount of a certain resource in your storage network. SHIFT + right click to configure. Left click to extract a stack, SHIFT + left click to extract a single resource, right click to insert a resource, right click multiple times to insert resources in bulk.", + "item.refinedstorage.pattern": "Pattern", + "item.refinedstorage.pattern.fuzzy_mode": "Fuzzy mode", + "item.refinedstorage.pattern.help": "Used in autocrafting to store the recipe to be crafted. Use while crouching to clear.", "misc.refinedstorage.stored": "Stored: %s", "misc.refinedstorage.stored_with_capacity": "Stored: %s / %s (%d%%)", "misc.refinedstorage.total": "%d total", @@ -298,6 +308,10 @@ "misc.refinedstorage.no_permission.build.break": "You are not allowed to break the %s.", "misc.refinedstorage.no_permission.build.rotate": "You are not allowed to rotate the %s.", "misc.refinedstorage.no_permission.build.dismantle": "You are not allowed to dismantle the %s.", + "misc.refinedstorage.pattern.crafting": "Crafting Pattern", + "misc.refinedstorage.pattern.processing": "Processing Pattern", + "misc.refinedstorage.pattern.stonecutter": "Stonecutter Pattern", + "misc.refinedstorage.pattern.smithing_table": "Smithing Table Pattern", "key.refinedstorage.focus_search_bar": "Focus search bar", "key.refinedstorage.clear_crafting_grid_matrix_to_network": "Clear Crafting Grid matrix to network", "key.refinedstorage.clear_crafting_grid_matrix_to_inventory": "Clear Crafting Grid matrix to inventory", @@ -373,6 +387,10 @@ "text.autoconfig.refinedstorage.option.craftingGrid.energyUsage.tooltip": "The energy used by the Crafting Grid.", "text.autoconfig.refinedstorage.option.craftingGrid.craftingMatrixCloseBehavior": "Crafting matrix close behavior", "text.autoconfig.refinedstorage.option.craftingGrid.craftingMatrixCloseBehavior.tooltip": "What should happen to the crafting matrix slots when closing the Crafting Grid.", + "text.autoconfig.refinedstorage.option.patternGrid": "Pattern Grid", + "text.autoconfig.refinedstorage.option.patternGrid.tooltip": "Configuration for the Pattern Grid.", + "text.autoconfig.refinedstorage.option.patternGrid.energyUsage": "Energy usage", + "text.autoconfig.refinedstorage.option.patternGrid.energyUsage.tooltip": "The energy used by the Pattern Grid.", "text.autoconfig.refinedstorage.option.controller": "Controller", "text.autoconfig.refinedstorage.option.controller.tooltip": "Configuration for the Controller.", "text.autoconfig.refinedstorage.option.controller.energyCapacity": "Energy capacity", diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern.json b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern.json new file mode 100644 index 000000000..9e88470d6 --- /dev/null +++ b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern.json @@ -0,0 +1,3 @@ +{ + "loader": "refinedstorage:pattern" +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/crafting.json b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/crafting.json new file mode 100644 index 000000000..4626053ed --- /dev/null +++ b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/crafting.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "refinedstorage:item/pattern/crafting" + } +} diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/empty.json b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/empty.json new file mode 100644 index 000000000..181a096c9 --- /dev/null +++ b/refinedstorage-common/src/main/resources/assets/refinedstorage/models/item/pattern/empty.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "refinedstorage:item/pattern/empty" + } +} diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/back.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/back.png new file mode 100644 index 000000000..ffb76f755 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/back.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/black.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/black.png new file mode 100644 index 000000000..5aa1136ac Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/black.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/blue.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/blue.png new file mode 100644 index 000000000..397da42e4 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/blue.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/brown.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/brown.png new file mode 100644 index 000000000..e68d356ef Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/brown.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/cyan.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/cyan.png new file mode 100644 index 000000000..d2cc6347f Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/cyan.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/gray.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/gray.png new file mode 100644 index 000000000..eb4885bb5 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/gray.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/green.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/green.png new file mode 100644 index 000000000..7e3269354 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/green.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/inactive.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/inactive.png new file mode 100644 index 000000000..1a6fc9e69 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/inactive.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_blue.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_blue.png new file mode 100644 index 000000000..cb3757fa5 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_blue.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_gray.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_gray.png new file mode 100644 index 000000000..d6e5f1fb0 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/light_gray.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/lime.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/lime.png new file mode 100644 index 000000000..946cafc7b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/lime.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/magenta.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/magenta.png new file mode 100644 index 000000000..f7c5e1090 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/magenta.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/orange.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/orange.png new file mode 100644 index 000000000..5f15468d0 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/orange.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/pink.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/pink.png new file mode 100644 index 000000000..db040d77b Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/pink.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/purple.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/purple.png new file mode 100644 index 000000000..77c29c878 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/purple.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/red.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/red.png new file mode 100644 index 000000000..6479cd8bc Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/red.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/white.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/white.png new file mode 100644 index 000000000..358dc332a Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/white.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/yellow.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/yellow.png new file mode 100644 index 000000000..277ddfdc8 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/cutouts/yellow.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/front.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/front.png new file mode 100644 index 000000000..d6f059405 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/front.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/left.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/left.png new file mode 100644 index 000000000..a4a5b2664 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/left.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/right.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/right.png new file mode 100644 index 000000000..eb4e500c5 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/right.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/top.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/top.png new file mode 100644 index 000000000..0d782d2d0 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/block/pattern_grid/top.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/book.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/book.png deleted file mode 100644 index 0177cc462..000000000 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/book.png and /dev/null differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png index 2a76f3627..1ea3e7a81 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/crafting_grid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/grid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/grid.png index fdb2cc35c..427fe9486 100644 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/grid.png and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/grid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/pattern_grid.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/pattern_grid.png new file mode 100644 index 000000000..93b6d6014 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/pattern_grid.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/grid_row.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/grid_row.png new file mode 100644 index 000000000..1560972c8 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/grid_row.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/help.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/help.png new file mode 100644 index 000000000..08cf6a985 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/help.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/large_slot.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/large_slot.png new file mode 100644 index 000000000..6c21320cd Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/large_slot.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/left_mouse_button.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/left_mouse_button.png new file mode 100644 index 000000000..f04af00db Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/left_mouse_button.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/light_arrow.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/light_arrow.png new file mode 100644 index 000000000..da1309976 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/light_arrow.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/pattern_grid/crafting.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/pattern_grid/crafting.png new file mode 100644 index 000000000..6a5292443 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/pattern_grid/crafting.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/right_mouse_button.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/right_mouse_button.png new file mode 100644 index 000000000..a3a064570 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/right_mouse_button.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/slot.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/slot.png new file mode 100644 index 000000000..cc17511b2 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/slot.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/warning.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/warning.png new file mode 100644 index 000000000..411746fe9 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/warning.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear.png new file mode 100644 index 000000000..a297d3218 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_disabled.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_disabled.png new file mode 100644 index 000000000..56741f57e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_disabled.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_focused.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_focused.png new file mode 100644 index 000000000..6c773af48 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/clear_focused.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern.png new file mode 100644 index 000000000..5f8f20ae9 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_disabled.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_disabled.png new file mode 100644 index 000000000..02a6f7f2d Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_disabled.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_focused.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_focused.png new file mode 100644 index 000000000..75dc86a18 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/create_pattern_focused.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button.png new file mode 100644 index 000000000..e0f684b0f Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_disabled.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_disabled.png new file mode 100644 index 000000000..7e333b515 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_disabled.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_focused.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_focused.png new file mode 100644 index 000000000..19db51239 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/generic_small_button_focused.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/progress_bar.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/progress_bar.png new file mode 100644 index 000000000..18cf56099 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/progress_bar.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar.png new file mode 100644 index 000000000..38e03a8b4 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_clicked.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_clicked.png new file mode 100644 index 000000000..878229c51 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_clicked.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_disabled.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_disabled.png new file mode 100644 index 000000000..be4716e63 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/scrollbar_disabled.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button.png new file mode 100644 index 000000000..4db677977 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hover_overlay.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hover_overlay.png new file mode 100644 index 000000000..23ce7d710 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hover_overlay.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hovered.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hovered.png new file mode 100644 index 000000000..b9f6e0a35 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/sprites/widget/side_button_hovered.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/widgets.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/widgets.png deleted file mode 100644 index fbdd1ff04..000000000 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/gui/widgets.png and /dev/null differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/icons.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/icons.png deleted file mode 100644 index 280fe5627..000000000 Binary files a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/icons.png and /dev/null differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/crafting.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/crafting.png new file mode 100644 index 000000000..a23d840a5 Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/crafting.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/empty.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/empty.png new file mode 100644 index 000000000..5b838ac0e Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/item/pattern/empty.png differ diff --git a/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png new file mode 100644 index 000000000..505efb56a Binary files /dev/null and b/refinedstorage-common/src/main/resources/assets/refinedstorage/textures/side_button_icons.png differ diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern.json new file mode 100644 index 000000000..0ef8ac15b --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern.json @@ -0,0 +1,22 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "GRG", + "RGR", + "EEE" + ], + "key": { + "G": { + "tag": "c:glass_blocks" + }, + "R": { + "tag": "c:dusts/redstone" + }, + "E": { + "item": "refinedstorage:quartz_enriched_iron" + } + }, + "result": { + "id": "refinedstorage:pattern" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern_grid.json b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern_grid.json new file mode 100644 index 000000000..dfd7439b2 --- /dev/null +++ b/refinedstorage-common/src/main/resources/data/refinedstorage/recipe/pattern_grid.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "refinedstorage:grid" + }, + { + "item": "refinedstorage:advanced_processor" + }, + { + "item": "refinedstorage:pattern" + } + ], + "result": { + "id": "refinedstorage:pattern_grid" + } +} \ No newline at end of file diff --git a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java index 1a7fc620a..ac3bdd729 100644 --- a/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java +++ b/refinedstorage-common/src/test/java/com/refinedmods/refinedstorage/common/TestPlatform.java @@ -227,4 +227,9 @@ public NetworkNodeContainerProvider getContainerProviderSafely(final Level level @Nullable final Direction direction) { throw new UnsupportedOperationException(); } + + @Override + public int getItemColor(final ItemStack stack, final int tintIndex) { + throw new UnsupportedOperationException(); + } } diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java index cb00fd976..e8a6a0a07 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ClientModInitializerImpl.java @@ -4,6 +4,9 @@ import com.refinedmods.refinedstorage.common.AbstractClientModInitializer; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; import com.refinedmods.refinedstorage.common.api.upgrade.AbstractUpgradeItem; +import com.refinedmods.refinedstorage.common.autocrafting.CraftingPatternClientTooltipComponent; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItem; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItemColor; import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardItemPropertyFunction; import com.refinedmods.refinedstorage.common.content.BlockColorMap; import com.refinedmods.refinedstorage.common.content.BlockEntities; @@ -32,6 +35,7 @@ import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeItem; import com.refinedmods.refinedstorage.common.upgrade.UpgradeDestinationClientTooltipComponent; import com.refinedmods.refinedstorage.common.util.IdentifierUtil; +import com.refinedmods.refinedstorage.fabric.autocrafting.PatternUnbakedModel; import com.refinedmods.refinedstorage.fabric.mixin.ItemPropertiesAccessor; import com.refinedmods.refinedstorage.fabric.storage.diskdrive.DiskDriveBlockEntityRendererImpl; import com.refinedmods.refinedstorage.fabric.storage.diskdrive.DiskDriveUnbakedModel; @@ -51,6 +55,7 @@ import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.model.loading.v1.ModelLoadingPlugin; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.client.rendering.v1.TooltipComponentCallback; import net.minecraft.client.KeyMapping; import net.minecraft.client.gui.screens.MenuScreens; @@ -96,6 +101,7 @@ public > void registerResourceRendering(); registerAlternativeGridHints(); registerItemProperties(); + registerItemColors(); } private void setRenderLayers() { @@ -105,6 +111,7 @@ private void setRenderLayers() { setCutout(Blocks.INSTANCE.getCable()); setCutout(Blocks.INSTANCE.getGrid()); setCutout(Blocks.INSTANCE.getCraftingGrid()); + setCutout(Blocks.INSTANCE.getPatternGrid()); setCutout(Blocks.INSTANCE.getController()); setCutout(Blocks.INSTANCE.getCreativeController()); setCutout(Blocks.INSTANCE.getDetector()); @@ -133,6 +140,7 @@ private void registerEmissiveModels() { registerColoredEmissiveModels(Blocks.INSTANCE.getCreativeController(), "controller"); registerColoredEmissiveModels(Blocks.INSTANCE.getGrid(), "grid"); registerColoredEmissiveModels(Blocks.INSTANCE.getCraftingGrid(), "crafting_grid"); + registerColoredEmissiveModels(Blocks.INSTANCE.getPatternGrid(), "pattern_grid"); registerColoredEmissiveModels(Blocks.INSTANCE.getDetector(), "detector"); registerConstructorDestructorEmissiveModels(Blocks.INSTANCE.getConstructor(), "constructor"); registerConstructorDestructorEmissiveModels(Blocks.INSTANCE.getDestructor(), "destructor"); @@ -299,6 +307,7 @@ private void registerCustomModels() { registerCustomDiskDriveModels(pluginContext, quadRotators); registerCustomDiskInterfaceModels(pluginContext, quadRotators); registerCustomPortableGridModels(pluginContext, quadRotators); + registerCustomPatternModel(pluginContext); }); } @@ -362,14 +371,30 @@ private void registerCustomDiskDriveModels(final ModelLoadingPlugin.Context plug }); } + private void registerCustomPatternModel(final ModelLoadingPlugin.Context pluginContext) { + final ResourceLocation patternIdentifier = createIdentifier(ITEM_PREFIX + "/pattern"); + pluginContext.resolveModel().register(context -> { + if (context.id().equals(patternIdentifier)) { + return new PatternUnbakedModel(); + } + return null; + }); + } + private void registerCustomTooltips() { TooltipComponentCallback.EVENT.register(data -> { if (data instanceof AbstractUpgradeItem.UpgradeDestinationTooltipComponent component) { return new UpgradeDestinationClientTooltipComponent(component.destinations()); } + return null; + }); + TooltipComponentCallback.EVENT.register(data -> { if (data instanceof HelpTooltipComponent component) { return HelpClientTooltipComponent.create(component.text()); } + return null; + }); + TooltipComponentCallback.EVENT.register(data -> { if (data instanceof RegulatorUpgradeItem.RegulatorTooltipComponent component) { final ClientTooltipComponent help = HelpClientTooltipComponent.create(component.helpText()); return component.configuredResource() == null @@ -378,6 +403,20 @@ private void registerCustomTooltips() { } return null; }); + TooltipComponentCallback.EVENT.register(data -> { + if (data instanceof PatternItem.CraftingPatternTooltipComponent component) { + final ClientTooltipComponent help = HelpClientTooltipComponent.create(component.helpText()); + return new CompositeClientTooltipComponent(List.of( + new CraftingPatternClientTooltipComponent( + component.width(), + component.height(), + component.craftingPattern() + ), + help + )); + } + return null; + }); } private CompositeClientTooltipComponent createRegulatorUpgradeClientTooltipComponent( @@ -447,4 +486,8 @@ private void registerItemProperties() { new SecurityCardItemPropertyFunction() ); } + + private void registerItemColors() { + ColorProviderRegistry.ITEM.register(new PatternItemColor(), Items.INSTANCE.getPattern()); + } } diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ConfigImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ConfigImpl.java index 440f1fcbf..d9edce291 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ConfigImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ConfigImpl.java @@ -28,6 +28,9 @@ public class ConfigImpl implements ConfigData, com.refinedmods.refinedstorage.co @ConfigEntry.Gui.CollapsibleObject private GridEntryImpl grid = new GridEntryImpl(); + @ConfigEntry.Gui.CollapsibleObject + private SimpleEnergyUsageEntryImpl patternGrid = new SimpleEnergyUsageEntryImpl(DefaultEnergyUsage.PATTERN_GRID); + @ConfigEntry.Gui.CollapsibleObject private CraftingGridEntryImpl craftingGrid = new CraftingGridEntryImpl(); @@ -145,6 +148,11 @@ public GridEntry getGrid() { return grid; } + @Override + public SimpleEnergyUsageEntry getPatternGrid() { + return patternGrid; + } + @Override public CraftingGridEntry getCraftingGrid() { return craftingGrid; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java index 8387e7aef..c26312d02 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/ModInitializerImpl.java @@ -32,6 +32,8 @@ import com.refinedmods.refinedstorage.common.support.packet.c2s.GridExtractPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.GridInsertPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.GridScrollPacket; +import com.refinedmods.refinedstorage.common.support.packet.c2s.PatternGridClearPacket; +import com.refinedmods.refinedstorage.common.support.packet.c2s.PatternGridCreatePatternPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.PropertyChangePacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.ResourceFilterSlotChangePacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.ResourceSlotAmountChangePacket; @@ -420,6 +422,14 @@ private void registerClientToServerPackets() { CraftingGridClearPacket.PACKET_TYPE, CraftingGridClearPacket.STREAM_CODEC ); + PayloadTypeRegistry.playC2S().register( + PatternGridClearPacket.PACKET_TYPE, + PatternGridClearPacket.STREAM_CODEC + ); + PayloadTypeRegistry.playC2S().register( + PatternGridCreatePatternPacket.PACKET_TYPE, + PatternGridCreatePatternPacket.STREAM_CODEC + ); PayloadTypeRegistry.playC2S().register( CraftingGridRecipeTransferPacket.PACKET_TYPE, CraftingGridRecipeTransferPacket.STREAM_CODEC @@ -487,6 +497,14 @@ private void registerPacketHandlers() { CraftingGridClearPacket.PACKET_TYPE, wrapHandler(CraftingGridClearPacket::handle) ); + ServerPlayNetworking.registerGlobalReceiver( + PatternGridClearPacket.PACKET_TYPE, + wrapHandler((packet, ctx) -> PatternGridClearPacket.handle(ctx)) + ); + ServerPlayNetworking.registerGlobalReceiver( + PatternGridCreatePatternPacket.PACKET_TYPE, + wrapHandler((packet, ctx) -> PatternGridCreatePatternPacket.handle(ctx)) + ); ServerPlayNetworking.registerGlobalReceiver( CraftingGridRecipeTransferPacket.PACKET_TYPE, wrapHandler(CraftingGridRecipeTransferPacket::handle) @@ -540,6 +558,7 @@ private void registerCapabilities() { registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getConstructor()); registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getController()); registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getCraftingGrid()); + registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getPatternGrid()); registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getCreativeController()); registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getDestructor()); registerNetworkNodeContainerProvider(BlockEntities.INSTANCE.getDetector()); diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java index 169862220..8f5e05b2e 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/PlatformImpl.java @@ -40,6 +40,7 @@ import com.mojang.blaze3d.platform.InputConstants; import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking; +import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry; import net.fabricmc.fabric.api.entity.FakePlayer; import net.fabricmc.fabric.api.event.player.PlayerBlockBreakEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking; @@ -55,6 +56,7 @@ import net.fabricmc.fabric.impl.transfer.context.ConstantContainerItemContext; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; +import net.minecraft.client.color.item.ItemColor; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.EditBox; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; @@ -474,6 +476,15 @@ public NetworkNodeContainerProvider getContainerProviderSafely(final Level level ); } + @Override + public int getItemColor(final ItemStack stack, final int tintIndex) { + final ItemColor itemColor = ColorProviderRegistry.ITEM.get(stack.getItem()); + if (itemColor == null) { + return -1; + } + return itemColor.getColor(stack, tintIndex); + } + private void doSave(final CompoundTag compoundTag, final Path tempFile, final Path targetPath) throws IOException { // Write to temp file first. NbtIo.writeCompressed(compoundTag, tempFile); diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternBakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternBakedModel.java new file mode 100644 index 000000000..fc7f3ed44 --- /dev/null +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternBakedModel.java @@ -0,0 +1,24 @@ +package com.refinedmods.refinedstorage.fabric.autocrafting; + +import com.refinedmods.refinedstorage.common.autocrafting.PatternItemOverrides; + +import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelBaker; + +class PatternBakedModel extends ForwardingBakedModel { + private final ItemOverrides itemOverrides; + + PatternBakedModel(final ModelBaker modelBaker, + final BakedModel emptyModel, + final BakedModel craftingModel) { + this.wrapped = emptyModel; + this.itemOverrides = new PatternItemOverrides(modelBaker, emptyModel, craftingModel); + } + + @Override + public ItemOverrides getOverrides() { + return itemOverrides; + } +} diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternUnbakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternUnbakedModel.java new file mode 100644 index 000000000..08b2f3c8b --- /dev/null +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/PatternUnbakedModel.java @@ -0,0 +1,45 @@ +package com.refinedmods.refinedstorage.fabric.autocrafting; + +import java.util.Collection; +import java.util.Set; +import java.util.function.Function; +import javax.annotation.Nullable; + +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.client.resources.model.ModelState; +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.resources.ResourceLocation; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; +import static java.util.Objects.requireNonNull; + +public class PatternUnbakedModel implements UnbakedModel { + private static final ResourceLocation EMPTY_MODEL = createIdentifier("item/pattern/empty"); + private static final ResourceLocation CRAFTING_MODEL = createIdentifier("item/pattern/crafting"); + + @Override + public Collection getDependencies() { + return Set.of(EMPTY_MODEL, CRAFTING_MODEL); + } + + @Override + public void resolveParents(final Function resolver) { + resolver.apply(EMPTY_MODEL).resolveParents(resolver); + resolver.apply(CRAFTING_MODEL).resolveParents(resolver); + } + + @Nullable + @Override + public BakedModel bake(final ModelBaker baker, + final Function spriteGetter, + final ModelState state) { + return new PatternBakedModel( + baker, + requireNonNull(baker.bake(EMPTY_MODEL, state)), + requireNonNull(baker.bake(CRAFTING_MODEL, state)) + ); + } +} diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/package-info.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/package-info.java new file mode 100644 index 000000000..e72b75536 --- /dev/null +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/autocrafting/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage.fabric.autocrafting; + +import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/mixin/AbstractBlockEntityWithoutLevelRendererMixin.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/mixin/AbstractBlockEntityWithoutLevelRendererMixin.java new file mode 100644 index 000000000..49b593b88 --- /dev/null +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/mixin/AbstractBlockEntityWithoutLevelRendererMixin.java @@ -0,0 +1,34 @@ +package com.refinedmods.refinedstorage.fabric.mixin; + +import com.refinedmods.refinedstorage.common.autocrafting.PatternBlockEntityWithoutLevelRenderer; + +import com.mojang.blaze3d.vertex.PoseStack; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; +import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.world.item.ItemDisplayContext; +import net.minecraft.world.item.ItemStack; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +@Mixin(BlockEntityWithoutLevelRenderer.class) +public abstract class AbstractBlockEntityWithoutLevelRendererMixin { + @Inject(method = "renderByItem", at = @At("HEAD"), cancellable = true) + public void onRenderByItem(final ItemStack stack, + final ItemDisplayContext displayContext, + final PoseStack poseStack, + final MultiBufferSource buffer, + final int packedLight, + final int packedOverlay, + final CallbackInfo callbackInfo) { + PatternBlockEntityWithoutLevelRenderer.getInstance().renderByItem( + stack, + displayContext, + poseStack, + buffer, + packedLight, + packedOverlay + ); + } +} diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java index eab952169..03d3c9728 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/AbstractDiskContainerBakedModel.java @@ -3,6 +3,7 @@ import com.refinedmods.refinedstorage.api.storage.StorageState; import com.refinedmods.refinedstorage.common.storage.AbstractDiskContainerBlockEntity; import com.refinedmods.refinedstorage.common.storage.Disk; +import com.refinedmods.refinedstorage.common.util.PlatformUtil; import com.refinedmods.refinedstorage.fabric.support.render.QuadTranslator; import java.util.Map; @@ -11,7 +12,6 @@ import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; -import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; import net.minecraft.core.component.DataComponents; @@ -58,7 +58,7 @@ public void emitBlockQuads(final BlockAndTintGetter blockView, public void emitItemQuads(final ItemStack stack, final Supplier randomSupplier, final RenderContext context) { - final Level level = Minecraft.getInstance().level; + final Level level = PlatformUtil.getClientLevel(); final CustomData customData = stack.get(DataComponents.BLOCK_ENTITY_DATA); if (customData == null || level == null) { return; diff --git a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java index 12f8a67a7..2c490a217 100644 --- a/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java +++ b/refinedstorage-fabric/src/main/java/com/refinedmods/refinedstorage/fabric/storage/portablegrid/PortableGridBakedModel.java @@ -6,6 +6,7 @@ import com.refinedmods.refinedstorage.common.storage.portablegrid.PortableGridBlockItem; import com.refinedmods.refinedstorage.common.storage.portablegrid.PortableGridBlockItemRenderInfo; import com.refinedmods.refinedstorage.common.support.direction.BiDirection; +import com.refinedmods.refinedstorage.common.util.PlatformUtil; import com.refinedmods.refinedstorage.fabric.support.render.QuadRotators; import com.refinedmods.refinedstorage.fabric.support.render.QuadTranslator; @@ -14,14 +15,13 @@ import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel; import net.fabricmc.fabric.api.renderer.v1.render.RenderContext; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; import net.minecraft.client.resources.model.BakedModel; import net.minecraft.core.BlockPos; import net.minecraft.util.RandomSource; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockAndTintGetter; +import net.minecraft.world.level.Level; import net.minecraft.world.level.block.state.BlockState; public class PortableGridBakedModel extends ForwardingBakedModel { @@ -56,7 +56,7 @@ public boolean isVanillaAdapter() { public void emitItemQuads(final ItemStack stack, final Supplier randomSupplier, final RenderContext context) { - final ClientLevel level = Minecraft.getInstance().level; + final Level level = PlatformUtil.getClientLevel(); if (level == null) { return; } diff --git a/refinedstorage-fabric/src/main/resources/refinedstorage.accesswidener b/refinedstorage-fabric/src/main/resources/refinedstorage.accesswidener index fbb2da410..f65de0bc5 100644 --- a/refinedstorage-fabric/src/main/resources/refinedstorage.accesswidener +++ b/refinedstorage-fabric/src/main/resources/refinedstorage.accesswidener @@ -5,4 +5,5 @@ accessible method net/minecraft/client/renderer/RenderType create (Ljava/lang/St accessible class net/minecraft/client/resources/model/ModelBakery$BakedCacheKey accessible class net/minecraft/client/resources/model/ModelBakery$ModelBakerImpl accessible method net/minecraft/client/resources/model/ModelBakery$BakedCacheKey (Lnet/minecraft/resources/ResourceLocation;Lcom/mojang/math/Transformation;Z)V -accessible method net/minecraft/client/gui/GuiGraphics renderTooltipInternal (Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;)V \ No newline at end of file +accessible method net/minecraft/client/gui/GuiGraphics renderTooltipInternal (Lnet/minecraft/client/gui/Font;Ljava/util/List;IILnet/minecraft/client/gui/screens/inventory/tooltip/ClientTooltipPositioner;)V +accessible method net/minecraft/client/renderer/block/model/ItemOverrides ()V diff --git a/refinedstorage-fabric/src/main/resources/refinedstorage.mixins.json b/refinedstorage-fabric/src/main/resources/refinedstorage.mixins.json index f92e1683e..0fe893dcb 100644 --- a/refinedstorage-fabric/src/main/resources/refinedstorage.mixins.json +++ b/refinedstorage-fabric/src/main/resources/refinedstorage.mixins.json @@ -8,7 +8,8 @@ "EditBoxAccessor", "ItemPropertiesAccessor", "KeyMappingAccessor", - "ModelBakeryAccessor" + "ModelBakeryAccessor", + "AbstractBlockEntityWithoutLevelRendererMixin" ], "injectors": { "defaultRequire": 1 diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ClientModInitializer.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ClientModInitializer.java index bba37a5c7..d91397489 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ClientModInitializer.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ClientModInitializer.java @@ -4,6 +4,10 @@ import com.refinedmods.refinedstorage.common.AbstractClientModInitializer; import com.refinedmods.refinedstorage.common.api.support.HelpTooltipComponent; import com.refinedmods.refinedstorage.common.api.upgrade.AbstractUpgradeItem; +import com.refinedmods.refinedstorage.common.autocrafting.CraftingPatternClientTooltipComponent; +import com.refinedmods.refinedstorage.common.autocrafting.PatternBlockEntityWithoutLevelRenderer; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItem; +import com.refinedmods.refinedstorage.common.autocrafting.PatternItemColor; import com.refinedmods.refinedstorage.common.configurationcard.ConfigurationCardItemPropertyFunction; import com.refinedmods.refinedstorage.common.content.BlockEntities; import com.refinedmods.refinedstorage.common.content.Blocks; @@ -20,6 +24,7 @@ import com.refinedmods.refinedstorage.common.support.tooltip.ResourceClientTooltipComponent; import com.refinedmods.refinedstorage.common.upgrade.RegulatorUpgradeItem; import com.refinedmods.refinedstorage.common.upgrade.UpgradeDestinationClientTooltipComponent; +import com.refinedmods.refinedstorage.neoforge.autocrafting.PatternGeometryLoader; import com.refinedmods.refinedstorage.neoforge.storage.diskdrive.DiskDriveBlockEntityRendererImpl; import com.refinedmods.refinedstorage.neoforge.storage.diskdrive.DiskDriveGeometryLoader; import com.refinedmods.refinedstorage.neoforge.storage.diskinterface.DiskInterfaceBlockEntityRendererImpl; @@ -34,6 +39,7 @@ import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.inventory.MenuAccess; import net.minecraft.client.gui.screens.inventory.tooltip.ClientTooltipComponent; +import net.minecraft.client.renderer.BlockEntityWithoutLevelRenderer; import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; import net.minecraft.client.renderer.item.ItemProperties; import net.minecraft.world.inventory.AbstractContainerMenu; @@ -43,14 +49,18 @@ import net.neoforged.neoforge.client.event.InputEvent; import net.neoforged.neoforge.client.event.ModelEvent; import net.neoforged.neoforge.client.event.RegisterClientTooltipComponentFactoriesEvent; +import net.neoforged.neoforge.client.event.RegisterColorHandlersEvent; import net.neoforged.neoforge.client.event.RegisterKeyMappingsEvent; import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent; +import net.neoforged.neoforge.client.extensions.common.IClientItemExtensions; +import net.neoforged.neoforge.client.extensions.common.RegisterClientExtensionsEvent; import net.neoforged.neoforge.client.settings.KeyConflictContext; import net.neoforged.neoforge.client.settings.KeyModifier; import net.neoforged.neoforge.common.NeoForge; import org.lwjgl.glfw.GLFW; import static com.refinedmods.refinedstorage.common.content.ContentIds.DISK_DRIVE; +import static com.refinedmods.refinedstorage.common.content.ContentIds.PATTERN; import static com.refinedmods.refinedstorage.common.content.ContentIds.PORTABLE_GRID; import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; @@ -85,6 +95,7 @@ private static void registerModelPredicates() { @SubscribeEvent public static void onRegisterModelGeometry(final ModelEvent.RegisterGeometryLoaders e) { registerDiskModels(); + e.register(PATTERN, new PatternGeometryLoader()); e.register(DISK_DRIVE, new DiskDriveGeometryLoader()); e.register(PORTABLE_GRID, new PortableGridGeometryLoader()); Blocks.INSTANCE.getDiskInterface().forEach( @@ -177,6 +188,21 @@ private static void registerBlockEntityRenderer() { ); } + @SubscribeEvent + public static void onRegisterItemColors(final RegisterColorHandlersEvent.Item e) { + e.register(new PatternItemColor(), Items.INSTANCE.getPattern()); + } + + @SubscribeEvent + public static void onRegisterClientExtensions(final RegisterClientExtensionsEvent e) { + e.registerItem(new IClientItemExtensions() { + @Override + public BlockEntityWithoutLevelRenderer getCustomRenderer() { + return PatternBlockEntityWithoutLevelRenderer.getInstance(); + } + }, Items.INSTANCE.getPattern()); + } + @SubscribeEvent public static void onRegisterTooltipFactories(final RegisterClientTooltipComponentFactoriesEvent e) { e.register( @@ -196,6 +222,20 @@ public static void onRegisterTooltipFactories(final RegisterClientTooltipCompone : createRegulatorUpgradeClientTooltipComponent(component.configuredResource(), help); } ); + e.register( + PatternItem.CraftingPatternTooltipComponent.class, + component -> { + final ClientTooltipComponent help = HelpClientTooltipComponent.create(component.helpText()); + return new CompositeClientTooltipComponent(List.of( + new CraftingPatternClientTooltipComponent( + component.width(), + component.height(), + component.craftingPattern() + ), + help + )); + } + ); } private static CompositeClientTooltipComponent createRegulatorUpgradeClientTooltipComponent( diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java index 9a4322505..1fe2b5685 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ConfigImpl.java @@ -30,6 +30,7 @@ public class ConfigImpl implements Config { private final DiskInterfaceEntry diskInterface; private final GridEntry grid; private final CraftingGridEntry craftingGrid; + private final SimpleEnergyUsageEntry patternGrid; private final StorageBlockEntry storageBlock; private final FluidStorageBlockEntry fluidStorageBlock; private final SimpleEnergyUsageEntry importer; @@ -67,6 +68,7 @@ public ConfigImpl() { diskInterface = new DiskInterfaceEntryImpl(); grid = new GridEntryImpl(); craftingGrid = new CraftingGridEntryImpl(); + patternGrid = new SimpleEnergyUsageEntryImpl("patternGrid", DefaultEnergyUsage.PATTERN_GRID); storageBlock = new StorageBlockEntryImpl(); fluidStorageBlock = new FluidStorageBlockEntryImpl(); importer = new SimpleEnergyUsageEntryImpl("importer", DefaultEnergyUsage.IMPORTER); @@ -125,6 +127,11 @@ public GridEntry getGrid() { return grid; } + @Override + public SimpleEnergyUsageEntry getPatternGrid() { + return patternGrid; + } + @Override public CraftingGridEntry getCraftingGrid() { return craftingGrid; diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java index a338ab84a..bde69c78a 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/ModInitializer.java @@ -32,6 +32,8 @@ import com.refinedmods.refinedstorage.common.support.packet.c2s.GridExtractPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.GridInsertPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.GridScrollPacket; +import com.refinedmods.refinedstorage.common.support.packet.c2s.PatternGridClearPacket; +import com.refinedmods.refinedstorage.common.support.packet.c2s.PatternGridCreatePatternPacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.PropertyChangePacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.ResourceFilterSlotChangePacket; import com.refinedmods.refinedstorage.common.support.packet.c2s.ResourceSlotAmountChangePacket; @@ -173,6 +175,8 @@ public ModInitializer(final IEventBus eventBus, final ModContainer modContainer) eventBus.addListener(ClientModInitializer::onRegisterModelGeometry); eventBus.addListener(ClientModInitializer::onRegisterMenuScreens); eventBus.addListener(ClientModInitializer::onRegisterKeyMappings); + eventBus.addListener(ClientModInitializer::onRegisterItemColors); + eventBus.addListener(ClientModInitializer::onRegisterClientExtensions); eventBus.addListener(ClientModInitializer::onRegisterTooltipFactories); modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new); } @@ -379,6 +383,7 @@ private void registerCapabilities(final RegisterCapabilitiesEvent event) { registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getConstructor()); registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getController()); registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getCraftingGrid()); + registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getPatternGrid()); registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getCreativeController()); registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getDestructor()); registerNetworkNodeContainerProvider(event, BlockEntities.INSTANCE.getDetector()); @@ -602,6 +607,16 @@ private static void registerClientToServerPackets(final PayloadRegistrar registr CraftingGridClearPacket.STREAM_CODEC, wrapHandler(CraftingGridClearPacket::handle) ); + registrar.playToServer( + PatternGridClearPacket.PACKET_TYPE, + PatternGridClearPacket.STREAM_CODEC, + wrapHandler((packet, ctx) -> PatternGridClearPacket.handle(ctx)) + ); + registrar.playToServer( + PatternGridCreatePatternPacket.PACKET_TYPE, + PatternGridCreatePatternPacket.STREAM_CODEC, + wrapHandler((packet, ctx) -> PatternGridCreatePatternPacket.handle(ctx)) + ); registrar.playToServer( CraftingGridRecipeTransferPacket.PACKET_TYPE, CraftingGridRecipeTransferPacket.STREAM_CODEC, diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java index acf8618a4..c660a3a0c 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/PlatformImpl.java @@ -398,4 +398,9 @@ public NetworkNodeContainerProvider getContainerProviderSafely(final Level level direction ); } + + @Override + public int getItemColor(final ItemStack stack, final int tintIndex) { + return Minecraft.getInstance().getItemColors().getColor(stack, tintIndex); + } } diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternBakedModel.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternBakedModel.java new file mode 100644 index 000000000..144b5f4bd --- /dev/null +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternBakedModel.java @@ -0,0 +1,22 @@ +package com.refinedmods.refinedstorage.neoforge.autocrafting; + +import com.refinedmods.refinedstorage.common.autocrafting.PatternItemOverrides; + +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.ModelBaker; +import net.neoforged.neoforge.client.model.BakedModelWrapper; + +class PatternBakedModel extends BakedModelWrapper { + private final ItemOverrides itemOverrides; + + PatternBakedModel(final ModelBaker modelBaker, final BakedModel emptyModel, final BakedModel craftingModel) { + super(emptyModel); + this.itemOverrides = new PatternItemOverrides(modelBaker, emptyModel, craftingModel); + } + + @Override + public ItemOverrides getOverrides() { + return itemOverrides; + } +} diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternGeometryLoader.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternGeometryLoader.java new file mode 100644 index 000000000..58aef78e1 --- /dev/null +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternGeometryLoader.java @@ -0,0 +1,15 @@ +package com.refinedmods.refinedstorage.neoforge.autocrafting; + +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import net.neoforged.neoforge.client.model.geometry.IGeometryLoader; + +public class PatternGeometryLoader implements IGeometryLoader { + @Override + public PatternUnbakedGeometry read(final JsonObject jsonObject, + final JsonDeserializationContext jsonDeserializationContext) + throws JsonParseException { + return new PatternUnbakedGeometry(); + } +} diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternUnbakedGeometry.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternUnbakedGeometry.java new file mode 100644 index 000000000..dcd6221af --- /dev/null +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/PatternUnbakedGeometry.java @@ -0,0 +1,42 @@ +package com.refinedmods.refinedstorage.neoforge.autocrafting; + +import java.util.function.Function; + +import net.minecraft.client.renderer.block.model.ItemOverrides; +import net.minecraft.client.renderer.texture.TextureAtlasSprite; +import net.minecraft.client.resources.model.BakedModel; +import net.minecraft.client.resources.model.Material; +import net.minecraft.client.resources.model.ModelBaker; +import net.minecraft.client.resources.model.ModelState; +import net.minecraft.client.resources.model.UnbakedModel; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.neoforge.client.model.geometry.IGeometryBakingContext; +import net.neoforged.neoforge.client.model.geometry.IUnbakedGeometry; + +import static com.refinedmods.refinedstorage.common.util.IdentifierUtil.createIdentifier; +import static java.util.Objects.requireNonNull; + +public class PatternUnbakedGeometry implements IUnbakedGeometry { + private static final ResourceLocation EMPTY_MODEL = createIdentifier("item/pattern/empty"); + private static final ResourceLocation CRAFTING_MODEL = createIdentifier("item/pattern/crafting"); + + @Override + public BakedModel bake(final IGeometryBakingContext ctx, + final ModelBaker modelBaker, + final Function function, + final ModelState modelState, + final ItemOverrides itemOverrides) { + return new PatternBakedModel( + modelBaker, + requireNonNull(modelBaker.bake(EMPTY_MODEL, modelState, function)), + requireNonNull(modelBaker.bake(CRAFTING_MODEL, modelState, function)) + ); + } + + @Override + public void resolveParents(final Function modelGetter, + final IGeometryBakingContext context) { + modelGetter.apply(EMPTY_MODEL).resolveParents(modelGetter); + modelGetter.apply(CRAFTING_MODEL).resolveParents(modelGetter); + } +} diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/package-info.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/package-info.java new file mode 100644 index 000000000..078def6f5 --- /dev/null +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/autocrafting/package-info.java @@ -0,0 +1,7 @@ +@ParametersAreNonnullByDefault +@FieldsAndMethodsAreNonnullByDefault +package com.refinedmods.refinedstorage.neoforge.autocrafting; + +import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockModelProviderImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockModelProviderImpl.java index b605ffb32..aee8cee99 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockModelProviderImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockModelProviderImpl.java @@ -50,6 +50,7 @@ protected void registerModels() { registerControllers(); registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getGrid(), "grid", ""); registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getCraftingGrid(), "crafting_grid", ""); + registerRightLeftBackFrontTopModel(Blocks.INSTANCE.getPatternGrid(), "pattern_grid", ""); registerDetectors(); registerWirelessTransmitters(); registerNetworkReceivers(); diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockStateProviderImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockStateProviderImpl.java index 43071d965..b8f689113 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockStateProviderImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/BlockStateProviderImpl.java @@ -162,6 +162,11 @@ private void registerGrids() { block, "crafting_grid" )); + Blocks.INSTANCE.getPatternGrid().forEach((color, id, block) -> configureActiveColoredDirectionalBlock( + color, + block, + "pattern_grid" + )); } private void registerControllers() { diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java index 19f52a8ad..3eb2074d0 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/ItemModelProviderImpl.java @@ -41,6 +41,7 @@ protected void registerModels() { registerCreativeControllers(); registerGrids(); registerCraftingGrids(); + registerPatternGrids(); registerDetectors(); registerConstructors(); registerDestructors(); @@ -128,6 +129,14 @@ private void registerCraftingGrids() { )); } + private void registerPatternGrids() { + final var blocks = Blocks.INSTANCE.getPatternGrid(); + blocks.forEach((color, id, block) -> withExistingParent( + id.getPath(), + createIdentifier("block/pattern_grid/" + color.getName()) + )); + } + private void registerDetectors() { final var blocks = Blocks.INSTANCE.getDetector(); blocks.forEach((color, id, block) -> withExistingParent( diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java index 0a547cf1a..801c31c73 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/loot/BlockDropProvider.java @@ -22,6 +22,7 @@ protected void generate() { Blocks.INSTANCE.getCable().forEach((color, id, block) -> dropSelf(block.get())); Blocks.INSTANCE.getGrid().forEach((color, id, block) -> dropSelf(block.get())); Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> dropSelf(block.get())); + Blocks.INSTANCE.getPatternGrid().forEach((color, id, block) -> dropSelf(block.get())); Blocks.INSTANCE.getController().forEach((color, id, block) -> add( block.get(), createSingleItemTable(block.get()).apply(EnergyLootItemFunction::new) @@ -44,6 +45,7 @@ protected Iterable getKnownBlocks() { blocks.addAll(Blocks.INSTANCE.getCable().values()); blocks.addAll(Blocks.INSTANCE.getGrid().values()); blocks.addAll(Blocks.INSTANCE.getCraftingGrid().values()); + blocks.addAll(Blocks.INSTANCE.getPatternGrid().values()); blocks.addAll(Blocks.INSTANCE.getController().values()); blocks.addAll(Blocks.INSTANCE.getCreativeController().values()); blocks.addAll(Blocks.INSTANCE.getDetector().values()); diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/recipe/RecoloringRecipeProvider.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/recipe/RecoloringRecipeProvider.java index 15672a360..83755c5f3 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/recipe/RecoloringRecipeProvider.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/recipe/RecoloringRecipeProvider.java @@ -47,6 +47,9 @@ protected void buildRecipes(final RecipeOutput output) { Blocks.INSTANCE.getCraftingGrid().forEach((color, id, block) -> recipe(Tags.CRAFTING_GRIDS, block.get().asItem(), color) .save(output, recipeId(color, "crafting_grid"))); + Blocks.INSTANCE.getPatternGrid().forEach((color, id, block) -> + recipe(Tags.PATTERN_GRIDS, block.get().asItem(), color) + .save(output, recipeId(color, "pattern_grid"))); Blocks.INSTANCE.getDetector().forEach((color, id, block) -> recipe(Tags.DETECTORS, block.get().asItem(), color) .save(output, recipeId(color, "detector"))); diff --git a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/tag/ItemTagsProviderImpl.java b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/tag/ItemTagsProviderImpl.java index d9e4687db..fa228fc71 100644 --- a/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/tag/ItemTagsProviderImpl.java +++ b/refinedstorage-neoforge/src/main/java/com/refinedmods/refinedstorage/neoforge/datagen/tag/ItemTagsProviderImpl.java @@ -35,6 +35,7 @@ import static com.refinedmods.refinedstorage.common.content.Tags.IMPORTERS; import static com.refinedmods.refinedstorage.common.content.Tags.NETWORK_RECEIVERS; import static com.refinedmods.refinedstorage.common.content.Tags.NETWORK_TRANSMITTERS; +import static com.refinedmods.refinedstorage.common.content.Tags.PATTERN_GRIDS; import static com.refinedmods.refinedstorage.common.content.Tags.RELAYS; import static com.refinedmods.refinedstorage.common.content.Tags.SECURITY_MANAGERS; import static com.refinedmods.refinedstorage.common.content.Tags.STORAGE_DISKS; @@ -71,6 +72,10 @@ protected void addTags(final HolderLookup.Provider provider) { Blocks.INSTANCE.getCraftingGrid().values().stream() .map(block -> (Supplier) block::asItem) .toList()); + addAllToTag(PATTERN_GRIDS, + Blocks.INSTANCE.getPatternGrid().values().stream() + .map(block -> (Supplier) block::asItem) + .toList()); addAllToTag(STORAGE_DISKS, Arrays.stream(ItemStorageVariant.values()) .filter(variant -> variant != ItemStorageVariant.CREATIVE) diff --git a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java index fee7f5328..b78757abb 100644 --- a/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java +++ b/refinedstorage-neoforge/src/test/java/com/refinedmods/refinedstorage/common/GameTestUtil.java @@ -168,6 +168,7 @@ private static Runnable resourceContainerContainsExactly(final GameTestHelper he final ResourceContainer container, final ResourceAmount... expected) { return () -> { + // todo: investigate issue with EnderIO integration // TODO: This does not take duplicate ResourceAmount into account for (final ResourceAmount expectedStack : expected) { final boolean contains = IntStream.range(0, container.size())