use of net.minecraft.block.BarrelBlock in project BleachHack by BleachDrinker420.
the class Peek method drawShulkerToolTip.
public List<TooltipComponent> drawShulkerToolTip(MatrixStack matrices, Slot slot, int mouseX, int mouseY) {
if (!(slot.getStack().getItem() instanceof BlockItem)) {
return null;
}
Block block = ((BlockItem) slot.getStack().getItem()).getBlock();
if (!(block instanceof ShulkerBoxBlock) && !(block instanceof ChestBlock) && !(block instanceof BarrelBlock) && !(block instanceof DispenserBlock) && !(block instanceof HopperBlock) && !(block instanceof AbstractFurnaceBlock)) {
return null;
}
List<ItemStack> items = ItemContentUtils.getItemsInContainer(slot.getStack());
if (items.stream().allMatch(ItemStack::isEmpty)) {
return null;
}
int mode = getSetting(0).asToggle().getChild(0).asMode().getMode();
int realY = mode == 2 ? mouseY + 24 : mouseY;
int tooltipWidth = block instanceof AbstractFurnaceBlock ? 47 : block instanceof HopperBlock ? 82 : 150;
int tooltipHeight = block instanceof AbstractFurnaceBlock || block instanceof HopperBlock || block instanceof DispenserBlock ? 13 : 47;
renderTooltipBox(matrices, mouseX, realY - tooltipHeight - 7, tooltipWidth, tooltipHeight, true);
int count = block instanceof HopperBlock || block instanceof DispenserBlock || block instanceof AbstractFurnaceBlock ? 18 : 0;
for (ItemStack i : items) {
if (count > 26) {
break;
}
int x = mouseX + 11 + 17 * (count % 9);
int y = realY - 67 + 17 * (count / 9);
mc.getItemRenderer().zOffset = 400;
mc.getItemRenderer().renderGuiItemIcon(i, x, y);
mc.getItemRenderer().renderGuiItemOverlay(mc.textRenderer, i, x, y, null);
mc.getItemRenderer().zOffset = 300;
count++;
}
if (mode == 1) {
return Arrays.asList(TooltipComponent.of(slot.getStack().getName().asOrderedText()));
} else if (mode == 2) {
return List.of();
}
return null;
}
Aggregations