Skip to content

Commit

Permalink
works in adventure
Browse files Browse the repository at this point in the history
HOW WAS THIS NOT FOUND
  • Loading branch information
TropheusJ committed Oct 5, 2022
1 parent ea39172 commit f9592b8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/main/java/one/devos/nautical/succ/mixin/ItemStackMixin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package one.devos.nautical.succ.mixin;

import net.minecraft.core.Registry;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;

import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.pattern.BlockInWorld;

import one.devos.nautical.succ.Succ;

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.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ItemStack.class)
public abstract class ItemStackMixin {
@Shadow
public abstract boolean is(Item item);

@Inject(method = "hasAdventureModePlaceTagForBlock", at = @At("HEAD"), cancellable = true)
private void succ$allowAdventureClimbing(Registry<Block> blockRegistry, BlockInWorld pos, CallbackInfoReturnable<Boolean> cir) {
if (is(Succ.SUCTION_CUP)) {
cir.setReturnValue(Boolean.TRUE);
}
}
}
1 change: 1 addition & 0 deletions src/main/resources/succ.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"package": "one.devos.nautical.succ.mixin",
"compatibilityLevel": "JAVA_17",
"mixins": [
"ItemStackMixin",
"ServerGamePacketListenerImplMixin",
"ServerPlayerGameModeMixin",
"TeleportCommandMixin",
Expand Down

1 comment on commit f9592b8

@asoji
Copy link
Member

@asoji asoji commented on f9592b8 Oct 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HOW WAS THIS NOT FOUND

tfw when everyone thought they tested it

Please sign in to comment.