Enchanting Infuser [Forge & Fabric]

Enchanting Infuser [Forge & Fabric]

3M Downloads

How can i limit the infuser to only work with player in a scpecific team ? #2

RulsOfficial opened this issue ยท 1 comments

commented

Mod Loader (Optional)

Fabric

Minecraft Version(s) (Optional)

1.20.1

Mod Version(s) (Optional)

No response

Suggestion (Required)

(in response to the last reply in the other issue)
Thats what i though, but it doesnt seem to work, here is the code i originally write to no avail:
@Override public InteractionResult use(BlockState state, Level level, BlockPos pos, Player player, InteractionHand interactionHand, BlockHitResult hitResult) { if (player.getScoreboardTeam() != null && player.getScoreboardTeam().getName().equals("Enchanter")) { if (level.getBlockEntity(pos) instanceof InfuserBlockEntity blockEntity) { if (!level.isClientSide) { player.openMenu(state.getMenuProvider(level, pos)); // items might still be in inventory slots, so this needs to update so that enchantment buttons are shown player.containerMenu.slotsChanged(blockEntity); } return InteractionResult.sidedSuccess(level.isClientSide); } return InteractionResult.PASS; }
Im pretty sure the methods are right since i have used them in another mod, even importing MinecraftClient doesnt seem to work, even getting de player with serverPlayer cant solve the issue...

commented

figured out on my own