use of net.minecraft.util.crash.CrashReportSection 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.CrashReportSection 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.CrashReportSection 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.CrashReportSection 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);
}
}
}
}
use of net.minecraft.util.crash.CrashReportSection in project fabric by FabricMC.
the class MixinSpriteAtlasTexture method beforeSpriteLoad.
// Handles DependentSprite + custom sprite object injections.
@ModifyVariable(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/texture/SpriteAtlasTexture;loadSprites(Lnet/minecraft/resource/ResourceManager;Ljava/util/Set;)Ljava/util/Collection;"), method = "stitch")
public Set<Identifier> beforeSpriteLoad(Set<Identifier> set) {
fabric_injectedSprites = new HashMap<>();
ClientSpriteRegistryCallback.Registry registry = new ClientSpriteRegistryCallback.Registry(fabric_injectedSprites, set::add);
// noinspection ConstantConditions
for (Identifier id : fabric_localIds) {
SpriteRegistryCallbackHolder.eventLocal(id).invoker().registerSprites((SpriteAtlasTexture) (Object) this, registry);
}
SpriteRegistryCallbackHolder.EVENT_GLOBAL.invoker().registerSprites((SpriteAtlasTexture) (Object) this, registry);
// TODO: Unoptimized.
Set<DependentSprite> dependentSprites = new HashSet<>();
Set<Identifier> dependentSpriteIds = new HashSet<>();
for (Identifier id : set) {
Sprite sprite;
if ((sprite = fabric_injectedSprites.get(id)) instanceof DependentSprite) {
dependentSprites.add((DependentSprite) sprite);
dependentSpriteIds.add(id);
}
}
Set<Identifier> result = set;
boolean isResultNew = false;
if (!dependentSprites.isEmpty()) {
if (!isResultNew) {
result = new LinkedHashSet<>();
isResultNew = true;
}
for (Identifier id : set) {
if (!dependentSpriteIds.contains(id)) {
result.add(id);
}
}
int lastSpriteSize = 0;
while (lastSpriteSize != result.size() && result.size() < set.size()) {
lastSpriteSize = result.size();
for (DependentSprite sprite : dependentSprites) {
Identifier id = ((Sprite) sprite).getId();
if (!result.contains(id) && result.containsAll(sprite.getDependencies())) {
result.add(id);
}
}
}
if (result.size() < set.size()) {
CrashReport report = CrashReport.create(new Throwable(), "Resolving sprite dependencies");
for (DependentSprite sprite : dependentSprites) {
Identifier id = ((Sprite) sprite).getId();
if (!result.contains(id)) {
CrashReportSection element = report.addElement("Unresolved sprite");
element.add("Sprite", id);
element.add("Dependencies", Joiner.on(',').join(sprite.getDependencies()));
}
}
throw new CrashException(report);
}
}
if (!fabric_injectedSprites.isEmpty()) {
if (!isResultNew) {
result = new LinkedHashSet<>(set);
isResultNew = true;
}
result.removeAll(fabric_injectedSprites.keySet());
}
return result;
}
Aggregations