Update testmod to 1.18
This commit is contained in:
parent
0779058ca5
commit
d52e6467ac
|
|
@ -16,6 +16,7 @@ dependencies {
|
|||
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
|
||||
modImplementation(fabricApi.module("fabric-resource-loader-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-models-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-registry-sync-v0", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-renderer-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modRuntimeOnly(fabricApi.module("fabric-renderer-indigo", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.testmod.client;
|
|||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import org.embeddedt.modernfix.testmod.TestMod;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
|
@ -23,5 +24,7 @@ public class TestModClient implements ClientModInitializer {
|
|||
}
|
||||
return null;
|
||||
});
|
||||
// needed to make debug level rendering work correctly
|
||||
Minecraft.getInstance().smartCull = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
package org.embeddedt.modernfix.testmod.mixin;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import org.embeddedt.modernfix.testmod.TestMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -14,20 +17,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||
@Mixin(DebugLevelSource.class)
|
||||
public class DebugLevelSourceMixin {
|
||||
@Inject(method = "applyBiomeDecoration", at = @At("HEAD"), cancellable = true)
|
||||
private void showColorCube(WorldGenRegion region, StructureFeatureManager structureManager, CallbackInfo ci) {
|
||||
private void showColorCube(WorldGenLevel level, ChunkAccess chunk, StructureFeatureManager structureFeatureManager, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||
int i = region.getCenterX();
|
||||
int j = region.getCenterZ();
|
||||
ChunkPos chunkPos = chunk.getPos();
|
||||
int i = chunkPos.x;
|
||||
int j = chunkPos.z;
|
||||
|
||||
for(int k = 0; k < 16; ++k) {
|
||||
for(int l = 0; l < 16; ++l) {
|
||||
int m = (i << 4) + k;
|
||||
int n = (j << 4) + l;
|
||||
int m = SectionPos.sectionToBlockCoord(i, k);
|
||||
int n = SectionPos.sectionToBlockCoord(j, l);
|
||||
for(int y = 0; y < 255; y++) {
|
||||
BlockState blockState = TestMod.getColorCubeStateFor(m, y, n);
|
||||
if (blockState != null) {
|
||||
region.setBlock(mutableBlockPos.set(m, y, n), blockState, 2);
|
||||
level.setBlock(mutableBlockPos.set(m, y, n), blockState, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
package org.embeddedt.modernfix.testmod.mixin;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import org.embeddedt.modernfix.testmod.TestMod;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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(targets = { "net/minecraft/client/renderer/chunk/RenderChunk" })
|
||||
public class RenderChunkMixin {
|
||||
@Shadow @Final private boolean debug;
|
||||
|
||||
@Inject(method = "getBlockState", at = @At("HEAD"), cancellable = true)
|
||||
private void redirectDebugWorld(BlockPos pos, CallbackInfoReturnable<BlockState> cir) {
|
||||
if(this.debug) {
|
||||
cir.setReturnValue(TestMod.getColorCubeStateFor(pos.getX(), pos.getY(), pos.getZ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,9 @@
|
|||
"ChunkMixin",
|
||||
"DebugLevelSourceMixin"
|
||||
],
|
||||
"client": [
|
||||
"RenderChunkMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user