mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
Fixinum
- Fix missing chunks when backend is off and sodium installed. - Fix crashes when used with iris.
This commit is contained in:
parent
377c729355
commit
ccbcaf9e3f
1 changed files with 10 additions and 5 deletions
|
@ -10,6 +10,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.jozufozu.flywheel.backend.Backend;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher;
|
||||
import com.jozufozu.flywheel.backend.instancing.InstancedRenderRegistry;
|
||||
|
||||
|
@ -30,15 +31,19 @@ public class SodiumChunkRenderDataMixin {
|
|||
|
||||
@Inject(method = "addBlockEntity", at = @At("HEAD"), cancellable = true, require = 0)
|
||||
private void flywheel$onAddBlockEntity(BlockEntity be, boolean cull, CallbackInfo ci) {
|
||||
if (flywheel$level == null) {
|
||||
flywheel$level = be.getLevel();
|
||||
}
|
||||
|
||||
if (!Backend.canUseInstancing(flywheel$level)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (InstancedRenderRegistry.canInstance(be.getType())) {
|
||||
if (flywheel$blockEntities == null) {
|
||||
flywheel$blockEntities = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (flywheel$level == null) {
|
||||
flywheel$level = be.getLevel();
|
||||
}
|
||||
|
||||
// Collect BEs in a temporary list to avoid excessive synchronization in InstancedRenderDispatcher.
|
||||
flywheel$blockEntities.add(be);
|
||||
}
|
||||
|
@ -50,7 +55,7 @@ public class SodiumChunkRenderDataMixin {
|
|||
|
||||
@Inject(method = "build", at = @At("HEAD"))
|
||||
private void flywheel$onBuild(CallbackInfoReturnable<ChunkRenderData> cir) {
|
||||
if (flywheel$level == null || flywheel$blockEntities == null) {
|
||||
if (flywheel$level == null || flywheel$blockEntities == null || !Backend.canUseInstancing(flywheel$level)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue