Skip to content

Commit

Permalink
Update backslot compat, fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Jan 3, 2022
1 parent 4cc2d6d commit cc48b68
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.time.Year

plugins {
id 'fabric-loom' version '0.10-SNAPSHOT'
id 'io.github.juuxel.loom-quiltflower-mini' version "1.2.1"
id 'org.cadixdev.licenser' version '0.6.1'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.jfrog.artifactory' version '4.21.0'
Expand Down
6 changes: 6 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
------------------------------------------------------
Version 0.6.1
------------------------------------------------------
**Mod Compatibility**
- Fixed crash at launch with BackSlot

------------------------------------------------------
Version 0.6.0
------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.18-pre7
yarn_mappings=1.18-pre7+build.4
minecraft_version=1.18.1
yarn_mappings=1.18.1+build.12
loader_version=0.12.5

# Mod Properties
mod_version = 0.6.0
mod_version = 0.6.1
maven_group = io.github.ladysnake
archives_base_name = locki

Expand All @@ -17,7 +17,7 @@ org.gradle.jvmargs=-Xmx1G
fabric_version=0.43.0+1.18
cca_version = 3.1.1
fpa_version=0.1-SNAPSHOT
backslot_version=3504133
backslot_version=3543530
cloth_config_version=5.0.34
modmenu_version=3.0.0
# Publishing
Expand Down
4 changes: 4 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ pluginManagement {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven {
name = 'Cotton'
url = 'https://server.bbkr.space/artifactory/libs-release/'
}
gradlePluginPortal()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,17 @@
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import org.spongepowered.asm.mixin.Dynamic;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(SwitchPacket.class)
@Mixin(SwitchPacket.SwitchPacketReceiver.class)
public abstract class SwitchPacketMixin {
@Shadow public static native boolean isItemAllowed(ItemStack stack, int slot);

@Dynamic("Lambda handler for SWITCH_PACKET")
@Redirect(method = "lambda$init$0", at = @At(value = "INVOKE", target = "Lnet/backslot/network/SwitchPacket;isItemAllowed(Lnet/minecraft/item/ItemStack;I)Z"))
@Redirect(method = "receive", at = @At(value = "INVOKE", target = "Lnet/backslot/network/SwitchPacket;isItemAllowed(Lnet/minecraft/item/ItemStack;I)Z"))
private static boolean lockAdditionalSlots(ItemStack stack, int slot, MinecraftServer server, ServerPlayerEntity player) {
if (InventoryKeeper.get(player).isSlotLocked(slot)) {
return false;
}
return isItemAllowed(stack, slot);
return SwitchPacket.isItemAllowed(stack, slot);
}
}

0 comments on commit cc48b68

Please sign in to comment.