generated from Turnip-Labs/bta-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
src/main/java/rootenginear/playground/mixin/ChunkProviderClientMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package rootenginear.playground.mixin; | ||
|
||
import net.minecraft.client.world.chunk.provider.ChunkProviderClient; | ||
import net.minecraft.core.world.chunk.Chunk; | ||
import net.minecraft.core.world.chunk.ChunkCoordIntPair; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
import rootenginear.playground.ChunkProcessor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Mixin(value = ChunkProviderClient.class, remap = false) | ||
public abstract class ChunkProviderClientMixin { | ||
@Shadow | ||
private Map chunkMapping; | ||
|
||
@Unique | ||
List<ChunkCoordIntPair> dumpedChunks = new ArrayList<>(); | ||
|
||
@Inject(method = "provideChunk", at = @At("TAIL")) | ||
void joopChunk(int chunkX, int chunkZ, CallbackInfoReturnable<Chunk> cir) { | ||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(chunkX, chunkZ); | ||
Chunk chunk = (Chunk) this.chunkMapping.get(chunkcoordintpair); | ||
if (dumpedChunks.contains(chunkcoordintpair) || chunk == null || !chunk.receivedFromServer) return; | ||
System.out.println("Dumping " + chunkX + " " + chunkZ); | ||
try { | ||
dumpedChunks.add(chunkcoordintpair); | ||
ChunkProcessor.readAndDumpChunkData(chunkX, chunkZ, chunk); | ||
} catch (Exception ignored) { | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,8 @@ | |
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
}, | ||
"client": [ | ||
"ChunkProviderClientMixin" | ||
] | ||
} |