|
@@ -2,7 +2,6 @@ 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.util.List;
|
|
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.blocks.cookingpot.TileEntityCookingPot;
|
|
import me.km.blocks.cookingpot.TileEntityCookingPot;
|
|
import me.km.items.ItemColoredSoup;
|
|
import me.km.items.ItemColoredSoup;
|
|
@@ -36,18 +35,12 @@ import net.minecraft.client.renderer.entity.EntityRenderer;
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
|
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
|
import net.minecraft.client.world.ClientWorld;
|
|
import net.minecraft.client.world.ClientWorld;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.Entity;
|
|
-import net.minecraft.item.Item;
|
|
|
|
-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.particles.ParticleTypes;
|
|
import net.minecraft.particles.ParticleTypes;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
import net.minecraft.util.text.ITextComponent;
|
|
-import net.minecraft.util.text.StringTextComponent;
|
|
|
|
-import net.minecraft.util.text.TextFormatting;
|
|
|
|
-import net.minecraft.util.text.LanguageMap;
|
|
|
|
import net.minecraft.world.GameType;
|
|
import net.minecraft.world.GameType;
|
|
import net.minecraft.world.GrassColors;
|
|
import net.minecraft.world.GrassColors;
|
|
import net.minecraft.world.biome.BiomeColors;
|
|
import net.minecraft.world.biome.BiomeColors;
|
|
@@ -57,7 +50,6 @@ import net.minecraftforge.client.event.GuiScreenEvent;
|
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
|
import net.minecraftforge.client.event.RenderNameplateEvent;
|
|
import net.minecraftforge.client.event.RenderNameplateEvent;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
import net.minecraftforge.common.MinecraftForge;
|
|
-import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
|
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
|
import net.minecraftforge.event.TickEvent;
|
|
import net.minecraftforge.event.TickEvent;
|
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
@@ -261,219 +253,4 @@ public class Client {
|
|
ItemStackDisplayGui.INSTANCE.setActive(false);
|
|
ItemStackDisplayGui.INSTANCE.setActive(false);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- @SubscribeEvent
|
|
|
|
- public void showingTooltip(ItemTooltipEvent e) {
|
|
|
|
- ItemStack stack = e.getItemStack();
|
|
|
|
- Item item = stack.getItem();
|
|
|
|
- if(item instanceof ArmorItem) {
|
|
|
|
- CompoundNBT com = stack.getTag();
|
|
|
|
- if(com != null && com.contains("magic")) {
|
|
|
|
- int magic = com.getInt("magic");
|
|
|
|
- if(magic != 0) {
|
|
|
|
- List<ITextComponent> list = e.getToolTip();
|
|
|
|
- for(int i = 0; i < list.size(); i++) {
|
|
|
|
- if(list.get(i).getString().contains("+")) {
|
|
|
|
- list.add(i, new StringTextComponent(
|
|
|
|
- String.format("%s+%d %s", TextFormatting.BLUE, magic,
|
|
|
|
- LanguageMap.getInstance().translateKey("magicarmor"))));
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /*@SubscribeEvent
|
|
|
|
- public void test(net.minecraftforge.client.event.ClientChatEvent e)
|
|
|
|
- {
|
|
|
|
- net.minecraft.world.chunk.Chunk c = Minecraft.getInstance().player.world.getChunkAt(Minecraft.getInstance().player.getPosition());
|
|
|
|
-
|
|
|
|
- if(!e.getMessage().equals("run"))
|
|
|
|
- {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- int cluster = 0;
|
|
|
|
- int blocks = 0;
|
|
|
|
-
|
|
|
|
- net.minecraft.util.math.BlockPos.MutableBlockPos pos = new net.minecraft.util.math.BlockPos.MutableBlockPos();
|
|
|
|
-
|
|
|
|
- for(int x = 0; x < 16; x += 4)
|
|
|
|
- {
|
|
|
|
- for(int z = 0; z < 16; z += 4)
|
|
|
|
- {
|
|
|
|
- for(int y = 0; y < 256; y += 16)
|
|
|
|
- {
|
|
|
|
- cluster++;
|
|
|
|
- pos.setPos(x, y, z);
|
|
|
|
- blocks++;
|
|
|
|
- net.minecraft.block.Block current = c.getBlockState(pos).getBlock();
|
|
|
|
- for(int mx = 0; mx < 4; mx++)
|
|
|
|
- {
|
|
|
|
- for(int mz = 0; mz < 4; mz++)
|
|
|
|
- {
|
|
|
|
- for(int my = 0; my < 16; my++)
|
|
|
|
- {
|
|
|
|
- pos.setPos(x + mx, y + my, z + mz);
|
|
|
|
- net.minecraft.block.Block next = c.getBlockState(pos).getBlock();
|
|
|
|
- if(current != next)
|
|
|
|
- {
|
|
|
|
- current = next;
|
|
|
|
- blocks++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger();
|
|
|
|
- logger.info("------------------------------------");
|
|
|
|
- logger.info(String.format("cluster: %d", cluster));
|
|
|
|
- logger.info(String.format("blocks: %d", blocks));
|
|
|
|
- logger.info(String.format("compression rate: %f", (16 * 16 * 256 * 16) / (cluster * 64.0 + blocks * 24.0)));
|
|
|
|
-
|
|
|
|
- cluster = 0;
|
|
|
|
- blocks = 0;
|
|
|
|
-
|
|
|
|
- for(int x = 0; x < 16; x++)
|
|
|
|
- {
|
|
|
|
- for(int z = 0; z < 16; z++)
|
|
|
|
- {
|
|
|
|
- cluster++;
|
|
|
|
- pos.setPos(x, 0, z);
|
|
|
|
- blocks++;
|
|
|
|
- net.minecraft.block.Block current = c.getBlockState(pos).getBlock();
|
|
|
|
- for(int y = 0; y < 256; y++)
|
|
|
|
- {
|
|
|
|
- pos.setPos(x, y, z);
|
|
|
|
- net.minecraft.block.Block next = c.getBlockState(pos).getBlock();
|
|
|
|
- if(current != next)
|
|
|
|
- {
|
|
|
|
- current = next;
|
|
|
|
- blocks++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- logger.info("------");
|
|
|
|
- logger.info(String.format("cluster %d blocks", cluster, blocks));
|
|
|
|
- logger.info(String.format("cluster: %d", cluster));
|
|
|
|
- logger.info(String.format("blocks: %d", blocks));
|
|
|
|
- logger.info(String.format("compression rate: %f", (16 * 16 * 256 * 16) / (cluster * 64.0 + blocks * 24.0)));
|
|
|
|
-
|
|
|
|
- cluster = 1;
|
|
|
|
- blocks = 1;
|
|
|
|
- pos.setPos(0, 0, 0);
|
|
|
|
- net.minecraft.block.Block current = c.getBlockState(pos).getBlock();
|
|
|
|
- for(int y = 0; y < 256; y++)
|
|
|
|
- {
|
|
|
|
- for(int x = 0; x < 16; x++)
|
|
|
|
- {
|
|
|
|
- for(int z = 0; z < 16; z++)
|
|
|
|
- {
|
|
|
|
- pos.setPos(x, y, z);
|
|
|
|
- net.minecraft.block.Block next = c.getBlockState(pos).getBlock();
|
|
|
|
- if(current != next)
|
|
|
|
- {
|
|
|
|
- current = next;
|
|
|
|
- blocks++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- logger.info("------");
|
|
|
|
- logger.info(String.format("cluster %d blocks", cluster, blocks));
|
|
|
|
- logger.info(String.format("cluster: %d", cluster));
|
|
|
|
- logger.info(String.format("blocks: %d", blocks));
|
|
|
|
- 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]));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|