use of net.minecraft.screen.CraftingScreenHandler in project Client by MatHax.
the class AutoCraft method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.interactionManager == null)
return;
if (items.get().isEmpty())
return;
if (!(mc.player.currentScreenHandler instanceof CraftingScreenHandler))
return;
if (antiDesync.get())
mc.player.getInventory().updateItems();
CraftingScreenHandler currentScreenHandler = (CraftingScreenHandler) mc.player.currentScreenHandler;
List<Item> itemList = items.get();
List<RecipeResultCollection> recipeResultCollectionList = mc.player.getRecipeBook().getOrderedResults();
for (RecipeResultCollection recipeResultCollection : recipeResultCollectionList) {
for (Recipe<?> recipe : recipeResultCollection.getRecipes(true)) {
if (!itemList.contains(recipe.getOutput().getItem()))
continue;
mc.interactionManager.clickRecipe(currentScreenHandler.syncId, recipe, craftAll.get());
mc.interactionManager.clickSlot(currentScreenHandler.syncId, 0, 1, drop.get() ? SlotActionType.THROW : SlotActionType.QUICK_MOVE, mc.player);
}
}
}
Aggregations