Skip to content

Commit

Permalink
Merge pull request #636 from refinedmods/feat/GH-104/pattern-grid
Browse files Browse the repository at this point in the history
feat: pattern grid and pattern
  • Loading branch information
raoulvdberge authored Jul 29, 2024
2 parents ba0ab59 + 81e91ac commit 112ec9f
Show file tree
Hide file tree
Showing 267 changed files with 5,723 additions and 171 deletions.
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,3 @@ project.extensions.getByType<SonarExtension>().apply {
)
}
}

allprojects {
apply(plugin = "maven-publish")
publishing {
repositories {
mavenLocal()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -200,4 +201,6 @@ EnergyStorage asBlockItemEnergyStorage(
void sendNoPermissionMessage(ServerPlayer player, Component message);

boolean canPlaceNetworkNode(ServerPlayer player, Level level, BlockPos pos, BlockState state);

Optional<Pattern> getPattern(ItemStack stack, Level level);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -395,6 +396,11 @@ public boolean canPlaceNetworkNode(final ServerPlayer player,
return ensureLoaded().canPlaceNetworkNode(player, level, pos, state);
}

@Override
public Optional<Pattern> 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");
Expand Down
Original file line number Diff line number Diff line change
@@ -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<List<PlatformResourceKey>> inputs,
ResourceAmount output,
List<ResourceAmount> byproducts) implements Pattern {
@Override
public Collection<ResourceAmount> getOutputs() {
return List.of(output);
}
}
Original file line number Diff line number Diff line change
@@ -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<ResourceAmount> getOutputs();
}
Original file line number Diff line number Diff line change
@@ -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<Pattern> getPattern(ItemStack stack, Level level);
}
Original file line number Diff line number Diff line change
@@ -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<List<ResourceAmount>> inputs, List<ResourceAmount> outputs) implements Pattern {
@Override
public Collection<ResourceAmount> getOutputs() {
return outputs;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ParametersAreNonnullByDefault
@FieldsAndMethodsAreNonnullByDefault
package com.refinedmods.refinedstorage.common.api.autocrafting;

import com.refinedmods.refinedstorage.api.core.FieldsAndMethodsAreNonnullByDefault;

import javax.annotation.ParametersAreNonnullByDefault;
Original file line number Diff line number Diff line change
@@ -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
}
}
}
Original file line number Diff line number Diff line change
@@ -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
}
}
}
Loading

0 comments on commit 112ec9f

Please sign in to comment.