Search in sources :

Example 1 with HeldItemTooltips

use of me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.HeldItemTooltips in project BedrockIfy by juancarloscp52.

the class BedrockifyClient method onInitializeClient.

@Override
public void onInitializeClient() {
    LOGGER.info("Initializing BedrockIfy Client.");
    overlay = new Overlay((MinecraftClient.getInstance()));
    reachAroundPlacement = new ReachAroundPlacement(MinecraftClient.getInstance());
    heldItemTooltips = new HeldItemTooltips();
    settingsGUI = new SettingsGUI();
    keyBinding = KeyBindingHelper.registerKeyBinding(new KeyBinding("bedrockIfy.key.settings", InputUtil.Type.KEYSYM, GLFW.GLFW_KEY_B, "BedrockIfy"));
    ClientTickEvents.END_CLIENT_TICK.register(client -> {
        while (keyBinding.wasPressed()) {
            client.openScreen(settingsGUI.getConfigScreen(client.currentScreen, true));
        }
    });
    instance = this;
}
Also used : KeyBinding(net.minecraft.client.options.KeyBinding) SettingsGUI(me.juancarloscp52.bedrockify.client.gui.SettingsGUI) Overlay(me.juancarloscp52.bedrockify.client.gui.overlay.Overlay) ReachAroundPlacement(me.juancarloscp52.bedrockify.client.features.ReachAroundPlacement) HeldItemTooltips(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.HeldItemTooltips)

Example 2 with HeldItemTooltips

use of me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.HeldItemTooltips in project BedrockIfy by juancarloscp52.

the class ItemTooltipsMixin method interceptItemStack.

/**
 * Show the item tooltip when changing from a item to another of the same type and name IFF different tooltips.
 */
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isEmpty()Z", ordinal = 1))
private boolean interceptItemStack(ItemStack itemStack) {
    ItemStack nextItem = this.client.player.inventory.getMainHandStack();
    HeldItemTooltips heldItemTooltips = BedrockifyClient.getInstance().heldItemTooltips;
    if (itemStack.getItem() == this.currentStack.getItem() && !heldItemTooltips.equals(currentStack, nextItem)) {
        this.heldItemTooltipFade = 41;
        return true;
    }
    return currentStack.isEmpty();
}
Also used : ItemStack(net.minecraft.item.ItemStack) HeldItemTooltips(me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.HeldItemTooltips) Redirect(org.spongepowered.asm.mixin.injection.Redirect)

Aggregations

HeldItemTooltips (me.juancarloscp52.bedrockify.client.features.HeldItemTooltips.HeldItemTooltips)2 ReachAroundPlacement (me.juancarloscp52.bedrockify.client.features.ReachAroundPlacement)1 SettingsGUI (me.juancarloscp52.bedrockify.client.gui.SettingsGUI)1 Overlay (me.juancarloscp52.bedrockify.client.gui.overlay.Overlay)1 KeyBinding (net.minecraft.client.options.KeyBinding)1 ItemStack (net.minecraft.item.ItemStack)1 Redirect (org.spongepowered.asm.mixin.injection.Redirect)1