Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pre rewrite/fabric/1.21 dev remove chunk render task schematic lock #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
187 commits
Select commit Hold shift + click to select a range
86f569a
23wb51b-SNAP 0.18.0-SNAP
sakura-ryoko Dec 22, 2023
110bf96
emitGameEvent Fix
sakura-ryoko Dec 22, 2023
994dc73
Update gradle-wrapper.properties
sakura-ryoko Jan 2, 2024
ff1c52a
Update NbtUtils.java
sakura-ryoko Jan 2, 2024
ffa3722
Update gradle-wrapper.properties
sakura-ryoko Jan 2, 2024
d08fd20
Update NbtUtils.java
sakura-ryoko Jan 2, 2024
a5ac1f6
Update gradle-wrapper.properties
sakura-ryoko Jan 2, 2024
5ed8a00
Update NbtUtils.java
sakura-ryoko Jan 2, 2024
5f2b3d8
1.20.x revert # 2
sakura-ryoko Jan 2, 2024
df5e672
Merge branch '23w51b-SNAP' of https://github.com/sakura-ryoko/litemat…
sakura-ryoko Jan 2, 2024
c8e0ede
update for malilib ChunkUtils
sakura-ryoko Jan 2, 2024
9a7aa07
revert #3
sakura-ryoko Jan 2, 2024
1ffb415
Update GameEmit code
sakura-ryoko Jan 2, 2024
01662c9
Revert "Update GameEmit code"
sakura-ryoko Jan 2, 2024
566ee2a
Update WorldSchematic.java
sakura-ryoko Jan 3, 2024
3e2f864
Update GameEmit code
sakura-ryoko Jan 3, 2024
1a56872
Update GameEmit code
sakura-ryoko Jan 3, 2024
99baecf
Update GameEmit code
sakura-ryoko Jan 3, 2024
3e81ea8
Update GameEmit code
sakura-ryoko Jan 3, 2024
4e7ac00
24w03a-SNAP -- Minor CustomPayload interface change.
sakura-ryoko Jan 17, 2024
ead0c4f
24w03b -- Also provides a logger to verify we are receiving Carpet He…
sakura-ryoko Jan 20, 2024
7b4d8b4
24w03b -- Also provides a logger to verify we are receiving Carpet He…
sakura-ryoko Jan 20, 2024
bdd4e31
24w04a - working carpet payload handler -- was chasing ghosts, but fo…
sakura-ryoko Jan 29, 2024
71ee26d
24w04a - Some minor cleanup
sakura-ryoko Jan 30, 2024
98a2436
Update build.gradle
sakura-ryoko Jan 30, 2024
b51861e
24w04a - gradle 8.6
sakura-ryoko Feb 5, 2024
4ee6d40
24w05b -- WorldRenderer issues. Things work, but Schematic Entities …
sakura-ryoko Feb 6, 2024
34b0abd
24w05b -- Add 0.17.1 code
sakura-ryoko Feb 7, 2024
883b846
24w05b -- Dolphies are fixed. What are we push()'ing and pop()'ing a…
sakura-ryoko Feb 7, 2024
3dd8d4a
24w06a - Some renderer reverts for malilib
sakura-ryoko Feb 8, 2024
1aa5663
24w06a - Trying to fix schematic rendering from Matrix4f method
sakura-ryoko Feb 8, 2024
c3d7649
24w06a - About as "fixed" as I can go before rendering breaks.
sakura-ryoko Feb 8, 2024
2ce0bde
24w06a - well, I've allowed Matrix4f data as far as the game would le…
sakura-ryoko Feb 8, 2024
1e6359f
24w06a - I've placed Matrix4f style handlers as far as I can without …
sakura-ryoko Feb 9, 2024
2603482
24w06a - Small CarpetHello channel refactor
sakura-ryoko Feb 9, 2024
d608e67
24w06a -- new Network API re-implementation (Carpet Hello Handler)
sakura-ryoko Feb 11, 2024
aca1d29
24w06a -- update Carpet Hello Listener for prod use
sakura-ryoko Feb 11, 2024
e76a18c
24w06a -- some cleanup
sakura-ryoko Feb 11, 2024
47d5041
24w06a -- some cleanup
sakura-ryoko Feb 11, 2024
2fe7a05
Update CarpetHelloPlayListener.java
sakura-ryoko Feb 13, 2024
3ff463a
24w06a -- Renderer notes & some cleanups
sakura-ryoko Feb 13, 2024
ec211a4
24w07a - no changes so far
sakura-ryoko Feb 14, 2024
0ca8771
24w07a -- Refactor CarpetHelloS2CPayload
sakura-ryoko Feb 20, 2024
b5c18f9
24w07a -- Fix Carpet Hello packets for when Carpet Client is installe…
sakura-ryoko Feb 23, 2024
3f76019
24w09a basic
sakura-ryoko Feb 28, 2024
5337ddf
24w09a - vertexQuad opacity value.
sakura-ryoko Feb 28, 2024
788baa1
24w09a - fixing ItemStack ComponentData issues, not yet finished. (Da…
sakura-ryoko Mar 1, 2024
d14e9e5
Update gradle.properties
sakura-ryoko Mar 1, 2024
62d5fed
24w09a - pending fixes (not enough time)
sakura-ryoko Mar 1, 2024
6fdd698
24w09a - Most items are now fixed, and ItemStacks are being handled c…
sakura-ryoko Mar 2, 2024
7630e00
24w09a - Moved "getItemStackFroMString()" handling to MaLiLib
sakura-ryoko Mar 3, 2024
63e14d1
24w09a - some minor cleanups
sakura-ryoko Mar 3, 2024
39abb00
24w09a - ghost bug hunting, not sure how to create a "DataFixer" for …
sakura-ryoko Mar 3, 2024
a34f45a
24w09a - Some network api cleanups
sakura-ryoko Mar 5, 2024
6ab35e8
24w10a - NbtHelper for Player Skulls removed -- now self-managed NBT …
sakura-ryoko Mar 6, 2024
19cc459
24w10a - some TE data testing
sakura-ryoko Mar 6, 2024
cd2f074
24w10a - Matrix4fStack for renderBlockOverlay
sakura-ryoko Mar 8, 2024
1469fc5
24w10a - Merge from upstream 0.17.2, Dynamic Registry Manager fixes
sakura-ryoko Mar 9, 2024
70f927f
24w10a - More Dynamic Registry fixes
sakura-ryoko Mar 10, 2024
7a57180
24w10a - Finding bugs with pickTEStack function
sakura-ryoko Mar 10, 2024
f0e447e
24w10a - Migrating to ModMenu 10.0.0-alpha.3, and refactoring Compone…
sakura-ryoko Mar 11, 2024
13e2492
24w10a - Disable Carpet Hello Listener. It breaks the real Carpet Mo…
sakura-ryoko Mar 11, 2024
57efaa1
24w10a - PRELIMINARY 1.20.x -> 1.20.5 NBT DATA FIXER (Litematics Vers…
sakura-ryoko Mar 12, 2024
fe24cce
24w10a - Vanilla Data Fixer's are now being used to load schematics. …
sakura-ryoko Mar 12, 2024
4434910
24w10a - Vanilla Data Fixer's are now being used to load schematics. …
sakura-ryoko Mar 13, 2024
be8d9e3
24w10a - fabric 0.96.9 and yarn build 8
sakura-ryoko Mar 13, 2024
ffaa85e
24w10a - storeTEInStack() fix
sakura-ryoko Mar 13, 2024
536b60c
24w10a - Some misc code testing and cleanup for loggers
sakura-ryoko Mar 13, 2024
e42d870
24w10a - Paste Sign fix
sakura-ryoko Mar 14, 2024
e9b6d58
24w11a - yarn build 2
sakura-ryoko Mar 14, 2024
5cb60a3
24w11a - Sponge Schematic Data Fixer implementation
sakura-ryoko Mar 14, 2024
91eba82
24w12a - Item Components --> Fix if item is Damageable (Doesn't work …
sakura-ryoko Mar 20, 2024
e3dac2d
24w12a - itemStack.getItem().isDamagable() -> itemStack.isDamageable()
sakura-ryoko Mar 20, 2024
807d27a
24w12a - itemStack.getItem().isDamagable() -> itemStack.isDamageable()
sakura-ryoko Mar 20, 2024
dcf6d1a
24w12a - loom 1.6, yarn build 3, api 0.96.12
sakura-ryoko Mar 20, 2024
2605209
24w13a -- "readNbt" -> "loadWithComponents" for Block Entity Tags, Da…
sakura-ryoko Mar 27, 2024
b617e80
24w13a - Just some code to comment out.
sakura-ryoko Mar 28, 2024
661df29
24w13a - yarn build 7, api 0.96.13
sakura-ryoko Mar 29, 2024
92aba8c
24w13a - add ModMenu parent for malilib
sakura-ryoko Mar 29, 2024
7aee767
24w13a - update ModMenu Dependency to a custom SNAPSHOT build, becaus…
sakura-ryoko Mar 29, 2024
cc910a1
24w14a - Java 21, no other changes
sakura-ryoko Apr 3, 2024
510a378
24w14a - code cleanups
sakura-ryoko Apr 4, 2024
2d549b7
24w14a - code cleanups
sakura-ryoko Apr 4, 2024
34540a1
24w14a - code cleanups, now enforces Vanilla Datafixer for any Minecr…
sakura-ryoko Apr 5, 2024
0aa78c3
24w14a - Config Menu version #
sakura-ryoko Apr 6, 2024
921d2cd
24w14a - gradle 8.7, yarn build 6
sakura-ryoko Apr 8, 2024
52c2971
1.20.5-pre.1 support -- renamed mod_version to 0.18.0-beta.1
sakura-ryoko Apr 10, 2024
c205f4a
1.20.5-pre.1 - yarn build 4
sakura-ryoko Apr 11, 2024
6a54174
1.20.5-pre.1 -- code cleanups
sakura-ryoko Apr 12, 2024
17bad70
1.20.5-pre.1 -- merge from HEAD (Add a materialListIgnoreState option)
sakura-ryoko Apr 12, 2024
389f2de
1.20.5-pre.1 -- code cleanups
sakura-ryoko Apr 12, 2024
68a3640
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 13, 2024
d769dd7
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 13, 2024
cd2469d
1.20.5-pre.1 - code cleanups
sakura-ryoko Apr 14, 2024
8fa973b
1.20.5-pre.2 support --> Remove (NBT+) Lore from Ctrl+PickBlock (Stor…
sakura-ryoko Apr 15, 2024
83d7537
1.20.5-pre.3 support
sakura-ryoko Apr 17, 2024
c7dfc96
1.20.5-pre.4 support
sakura-ryoko Apr 18, 2024
0d8290c
1.20.5-rc1 -- material list bug fixing (Most of the problems came fro…
sakura-ryoko Apr 18, 2024
0f02bc3
1.20.5-rc1 - code cleanups
sakura-ryoko Apr 19, 2024
d93cde3
1.20.5-rc1 - remove sources jar
sakura-ryoko Apr 19, 2024
8bb09fc
1.20.5-rc2 no real changes
sakura-ryoko Apr 20, 2024
f74c4e1
1.20.5-rc.3
sakura-ryoko Apr 23, 2024
31a9555
code cleanup
sakura-ryoko Apr 23, 2024
a7c33ff
1.20.5-DEV
sakura-ryoko Apr 23, 2024
ddca53f
1.20.5-DEV
sakura-ryoko Apr 23, 2024
bb4abc2
1.20.5-DEV
sakura-ryoko Apr 23, 2024
7108bbc
"sakura.1" branding until official release
sakura-ryoko Apr 25, 2024
aff4a53
"sakura.1" branding until official release
sakura-ryoko Apr 25, 2024
bb2c302
Harden Schematic World DynamicRegistry values for when mc.world is nu…
sakura-ryoko Apr 27, 2024
a8c1d8e
sakura.1a bump
sakura-ryoko Apr 27, 2024
6009a06
WorldSchematic mc.world must not be null or throw.
sakura-ryoko Apr 27, 2024
47c26f4
WorldSchematic mc.world must not be null or throw.
sakura-ryoko Apr 27, 2024
696872f
1.20.6 versioning
sakura-ryoko Apr 30, 2024
937de10
24w18a support --> trivial fixes to PaintingVariant and getBlockPos()…
sakura-ryoko May 3, 2024
bc62442
build 2, api 0.97.9
sakura-ryoko May 4, 2024
62e851d
24w19b support
sakura-ryoko May 11, 2024
855f56e
24w20a --> world renderer Mixin change partialTicks
sakura-ryoko May 16, 2024
7ae5a05
yarn build 3, waiting on FAPI
sakura-ryoko May 16, 2024
cb9f405
FAPI / ModMenu update
sakura-ryoko May 17, 2024
9c54352
Update fabric.mod.json
sakura-ryoko May 19, 2024
cbc579f
Disable Schematica Vanilla Data Fixer code
sakura-ryoko May 21, 2024
ac18d84
Disable Schematica Vanilla Data Fixer code
sakura-ryoko May 21, 2024
030b97e
Fix Data Fixer code
sakura-ryoko May 21, 2024
eaeff49
Add VanillaStructure Data Fixer (.nbt files), add datafixerDefaultSch…
sakura-ryoko May 22, 2024
9ea60d2
24w21b -- broken yet
sakura-ryoko May 23, 2024
4017b3c
24w21b -- broken yet
sakura-ryoko May 23, 2024
5286dad
24w21b -- broken yet
sakura-ryoko May 23, 2024
5018baf
24w21b -- broken yet
sakura-ryoko May 23, 2024
c2f7cb6
allow ItemStack.EMPTY to be your toolItem.
sakura-ryoko May 23, 2024
68501bc
compiles but still broken.
sakura-ryoko May 24, 2024
8ddf8a4
compiles but still broken.
sakura-ryoko May 24, 2024
e57a8fe
compiles but still broken. Much closer now.
sakura-ryoko May 24, 2024
2286ecc
compiles but still broken.
sakura-ryoko May 24, 2024
6b47ec4
compiles but still broken.
sakura-ryoko May 24, 2024
c5474d0
compiles but still broken.
sakura-ryoko May 24, 2024
5ae7b2f
compiles but still broken.
sakura-ryoko May 24, 2024
3f51801
compiles but still broken.
sakura-ryoko May 25, 2024
2f487e6
compiles but still broken.
sakura-ryoko May 25, 2024
87c0cfe
compiles but still broken.
sakura-ryoko May 26, 2024
80a21f2
Working on SchematicWorld Renderer re-write to find bugs / merge with…
sakura-ryoko May 26, 2024
645e867
REVERT FROM 1.20.6
sakura-ryoko May 27, 2024
7c8f6f7
working on things ...
sakura-ryoko May 28, 2024
940704d
things are partially working, but easily broken if RenderLayer.transl…
sakura-ryoko May 28, 2024
ff6fe18
things are partially working, but easily broken if RenderLayer.transl…
sakura-ryoko May 28, 2024
b1f215c
things are partially working, but easily broken if RenderLayer.transl…
sakura-ryoko May 28, 2024
9f09fbe
things are partially working, but easily broken if RenderLayer.transl…
sakura-ryoko May 28, 2024
440eb34
IT WORKS!
sakura-ryoko May 29, 2024
5061e01
IT WORKS!
sakura-ryoko May 29, 2024
3898b45
Some cleanup / performance tweaking required
sakura-ryoko May 29, 2024
91c1fdb
still working on the testing code
sakura-ryoko May 29, 2024
5c1c083
yarn build 8
sakura-ryoko May 29, 2024
3e639bd
1.21-pre1
sakura-ryoko May 29, 2024
cb7dea0
Still doing work on a test renderer system
sakura-ryoko May 30, 2024
1033f2f
working pretty well, atm.
sakura-ryoko May 31, 2024
569f231
working pretty well, atm.
sakura-ryoko May 31, 2024
96e1aad
Remove test rendering code
sakura-ryoko May 31, 2024
a447d66
1.21 pre 2
sakura-ryoko May 31, 2024
0460afa
fix missing chunks for rendering
sakura-ryoko Jun 1, 2024
eb51015
Update visibility of the Rendering System to be better protected, and…
sakura-ryoko Jun 1, 2024
de805fe
Create jitpack.yml
sakura-ryoko Jun 1, 2024
a78f41a
Delete jitpack.yml
sakura-ryoko Jun 2, 2024
84afb2c
MERGE FROM UPSTREAM 0.17.3
sakura-ryoko Jun 3, 2024
48f1df4
MERGE FROM UPSTREAM 0.17.3
sakura-ryoko Jun 3, 2024
302009b
ModMenu update
sakura-ryoko Jun 4, 2024
dad9df4
1.21-pre3
sakura-ryoko Jun 5, 2024
710a2ca
bumps support for malilib sakura.5
sakura-ryoko Jun 7, 2024
2302bf6
jitpack
sakura-ryoko Jun 7, 2024
9378ae2
jitpack
sakura-ryoko Jun 7, 2024
c96c914
1.21-pre4
sakura-ryoko Jun 7, 2024
bc07763
new BufferAllocatorCachePool for future multi-threading.
sakura-ryoko Jun 7, 2024
5f7bbdf
Create build.yml
sakura-ryoko Jun 8, 2024
6d389b5
Add Sponge Schematic V3 support
sakura-ryoko Jun 8, 2024
10b288a
1.21 rc1
sakura-ryoko Jun 10, 2024
48a9624
1.21 rc1
sakura-ryoko Jun 11, 2024
680f6b0
1.21 rc1
sakura-ryoko Jun 11, 2024
e5758a0
1.21-rc1
sakura-ryoko Jun 12, 2024
c8b71d8
corrections
sakura-ryoko Jun 12, 2024
46483b3
resync
sakura-ryoko Jun 12, 2024
72c4a46
1.21
sakura-ryoko Jun 13, 2024
82fe844
fix seldom crashes with Selection Boxes and Iris being installed.
sakura-ryoko Jun 14, 2024
cb50b25
yarn build 2, modmenu beta 2, version # update
sakura-ryoko Jun 14, 2024
e561d31
Fixes Lithium Crash with new attacks on the SchematicWorld.getRegistr…
sakura-ryoko Jun 16, 2024
372853b
fix various Rendering issues
sakura-ryoko Jun 18, 2024
a221d31
Remove lock from ChunkRenderTaskSchematic class first pass
Defenastrator Jun 19, 2024
1e1dabc
No more locks in ChunkRendererSchematicVbo
Defenastrator Jun 20, 2024
0669a99
fix failure to set initial atomic references
Defenastrator Jun 20, 2024
8f50bd0
Merge branch 'pre-rewrite/fabric/1.21' into pre-rewrite/fabric/1.21-D…
sakura-ryoko Jun 20, 2024
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ targetCompatibility = JavaVersion.VERSION_21

repositories {
maven { url 'https://masa.dy.fi/maven' }
maven { url 'https://maven.terraformersmc.com/releases/' }
maven { url 'https://maven.terraformersmc.com/releases/' }
// maven { url 'https://maven.quiltmc.org/repository/release/' }
maven { url 'https://jitpack.io' }
}
Expand Down
71 changes: 21 additions & 50 deletions src/main/java/fi/dy/masa/litematica/gui/GuiConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import java.util.Collections;
import java.util.List;
import java.util.Objects;

import fi.dy.masa.litematica.Reference;
import fi.dy.masa.litematica.config.Configs;
import fi.dy.masa.litematica.config.Hotkeys;
Expand Down Expand Up @@ -82,32 +84,14 @@ public List<ConfigOptionWrapper> getConfigs()
{
List<? extends IConfigBase> configs;
ConfigGuiTab tab = DataManager.getConfigGuiTab();

if (tab == ConfigGuiTab.GENERIC)
{
configs = Configs.Generic.OPTIONS;
}
else if (tab == ConfigGuiTab.INFO_OVERLAYS)
{
configs = Configs.InfoOverlays.OPTIONS;
}
else if (tab == ConfigGuiTab.VISUALS)
{
configs = Configs.Visuals.OPTIONS;
}
else if (tab == ConfigGuiTab.COLORS)
{
configs = Configs.Colors.OPTIONS;
}
else if (tab == ConfigGuiTab.HOTKEYS)
{
configs = Hotkeys.HOTKEY_LIST;
}
else
{
return Collections.emptyList();
}

configs = switch (tab) {
case GENERIC -> Configs.Generic.OPTIONS;
case INFO_OVERLAYS -> Configs.InfoOverlays.OPTIONS;
case VISUALS -> Configs.Visuals.OPTIONS;
case COLORS -> Configs.Colors.OPTIONS;
case HOTKEYS -> Hotkeys.HOTKEY_LIST;
case RENDER_LAYERS -> Collections.emptyList();
};
return ConfigOptionWrapper.createFor(configs);
}

Expand All @@ -119,34 +103,21 @@ protected void onSettingsChanged()
SchematicWorldRefresher.INSTANCE.updateAll();
}

private static class ButtonListener implements IButtonActionListener
{
private final GuiConfigs parent;
private final ConfigGuiTab tab;

public ButtonListener(ConfigGuiTab tab, GuiConfigs parent)
{
this.tab = tab;
this.parent = parent;
}
private record ButtonListener(ConfigGuiTab tab, GuiConfigs parent) implements IButtonActionListener {

@Override
public void actionPerformedWithButton(ButtonBase button, int mouseButton)
{
DataManager.setConfigGuiTab(this.tab);

if (this.tab != ConfigGuiTab.RENDER_LAYERS)
{
this.parent.reCreateListWidget(); // apply the new config width
this.parent.getListWidget().resetScrollbarPosition();
this.parent.initGui();
}
else
{
GuiBase.openGui(new GuiRenderLayer());
public void actionPerformedWithButton(ButtonBase button, int mouseButton) {
DataManager.setConfigGuiTab(this.tab);

if (this.tab != ConfigGuiTab.RENDER_LAYERS) {
this.parent.reCreateListWidget(); // apply the new config width
Objects.requireNonNull(this.parent.getListWidget()).resetScrollbarPosition();
this.parent.initGui();
} else {
GuiBase.openGui(new GuiRenderLayer());
}
}
}
}

public enum ConfigGuiTab
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fi.dy.masa.litematica.materials;

import java.util.Comparator;
import fi.dy.masa.litematica.materials.MaterialListBase.SortCriteria;

public class MaterialListSorter implements Comparator<MaterialListEntry>
{
Expand All @@ -15,23 +14,14 @@ public MaterialListSorter(MaterialListBase materialList)
@Override
public int compare(MaterialListEntry entry1, MaterialListEntry entry2)
{
boolean reverse = this.materialList.getSortInReverse();
SortCriteria sortCriteria = this.materialList.getSortCriteria();
int nameCompare = entry1.getStack().getName().getString().compareTo(entry2.getStack().getName().getString());

if (sortCriteria == SortCriteria.COUNT_TOTAL)
{
return entry1.getCountTotal() == entry2.getCountTotal() ? nameCompare : ((entry1.getCountTotal() > entry2.getCountTotal()) != reverse ? -1 : 1);
}
else if (sortCriteria == SortCriteria.COUNT_MISSING)
{
return entry1.getCountMissing() == entry2.getCountMissing() ? nameCompare : ((entry1.getCountMissing() > entry2.getCountMissing()) != reverse ? -1 : 1);
}
else if (sortCriteria == SortCriteria.COUNT_AVAILABLE)
{
return entry1.getCountAvailable() == entry2.getCountAvailable() ? nameCompare : ((entry1.getCountAvailable() > entry2.getCountAvailable()) != reverse ? -1 : 1);
}

return reverse == false ? nameCompare * -1 : nameCompare;
int cmp = switch (this.materialList.getSortCriteria()) {
case COUNT_TOTAL -> entry1.getCountTotal() - entry2.getCountTotal();
case COUNT_MISSING -> entry1.getCountMissing() - entry2.getCountMissing();
case COUNT_AVAILABLE -> entry1.getCountAvailable() - entry2.getCountAvailable();
default -> 0;
};
if(cmp==0)
cmp = entry1.getStack().getName().getString().compareTo(entry2.getStack().getName().getString());
return this.materialList.getSortInReverse()? -cmp: cmp;
}
}
11 changes: 4 additions & 7 deletions src/main/java/fi/dy/masa/litematica/render/BlockInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ public class BlockInfo
private final List<String> props;
private final int totalWidth;
private final int totalHeight;
private final int columnWidth;

public BlockInfo(BlockState state, String titleKey)
{
Expand All @@ -34,28 +33,26 @@ public BlockInfo(BlockState state, String titleKey)
this.stack = ItemUtils.getItemForState(this.state);

Identifier rl = Registries.BLOCK.getId(this.state.getBlock());
this.blockRegistryname = rl != null ? rl.toString() : "<null>";
this.blockRegistryname = rl.toString();

this.stackName = this.stack.getName().getString();

int w = StringUtils.getStringWidth(this.stackName) + 20;
w = Math.max(w, StringUtils.getStringWidth(this.blockRegistryname));
w = Math.max(w, StringUtils.getStringWidth(this.title));
this.columnWidth = w;

this.props = BlockUtils.getFormattedBlockStateProperties(this.state, " = ");
this.totalWidth = this.columnWidth + 40;
this.totalWidth = w + 40;
this.totalHeight = this.props.size() * (StringUtils.getFontHeight() + 2) + 60;
}

public int getTotalWidth()
{
return this.totalWidth;
return totalWidth;
}

public int getTotalHeight()
{
return this.totalHeight;
return totalHeight;
}

public void render(int x, int y, MinecraftClient mc, DrawContext drawContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void calculateFinishTime()
}
else
{
this.finishTimeNano = System.nanoTime() + Math.max(1000000000L / fpsTarget / 2L, 0L);
this.finishTimeNano = System.nanoTime() + 1000000000L / fpsTarget / 2L;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,68 +1,58 @@
package fi.dy.masa.litematica.render.schematic;

import javax.annotation.Nonnull;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import net.minecraft.client.render.BuiltBuffer;
import net.minecraft.client.render.RenderLayer;

public class BufferBuilderCache implements AutoCloseable
{
private final Map<RenderLayer, BufferBuilderPatch> blockBufferBuilders = new HashMap<>();
private final Map<ChunkRendererSchematicVbo.OverlayRenderType, BufferBuilderPatch> overlayBufferBuilders = new HashMap<>();
private final ConcurrentHashMap<RenderLayer, BufferBuilderPatch> blockBufferBuilders = new ConcurrentHashMap<>();
private final Map<ChunkRendererSchematicVbo.OverlayRenderType, BufferBuilderPatch> overlayBufferBuilders = new ConcurrentHashMap<>();

protected BufferBuilderCache() { }

protected boolean hasBufferByLayer(RenderLayer layer)
{
return this.blockBufferBuilders.containsKey(layer);
return blockBufferBuilders.containsKey(layer);
}

protected boolean hasBufferByOverlay(ChunkRendererSchematicVbo.OverlayRenderType type)
{
return this.overlayBufferBuilders.containsKey(type);
return overlayBufferBuilders.containsKey(type);
}

protected BufferBuilderPatch getBufferByLayer(RenderLayer layer, @Nonnull BufferAllocatorCache allocators)
{
if (this.hasBufferByLayer(layer) == false)
{
this.blockBufferBuilders.put(layer, new BufferBuilderPatch(allocators.getBufferByLayer(layer), layer.getDrawMode(), layer.getVertexFormat()));
}

return this.blockBufferBuilders.get(layer);
return blockBufferBuilders.computeIfAbsent(layer, (key) -> new BufferBuilderPatch(allocators.getBufferByLayer(key), key.getDrawMode(), key.getVertexFormat()));
}

protected BufferBuilderPatch getBufferByOverlay(ChunkRendererSchematicVbo.OverlayRenderType type, @Nonnull BufferAllocatorCache allocators)
{
if (this.hasBufferByOverlay(type) == false)
{
this.overlayBufferBuilders.put(type, new BufferBuilderPatch(allocators.getBufferByOverlay(type), type.getDrawMode(), type.getVertexFormat()));
}

return this.overlayBufferBuilders.get(type);
}

private void clear(BufferBuilderPatch buffer)
{
try
{
BuiltBuffer built = buffer.endNullable();

if (built != null)
{
built.close();
}
}
catch (Exception ignored) { }
return overlayBufferBuilders.computeIfAbsent(type,(key) -> new BufferBuilderPatch(allocators.getBufferByOverlay(key), key.getDrawMode(), key.getVertexFormat()));
}

protected void clearAll()
{
this.blockBufferBuilders.forEach((layer, buffer) -> this.clear(buffer));
this.overlayBufferBuilders.forEach((type, buffer) -> this.clear(buffer));
this.blockBufferBuilders.clear();
this.overlayBufferBuilders.clear();
ArrayList<BufferBuilderPatch> buffers;
synchronized (blockBufferBuilders) {
buffers = new ArrayList<>(blockBufferBuilders.values());
blockBufferBuilders.clear();
}
synchronized (overlayBufferBuilders) {
buffers.addAll(overlayBufferBuilders.values());
overlayBufferBuilders.clear();
}
for(BufferBuilderPatch buffer:buffers) {
try{
BuiltBuffer built = buffer.endNullable();
if(built!=null)
built.close();
} catch (Exception ignored) {}
}
}

@Override
Expand Down
Loading
Loading