Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/main/java/gregtech/client/particle/GTParticleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ public void renderParticles(@NotNull Entity renderViewEntity, float partialTicks

private static void renderGlParticlesInLayer(@NotNull Map<@Nullable IRenderSetup, ArrayDeque<GTParticle>> renderQueue,
@NotNull EffectRenderContext context) {
for (var e : renderQueue.entrySet()) {
for (var entry : renderQueue.entrySet()) {
@Nullable
IRenderSetup handler = e.getKey();
ArrayDeque<GTParticle> particles = e.getValue();
IRenderSetup handler = entry.getKey();
ArrayDeque<GTParticle> particles = entry.getValue();
if (particles.isEmpty()) continue;

boolean initialized = false;
Expand All @@ -160,8 +160,8 @@ private static void renderGlParticlesInLayer(@NotNull Map<@Nullable IRenderSetup
}
}
particle.renderParticle(buffer, context);
} catch (Throwable throwable) {
GTLog.logger.error("particle render error: {}", particle.toString(), throwable);
} catch (RuntimeException e) {
GTLog.logger.error("particle render error: {}", particle.toString(), e);
particle.setExpired();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public static IBlockState lookupBlockForItem(ItemStack itemStack) {
}

private static IBlockState lookupBlockForItemUnsafe(ItemStack itemStack) {
if (!(itemStack.getItem() instanceof ItemBlock)) {
if (!(itemStack.getItem() instanceof ItemBlock itemBlock)) {
return null;
}
Block block = ((ItemBlock) itemStack.getItem()).getBlock();
Block block = itemBlock.getBlock();
int blockMetadata = itemStack.getItem().getMetadata(itemStack);
try {
// noinspection deprecation
return block.getStateFromMeta(blockMetadata);
} catch (Throwable e) {
} catch (RuntimeException e) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
if (!result && mouseY >= this.getPosition().y && mouseY <= this.getPosition().y + this.getSize().height) {
Widget widget = this.widgets.stream().filter(it -> it.isMouseOverElement(mouseX, mouseY)).findFirst()
.orElse(null);
if (widget instanceof WidgetGroup) {
List<Widget> children = ((WidgetGroup) widget).getContainedWidgets(true);
if (widget instanceof WidgetGroup wg) {
List<Widget> children = wg.getContainedWidgets(true);
if (children.get(0).isMouseOverElement(mouseX, mouseY)) {
try {
String posString = ObfuscationReflectionHelper.getPrivateValue(LabelWidget.class,
Expand All @@ -108,7 +108,7 @@ public boolean mouseClicked(int mouseX, int mouseY, int button) {
((SlotWidget) children.get(0)).getHandle().getStack().getDisplayName() +
": " + posString));
return false;
} catch (Throwable e) {
} catch (NumberFormatException e) {
GTLog.logger.error("Could not reflect GregTech WidgetLabel text", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ private static void onContainerOpen(Container container) {
resultSlot.slotNumber = previousLapisSlot.slotNumber;
container.inventorySlots.set(index, resultSlot);
}
} catch (Throwable exception) {
} catch (RuntimeException exception) {
GTLog.logger.warn("Failed to replace enchantment container slot", exception);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/gregtech/common/worldgen/LootTableHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public static void initialize() {
gsonField.setAccessible(true);
Gson gsonInstance = (Gson) gsonField.get(null);
replaceGsonTypeHierarchySerializer(gsonInstance, LootEntry.class, LootTableEntrySerializerDelegate::new);
} catch (Throwable exception) {
GTLog.logger.fatal("Failed to initialize loot table helper", exception);
throw new RuntimeException(exception);
} catch (SecurityException | IllegalAccessException e) {
GTLog.logger.fatal("Failed to initialize loot table helper", e);
throw new IllegalStateException(e);
}
registerLootEntry("gregtech:meta_item", LootEntryMetaItem::deserialize);
registerLootEntry("gregtech:ore_dict", LootEntryOreDict::deserialize);
Expand Down
Loading