|
@@ -2,6 +2,11 @@ package me.km;
|
|
|
|
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
|
import java.awt.Color;
|
|
import java.awt.Color;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.HashSet;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.blocks.cookingpot.TileEntityCookingPot;
|
|
import me.km.blocks.cookingpot.TileEntityCookingPot;
|
|
@@ -17,6 +22,8 @@ import me.km.networking.PlayerDisplayGui;
|
|
import me.km.networking.PlayerHeadGui;
|
|
import me.km.networking.PlayerHeadGui;
|
|
import me.km.networking.StatusDisplayGui;
|
|
import me.km.networking.StatusDisplayGui;
|
|
import me.km.utils.ClientReflectionUtils;
|
|
import me.km.utils.ClientReflectionUtils;
|
|
|
|
+import net.minecraft.block.Block;
|
|
|
|
+import net.minecraft.block.BlockState;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
import net.minecraft.client.gui.FontRenderer;
|
|
import net.minecraft.client.gui.screen.MainMenuScreen;
|
|
import net.minecraft.client.gui.screen.MainMenuScreen;
|
|
@@ -38,11 +45,13 @@ import net.minecraft.item.ArmorItem;
|
|
import net.minecraft.item.BlockItem;
|
|
import net.minecraft.item.BlockItem;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.nbt.CompoundNBT;
|
|
import net.minecraft.nbt.CompoundNBT;
|
|
|
|
+import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.StringTextComponent;
|
|
import net.minecraft.util.text.StringTextComponent;
|
|
import net.minecraft.util.text.TextFormatting;
|
|
import net.minecraft.util.text.TextFormatting;
|
|
import net.minecraft.util.text.LanguageMap;
|
|
import net.minecraft.util.text.LanguageMap;
|
|
import net.minecraft.world.GrassColors;
|
|
import net.minecraft.world.GrassColors;
|
|
|
|
+import net.minecraft.world.World;
|
|
import net.minecraft.world.biome.BiomeColors;
|
|
import net.minecraft.world.biome.BiomeColors;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.Dist;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
|
@@ -336,4 +345,89 @@ public class Client {
|
|
logger.info(String.format("blocks: %d", blocks));
|
|
logger.info(String.format("blocks: %d", blocks));
|
|
logger.info(String.format("compression rate: %f", (16 * 16 * 256 * 16) / (cluster * 64.0 + blocks * 24.0)));
|
|
logger.info(String.format("compression rate: %f", (16 * 16 * 256 * 16) / (cluster * 64.0 + blocks * 24.0)));
|
|
}*/
|
|
}*/
|
|
|
|
+
|
|
|
|
+ /*@SubscribeEvent
|
|
|
|
+ public void test(net.minecraftforge.client.event.ClientChatEvent e) {
|
|
|
|
+ int size;
|
|
|
|
+ try {
|
|
|
|
+ size = Short.parseShort(e.getMessage());
|
|
|
|
+ } catch(NumberFormatException ex) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ World w = Minecraft.getInstance().player.world;
|
|
|
|
+ int idCounter = 0;
|
|
|
|
+ HashMap<BlockState, Integer> mapping = new HashMap<>();
|
|
|
|
+ int sizeY = Math.min(256, size);
|
|
|
|
+
|
|
|
|
+ int index = 0;
|
|
|
|
+ byte[] b = new byte[sizeY * size * size];
|
|
|
|
+
|
|
|
|
+ BlockPos.Mutable pos = new BlockPos.Mutable();
|
|
|
|
+ for(int x = 0; x < size; x++) {
|
|
|
|
+ for(int y = 0; y < sizeY; y++) {
|
|
|
|
+ for(int z = 0; z < size; z++) {
|
|
|
|
+ pos.setPos(x, y, z);
|
|
|
|
+ BlockState blockState = w.getBlockState(pos);
|
|
|
|
+ Integer id = mapping.get(blockState);
|
|
|
|
+ if(id == null) {
|
|
|
|
+ id = idCounter++;
|
|
|
|
+ mapping.put(blockState, id);
|
|
|
|
+ }
|
|
|
|
+ b[index++] = id.byteValue();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Thread th = new Thread(() -> {
|
|
|
|
+ try(FileOutputStream out = new FileOutputStream(new File(String.format("%d_%d_data", size, size)))) {
|
|
|
|
+ out.write(b);
|
|
|
|
+ } catch(IOException ex) {
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ th.start();
|
|
|
|
+
|
|
|
|
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger();
|
|
|
|
+ logger.info("------------------------------------");
|
|
|
|
+ logger.info(String.format("block types: %d", idCounter));
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ /*@SubscribeEvent
|
|
|
|
+ public void test(net.minecraftforge.client.event.ClientChatEvent e) {
|
|
|
|
+ int size;
|
|
|
|
+ try {
|
|
|
|
+ size = Integer.parseInt(e.getMessage());
|
|
|
|
+ } catch(NumberFormatException ex) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ World w = Minecraft.getInstance().player.world;
|
|
|
|
+
|
|
|
|
+ int[] counter = new int[256];
|
|
|
|
+
|
|
|
|
+ int sizeY = Math.min(256, size);
|
|
|
|
+ BlockPos.Mutable pos = new BlockPos.Mutable();
|
|
|
|
+ for(int cx = 0; cx < size; cx += 16) {
|
|
|
|
+ for(int cy = 0; cy < 16; cy += 16) {
|
|
|
|
+ for(int cz = 0; cz < size; cz += 16) {
|
|
|
|
+ HashSet<BlockState> states = new HashSet<>();
|
|
|
|
+ for(int x = 0; x < 16; x++) {
|
|
|
|
+ for(int y = 0; y < 16; y++) {
|
|
|
|
+ for(int z = 0; z < 16; z++) {
|
|
|
|
+ pos.setPos(cx + x, cy + y, cz + z);
|
|
|
|
+ states.add(w.getBlockState(pos));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ counter[states.size()]++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger();
|
|
|
|
+ logger.info("------------------------------------");
|
|
|
|
+ for(int i = 0; i < counter.length; i++) {
|
|
|
|
+ logger.info(String.format("%d: %d", i, counter[i]));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }*/
|
|
}
|
|
}
|