-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathMixinLevel.java
More file actions
45 lines (37 loc) · 1.58 KB
/
MixinLevel.java
File metadata and controls
45 lines (37 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package net.modificationstation.sltest.mixin;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.storage.WorldStorage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import javax.swing.*;
import java.awt.image.BufferedImage;
import java.awt.image.DataBufferInt;
@Mixin(World.class)
public abstract class MixinLevel {
@Shadow public abstract BiomeSource getBiomeSource();
/*@Inject(
method = "<init>(Lnet/minecraft/level/dimension/DimensionData;Ljava/lang/String;J)V",
at = @At("TAIL")
)*/
private void onInit(WorldStorage string, String l, long par3, CallbackInfo ci) {
int side = 800;
BufferedImage buffer = new BufferedImage(side, side, BufferedImage.TYPE_INT_ARGB);
int[] pixels = ((DataBufferInt) buffer.getRaster().getDataBuffer()).getData();
int start = -(side >> 1);
BiomeSource biomeSource = getBiomeSource();
Biome[] biomes = biomeSource.getBiomesInArea(new Biome[side * side], start, start, side, side);
for (int i = 0; i < pixels.length; i++) {
pixels[i] = biomes[i].grassColor | 0xFF000000;
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(new JLabel(new ImageIcon(buffer)));
frame.setResizable(false);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}