Skip to content

Commit

Permalink
Merge pull request #42 from Sefiraat/fix/distinctive_item
Browse files Browse the repository at this point in the history
Fix distinction
  • Loading branch information
Sefiraat authored Jul 20, 2023
2 parents f2a8ab1 + 2b90f97 commit aa6c220
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@
<dependency>
<groupId>com.github.Slimefun</groupId>
<artifactId>Slimefun4</artifactId>
<version>2c4f886</version>
<version>RC-35</version>
<scope>provided</scope>
</dependency>

<!-- Tools etc. -->
<dependency>
<groupId>org.bstats</groupId>
<artifactId>bstats-bukkit</artifactId>
<version>3.0.0</version>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -136,7 +136,7 @@
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -150,19 +150,19 @@
<dependency>
<groupId>com.gmail.nossr50.mcMMO</groupId>
<artifactId>mcMMO</artifactId>
<version>2.1.214</version>
<version>2.1.222</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.bgsoftware</groupId>
<artifactId>WildStackerAPI</artifactId>
<version>3.8.0</version>
<version>2023.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>dev.rosewood</groupId>
<artifactId>rosestacker</artifactId>
<version>1.4.12</version>
<version>1.5.9</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void newInstance(@NotNull BlockMenu menu, @NotNull Block b) {

private boolean testRecipe(ItemStack[] input, ItemStack[] recipe) {
for (int test = 0; test < recipe.length; test++) {
if (!SlimefunUtils.isItemSimilar(input[test], recipe[test], true, false)) {
if (!SlimefunUtils.isItemSimilar(input[test], recipe[test], true, false, false)) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.items.settings.IntRangeSetting;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.DistinctiveItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock;
import lombok.Getter;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;

public class DankPack extends UnplaceableBlock {
public class DankPack extends UnplaceableBlock implements DistinctiveItem {

@Getter
private final int tier;
Expand All @@ -25,4 +28,9 @@ public DankPack(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeTy
this.capacityPerSlot = new IntRangeSetting(this, "capacity_per_slot", 1, defaultCapacity, Integer.MAX_VALUE);
addItemSetting(capacityPerSlot);
}

@Override
public boolean canStack(@NotNull ItemMeta itemMeta, @NotNull ItemMeta itemMeta1) {
return itemMeta1.getPersistentDataContainer().equals(itemMeta.getPersistentDataContainer());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
import io.github.thebusybiscuit.slimefun4.api.items.ItemGroup;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.thebusybiscuit.slimefun4.api.recipes.RecipeType;
import io.github.thebusybiscuit.slimefun4.core.attributes.DistinctiveItem;
import io.github.thebusybiscuit.slimefun4.implementation.items.blocks.UnplaceableBlock;
import lombok.Getter;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.jetbrains.annotations.NotNull;

public class TrashPack extends UnplaceableBlock {
public class TrashPack extends UnplaceableBlock implements DistinctiveItem {

@Getter
private final int tier;
Expand All @@ -19,4 +22,9 @@ public TrashPack(ItemGroup itemGroup, SlimefunItemStack item, RecipeType recipeT
this.tier = tier;
this.slots = tier * 2;
}

@Override
public boolean canStack(@NotNull ItemMeta itemMeta, @NotNull ItemMeta itemMeta1) {
return itemMeta1.getPersistentDataContainer().equals(itemMeta.getPersistentDataContainer());
}
}

0 comments on commit aa6c220

Please sign in to comment.