use of net.minecraft.client.gui.screens.inventory.AbstractContainerScreen in project Balm by ModdingForBlockheads.
the class AbstractContainerScreenMixin method renderForeground.
@Inject(method = "render(Lcom/mojang/blaze3d/vertex/PoseStack;IIF)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderLabels(Lcom/mojang/blaze3d/vertex/PoseStack;II)V", shift = At.Shift.AFTER))
public void renderForeground(PoseStack poseStack, int mouseX, int mouseY, float partialTicks, CallbackInfo callbackInfo) {
Screen screen = (Screen) (Object) this;
Balm.getEvents().fireEvent(new ContainerScreenDrawEvent.Foreground(screen, poseStack, mouseX, mouseY));
}
use of net.minecraft.client.gui.screens.inventory.AbstractContainerScreen in project Botania by VazkiiMods.
the class JEIBotaniaPlugin method onRuntimeAvailable.
@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
IRecipeManager recipeRegistry = jeiRuntime.getRecipeManager();
// Hide the return recipes (iron ingot/diamond/ender pearl returns, not lexicon)
for (IElvenTradeRecipe recipe : TileAlfPortal.elvenTradeRecipes(Minecraft.getInstance().level)) {
if (recipe instanceof LexiconElvenTradeRecipe) {
continue;
}
List<Ingredient> inputs = recipe.getIngredients();
List<ItemStack> outputs = recipe.getOutputs();
if (inputs.size() == 1 && outputs.size() == 1 && recipe.containsItem(outputs.get(0))) {
recipeRegistry.hideRecipe(recipe, ElvenTradeRecipeCategory.UID);
}
}
RecipeManager recipeManager = Minecraft.getInstance().level.getRecipeManager();
recipeManager.byKey(prefix("petal_apothecary/daybloom_motif")).ifPresent(r -> recipeRegistry.hideRecipe(r, PetalApothecaryRecipeCategory.UID));
recipeManager.byKey(prefix("petal_apothecary/nightshade_motif")).ifPresent(r -> recipeRegistry.hideRecipe(r, PetalApothecaryRecipeCategory.UID));
CorporeaInputHandler.jeiPanelSupplier = () -> {
ItemStack stack = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse(VanillaTypes.ITEM);
if (stack == null && Minecraft.getInstance().screen == jeiRuntime.getRecipesGui()) {
stack = jeiRuntime.getRecipesGui().getIngredientUnderMouse(VanillaTypes.ITEM);
}
if (stack == null) {
stack = jeiRuntime.getBookmarkOverlay().getIngredientUnderMouse(VanillaTypes.ITEM);
}
if (stack != null) {
return stack;
}
return ItemStack.EMPTY;
};
CorporeaInputHandler.supportedGuiFilter = gui -> gui instanceof AbstractContainerScreen<?> || gui instanceof IRecipesGui;
}
use of net.minecraft.client.gui.screens.inventory.AbstractContainerScreen in project Tweak-My-Client by Hendrix-Shen.
the class AutoDropUtils method doDrop.
public static void doDrop() {
Minecraft minecraftClient = TweakMyClient.getMinecraftClient();
MultiPlayerGameMode interactionManager = minecraftClient.gameMode;
if (minecraftClient.screen instanceof AbstractContainerScreen && !(minecraftClient.screen instanceof InventoryScreen)) {
return;
}
for (int slot = 9; slot < 45; slot++) {
int adjustedSlot = slot;
if (adjustedSlot >= 36)
adjustedSlot -= 36;
assert minecraftClient.player != null;
ItemStack stack = minecraftClient.player.inventory.getItem(adjustedSlot);
if (stack.isEmpty())
continue;
Configs.AutoDropListType mode = (Configs.AutoDropListType) Configs.List.LIST_AUTO_DROP_TYPE.getOptionListValue();
switch(mode) {
case BLACKLIST:
if (!itemStacksBlackList.contains(stack.getItem())) {
assert interactionManager != null;
interactionManager.handleInventoryMouseClick(0, slot, 1, ClickType.THROW, TweakMyClient.getMinecraftClient().player);
}
break;
case WHITELIST:
if (itemStacksWhitelist.contains(stack.getItem())) {
assert interactionManager != null;
interactionManager.handleInventoryMouseClick(0, slot, 1, ClickType.THROW, TweakMyClient.getMinecraftClient().player);
}
break;
}
}
}
use of net.minecraft.client.gui.screens.inventory.AbstractContainerScreen in project LightmansCurrency by Lightman314.
the class ItemRenderUtil method drawItemStack.
/**
* Draws an ItemStack.
*/
public static void drawItemStack(GuiComponent gui, Font font, ItemStack stack, int x, int y) {
Minecraft minecraft = Minecraft.getInstance();
ItemRenderer itemRenderer = minecraft.getItemRenderer();
Player player = minecraft.player;
Screen screen = minecraft.screen;
int imageWidth = 0;
if (screen != null) {
imageWidth = screen.width;
if (screen instanceof AbstractContainerScreen<?>)
imageWidth = ((AbstractContainerScreen<?>) screen).getXSize();
}
if (font == null)
font = minecraft.font;
gui.setBlitOffset(100);
itemRenderer.blitOffset = 100.0F;
RenderSystem.enableDepthTest();
itemRenderer.renderAndDecorateItem(player, stack, x, y, x + y * imageWidth);
itemRenderer.renderGuiItemDecorations(font, stack, x, y, null);
itemRenderer.blitOffset = 0.0F;
gui.setBlitOffset(0);
}
use of net.minecraft.client.gui.screens.inventory.AbstractContainerScreen in project LightmansCurrency by Lightman314.
the class ClientEvents method onInventoryGuiInit.
// Add the wallet button to the gui
@SubscribeEvent
public static void onInventoryGuiInit(ScreenEvent.InitScreenEvent.Post event) {
if (!Config.CLIENT.renderWalletButton.get())
return;
Screen screen = event.getScreen();
if (screen instanceof InventoryScreen || screen instanceof CreativeModeInventoryScreen) {
AbstractContainerScreen<?> gui = (AbstractContainerScreen<?>) screen;
boolean isCreative = screen instanceof CreativeModeInventoryScreen;
int xPos = isCreative ? Config.CLIENT.walletButtonCreativeX.get() : Config.CLIENT.walletButtonX.get();
int yPos = isCreative ? Config.CLIENT.walletButtonCreativeY.get() : Config.CLIENT.walletButtonY.get();
;
event.addListener(new WalletButton(gui, xPos, yPos, button -> LightmansCurrencyPacketHandler.instance.sendToServer(new MessageOpenWallet())));
}
}
Aggregations