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;
}
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);
}
}
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);
}
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()));
}
}
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);
}
}
}
}
Aggregations