Skip to content

Commit

Permalink
Readded Quick Shulker Compat
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Dec 3, 2021
1 parent 120de45 commit 3dda32f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.kotlindiscord.com/repository/terraformers/" }
maven {url "https://maven.kyrptonaught.dev"}
maven { url "https://maven.terraformersmc.com/releases"}
}

dependencies {
Expand All @@ -29,7 +30,7 @@ dependencies {
}
modApi("com.terraformersmc:modmenu:${project.modmenu_version}")

//modImplementation('net.kyrptonaught:quickshulker:1.2.2-1.17')
modImplementation('net.kyrptonaught:quickshulker:1.3.1-1.18')
}

processResources {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn_mappings=1.18+build.1
loader_version=0.12.6

# Mod Properties
mod_version=2.4.0-1.18.0
mod_version=2.5.0-1.18.0
maven_group=de.dafuqs.lootcrates
archives_base_name=ModularLootcrates

Expand Down
24 changes: 22 additions & 2 deletions src/main/java/de/dafuqs/lootcrates/compat/QuickShulkerCompat.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*package de.dafuqs.lootcrates.compat;
package de.dafuqs.lootcrates.compat;

import de.dafuqs.lootcrates.LootCrateAtlas;
import de.dafuqs.lootcrates.LootCrates;
import de.dafuqs.lootcrates.blocks.barrel.LootBarrelBlock;
import de.dafuqs.lootcrates.blocks.chest.ChestLootCrateBlock;
import de.dafuqs.lootcrates.blocks.shulker.ShulkerLootCrateBlock;
import de.dafuqs.lootcrates.enums.LootCrateRarity;
Expand Down Expand Up @@ -42,6 +43,7 @@ public class QuickShulkerCompat implements RegisterQuickShulker {
public void registerProviders() {
QuickOpenableRegistry.register(ShulkerLootCrateBlock.class, true, false, ((player, stack) -> {
if (LootCrates.CONFIG.ShulkerCratesKeepTheirInventory) {
checkRelock(player, stack);
if (isLocked(stack)) {
if(consumeKey(player, LootCrateAtlas.getCrateItemRarity(stack.getItem()))) {
unlock(player, stack);
Expand All @@ -58,6 +60,7 @@ public void registerProviders() {

QuickOpenableRegistry.register(ChestLootCrateBlock.class, true, false, ((player, stack) -> {
if (LootCrates.CONFIG.ChestCratesKeepTheirInventory) {
checkRelock(player, stack);
if (isLocked(stack)) {
if(consumeKey(player, LootCrateAtlas.getCrateItemRarity(stack.getItem()))) {
unlock(player, stack);
Expand All @@ -71,6 +74,23 @@ public void registerProviders() {
}
}
}));

QuickOpenableRegistry.register(LootBarrelBlock.class, true, false, ((player, stack) -> {
if (LootCrates.CONFIG.LootBarrelsKeepTheirInventory) {
checkRelock(player, stack);
if (isLocked(stack)) {
if(consumeKey(player, LootCrateAtlas.getCrateItemRarity(stack.getItem()))) {
unlock(player, stack);
} else {
printLockedMessage(player, stack);
}
} else {
checkLootInteraction(stack, (ServerPlayerEntity) player);
player.openHandledScreen(new SimpleNamedScreenHandlerFactory((i, playerInventory, playerEntity) ->
new ShulkerBoxScreenHandler(i, player.getInventory(), ShulkerUtils.getInventoryFromShulker(stack)), stack.hasCustomName() ? stack.getName() : new TranslatableText("container.lootcrates.loot_barrel")));
}
}
}));
}

private boolean isLocked(ItemStack stack) {
Expand Down Expand Up @@ -237,4 +257,4 @@ public void saveNbtToStack(ItemStack stack, long lastReplenishTimeTick, boolean
}
}
}
}*/
}

0 comments on commit 3dda32f

Please sign in to comment.