Skip to content

Commit c63bfa4

Browse files
committed
Update LevelChunkSectionMixin fixes #169
1 parent 8a43c9f commit c63bfa4

2 files changed

Lines changed: 9 additions & 16 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,7 @@ run/
119119

120120
ConcurrentUtil/
121121
YamlConfig/
122+
123+
.settings
124+
.eclipse/
125+
.project

src/main/java/ca/spottedleaf/moonrise/mixin/block_counting/LevelChunkSectionMixin.java

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ abstract class LevelChunkSectionMixin implements BlockCountingChunkSection {
3838
@Shadow
3939
private short nonEmptyBlockCount;
4040

41+
@Shadow
42+
private short fluidCount;
43+
4144
@Shadow
4245
private short tickingBlockCount;
4346

@@ -124,21 +127,6 @@ private void updateBlockCallback(final int x, final int y, final int z, final Bl
124127
}
125128
}
126129

127-
/**
128-
* @reason We should only adjust the fluid ticking count based on whether the fluid is TICKING, not whether it is EMPTY.
129-
* @author Spottedleaf
130-
*/
131-
@Redirect(
132-
method = "setBlockState(IIILnet/minecraft/world/level/block/state/BlockState;Z)Lnet/minecraft/world/level/block/state/BlockState;",
133-
at = @At(
134-
value = "INVOKE",
135-
target = "Lnet/minecraft/world/level/material/FluidState;isEmpty()Z"
136-
)
137-
)
138-
private boolean fixTickingFluidCount(final FluidState instance) {
139-
return !instance.isRandomlyTicking();
140-
}
141-
142130
/**
143131
* @reason Calculate block counts after deserialization.
144132
* @author Spottedleaf
@@ -147,6 +135,7 @@ private boolean fixTickingFluidCount(final FluidState instance) {
147135
public void recalcBlockCounts() {
148136
// reset, then recalculate
149137
this.nonEmptyBlockCount = (short)0;
138+
this.fluidCount = (short)0;
150139
this.tickingBlockCount = (short)0;
151140
this.tickingFluidCount = (short)0;
152141
this.specialCollidingBlocks = (short)0;
@@ -200,7 +189,7 @@ public void recalcBlockCounts() {
200189
final FluidState fluid = state.getFluidState();
201190

202191
if (!fluid.isEmpty()) {
203-
//this.nonEmptyBlockCount += count; // fix vanilla bug: make non-empty block count correct
192+
this.fluidCount += (short)paletteCount;
204193
if (fluid.isRandomlyTicking()) {
205194
this.tickingFluidCount += (short)paletteCount;
206195
}

0 commit comments

Comments
 (0)