-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathMChunkRendererRegion.java
55 lines (48 loc) · 2.22 KB
/
MChunkRendererRegion.java
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
46
47
48
49
50
51
52
53
54
55
package dev.dfonline.codeclient.mixin.render;
import dev.dfonline.codeclient.CodeClient;
import dev.dfonline.codeclient.dev.NoClip;
import dev.dfonline.codeclient.location.Plot;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(World.class)
public abstract class MChunkRendererRegion {
@Shadow public abstract boolean setBlockState(BlockPos pos, BlockState state);
// @Inject(method = "getBlockState", at = @At("HEAD"), cancellable = true)
// private void getAppearance(BlockPos pos, CallbackInfoReturnable<BlockState> cir) {
// if(CodeClient.location instanceof Plot plot) {
// Boolean inPlot = plot.isInPlot(pos);
// if(inPlot != null && !inPlot) {
// cir.setReturnValue(Blocks.VOID_AIR.getDefaultState());
// }
// BlockState state = NoClip.replaceBlockAt(pos);
// if(state != null) {
// CodeClient.MC.world.setBlockState(pos, state);
// this.setBlockState(pos, state);
// cir.setReturnValue(state);
// }
// }
// }
@Inject(method = "getBlockState", at = @At("RETURN"))
private void getSize(BlockPos pos, CallbackInfoReturnable<BlockState> cir) {
BlockState block = cir.getReturnValue();
if(block == null) return;
if(CodeClient.location instanceof Plot plot) {
if(plot.getX() == null) return;
if(plot.getSize() != null) return;
if(pos.getY() != 49) return;
if(block.getBlock() != Blocks.STONE) return;
if(pos.getX() + 1 > plot.getX()) return;
if(pos.getX() < plot.getX() - 19) return;
if(pos.getZ() == plot.getZ() + 50) plot.setSize(Plot.Size.BASIC);
if(pos.getZ() == plot.getZ() + 100) plot.setSize(Plot.Size.LARGE);
if(pos.getZ() == plot.getZ() + 300) plot.setSize(Plot.Size.MASSIVE);
}
}
}