Search in sources :

Example 6 with CrashReport

use of net.minecraft.util.crash.CrashReport in project Indium by comp500.

the class IndiumTerrainRenderContext method tesselateBlock.

/**
 * Called from chunk renderer hook.
 */
public boolean tesselateBlock(BlockState blockState, BlockPos blockPos, final BakedModel model, MatrixStack matrixStack) {
    this.matrix = matrixStack.peek().getModel();
    this.normalMatrix = matrixStack.peek().getNormal();
    try {
        aoCalc.clear();
        blockInfo.prepareForBlock(blockState, blockPos, model.useAmbientOcclusion());
        ((FabricBakedModel) model).emitBlockQuads(blockInfo.blockView, blockInfo.blockState, blockInfo.blockPos, blockInfo.randomSupplier, this);
    } catch (Throwable var9) {
        CrashReport crashReport_1 = CrashReport.create(var9, "Tesselating block in world - Indium Renderer");
        CrashReportSection crashReportElement_1 = crashReport_1.addElement("Block being tesselated");
        CrashReportSection.addBlockInfo(crashReportElement_1, blockPos, blockState);
        throw new CrashException(crashReport_1);
    }
    // false because we've already marked the chunk as populated - caller doesn't need to
    return false;
}
Also used : CrashException(net.minecraft.util.crash.CrashException) CrashReport(net.minecraft.util.crash.CrashReport) FabricBakedModel(net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel) CrashReportSection(net.minecraft.util.crash.CrashReportSection)

Example 7 with CrashReport

use of net.minecraft.util.crash.CrashReport in project Overlord by The-Fireplace-Minecraft-Mods.

the class SkeletonInventory method insertStack.

public boolean insertStack(int slot, ItemStack stack) {
    if (stack.isEmpty()) {
        return false;
    }
    try {
        if (stack.isDamaged()) {
            if (slot == -1) {
                slot = this.getEmptySlot();
            }
            if (slot >= 0) {
                this.main.set(slot, stack.copy());
                this.main.get(slot).setBobbingAnimationTime(5);
                stack.setCount(0);
                return true;
            } else {
                return false;
            }
        } else {
            int i;
            do {
                i = stack.getCount();
                if (slot == -1) {
                    stack.setCount(this.addStack(stack));
                } else {
                    stack.setCount(this.addStack(slot, stack));
                }
            } while (!stack.isEmpty() && stack.getCount() < i);
            return stack.getCount() < i;
        }
    } catch (Throwable t) {
        CrashReport crashReport = CrashReport.create(t, "Adding item to inventory");
        CrashReportSection crashReportSection = crashReport.addElement("Item being added");
        crashReportSection.add("Item ID", Item.getRawId(stack.getItem()));
        crashReportSection.add("Item data", stack.getDamage());
        crashReportSection.add("Item name", () -> stack.getName().getString());
        throw new CrashException(crashReport);
    }
}
Also used : CrashException(net.minecraft.util.crash.CrashException) CrashReport(net.minecraft.util.crash.CrashReport) CrashReportSection(net.minecraft.util.crash.CrashReportSection)

Example 8 with CrashReport

use of net.minecraft.util.crash.CrashReport in project roadrunner by MaxNeedsSnacks.

the class DataTrackerMixin method onGetException.

private static <T> CrashException onGetException(Throwable cause, TrackedData<T> data) {
    CrashReport report = CrashReport.create(cause, "Getting synced entity data");
    CrashReportSection section = report.addElement("Synced entity data");
    section.add("Data ID", data);
    return new CrashException(report);
}
Also used : CrashException(net.minecraft.util.crash.CrashException) CrashReport(net.minecraft.util.crash.CrashReport) CrashReportSection(net.minecraft.util.crash.CrashReportSection)

Example 9 with CrashReport

use of net.minecraft.util.crash.CrashReport in project jGui by ReplayMod.

the class AbstractGuiContainer method layout.

@Override
public void layout(ReadableDimension size, RenderInfo renderInfo) {
    super.layout(size, renderInfo);
    if (size == null)
        return;
    try {
        layedOutElements = layout.layOut(this, size);
    } catch (Exception ex) {
        CrashReport crashReport = CrashReport.create(ex, "Gui Layout");
        renderInfo.addTo(crashReport);
        CrashReportSection category = crashReport.addElement("Gui container details");
        MCVer.addDetail(category, "Container", this::toString);
        MCVer.addDetail(category, "Layout", layout::toString);
        throw new CrashException(crashReport);
    }
    for (final Map.Entry<GuiElement, Pair<ReadablePoint, ReadableDimension>> e : layedOutElements.entrySet()) {
        GuiElement element = e.getKey();
        if (element instanceof ComposedGuiElement) {
            if (((ComposedGuiElement) element).getMaxLayer() < renderInfo.layer) {
                continue;
            }
        } else {
            if (element.getLayer() != renderInfo.layer) {
                continue;
            }
        }
        ReadablePoint ePosition = e.getValue().getLeft();
        ReadableDimension eSize = e.getValue().getRight();
        element.layout(eSize, renderInfo.offsetMouse(ePosition.getX(), ePosition.getY()).layer(renderInfo.getLayer() - element.getLayer()));
    }
}
Also used : CrashException(net.minecraft.util.crash.CrashException) ReadableDimension(de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension) CrashReport(net.minecraft.util.crash.CrashReport) CrashReportSection(net.minecraft.util.crash.CrashReportSection) AbstractComposedGuiElement(de.johni0702.minecraft.gui.element.AbstractComposedGuiElement) GuiElement(de.johni0702.minecraft.gui.element.GuiElement) ComposedGuiElement(de.johni0702.minecraft.gui.element.ComposedGuiElement) AbstractComposedGuiElement(de.johni0702.minecraft.gui.element.AbstractComposedGuiElement) ComposedGuiElement(de.johni0702.minecraft.gui.element.ComposedGuiElement) ReadablePoint(de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint) CrashException(net.minecraft.util.crash.CrashException) Pair(org.apache.commons.lang3.tuple.Pair)

Example 10 with CrashReport

use of net.minecraft.util.crash.CrashReport in project jGui by ReplayMod.

the class AbstractGuiOverlay method draw.

@Override
public void draw(GuiRenderer renderer, ReadableDimension size, RenderInfo renderInfo) {
    super.draw(renderer, size, renderInfo);
    if (mouseVisible && renderInfo.layer == getMaxLayer()) {
        final GuiElement tooltip = forEach(GuiElement.class, e -> e.getTooltip(renderInfo));
        if (tooltip != null) {
            final ReadableDimension tooltipSize = tooltip.getMinSize();
            int x, y;
            if (renderInfo.mouseX + 8 + tooltipSize.getWidth() < screenSize.getWidth()) {
                x = renderInfo.mouseX + 8;
            } else {
                x = screenSize.getWidth() - tooltipSize.getWidth() - 1;
            }
            if (renderInfo.mouseY + 8 + tooltipSize.getHeight() < screenSize.getHeight()) {
                y = renderInfo.mouseY + 8;
            } else {
                y = screenSize.getHeight() - tooltipSize.getHeight() - 1;
            }
            final ReadablePoint position = new Point(x, y);
            try {
                OffsetGuiRenderer eRenderer = new OffsetGuiRenderer(renderer, position, tooltipSize);
                tooltip.draw(eRenderer, tooltipSize, renderInfo);
            } catch (Exception ex) {
                CrashReport crashReport = CrashReport.create(ex, "Rendering Gui Tooltip");
                renderInfo.addTo(crashReport);
                CrashReportSection category = crashReport.addElement("Gui container details");
                MCVer.addDetail(category, "Container", this::toString);
                MCVer.addDetail(category, "Width", () -> "" + size.getWidth());
                MCVer.addDetail(category, "Height", () -> "" + size.getHeight());
                category = crashReport.addElement("Tooltip details");
                MCVer.addDetail(category, "Element", tooltip::toString);
                MCVer.addDetail(category, "Position", position::toString);
                MCVer.addDetail(category, "Size", tooltipSize::toString);
                throw new CrashException(crashReport);
            }
        }
    }
}
Also used : CrashException(net.minecraft.util.crash.CrashException) ReadableDimension(de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension) CrashReport(net.minecraft.util.crash.CrashReport) OffsetGuiRenderer(de.johni0702.minecraft.gui.OffsetGuiRenderer) Point(de.johni0702.minecraft.gui.utils.lwjgl.Point) ReadablePoint(de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint) CrashReportSection(net.minecraft.util.crash.CrashReportSection) GuiElement(de.johni0702.minecraft.gui.element.GuiElement) ReadablePoint(de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint) Point(de.johni0702.minecraft.gui.utils.lwjgl.Point) ReadablePoint(de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint) CrashException(net.minecraft.util.crash.CrashException)

Aggregations

CrashException (net.minecraft.util.crash.CrashException)16 CrashReport (net.minecraft.util.crash.CrashReport)16 CrashReportSection (net.minecraft.util.crash.CrashReportSection)15 GuiElement (de.johni0702.minecraft.gui.element.GuiElement)4 ReadableDimension (de.johni0702.minecraft.gui.utils.lwjgl.ReadableDimension)4 ReadablePoint (de.johni0702.minecraft.gui.utils.lwjgl.ReadablePoint)4 OffsetGuiRenderer (de.johni0702.minecraft.gui.OffsetGuiRenderer)3 AbstractComposedGuiElement (de.johni0702.minecraft.gui.element.AbstractComposedGuiElement)2 ComposedGuiElement (de.johni0702.minecraft.gui.element.ComposedGuiElement)2 Point (de.johni0702.minecraft.gui.utils.lwjgl.Point)2 ArrayList (java.util.ArrayList)2 FabricBakedModel (net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel)2 Pair (org.apache.commons.lang3.tuple.Pair)2 Dimension (de.johni0702.minecraft.gui.utils.lwjgl.Dimension)1 DynamicBakedModel (grondag.frex.api.model.DynamicBakedModel)1 Objects (java.util.Objects)1 ClientSpriteRegistryCallback (net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback)1 BakedModel (net.minecraft.client.render.model.BakedModel)1 Sprite (net.minecraft.client.texture.Sprite)1 Identifier (net.minecraft.util.Identifier)1