C U B E
This commit is contained in:
parent
cb6ff1d68b
commit
8b4c5d4c7a
|
|
@ -4,6 +4,7 @@ loom {
|
|||
accessWidenerPath = project(":common").loom.accessWidenerPath
|
||||
runs {
|
||||
client {
|
||||
vmArgs "-Xmx8G"
|
||||
property("modernfix.config.mixin.perf.blast_search_trees", "true")
|
||||
property("modernfix.config.mixin.perf.dynamic_resources", "true")
|
||||
property("modernfix.config.mixin.perf.dynamic_block_codecs", "true")
|
||||
|
|
@ -24,6 +25,8 @@ dependencies {
|
|||
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-renderer-api-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-rendering-data-attachment-v1", rootProject.fabric_api_version)) { exclude group: 'net.fabricmc', module: 'fabric-loader' }
|
||||
modImplementation(fabricApi.module("fabric-rendering-fluids-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' }
|
||||
|
||||
implementation project(path: ":common", configuration: "namedElements")
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class TestMod implements ModInitializer {
|
|||
public static final String ID = "mfix_testmod";
|
||||
public static final Logger LOGGER = LogManager.getLogger("ModernFix TestMod");
|
||||
|
||||
public static final int NUM_COLORS = 100;
|
||||
public static final int NUM_COLORS = 256;
|
||||
public static final int MAX_COLOR = NUM_COLORS - 1;
|
||||
|
||||
public static final List<BlockState> WOOL_STATES = new ArrayList<>();
|
||||
|
|
@ -34,7 +34,7 @@ public class TestMod implements ModInitializer {
|
|||
ResourceLocation name = new ResourceLocation(ID, "wool_" + r + "_" + g + "_" + b);
|
||||
TestBlock block = Registry.register(Registry.BLOCK, name, new TestBlock());
|
||||
WOOL_STATES.add(block.defaultBlockState());
|
||||
Registry.register(Registry.ITEM, name, new TestBlockItem(block));
|
||||
//Registry.register(Registry.ITEM, name, new TestBlockItem(block));
|
||||
numRegistered++;
|
||||
if((numRegistered % progressReport) == 0) {
|
||||
LOGGER.info(String.format("Registering... %.02f%%", ((float)numRegistered)/totalToRegister * 100));
|
||||
|
|
@ -49,11 +49,14 @@ public class TestMod implements ModInitializer {
|
|||
private static final BlockState AIR = Blocks.AIR.defaultBlockState();
|
||||
|
||||
public static BlockState getColorCubeStateFor(int chunkX, int chunkY, int chunkZ) {
|
||||
BlockState blockState = AIR;
|
||||
if (chunkX >= 0 && chunkY >= 0 && chunkZ >= 0 && chunkX % 2 == 0 && chunkY % 2 == 0 && chunkZ % 2 == 0) {
|
||||
BlockState blockState = null;
|
||||
if (chunkX >= 0 && chunkY >= 0 && chunkZ >= 0) { // && chunkX % 2 == 0 && chunkY % 2 == 0 && chunkZ % 2 == 0) {
|
||||
/*
|
||||
chunkX /= 2;
|
||||
chunkY /= 2;
|
||||
chunkZ /= 2;
|
||||
|
||||
*/
|
||||
if(chunkX <= TestMod.MAX_COLOR && chunkY <= TestMod.MAX_COLOR && chunkZ <= TestMod.MAX_COLOR) {
|
||||
blockState = TestMod.WOOL_STATES.get((chunkX * TestMod.NUM_COLORS * TestMod.NUM_COLORS) + (chunkY * TestMod.NUM_COLORS) + chunkZ);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.embeddedt.modernfix.testmod.client;
|
|||
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
|
||||
import org.embeddedt.modernfix.fabric.api.dynresources.ModelScanController;
|
||||
import org.embeddedt.modernfix.testmod.TestMod;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
|
|
@ -11,6 +12,7 @@ public class TestModClient implements ClientModInitializer {
|
|||
private static final Pattern RGB_PATTERN = Pattern.compile("^wool_([0-9]+)_([0-9]+)_([0-9]+)$");
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
ModelScanController.SCAN_PREDICATES.add(rl -> !rl.getNamespace().equals(TestMod.ID));
|
||||
ModelLoadingRegistry.INSTANCE.registerVariantProvider(resourceManager -> (modelId, context) -> {
|
||||
if(modelId.getNamespace().equals(TestMod.ID)) {
|
||||
Matcher matcher = RGB_PATTERN.matcher(modelId.getPath());
|
||||
|
|
|
|||
|
|
@ -1,25 +1,21 @@
|
|||
package org.embeddedt.modernfix.testmod.mixin;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.LevelChunk;
|
||||
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(LevelChunk.class)
|
||||
public class ChunkMixin {
|
||||
@Shadow @Final private Level level;
|
||||
|
||||
@Inject(method = "getBlockState", at = @At("HEAD"), cancellable = true)
|
||||
private void redirectDebugWorld(BlockPos pos, CallbackInfoReturnable<BlockState> cir) {
|
||||
if(this.level.isDebug()) {
|
||||
cir.setReturnValue(TestMod.getColorCubeStateFor(pos.getX(), pos.getY(), pos.getZ()));
|
||||
BlockState overrideState = TestMod.getColorCubeStateFor(pos.getX(), pos.getY(), pos.getZ());
|
||||
if(overrideState != null) {
|
||||
cir.setReturnValue(overrideState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,19 +3,22 @@ package org.embeddedt.modernfix.testmod.mixin;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.WorldGenRegion;
|
||||
import net.minecraft.world.level.StructureFeatureManager;
|
||||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.DebugLevelSource;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.FlatLevelSource;
|
||||
import net.minecraft.world.level.levelgen.StructureSettings;
|
||||
import org.embeddedt.modernfix.testmod.TestMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
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) {
|
||||
ci.cancel();
|
||||
@Mixin(FlatLevelSource.class)
|
||||
public abstract class DebugLevelSourceMixin extends ChunkGenerator {
|
||||
public DebugLevelSourceMixin(BiomeSource biomeSource, StructureSettings structureSettings) {
|
||||
super(biomeSource, structureSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyBiomeDecoration(WorldGenRegion region, StructureFeatureManager structureManager) {
|
||||
BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos();
|
||||
int i = region.getCenterX();
|
||||
int j = region.getCenterZ();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user