Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Curios be used as Ender Masks #196

Closed
Nyfaria opened this issue Dec 20, 2021 · 0 comments
Closed

Curios be used as Ender Masks #196

Nyfaria opened this issue Dec 20, 2021 · 0 comments
Assignees
Labels
type: enhancement New feature or request

Comments

@Nyfaria
Copy link

Nyfaria commented Dec 20, 2021

Please describe the new feature or change.

Well the name describes it all really.

Please describe why you want this feature.

Mostly for personal use but im certain many people would love to not have to Mixin this themselves.

Here is my Mixin so you can go off it, im sure it wont look the same because im using the API and yours will be directly in the mod:

@Mixin(EnderMan.class)
public class EnderMaskMixin {

    boolean found = false;

    @Inject(method = "isLookingAtMe", at = @At("HEAD"), cancellable = true)
    public void curioEnderMask(Player player, CallbackInfoReturnable<Boolean> cir) {
        found = false;
        CuriosApi.getCuriosHelper().getEquippedCurios(player).ifPresent(e -> {
            for (int i = 0; i < e.getSlots(); i++) {
                ItemStack itemStack = e.getStackInSlot(i);
                if (itemStack.getItem().isEnderMask(itemStack, player, (EnderMan) (Object) this)) {
                    found = true;
                }
            }
        });
        if(found){
            cir.setReturnValue(false);
        }
    }
}
@Nyfaria Nyfaria added the type: enhancement New feature or request label Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants