Skip to content

Commit

Permalink
Fix error on ViewArea camera reposition
Browse files Browse the repository at this point in the history
  • Loading branch information
xCollateral committed Sep 24, 2024
1 parent d376d8c commit b447a65
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/main/java/net/vulkanmod/mixin/chunk/ViewAreaM.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ViewArea.class)
public class ViewAreaM {
public abstract class ViewAreaM {

@Shadow public SectionRenderDispatcher.RenderSection[] sections;

@Inject(method = "createSections", at = @At("HEAD"), cancellable = true)
private void skipAllocation(SectionRenderDispatcher sectionRenderDispatcher, CallbackInfo ci) {
this.sections = new SectionRenderDispatcher.RenderSection[0];
@Shadow protected abstract void setViewDistance(int i);

ci.cancel();
@Inject(method = "createSections", at = @At("HEAD"))
private void skipAllocation(SectionRenderDispatcher sectionRenderDispatcher, CallbackInfo ci) {
// It's not possible to completely skip allocation since it would cause an error if repositionCamera is called
this.setViewDistance(0);
}
}

0 comments on commit b447a65

Please sign in to comment.