basic 1.16.1 support

This commit is contained in:
Eoghanmc22 2020-06-25 15:05:58 -04:00
parent 8e26447f9a
commit b80da2f097
35 changed files with 2304 additions and 1834 deletions

View File

@ -46,8 +46,6 @@ dependencies {
api 'org.mongodb.morphia:morphia:1.3.2'
api 'org.mongodb:mongo-java-driver:3.12.5'
api 'net.kyori:text-api:3.0.3'
api 'net.kyori:text-serializer-legacy:3.0.3'
api 'net.kyori:text-serializer-gson:3.0.3'
api 'net.kyori:text-serializer-plain:3.0.3'

View File

@ -66,7 +66,7 @@ public class Main {
MojangAuth.init();
minecraftServer.start("localhost", 55555, PlayerInit.getResponseDataConsumer());
minecraftServer.start("localhost", 25565, PlayerInit.getResponseDataConsumer());
}
}

View File

@ -41,7 +41,7 @@ public class MainDemo {
});
// Start the server
minecraftServer.start("localhost", 55555);
minecraftServer.start("localhost", 25565);
}
private static class GeneratorDemo extends ChunkGenerator {

View File

@ -32,6 +32,7 @@ import net.minestom.server.world.Difficulty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.net.Proxy;
import java.security.KeyPair;
@ -40,7 +41,7 @@ public class MinecraftServer {
@Getter
private final static Logger LOGGER = LoggerFactory.getLogger(MinecraftServer.class);
public static final int PROTOCOL_VERSION = 578;
public static final int PROTOCOL_VERSION = 736;
// Threads
public static final String THREAD_NAME_BENCHMARK = "Ms-Benchmark";
@ -141,7 +142,7 @@ public class MinecraftServer {
// Registry
try {
ResourceGatherer.ensureResourcesArePresent(null); // TODO: provide a way to give a path override, probably via launch arguments?
ResourceGatherer.ensureResourcesArePresent(new File("C:\\Users\\Eogha\\AppData\\Roaming\\.minecraft")); // TODO: provide a way to give a path override, probably via launch arguments?
} catch (IOException e) {
LOGGER.error("An error happened during resource gathering. Minestom will attempt to load anyway, but things may not work, and crashes can happen.", e);
}

View File

@ -2,19 +2,19 @@ package net.minestom.server.attribute;
public enum Attribute {
MAX_HEALTH("generic.maxHealth", 20, 1024),
FOLLOW_RANGE("generic.followRange", 32, 2048),
KNOCKBACK_RESISTANCE("generic.knockbackResistance", 0, 1),
MOVEMENT_SPEED("generic.movementSpeed", 0.7f, 1024),
ATTACK_DAMAGE("generic.attackDamage", 2, 2048),
ATTACK_SPEED("generic.attackSpeed", 4, 1024),
FLYING_SPEED("generic.flyingSpeed", 0.4f, 1024),
MAX_HEALTH("generic.max_health", 20, 1024),
FOLLOW_RANGE("generic.follow_range", 32, 2048),
KNOCKBACK_RESISTANCE("generic.knockback_resistance", 0, 1),
MOVEMENT_SPEED("generic.movement_speed", 0.7f, 1024),
ATTACK_DAMAGE("generic.attack_damage", 2, 2048),
ATTACK_SPEED("generic.attack_speed", 4, 1024),
FLYING_SPEED("generic.flying_speed", 0.4f, 1024),
ARMOR("generic.armor", 0, 30),
ARMOR_TOUGHNESS("generic.armorToughness", 0, 20),
ATTACK_KNOCKBACK("generic.attackKnockback", 0, 5),
ARMOR_TOUGHNESS("generic.armor_toughness", 0, 20),
ATTACK_KNOCKBACK("generic.attack_knockback", 0, 5),
LUCK("generic.luck", 0, 1024),
HORSE_JUMP_STRENGTH("horse.jumpStrength", 0.7f, 2),
ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawnReinforcements", 0, 1);
HORSE_JUMP_STRENGTH("horse.jump_strength", 0.7f, 2),
ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawn_reinforcements", 0, 1);
private String key;
private float defaultValue;

View File

@ -17,8 +17,8 @@ public enum EntityType {
COD,
COW,
CREEPER,
DONKEY,
DOLPHIN,
DONKEY,
DRAGON_FIREBALL,
DROWNED,
ELDER_GUARDIAN,
@ -26,8 +26,8 @@ public enum EntityType {
ENDER_DRAGON,
ENDERMAN,
ENDERMITE,
EVOKER_FANGS,
EVOKER,
EVOKER_FANGS,
EXPERIENCE_ORB,
EYE_OF_ENDER,
FALLING_BLOCK,
@ -36,13 +36,16 @@ public enum EntityType {
GHAST,
GIANT,
GUARDIAN,
HOGLIN,
HORSE,
HUSK,
ILLUSIONER,
IRON_GOLEM,
ITEM,
ITEM_FRAME,
FIREBALL,
LEASH_KNOT,
LIGHTNING_BOLT,
LLAMA,
LLAMA_SPIT,
MAGMA_CUBE,
@ -59,12 +62,15 @@ public enum EntityType {
PAINTING,
PANDA,
PARROT,
PHANTOM,
PIG,
PUFFERFISH,
ZOMBIE_PIGMAN,
PIGLIN,
PILLAGER,
POLAR_BEAR,
TNT,
PUFFERFISH,
RABBIT,
RAVAGER,
SALMON,
SHEEP,
SHULKER,
@ -80,31 +86,29 @@ public enum EntityType {
SPIDER,
SQUID,
STRAY,
TRADER_LLAMA,
TROPICAL_FISH,
TURTLE,
STRIDER,
EGG,
ENDER_PEARL,
EXPERIENCE_BOTTLE,
POTION,
TRIDENT,
TRADER_LLAMA,
TROPICAL_FISH,
TURTLE,
VEX,
VILLAGER,
IRON_GOLEM,
VINDICATOR,
PILLAGER,
WANDERING_TRADER,
WITCH,
WITHER,
WITHER_SKELETON,
WITHER_SKULL,
WOLF,
ZOGLIN,
ZOMBIE,
ZOMBIE_HORSE,
ZOMBIE_VILLAGER,
PHANTOM,
RAVAGER,
LIGHTNING_BOLT,
ZOMBIFIED_PIGLIN,
PLAYER,
FISHING_BOBBER;

View File

@ -126,7 +126,7 @@ public class Player extends LivingEntity implements CommandSender {
private boolean allowFlying;
private boolean instantBreak;
private float flyingSpeed = 0.05f;
private float fieldViewModifier = 0.1f;
private float walkingSpeed = 0.1f;
// Statistics
private Map<PlayerStatistic, Integer> statisticValueMap = new Hashtable<>();
@ -264,6 +264,14 @@ public class Player extends LivingEntity implements CommandSender {
return result;
}
@Override
public float getAttributeValue(Attribute attribute) {
if (attribute == Attribute.MOVEMENT_SPEED) {
return walkingSpeed;
}
return super.getAttributeValue(attribute);
}
@Override
public void update(long time) {
// Flush all pending packets
@ -1672,12 +1680,12 @@ public class Player extends LivingEntity implements CommandSender {
refreshAbilities();
}
public float getFieldViewModifier() {
return fieldViewModifier;
public float getWalkingSpeed() {
return walkingSpeed;
}
public void setFieldViewModifier(float fieldViewModifier) {
this.fieldViewModifier = fieldViewModifier;
public void setWalkingSpeed(float walkingSpeed) {
this.walkingSpeed = walkingSpeed;
refreshAbilities();
}
@ -1707,7 +1715,7 @@ public class Player extends LivingEntity implements CommandSender {
playerAbilitiesPacket.allowFlying = allowFlying;
playerAbilitiesPacket.instantBreak = instantBreak;
playerAbilitiesPacket.flyingSpeed = flyingSpeed;
playerAbilitiesPacket.fieldViewModifier = fieldViewModifier;
playerAbilitiesPacket.walkingSpeed = walkingSpeed;
playerConnection.sendPacket(playerAbilitiesPacket);
}

View File

@ -13,7 +13,7 @@ public class EntityPigZombie extends EntityCreature {
private boolean becomingDrowned;
public EntityPigZombie(Position spawnPosition) {
super(EntityType.ZOMBIE_PIGMAN, spawnPosition);
super(EntityType.ZOMBIFIED_PIGLIN, spawnPosition);
setBoundingBox(0.6f, 1.95f, 0.6f);
}

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,7 @@ public enum Enchantment {
DEPTH_STRIDER,
FROST_WALKER,
BINDING_CURSE,
SOUL_SPEED,
SHARPNESS,
SMITE,
BANE_OF_ARTHROPODS,

View File

@ -17,6 +17,8 @@ public enum Material {
DIRT,
COARSE_DIRT,
PODZOL,
CRIMSON_NYLIUM,
WARPED_NYLIUM,
COBBLESTONE,
OAK_PLANKS,
SPRUCE_PLANKS,
@ -24,6 +26,8 @@ public enum Material {
JUNGLE_PLANKS,
ACACIA_PLANKS,
DARK_OAK_PLANKS,
CRIMSON_PLANKS,
WARPED_PLANKS,
OAK_SAPLING,
SPRUCE_SAPLING,
BIRCH_SAPLING,
@ -37,30 +41,39 @@ public enum Material {
GOLD_ORE,
IRON_ORE,
COAL_ORE,
NETHER_GOLD_ORE,
OAK_LOG,
SPRUCE_LOG,
BIRCH_LOG,
JUNGLE_LOG,
ACACIA_LOG,
DARK_OAK_LOG,
CRIMSON_STEM,
WARPED_STEM,
STRIPPED_OAK_LOG,
STRIPPED_SPRUCE_LOG,
STRIPPED_BIRCH_LOG,
STRIPPED_JUNGLE_LOG,
STRIPPED_ACACIA_LOG,
STRIPPED_DARK_OAK_LOG,
STRIPPED_CRIMSON_STEM,
STRIPPED_WARPED_STEM,
STRIPPED_OAK_WOOD,
STRIPPED_SPRUCE_WOOD,
STRIPPED_BIRCH_WOOD,
STRIPPED_JUNGLE_WOOD,
STRIPPED_ACACIA_WOOD,
STRIPPED_DARK_OAK_WOOD,
STRIPPED_CRIMSON_HYPHAE,
STRIPPED_WARPED_HYPHAE,
OAK_WOOD,
SPRUCE_WOOD,
BIRCH_WOOD,
JUNGLE_WOOD,
ACACIA_WOOD,
DARK_OAK_WOOD,
CRIMSON_HYPHAE,
WARPED_HYPHAE,
OAK_LEAVES,
SPRUCE_LEAVES,
BIRCH_LEAVES,
@ -118,6 +131,16 @@ public enum Material {
WITHER_ROSE,
BROWN_MUSHROOM,
RED_MUSHROOM,
CRIMSON_FUNGUS,
WARPED_FUNGUS,
CRIMSON_ROOTS,
WARPED_ROOTS,
NETHER_SPROUTS,
WEEPING_VINES,
TWISTING_VINES,
SUGAR_CANE,
KELP,
BAMBOO,
GOLD_BLOCK,
IRON_BLOCK,
OAK_SLAB,
@ -126,6 +149,8 @@ public enum Material {
JUNGLE_SLAB,
ACACIA_SLAB,
DARK_OAK_SLAB,
CRIMSON_SLAB,
WARPED_SLAB,
STONE_SLAB,
SMOOTH_STONE_SLAB,
SANDSTONE_SLAB,
@ -177,9 +202,11 @@ public enum Material {
JUNGLE_PRESSURE_PLATE,
ACACIA_PRESSURE_PLATE,
DARK_OAK_PRESSURE_PLATE,
CRIMSON_PRESSURE_PLATE,
WARPED_PRESSURE_PLATE,
POLISHED_BLACKSTONE_PRESSURE_PLATE,
REDSTONE_ORE,
REDSTONE_TORCH,
STONE_BUTTON,
SNOW,
ICE,
SNOW_BLOCK,
@ -192,10 +219,16 @@ public enum Material {
JUNGLE_FENCE,
ACACIA_FENCE,
DARK_OAK_FENCE,
CRIMSON_FENCE,
WARPED_FENCE,
PUMPKIN,
CARVED_PUMPKIN,
NETHERRACK,
SOUL_SAND,
SOUL_SOIL,
BASALT,
POLISHED_BASALT,
SOUL_TORCH,
GLOWSTONE,
JACK_O_LANTERN,
OAK_TRAPDOOR,
@ -204,6 +237,8 @@ public enum Material {
JUNGLE_TRAPDOOR,
ACACIA_TRAPDOOR,
DARK_OAK_TRAPDOOR,
CRIMSON_TRAPDOOR,
WARPED_TRAPDOOR,
INFESTED_STONE,
INFESTED_COBBLESTONE,
INFESTED_STONE_BRICKS,
@ -218,6 +253,7 @@ public enum Material {
RED_MUSHROOM_BLOCK,
MUSHROOM_STEM,
IRON_BARS,
CHAIN,
GLASS_PANE,
MELON,
VINE,
@ -227,11 +263,15 @@ public enum Material {
JUNGLE_FENCE_GATE,
ACACIA_FENCE_GATE,
DARK_OAK_FENCE_GATE,
CRIMSON_FENCE_GATE,
WARPED_FENCE_GATE,
BRICK_STAIRS,
STONE_BRICK_STAIRS,
MYCELIUM,
LILY_PAD,
NETHER_BRICKS,
CRACKED_NETHER_BRICKS,
CHISELED_NETHER_BRICKS,
NETHER_BRICK_FENCE,
NETHER_BRICK_STAIRS,
ENCHANTING_TABLE,
@ -248,6 +288,8 @@ public enum Material {
SPRUCE_STAIRS,
BIRCH_STAIRS,
JUNGLE_STAIRS,
CRIMSON_STAIRS,
WARPED_STAIRS,
COMMAND_BLOCK,
BEACON,
COBBLESTONE_WALL,
@ -264,12 +306,19 @@ public enum Material {
SANDSTONE_WALL,
END_STONE_BRICK_WALL,
DIORITE_WALL,
BLACKSTONE_WALL,
POLISHED_BLACKSTONE_WALL,
POLISHED_BLACKSTONE_BRICK_WALL,
STONE_BUTTON,
OAK_BUTTON,
SPRUCE_BUTTON,
BIRCH_BUTTON,
JUNGLE_BUTTON,
ACACIA_BUTTON,
DARK_OAK_BUTTON,
CRIMSON_BUTTON,
WARPED_BUTTON,
POLISHED_BLACKSTONE_BUTTON,
ANVIL,
CHIPPED_ANVIL,
DAMAGED_ANVIL,
@ -282,6 +331,7 @@ public enum Material {
HOPPER,
CHISELED_QUARTZ_BLOCK,
QUARTZ_BLOCK,
QUARTZ_BRICKS,
QUARTZ_PILLAR,
QUARTZ_STAIRS,
ACTIVATOR_RAIL,
@ -381,6 +431,7 @@ public enum Material {
CHAIN_COMMAND_BLOCK,
MAGMA_BLOCK,
NETHER_WART_BLOCK,
WARPED_WART_BLOCK,
RED_NETHER_BRICKS,
BONE_BLOCK,
STRUCTURE_VOID,
@ -518,11 +569,12 @@ public enum Material {
JUNGLE_DOOR,
ACACIA_DOOR,
DARK_OAK_DOOR,
CRIMSON_DOOR,
WARPED_DOOR,
REPEATER,
COMPARATOR,
STRUCTURE_BLOCK,
JIGSAW,
COMPOSTER,
TURTLE_HELMET,
SCUTE,
IRON_SHOVEL,
@ -537,6 +589,8 @@ public enum Material {
DIAMOND,
IRON_INGOT,
GOLD_INGOT,
NETHERITE_INGOT,
NETHERITE_SCRAP,
IRON_SWORD,
WOODEN_SWORD,
WOODEN_SHOVEL,
@ -557,6 +611,10 @@ public enum Material {
GOLDEN_SHOVEL,
GOLDEN_PICKAXE,
GOLDEN_AXE,
NETHERITE_SWORD,
NETHERITE_SHOVEL,
NETHERITE_PICKAXE,
NETHERITE_AXE,
STRING,
FEATHER,
GUNPOWDER,
@ -565,6 +623,7 @@ public enum Material {
IRON_HOE,
DIAMOND_HOE,
GOLDEN_HOE,
NETHERITE_HOE,
WHEAT_SEEDS,
WHEAT,
BREAD,
@ -588,6 +647,10 @@ public enum Material {
GOLDEN_CHESTPLATE,
GOLDEN_LEGGINGS,
GOLDEN_BOOTS,
NETHERITE_HELMET,
NETHERITE_CHESTPLATE,
NETHERITE_LEGGINGS,
NETHERITE_BOOTS,
FLINT,
PORKCHOP,
COOKED_PORKCHOP,
@ -600,6 +663,8 @@ public enum Material {
JUNGLE_SIGN,
ACACIA_SIGN,
DARK_OAK_SIGN,
CRIMSON_SIGN,
WARPED_SIGN,
BUCKET,
WATER_BUCKET,
LAVA_BUCKET,
@ -616,10 +681,7 @@ public enum Material {
TROPICAL_FISH_BUCKET,
BRICK,
CLAY_BALL,
SUGAR_CANE,
KELP,
DRIED_KELP_BLOCK,
BAMBOO,
PAPER,
BOOK,
SLIME_BALL,
@ -721,6 +783,7 @@ public enum Material {
FOX_SPAWN_EGG,
GHAST_SPAWN_EGG,
GUARDIAN_SPAWN_EGG,
HOGLIN_SPAWN_EGG,
HORSE_SPAWN_EGG,
HUSK_SPAWN_EGG,
LLAMA_SPAWN_EGG,
@ -732,6 +795,7 @@ public enum Material {
PARROT_SPAWN_EGG,
PHANTOM_SPAWN_EGG,
PIG_SPAWN_EGG,
PIGLIN_SPAWN_EGG,
PILLAGER_SPAWN_EGG,
POLAR_BEAR_SPAWN_EGG,
PUFFERFISH_SPAWN_EGG,
@ -747,6 +811,7 @@ public enum Material {
SPIDER_SPAWN_EGG,
SQUID_SPAWN_EGG,
STRAY_SPAWN_EGG,
STRIDER_SPAWN_EGG,
TRADER_LLAMA_SPAWN_EGG,
TROPICAL_FISH_SPAWN_EGG,
TURTLE_SPAWN_EGG,
@ -757,10 +822,11 @@ public enum Material {
WITCH_SPAWN_EGG,
WITHER_SKELETON_SPAWN_EGG,
WOLF_SPAWN_EGG,
ZOGLIN_SPAWN_EGG,
ZOMBIE_SPAWN_EGG,
ZOMBIE_HORSE_SPAWN_EGG,
ZOMBIE_PIGMAN_SPAWN_EGG,
ZOMBIE_VILLAGER_SPAWN_EGG,
ZOMBIFIED_PIGLIN_SPAWN_EGG,
EXPERIENCE_BOTTLE,
FIRE_CHARGE,
WRITABLE_BOOK,
@ -781,6 +847,7 @@ public enum Material {
CREEPER_HEAD,
DRAGON_HEAD,
CARROT_ON_A_STICK,
WARPED_FUNGUS_ON_A_STICK,
NETHER_STAR,
PUMPKIN_PIE,
FIREWORK_ROCKET,
@ -858,6 +925,7 @@ public enum Material {
MUSIC_DISC_WARD,
MUSIC_DISC_11,
MUSIC_DISC_WAIT,
MUSIC_DISC_PIGSTEP,
TRIDENT,
PHANTOM_MEMBRANE,
NAUTILUS_SHELL,
@ -870,6 +938,8 @@ public enum Material {
SKULL_BANNER_PATTERN,
MOJANG_BANNER_PATTERN,
GLOBE_BANNER_PATTERN,
PIGLIN_BANNER_PATTERN,
COMPOSTER,
BARREL,
SMOKER,
BLAST_FURNACE,
@ -881,14 +951,35 @@ public enum Material {
STONECUTTER,
BELL,
LANTERN,
SOUL_LANTERN,
SWEET_BERRIES,
CAMPFIRE,
SOUL_CAMPFIRE,
SHROOMLIGHT,
HONEYCOMB,
BEE_NEST,
BEEHIVE,
HONEY_BOTTLE,
HONEY_BLOCK,
HONEYCOMB_BLOCK;
HONEYCOMB_BLOCK,
LODESTONE,
NETHERITE_BLOCK,
ANCIENT_DEBRIS,
TARGET,
CRYING_OBSIDIAN,
BLACKSTONE,
BLACKSTONE_SLAB,
BLACKSTONE_STAIRS,
GILDED_BLACKSTONE,
POLISHED_BLACKSTONE,
POLISHED_BLACKSTONE_SLAB,
POLISHED_BLACKSTONE_STAIRS,
CHISELED_POLISHED_BLACKSTONE,
POLISHED_BLACKSTONE_BRICKS,
POLISHED_BLACKSTONE_BRICK_SLAB,
POLISHED_BLACKSTONE_BRICK_STAIRS,
CRACKED_POLISHED_BLACKSTONE_BRICKS,
RESPAWN_ANCHOR;
private static Short2ObjectOpenHashMap<Material> idToMaterial = new Short2ObjectOpenHashMap<>();

View File

@ -65,13 +65,13 @@ public class PacketProcessor {
Player player = playerConnection.getPlayer();
ClientPlayPacket playPacket = (ClientPlayPacket) playPacketsHandler.getPacketInstance(id);
playPacket.read(packetReader);
//System.out.println("play");
player.addPacketToQueue(playPacket);
break;
case LOGIN:
ClientPreplayPacket loginPacket = (ClientPreplayPacket) loginPacketsHandler.getPacketInstance(id);
loginPacket.read(packetReader);
//System.out.println("login");
loginPacket.process(playerConnection, connectionManager);
break;
case STATUS:

View File

@ -7,9 +7,9 @@ import java.util.function.Supplier;
public class ClientPacketsHandler {
// Max packet id
private static final int SIZE = 0x2E;
private static final int SIZE = 0x2F;
private Supplier<? extends ClientPacket>[] supplierAccesses = new Supplier[SIZE];
private final Supplier<? extends ClientPacket>[] supplierAccesses = new Supplier[SIZE];
public void register(int id, Supplier<? extends ClientPacket> packetSupplier) {
supplierAccesses[id] = packetSupplier;
@ -20,7 +20,7 @@ public class ClientPacketsHandler {
throw new IllegalStateException("Packet ID 0x" + Integer.toHexString(id) + " has been tried to be parsed, debug needed");
Supplier<? extends ClientPacket> supplier = supplierAccesses[id];
if (supplierAccesses == null)
if (supplierAccesses[id] == null)
throw new IllegalStateException("Packet id 0x" + Integer.toHexString(id) + " isn't registered!");
ClientPacket packet = supplier.get();

View File

@ -16,34 +16,40 @@ public class ClientPlayPacketsHandler extends ClientPacketsHandler {
register(0x0A, ClientCloseWindow::new);
register(0x0B, ClientPluginMessagePacket::new);
register(0x0E, ClientInteractEntityPacket::new);
//todo 0x0F Generate Structure
register(0x0F, ClientKeepAlivePacket::new);
register(0x10, ClientKeepAlivePacket::new);
// 0x10 packet not used server-side
register(0x11, ClientPlayerPositionPacket::new);
register(0x12, ClientPlayerPositionAndRotationPacket::new);
register(0x13, ClientPlayerRotationPacket::new);
register(0x14, ClientPlayerPacket::new);
register(0x15, ClientVehicleMovePacket::new);
register(0x16, ClientSteerBoatPacket::new);
register(0x17, ClientPickItemPacket::new);
register(0x18, ClientCraftRecipeRequest::new);
register(0x19, ClientPlayerAbilitiesPacket::new);
register(0x1A, ClientPlayerDiggingPacket::new);
register(0x1B, ClientEntityActionPacket::new);
register(0x1C, ClientSteerVehiclePacket::new);
register(0x1D, ClientRecipeBookData::new);
register(0x1E, ClientNameItemPacket::new);
register(0x1F, ClientResourcePackStatusPacket::new);
// 0x11 packet not used server-side
register(0x12, ClientPlayerPositionPacket::new);
register(0x13, ClientPlayerPositionAndRotationPacket::new);
register(0x14, ClientPlayerRotationPacket::new);
register(0x15, ClientPlayerPacket::new);
register(0x16, ClientVehicleMovePacket::new);
register(0x17, ClientSteerBoatPacket::new);
register(0x18, ClientPickItemPacket::new);
register(0x19, ClientCraftRecipeRequest::new);
register(0x1A, ClientPlayerAbilitiesPacket::new);
register(0x1B, ClientPlayerDiggingPacket::new);
register(0x1C, ClientEntityActionPacket::new);
register(0x1D, ClientSteerVehiclePacket::new);
register(0x1E, ClientRecipeBookData::new);
register(0x1F, ClientNameItemPacket::new);
register(0x20, ClientResourcePackStatusPacket::new);
register(0x20, ClientAdvancementTabPacket::new);
register(0x21, ClientSelectTradePacket::new);
register(0x23, ClientHeldItemChangePacket::new);
register(0x24, ClientUpdateCommandBlockPacket::new);
register(0x25, ClientUpdateCommandBlockMinecartPacket::new);
register(0x26, ClientCreativeInventoryActionPacket::new);
register(0x29, ClientUpdateSignPacket::new);
register(0x2A, ClientAnimationPacket::new);
register(0x2C, ClientPlayerBlockPlacementPacket::new);
register(0x2D, ClientUseItemPacket::new);
register(0x21, ClientAdvancementTabPacket::new);
register(0x22, ClientSelectTradePacket::new);
// Set Beacon Effect??
register(0x24, ClientHeldItemChangePacket::new);
register(0x25, ClientUpdateCommandBlockPacket::new);
register(0x26, ClientUpdateCommandBlockMinecartPacket::new);
register(0x27, ClientCreativeInventoryActionPacket::new);
//Update Jigsaw Block??
//Update Structure Block??
register(0x2A, ClientUpdateSignPacket::new);
register(0x2B, ClientAnimationPacket::new);
//Spectate??
register(0x2D, ClientPlayerBlockPlacementPacket::new);
register(0x2E, ClientUseItemPacket::new);
}
}

View File

@ -30,8 +30,8 @@ public class ClientInteractEntityPacket extends ClientPlayPacket {
this.z = reader.readFloat();
this.hand = Player.Hand.values()[reader.readVarInt()];
break;
}
reader.readBoolean(); //TODO use
}
public enum Type {

View File

@ -6,13 +6,9 @@ import net.minestom.server.network.packet.client.ClientPlayPacket;
public class ClientPlayerAbilitiesPacket extends ClientPlayPacket {
public byte flags;
public float flyingSpeed;
public float walkingSpeed;
@Override
public void read(PacketReader reader) {
this.flags = reader.readByte();
this.flyingSpeed = reader.readFloat();
this.walkingSpeed = reader.readFloat();
}
}

View File

@ -17,7 +17,7 @@ public class StatusRequestPacket implements ClientPreplayPacket {
ResponseData responseData = new ResponseData();
// Fill default params
responseData.setName("1.15.2");
responseData.setName("1.16.1");
responseData.setProtocol(MinecraftServer.PROTOCOL_VERSION);
responseData.setMaxPlayer(0);
responseData.setOnline(0);

View File

@ -4,71 +4,71 @@ public class ServerPacketIdentifier {
public static final int SPAWN_ENTITY = 0x00;
public static final int SPAWN_EXPERIENCE_ORB = 0x01;
public static final int SPAWN_WEATHER_ENTITY = 0x02;
public static final int SPAWN_LIVING_ENTITY = 0x03;
public static final int SPAWN_PAINTING = 0x04;
public static final int SPAWN_PLAYER = 0x05;
public static final int ENTITY_ANIMATION = 0x06;
public static final int STATISTICS = 0x07;
public static final int ACKNOWLEDGE_PLAYER_DIGGING = 0x08;
public static final int BLOCK_BREAK_ANIMATION = 0x09;
public static final int BLOCK_ENTITY_DATA = 0x0A;
public static final int BLOCK_ACTION = 0x0B;
public static final int BLOCK_CHANGE = 0x0C;
public static final int BOSS_BAR = 0x0D;
public static final int SERVER_DIFFICULTY = 0x0E;
public static final int CHAT_MESSAGE = 0x0F;
public static final int MULTI_BLOCK_CHANGE = 0x10;
public static final int TAB_COMPLETE = 0x11;
public static final int DECLARE_COMMANDS = 0x12;
public static final int WINDOW_CONFIRMATION = 0x13;
public static final int CLOSE_WINDOW = 0x14;
public static final int WINDOW_ITEMS = 0x15;
public static final int WINDOW_PROPERTY = 0x16;
public static final int SET_SLOT = 0x17;
public static final int SET_COOLDOWN = 0x18;
public static final int PLUGIN_MESSAGE = 0x19;
public static final int NAMED_SOUND_EFFECT = 0x1A;
public static final int DISCONNECT = 0x1B;
public static final int ENTITY_STATUS = 0x1C;
public static final int EXPLOSION = 0x1D;
public static final int UNLOAD_CHUNK = 0x1E;
public static final int CHANGE_GAME_STATE = 0x1F;
public static final int OPEN_HORSE_WINDOW = 0x20;
public static final int KEEP_ALIVE = 0x21;
public static final int CHUNK_DATA = 0x22;
public static final int EFFECT = 0x23;
public static final int PARTICLE = 0x24;
public static final int UPDATE_LIGHT = 0x25;
public static final int JOIN_GAME = 0x26;
public static final int MAP_DATA = 0x27;
public static final int TRADE_LIST = 0x28;
public static final int ENTITY_POSITION = 0x29;
public static final int ENTITY_POSITION_AND_ROTATION = 0x2A;
public static final int ENTITY_ROTATION = 0x2B;
public static final int ENTITY_MOVEMENT = 0x2C;
public static final int VEHICLE_MOVE = 0x2D;
public static final int OPEN_BOOK = 0x2E;
public static final int OPEN_WINDOW = 0x2F;
public static final int OPEN_SIGN_EDITOR = 0x30;
public static final int CRAFT_RECIPE_RESPONSE = 0x31;
public static final int PLAYER_ABILITIES = 0x32;
public static final int COMBAT_EVENT = 0x33;
public static final int PLAYER_INFO = 0x34;
public static final int FACE_PLAYER = 0x35;
public static final int PLAYER_POSITION_AND_LOOK = 0x36;
public static final int UNLOCK_RECIPES = 0x37;
public static final int DESTROY_ENTITIES = 0x38;
public static final int REMOVE_ENTITY_EFFECT = 0x39;
public static final int RESOURCE_PACK_SEND = 0x3A;
public static final int RESPAWN = 0x3B;
public static final int ENTITY_HEAD_LOOK = 0x3C;
public static final int SELECT_ADVANCEMENT_TAB = 0x3D;
public static final int WORLD_BORDER = 0x3E;
public static final int CAMERA = 0x3F;
public static final int HELD_ITEM_CHANGE = 0x40;
public static final int UPDATE_VIEW_POSITION = 0x41;
public static final int UPDATE_VIEW_DISTANCE = 0x42; // Not used by the dedicated server
public static final int SPAWN_LIVING_ENTITY = 0x02;
public static final int SPAWN_PAINTING = 0x03;
public static final int SPAWN_PLAYER = 0x04;
public static final int ENTITY_ANIMATION = 0x05;
public static final int STATISTICS = 0x06;
public static final int ACKNOWLEDGE_PLAYER_DIGGING = 0x07;
public static final int BLOCK_BREAK_ANIMATION = 0x08;
public static final int BLOCK_ENTITY_DATA = 0x09;
public static final int BLOCK_ACTION = 0x0A;
public static final int BLOCK_CHANGE = 0x0B;
public static final int BOSS_BAR = 0x0C;
public static final int SERVER_DIFFICULTY = 0x0D;
public static final int CHAT_MESSAGE = 0x0E;
public static final int MULTI_BLOCK_CHANGE = 0x0F;
public static final int TAB_COMPLETE = 0x10;
public static final int DECLARE_COMMANDS = 0x11;
public static final int WINDOW_CONFIRMATION = 0x12;
public static final int CLOSE_WINDOW = 0x13;
public static final int WINDOW_ITEMS = 0x14;
public static final int WINDOW_PROPERTY = 0x15;
public static final int SET_SLOT = 0x16;
public static final int SET_COOLDOWN = 0x17;
public static final int PLUGIN_MESSAGE = 0x18;
public static final int NAMED_SOUND_EFFECT = 0x19;
public static final int DISCONNECT = 0x1A;
public static final int ENTITY_STATUS = 0x1B;
public static final int EXPLOSION = 0x1C;
public static final int UNLOAD_CHUNK = 0x1D;
public static final int CHANGE_GAME_STATE = 0x1E;
public static final int OPEN_HORSE_WINDOW = 0x1F;
public static final int KEEP_ALIVE = 0x20;
public static final int CHUNK_DATA = 0x21;
public static final int EFFECT = 0x22;
public static final int PARTICLE = 0x23;
public static final int UPDATE_LIGHT = 0x24;
public static final int JOIN_GAME = 0x25;
public static final int MAP_DATA = 0x26;
public static final int TRADE_LIST = 0x27;
public static final int ENTITY_POSITION = 0x28;
public static final int ENTITY_POSITION_AND_ROTATION = 0x29;
public static final int ENTITY_ROTATION = 0x2A;
public static final int ENTITY_MOVEMENT = 0x2B;
public static final int VEHICLE_MOVE = 0x2C;
public static final int OPEN_BOOK = 0x2D;
public static final int OPEN_WINDOW = 0x2E;
public static final int OPEN_SIGN_EDITOR = 0x2F;
public static final int CRAFT_RECIPE_RESPONSE = 0x30;
public static final int PLAYER_ABILITIES = 0x31;
public static final int COMBAT_EVENT = 0x32;
public static final int PLAYER_INFO = 0x33;
public static final int FACE_PLAYER = 0x34;
public static final int PLAYER_POSITION_AND_LOOK = 0x35;
public static final int UNLOCK_RECIPES = 0x36;
public static final int DESTROY_ENTITIES = 0x37;
public static final int REMOVE_ENTITY_EFFECT = 0x38;
public static final int RESOURCE_PACK_SEND = 0x39;
public static final int RESPAWN = 0x3A;
public static final int ENTITY_HEAD_LOOK = 0x3B;
public static final int SELECT_ADVANCEMENT_TAB = 0x3C;
public static final int WORLD_BORDER = 0x3D;
public static final int CAMERA = 0x3E;
public static final int HELD_ITEM_CHANGE = 0x3F;
public static final int UPDATE_VIEW_POSITION = 0x40;
public static final int UPDATE_VIEW_DISTANCE = 0x41; // Not used by the dedicated server
public static final int SPAWN_POSITION = 0x42;
public static final int DISPLAY_SCOREBOARD = 0x43;
public static final int ENTITY_METADATA = 0x44;
public static final int ATTACH_ENTITY = 0x45;
@ -80,20 +80,19 @@ public class ServerPacketIdentifier {
public static final int SET_PASSENGERS = 0x4B;
public static final int TEAMS = 0x4C;
public static final int UPDATE_SCORE = 0x4D;
public static final int SPAWN_POSITION = 0x4E;
public static final int TIME_UPDATE = 0x4F;
public static final int TITLE = 0x50;
public static final int ENTITY_SOUND_EFFECT = 0x51;
public static final int SOUND_EFFECT = 0x52;
public static final int STOP_SOUND = 0x53;
public static final int PLAYER_LIST_HEADER_AND_FOOTER = 0x54;
public static final int NBT_QUERY_RESPONSE = 0x55;
public static final int COLLECT_ITEM = 0x56;
public static final int ENTITY_TELEPORT = 0x57;
public static final int ADVANCEMENTS = 0x58;
public static final int ENTITY_PROPERTIES = 0x59;
public static final int ENTITY_EFFECT = 0x5A;
public static final int DECLARE_RECIPES = 0x5B;
public static final int TAGS = 0x5C;
public static final int TIME_UPDATE = 0x4E;
public static final int TITLE = 0x4F;
public static final int ENTITY_SOUND_EFFECT = 0x50;
public static final int SOUND_EFFECT = 0x51;
public static final int STOP_SOUND = 0x52;
public static final int PLAYER_LIST_HEADER_AND_FOOTER = 0x53;
public static final int NBT_QUERY_RESPONSE = 0x54;
public static final int COLLECT_ITEM = 0x55;
public static final int ENTITY_TELEPORT = 0x56;
public static final int ADVANCEMENTS = 0x57;
public static final int ENTITY_PROPERTIES = 0x58;
public static final int ENTITY_EFFECT = 0x59;
public static final int DECLARE_RECIPES = 0x5A;
public static final int TAGS = 0x5B;
}

View File

@ -4,40 +4,77 @@ import net.minestom.server.entity.GameMode;
import net.minestom.server.network.packet.PacketWriter;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
import net.minestom.server.utils.nbt.NbtWriter;
import net.minestom.server.world.Dimension;
import net.minestom.server.world.LevelType;
import static net.minestom.server.utils.nbt.NBT.*;
public class JoinGamePacket implements ServerPacket {
public int entityId;
public GameMode gameMode = GameMode.SURVIVAL;
public Dimension dimension = Dimension.OVERWORLD;
public long hashedSeed;
public byte maxPlayers = 0; // Unused
public LevelType levelType;
public int viewDistance;
public boolean reducedDebugInfo = false;
public boolean enableRespawnScreen = true;
public int entityId;
public GameMode gameMode = GameMode.SURVIVAL;
public Dimension dimension = Dimension.OVERWORLD;
public long hashedSeed;
public byte maxPlayers = 0; // Unused
//TODO remove
public LevelType levelType;
//TODO add api
String identifier = "test:spawn";
public int viewDistance;
public boolean reducedDebugInfo = false;
public boolean enableRespawnScreen = true;
@Override
public void write(PacketWriter writer) {
int gameModeId = gameMode.getId();
if (gameMode.isHardcore())
gameModeId |= 8;
@Override
public void write(PacketWriter writer) {
NbtWriter nbtWriter = new NbtWriter(writer);
int gameModeId = gameMode.getId();
if (gameMode.isHardcore())
gameModeId |= 8;
writer.writeInt(entityId);
writer.writeByte((byte) gameModeId);
writer.writeInt(dimension.getId());
writer.writeLong(hashedSeed);
writer.writeByte(maxPlayers);
writer.writeSizedString(levelType.getType());
writer.writeVarInt(viewDistance);
writer.writeBoolean(reducedDebugInfo);
writer.writeBoolean(enableRespawnScreen);
}
writer.writeInt(entityId);
writer.writeByte((byte) gameModeId);
//Previous Gamemode
writer.writeByte((byte) gameModeId);
//array of worlds
writer.writeVarInt(1);
writer.writeSizedString(identifier);
nbtWriter.writeCompound("", (writer1) -> {
writer1.writeList("dimension", NBT_COMPOUND, 1, () -> {
writer1.writeString("name", "test:normal");
writer1.writeFloat("ambient_light", 1F);
writer1.writeString("infiniburn", "");
writer1.writeByte("natural", (byte) 0x01);
writer1.writeByte("has_ceiling", (byte) 0x01);
writer1.writeByte("has_skylight", (byte) 0x01);
writer1.writeByte("shrunk", (byte) 0x00);
writer1.writeByte("ultrawarm", (byte) 0x00);
writer1.writeByte("has_raids", (byte) 0x00);
writer1.writeByte("respawn_anchor_works", (byte) 0x00);
writer1.writeByte("bed_works", (byte) 0x01);
writer1.writeByte("piglin_safe", (byte) 0x01);
writer1.writeInt("logical_height", 255);
});
});
//writer.writeInt(dimension.getId());
writer.writeSizedString("test:normal");
writer.writeSizedString(identifier);
writer.writeLong(hashedSeed);
writer.writeByte(maxPlayers);
writer.writeVarInt(viewDistance);
writer.writeBoolean(reducedDebugInfo);
writer.writeBoolean(enableRespawnScreen);
//debug
writer.writeBoolean(false);
//is flat
writer.writeBoolean(true);
}
@Override
public int getId() {
return ServerPacketIdentifier.JOIN_GAME;
}
@Override
public int getId() {
return ServerPacketIdentifier.JOIN_GAME;
}
}

View File

@ -17,7 +17,7 @@ public class LoginSuccessPacket implements ServerPacket {
@Override
public void write(PacketWriter writer) {
writer.writeSizedString(uuid.toString());
writer.writeUuid(uuid);
writer.writeSizedString(username);
}

View File

@ -4,10 +4,14 @@ import net.minestom.server.network.packet.PacketWriter;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
import java.util.UUID;
public class ChatMessagePacket implements ServerPacket {
private String jsonMessage;
private Position position;
//TODO use real uuid
private UUID uuid = UUID.randomUUID();
public ChatMessagePacket(String jsonMessage, Position position) {
this.jsonMessage = jsonMessage;
@ -18,6 +22,7 @@ public class ChatMessagePacket implements ServerPacket {
public void write(PacketWriter writer) {
writer.writeSizedString(jsonMessage);
writer.writeByte((byte) position.ordinal());
writer.writeUuid(uuid);
}
@Override

View File

@ -24,6 +24,8 @@ public class ChunkDataPacket implements ServerPacket {
private static final BlockManager BLOCK_MANAGER = MinecraftServer.getBlockManager();
public boolean fullChunk;
//todo make a changeable
public boolean ignoreOldLighting = true;
public Biome[] biomes;
public int chunkX, chunkZ;
@ -37,7 +39,7 @@ public class ChunkDataPacket implements ServerPacket {
public int[] sections;
private static final byte CHUNK_SECTION_COUNT = 16;
private static final int BITS_PER_ENTRY = 14;
private static final int BITS_PER_ENTRY = 15;
private static final int MAX_BUFFER_SIZE = (Short.BYTES + Byte.BYTES + 5 * Byte.BYTES + (4096 * BITS_PER_ENTRY / Long.SIZE * Long.BYTES)) * CHUNK_SECTION_COUNT + 256 * Integer.BYTES;
@Override
@ -48,6 +50,8 @@ public class ChunkDataPacket implements ServerPacket {
writer.writeInt(chunkZ);
writer.writeBoolean(fullChunk);
writer.writeBoolean(ignoreOldLighting);
int mask = 0;
BufferWrapper blocks = BufferUtils.getBuffer(MAX_BUFFER_SIZE);
for (byte i = 0; i < CHUNK_SECTION_COUNT; i++) {
@ -57,10 +61,10 @@ public class ChunkDataPacket implements ServerPacket {
mask |= 1 << i;
Utils.writeBlocks(blocks, section, BITS_PER_ENTRY);
} else {
mask |= 0 << i;
mask |= 0;
}
} else {
mask |= 0 << i;
mask |= 0;
}
}

View File

@ -57,8 +57,8 @@ public class DeclareRecipesPacket implements ServerPacket {
private void write(PacketWriter writer) {
writer.writeSizedString(recipeType);
writer.writeSizedString(recipeId);
writer.writeSizedString(recipeType);
switch (recipeType) {
case "crafting_shapeless":

View File

@ -15,7 +15,8 @@ public class EntityEquipmentPacket implements ServerPacket {
@Override
public void write(PacketWriter writer) {
writer.writeVarInt(entityId);
writer.writeVarInt(slot.ordinal());
//TODO make better
writer.writeByte((byte) slot.ordinal());
writer.writeItemStack(itemStack);
}

View File

@ -14,7 +14,7 @@ public class PlayerAbilitiesPacket implements ServerPacket {
// Options
public float flyingSpeed;
public float fieldViewModifier;
public float walkingSpeed;
@Override
public void write(PacketWriter writer) {
@ -30,7 +30,7 @@ public class PlayerAbilitiesPacket implements ServerPacket {
writer.writeByte(flags);
writer.writeFloat(flyingSpeed);
writer.writeFloat(fieldViewModifier);
writer.writeFloat(walkingSpeed);
}
@Override

View File

@ -16,10 +16,18 @@ public class RespawnPacket implements ServerPacket {
@Override
public void write(PacketWriter writer) {
writer.writeInt(dimension.getId());
//TODO add api
writer.writeSizedString("test:normal");
writer.writeSizedString("test:spawn");
writer.writeLong(hashedSeed);
writer.writeByte(gameMode.getId());
writer.writeByte(gameMode.getId()); // Hardcore flag not included
writer.writeSizedString(levelType.getType());
//debug
writer.writeBoolean(false);
//is flat
writer.writeBoolean(true);
//copy meta
writer.writeBoolean(true);
}
@Override

View File

@ -1,26 +0,0 @@
package net.minestom.server.network.packet.server.play;
import net.minestom.server.network.packet.PacketWriter;
import net.minestom.server.network.packet.server.ServerPacket;
import net.minestom.server.network.packet.server.ServerPacketIdentifier;
public class SpawnWeatherEntityPacket implements ServerPacket {
public int entityId;
public byte type;
public double x, y, z;
@Override
public void write(PacketWriter writer) {
writer.writeVarInt(entityId);
writer.writeByte(type);
writer.writeDouble(x);
writer.writeDouble(y);
writer.writeDouble(z);
}
@Override
public int getId() {
return ServerPacketIdentifier.SPAWN_WEATHER_ENTITY;
}
}

View File

@ -10,6 +10,8 @@ public class UpdateLightPacket implements ServerPacket {
public int chunkX;
public int chunkZ;
//todo make changeable
public boolean trustEdges = true;
public int skyLightMask;
public int blockLightMask;
@ -25,6 +27,8 @@ public class UpdateLightPacket implements ServerPacket {
writer.writeVarInt(chunkX);
writer.writeVarInt(chunkZ);
writer.writeBoolean(trustEdges);
writer.writeVarInt(skyLightMask);
writer.writeVarInt(blockLightMask);

View File

@ -36,6 +36,7 @@ public class NettyPlayerConnection extends PlayerConnection {
@Override
public void sendPacket(ByteBuf buffer) {
//System.out.println(getConnectionState() + " out");
if (encrypted) {
buffer = buffer.copy();
buffer.retain();
@ -50,10 +51,10 @@ public class NettyPlayerConnection extends PlayerConnection {
@Override
public void writePacket(ByteBuf buffer) {
if (encrypted) {
buffer = buffer.copy();
buffer.retain();
getChannel().write(buffer);
buffer.release();
buffer = buffer.copy();
buffer.retain();
getChannel().write(buffer);
buffer.release();
} else {
buffer.retain();
getChannel().write(buffer);
@ -62,6 +63,7 @@ public class NettyPlayerConnection extends PlayerConnection {
@Override
public void sendPacket(ServerPacket serverPacket) {
//System.out.println(serverPacket.getClass().getName() + " out");
ByteBuf buffer = PacketUtils.writePacket(serverPacket);
sendPacket(buffer);
buffer.release();

View File

@ -31,6 +31,8 @@ public enum Particle {
FIREWORK,
FISHING,
FLAME,
SOUL_FIRE_FLAME,
SOUL,
FLASH,
HAPPY_VILLAGER,
COMPOSTER,
@ -65,7 +67,15 @@ public enum Particle {
DRIPPING_HONEY,
FALLING_HONEY,
LANDING_HONEY,
FALLING_NECTAR;
FALLING_NECTAR,
ASH,
CRIMSON_SPORE,
WARPED_SPORE,
DRIPPING_OBSIDIAN_TEAR,
FALLING_OBSIDIAN_TEAR,
LANDING_OBSIDIAN_TEAR,
REVERSE_PORTAL,
WHITE_ASH;
private static Int2ObjectOpenHashMap<Particle> map = new Int2ObjectOpenHashMap();

View File

@ -39,13 +39,14 @@ public class RegistryMain {
List<RegistryStat> stats = parseStats(STATS_PATH);
List<RegistryEnchantment> enchantments = parseEnchantments(STATS_PATH);
List<RegistryPotion> potions = parsePotions(STATS_PATH);
//writeBlocksClass(blocks);
//writeItemsClass(items);
//writeEntitiesClass(entities);
//writeSoundsClass(sounds);
//writeStatsClass(stats);
//writeEnchantmentsClass(enchantments);
writeBlocksClass(blocks);
writeItemsClass(items);
writeEntitiesClass(entities);
writeSoundsClass(sounds);
writeStatsClass(stats);
writeEnchantmentsClass(enchantments);
writePotionsClass(potions);
writeParticlesClass(particles);
}
public static void registerBlocks() {
@ -142,60 +143,76 @@ public class RegistryMain {
}
private static void writeBlocksClass(List<RegistryBlock> blocks) {
System.out.println("\n//Blocks Start");
for (RegistryBlock registryBlock : blocks) {
String line = registryBlock.name + ",";
System.out.println(line);
}
System.out.println("//Blocks End");
}
private static void writeItemsClass(List<RegistryItem> items) {
System.out.println("\n//Items Start");
for (RegistryItem registryItem : items) {
String line = registryItem.name + ",";
System.out.println(line);
}
System.out.println("//Items End");
}
private static void writeEntitiesClass(List<RegistryEntityType> entities) {
System.out.println("\n//Entities Start");
for (RegistryEntityType registryEntityType : entities) {
String line = registryEntityType.name + ",";
System.out.println(line);
}
System.out.println("//Entities End");
}
private static void writeSoundsClass(List<RegistrySound> sounds) {
System.out.println("\n//Sounds Start");
for (RegistrySound registrySound : sounds) {
String line = registrySound.name + ",";
System.out.println(line);
}
System.out.println("//Sounds End");
}
private static void writeParticlesClass(List<RegistryParticle> particles) {
System.out.println("\n//Particles Start");
for (RegistryParticle registryParticle : particles) {
String line = registryParticle.name + ",";
System.out.println(line);
}
System.out.println("//Particles End");
}
private static void writeStatsClass(List<RegistryStat> stats) {
System.out.println("\n//Stats Start");
for (RegistryStat registryStat : stats) {
String line = registryStat.name + ",";
System.out.println(line);
}
System.out.println("//Stats End");
}
private static void writeEnchantmentsClass(List<RegistryEnchantment> enchantments) {
System.out.println("\n//Enchantments Start");
for (RegistryEnchantment registryEnchantment : enchantments) {
String line = registryEnchantment.name + ",";
System.out.println(line);
}
System.out.println("//Enchantments End");
}
private static void writePotionsClass(List<RegistryPotion> potions) {
System.out.println("\n//Potions Start");
for (RegistryPotion registryPotion : potions) {
String line = registryPotion.name + ",";
System.out.println(line);
}
System.out.println("//Potions End");
}

View File

@ -33,7 +33,7 @@ public class ResourceGatherer {
throw new IOException("Failed to create tmp folder.");
}
final String version = "1.15.2"; // TODO: Do not hardcode
final String version = "1.16.1"; // TODO: Do not hardcode
LOGGER.info("Starting download of Minecraft server jar for version " + version + " from Mojang servers...");
File minecraftFolder = getMinecraftFolder(minecraftFolderOverride);

View File

@ -5,12 +5,32 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
public enum Sound {
AMBIENT_CAVE,
AMBIENT_BASALT_DELTAS_ADDITIONS,
AMBIENT_BASALT_DELTAS_LOOP,
AMBIENT_BASALT_DELTAS_MOOD,
AMBIENT_CRIMSON_FOREST_ADDITIONS,
AMBIENT_CRIMSON_FOREST_LOOP,
AMBIENT_CRIMSON_FOREST_MOOD,
AMBIENT_NETHER_WASTES_ADDITIONS,
AMBIENT_NETHER_WASTES_LOOP,
AMBIENT_NETHER_WASTES_MOOD,
AMBIENT_SOUL_SAND_VALLEY_ADDITIONS,
AMBIENT_SOUL_SAND_VALLEY_LOOP,
AMBIENT_SOUL_SAND_VALLEY_MOOD,
AMBIENT_WARPED_FOREST_ADDITIONS,
AMBIENT_WARPED_FOREST_LOOP,
AMBIENT_WARPED_FOREST_MOOD,
AMBIENT_UNDERWATER_ENTER,
AMBIENT_UNDERWATER_EXIT,
AMBIENT_UNDERWATER_LOOP,
AMBIENT_UNDERWATER_LOOP_ADDITIONS,
AMBIENT_UNDERWATER_LOOP_ADDITIONS_RARE,
AMBIENT_UNDERWATER_LOOP_ADDITIONS_ULTRA_RARE,
BLOCK_ANCIENT_DEBRIS_BREAK,
BLOCK_ANCIENT_DEBRIS_STEP,
BLOCK_ANCIENT_DEBRIS_PLACE,
BLOCK_ANCIENT_DEBRIS_HIT,
BLOCK_ANCIENT_DEBRIS_FALL,
BLOCK_ANVIL_BREAK,
BLOCK_ANVIL_DESTROY,
BLOCK_ANVIL_FALL,
@ -26,6 +46,7 @@ public enum Sound {
ITEM_ARMOR_EQUIP_GOLD,
ITEM_ARMOR_EQUIP_IRON,
ITEM_ARMOR_EQUIP_LEATHER,
ITEM_ARMOR_EQUIP_NETHERITE,
ITEM_ARMOR_EQUIP_TURTLE,
ENTITY_ARMOR_STAND_BREAK,
ENTITY_ARMOR_STAND_FALL,
@ -45,6 +66,11 @@ public enum Sound {
BLOCK_BAMBOO_SAPLING_PLACE,
BLOCK_BARREL_CLOSE,
BLOCK_BARREL_OPEN,
BLOCK_BASALT_BREAK,
BLOCK_BASALT_STEP,
BLOCK_BASALT_PLACE,
BLOCK_BASALT_HIT,
BLOCK_BASALT_FALL,
ENTITY_BAT_AMBIENT,
ENTITY_BAT_DEATH,
ENTITY_BAT_HURT,
@ -74,11 +100,13 @@ public enum Sound {
ENTITY_BLAZE_SHOOT,
ENTITY_BOAT_PADDLE_LAND,
ENTITY_BOAT_PADDLE_WATER,
BLOCK_BONE_BLOCK_BREAK,
BLOCK_BONE_BLOCK_FALL,
BLOCK_BONE_BLOCK_HIT,
BLOCK_BONE_BLOCK_PLACE,
BLOCK_BONE_BLOCK_STEP,
ITEM_BOOK_PAGE_TURN,
ITEM_BOOK_PUT,
ENTITY_FISHING_BOBBER_RETRIEVE,
ENTITY_FISHING_BOBBER_SPLASH,
ENTITY_FISHING_BOBBER_THROW,
BLOCK_BLASTFURNACE_FIRE_CRACKLE,
ITEM_BOTTLE_EMPTY,
ITEM_BOTTLE_FILL,
@ -105,6 +133,11 @@ public enum Sound {
ENTITY_CAT_HURT,
ENTITY_CAT_PURR,
ENTITY_CAT_PURREOW,
BLOCK_CHAIN_BREAK,
BLOCK_CHAIN_FALL,
BLOCK_CHAIN_HIT,
BLOCK_CHAIN_PLACE,
BLOCK_CHAIN_STEP,
BLOCK_CHEST_CLOSE,
BLOCK_CHEST_LOCKED,
BLOCK_CHEST_OPEN,
@ -116,11 +149,6 @@ public enum Sound {
BLOCK_CHORUS_FLOWER_DEATH,
BLOCK_CHORUS_FLOWER_GROW,
ITEM_CHORUS_FRUIT_TELEPORT,
BLOCK_WOOL_BREAK,
BLOCK_WOOL_FALL,
BLOCK_WOOL_HIT,
BLOCK_WOOL_PLACE,
BLOCK_WOOL_STEP,
ENTITY_COD_AMBIENT,
ENTITY_COD_DEATH,
ENTITY_COD_FLOP,
@ -135,6 +163,11 @@ public enum Sound {
BLOCK_CONDUIT_AMBIENT_SHORT,
BLOCK_CONDUIT_ATTACK_TARGET,
BLOCK_CONDUIT_DEACTIVATE,
BLOCK_CORAL_BLOCK_BREAK,
BLOCK_CORAL_BLOCK_FALL,
BLOCK_CORAL_BLOCK_HIT,
BLOCK_CORAL_BLOCK_PLACE,
BLOCK_CORAL_BLOCK_STEP,
ENTITY_COW_AMBIENT,
ENTITY_COW_DEATH,
ENTITY_COW_HURT,
@ -170,6 +203,7 @@ public enum Sound {
ENTITY_DONKEY_ANGRY,
ENTITY_DONKEY_CHEST,
ENTITY_DONKEY_DEATH,
ENTITY_DONKEY_EAT,
ENTITY_DONKEY_HURT,
ENTITY_DROWNED_AMBIENT,
ENTITY_DROWNED_AMBIENT_WATER,
@ -241,6 +275,9 @@ public enum Sound {
BLOCK_FIRE_AMBIENT,
BLOCK_FIRE_EXTINGUISH,
ENTITY_FISH_SWIM,
ENTITY_FISHING_BOBBER_RETRIEVE,
ENTITY_FISHING_BOBBER_SPLASH,
ENTITY_FISHING_BOBBER_THROW,
ITEM_FLINTANDSTEEL_USE,
ENTITY_FOX_AGGRO,
ENTITY_FOX_AMBIENT,
@ -252,6 +289,12 @@ public enum Sound {
ENTITY_FOX_SLEEP,
ENTITY_FOX_SNIFF,
ENTITY_FOX_SPIT,
ENTITY_FOX_TELEPORT,
BLOCK_ROOTS_BREAK,
BLOCK_ROOTS_STEP,
BLOCK_ROOTS_PLACE,
BLOCK_ROOTS_HIT,
BLOCK_ROOTS_FALL,
BLOCK_FURNACE_FIRE_CRACKLE,
ENTITY_GENERIC_BIG_FALL,
ENTITY_GENERIC_BURN,
@ -270,6 +313,11 @@ public enum Sound {
ENTITY_GHAST_SCREAM,
ENTITY_GHAST_SHOOT,
ENTITY_GHAST_WARN,
BLOCK_GILDED_BLACKSTONE_BREAK,
BLOCK_GILDED_BLACKSTONE_FALL,
BLOCK_GILDED_BLACKSTONE_HIT,
BLOCK_GILDED_BLACKSTONE_PLACE,
BLOCK_GILDED_BLACKSTONE_STEP,
BLOCK_GLASS_BREAK,
BLOCK_GLASS_FALL,
BLOCK_GLASS_HIT,
@ -280,16 +328,6 @@ public enum Sound {
BLOCK_GRASS_HIT,
BLOCK_GRASS_PLACE,
BLOCK_GRASS_STEP,
BLOCK_WET_GRASS_BREAK,
BLOCK_WET_GRASS_FALL,
BLOCK_WET_GRASS_HIT,
BLOCK_WET_GRASS_PLACE,
BLOCK_WET_GRASS_STEP,
BLOCK_CORAL_BLOCK_BREAK,
BLOCK_CORAL_BLOCK_FALL,
BLOCK_CORAL_BLOCK_HIT,
BLOCK_CORAL_BLOCK_PLACE,
BLOCK_CORAL_BLOCK_STEP,
BLOCK_GRAVEL_BREAK,
BLOCK_GRAVEL_FALL,
BLOCK_GRAVEL_HIT,
@ -305,6 +343,14 @@ public enum Sound {
ENTITY_GUARDIAN_HURT,
ENTITY_GUARDIAN_HURT_LAND,
ITEM_HOE_TILL,
ENTITY_HOGLIN_AMBIENT,
ENTITY_HOGLIN_ANGRY,
ENTITY_HOGLIN_ATTACK,
ENTITY_HOGLIN_CONVERTED_TO_ZOMBIFIED,
ENTITY_HOGLIN_DEATH,
ENTITY_HOGLIN_HURT,
ENTITY_HOGLIN_RETREAT,
ENTITY_HOGLIN_STEP,
BLOCK_HONEY_BLOCK_BREAK,
BLOCK_HONEY_BLOCK_FALL,
BLOCK_HONEY_BLOCK_HIT,
@ -336,14 +382,6 @@ public enum Sound {
ENTITY_HUSK_DEATH,
ENTITY_HUSK_HURT,
ENTITY_HUSK_STEP,
ENTITY_RAVAGER_AMBIENT,
ENTITY_RAVAGER_ATTACK,
ENTITY_RAVAGER_CELEBRATE,
ENTITY_RAVAGER_DEATH,
ENTITY_RAVAGER_HURT,
ENTITY_RAVAGER_STEP,
ENTITY_RAVAGER_STUNNED,
ENTITY_RAVAGER_ROAR,
ENTITY_ILLUSIONER_AMBIENT,
ENTITY_ILLUSIONER_CAST_SPELL,
ENTITY_ILLUSIONER_DEATH,
@ -396,10 +434,19 @@ public enum Sound {
ENTITY_LLAMA_SPIT,
ENTITY_LLAMA_STEP,
ENTITY_LLAMA_SWAG,
ENTITY_MAGMA_CUBE_DEATH_SMALL,
BLOCK_LODESTONE_BREAK,
BLOCK_LODESTONE_STEP,
BLOCK_LODESTONE_PLACE,
BLOCK_LODESTONE_HIT,
BLOCK_LODESTONE_FALL,
ITEM_LODESTONE_COMPASS_LOCK,
ENTITY_MAGMA_CUBE_DEATH,
ENTITY_MAGMA_CUBE_HURT,
ENTITY_MAGMA_CUBE_HURT_SMALL,
ENTITY_MAGMA_CUBE_JUMP,
ENTITY_MAGMA_CUBE_SQUISH,
ENTITY_MAGMA_CUBE_SQUISH_SMALL,
BLOCK_METAL_BREAK,
BLOCK_METAL_FALL,
BLOCK_METAL_HIT,
@ -415,19 +462,83 @@ public enum Sound {
ENTITY_MOOSHROOM_SUSPICIOUS_MILK,
ENTITY_MOOSHROOM_SHEAR,
ENTITY_MULE_AMBIENT,
ENTITY_MULE_ANGRY,
ENTITY_MULE_CHEST,
ENTITY_MULE_DEATH,
ENTITY_MULE_EAT,
ENTITY_MULE_HURT,
MUSIC_CREATIVE,
MUSIC_CREDITS,
MUSIC_DISC_11,
MUSIC_DISC_13,
MUSIC_DISC_BLOCKS,
MUSIC_DISC_CAT,
MUSIC_DISC_CHIRP,
MUSIC_DISC_FAR,
MUSIC_DISC_MALL,
MUSIC_DISC_MELLOHI,
MUSIC_DISC_PIGSTEP,
MUSIC_DISC_STAL,
MUSIC_DISC_STRAD,
MUSIC_DISC_WAIT,
MUSIC_DISC_WARD,
MUSIC_DRAGON,
MUSIC_END,
MUSIC_GAME,
MUSIC_MENU,
MUSIC_NETHER,
MUSIC_NETHER_BASALT_DELTAS,
MUSIC_NETHER_NETHER_WASTES,
MUSIC_NETHER_SOUL_SAND_VALLEY,
MUSIC_NETHER_CRIMSON_FOREST,
MUSIC_NETHER_WARPED_FOREST,
MUSIC_UNDER_WATER,
BLOCK_NETHER_BRICKS_BREAK,
BLOCK_NETHER_BRICKS_STEP,
BLOCK_NETHER_BRICKS_PLACE,
BLOCK_NETHER_BRICKS_HIT,
BLOCK_NETHER_BRICKS_FALL,
BLOCK_NETHER_WART_BREAK,
ITEM_NETHER_WART_PLANT,
BLOCK_STEM_BREAK,
BLOCK_STEM_STEP,
BLOCK_STEM_PLACE,
BLOCK_STEM_HIT,
BLOCK_STEM_FALL,
BLOCK_NYLIUM_BREAK,
BLOCK_NYLIUM_STEP,
BLOCK_NYLIUM_PLACE,
BLOCK_NYLIUM_HIT,
BLOCK_NYLIUM_FALL,
BLOCK_NETHER_SPROUTS_BREAK,
BLOCK_NETHER_SPROUTS_STEP,
BLOCK_NETHER_SPROUTS_PLACE,
BLOCK_NETHER_SPROUTS_HIT,
BLOCK_NETHER_SPROUTS_FALL,
BLOCK_FUNGUS_BREAK,
BLOCK_FUNGUS_STEP,
BLOCK_FUNGUS_PLACE,
BLOCK_FUNGUS_HIT,
BLOCK_FUNGUS_FALL,
BLOCK_WEEPING_VINES_BREAK,
BLOCK_WEEPING_VINES_STEP,
BLOCK_WEEPING_VINES_PLACE,
BLOCK_WEEPING_VINES_HIT,
BLOCK_WEEPING_VINES_FALL,
BLOCK_WART_BLOCK_BREAK,
BLOCK_WART_BLOCK_STEP,
BLOCK_WART_BLOCK_PLACE,
BLOCK_WART_BLOCK_HIT,
BLOCK_WART_BLOCK_FALL,
BLOCK_NETHERITE_BLOCK_BREAK,
BLOCK_NETHERITE_BLOCK_STEP,
BLOCK_NETHERITE_BLOCK_PLACE,
BLOCK_NETHERITE_BLOCK_HIT,
BLOCK_NETHERITE_BLOCK_FALL,
BLOCK_NETHERRACK_BREAK,
BLOCK_NETHERRACK_STEP,
BLOCK_NETHERRACK_PLACE,
BLOCK_NETHERRACK_HIT,
BLOCK_NETHERRACK_FALL,
BLOCK_NOTE_BLOCK_BASEDRUM,
BLOCK_NOTE_BLOCK_BASS,
BLOCK_NOTE_BLOCK_BELL,
@ -474,10 +585,12 @@ public enum Sound {
ENTITY_PARROT_IMITATE_EVOKER,
ENTITY_PARROT_IMITATE_GHAST,
ENTITY_PARROT_IMITATE_GUARDIAN,
ENTITY_PARROT_IMITATE_HOGLIN,
ENTITY_PARROT_IMITATE_HUSK,
ENTITY_PARROT_IMITATE_ILLUSIONER,
ENTITY_PARROT_IMITATE_MAGMA_CUBE,
ENTITY_PARROT_IMITATE_PHANTOM,
ENTITY_PARROT_IMITATE_PIGLIN,
ENTITY_PARROT_IMITATE_PILLAGER,
ENTITY_PARROT_IMITATE_RAVAGER,
ENTITY_PARROT_IMITATE_SHULKER,
@ -491,6 +604,7 @@ public enum Sound {
ENTITY_PARROT_IMITATE_WITCH,
ENTITY_PARROT_IMITATE_WITHER,
ENTITY_PARROT_IMITATE_WITHER_SKELETON,
ENTITY_PARROT_IMITATE_ZOGLIN,
ENTITY_PARROT_IMITATE_ZOMBIE,
ENTITY_PARROT_IMITATE_ZOMBIE_VILLAGER,
ENTITY_PARROT_STEP,
@ -505,6 +619,16 @@ public enum Sound {
ENTITY_PIG_HURT,
ENTITY_PIG_SADDLE,
ENTITY_PIG_STEP,
ENTITY_PIGLIN_ADMIRING_ITEM,
ENTITY_PIGLIN_AMBIENT,
ENTITY_PIGLIN_ANGRY,
ENTITY_PIGLIN_CELEBRATE,
ENTITY_PIGLIN_DEATH,
ENTITY_PIGLIN_JEALOUS,
ENTITY_PIGLIN_HURT,
ENTITY_PIGLIN_RETREAT,
ENTITY_PIGLIN_STEP,
ENTITY_PIGLIN_CONVERTED_TO_ZOMBIFIED,
ENTITY_PILLAGER_AMBIENT,
ENTITY_PILLAGER_CELEBRATE,
ENTITY_PILLAGER_DEATH,
@ -553,19 +677,29 @@ public enum Sound {
ENTITY_RABBIT_HURT,
ENTITY_RABBIT_JUMP,
EVENT_RAID_HORN,
MUSIC_DISC_11,
MUSIC_DISC_13,
MUSIC_DISC_BLOCKS,
MUSIC_DISC_CAT,
MUSIC_DISC_CHIRP,
MUSIC_DISC_FAR,
MUSIC_DISC_MALL,
MUSIC_DISC_MELLOHI,
MUSIC_DISC_STAL,
MUSIC_DISC_STRAD,
MUSIC_DISC_WAIT,
MUSIC_DISC_WARD,
ENTITY_RAVAGER_AMBIENT,
ENTITY_RAVAGER_ATTACK,
ENTITY_RAVAGER_CELEBRATE,
ENTITY_RAVAGER_DEATH,
ENTITY_RAVAGER_HURT,
ENTITY_RAVAGER_STEP,
ENTITY_RAVAGER_STUNNED,
ENTITY_RAVAGER_ROAR,
BLOCK_NETHER_GOLD_ORE_BREAK,
BLOCK_NETHER_GOLD_ORE_FALL,
BLOCK_NETHER_GOLD_ORE_HIT,
BLOCK_NETHER_GOLD_ORE_PLACE,
BLOCK_NETHER_GOLD_ORE_STEP,
BLOCK_NETHER_ORE_BREAK,
BLOCK_NETHER_ORE_FALL,
BLOCK_NETHER_ORE_HIT,
BLOCK_NETHER_ORE_PLACE,
BLOCK_NETHER_ORE_STEP,
BLOCK_REDSTONE_TORCH_BURNOUT,
BLOCK_RESPAWN_ANCHOR_AMBIENT,
BLOCK_RESPAWN_ANCHOR_CHARGE,
BLOCK_RESPAWN_ANCHOR_DEPLETE,
BLOCK_RESPAWN_ANCHOR_SET_SPAWN,
ENTITY_SALMON_AMBIENT,
ENTITY_SALMON_DEATH,
ENTITY_SALMON_FLOP,
@ -587,6 +721,11 @@ public enum Sound {
ENTITY_SHEEP_STEP,
ITEM_SHIELD_BLOCK,
ITEM_SHIELD_BREAK,
BLOCK_SHROOMLIGHT_BREAK,
BLOCK_SHROOMLIGHT_STEP,
BLOCK_SHROOMLIGHT_PLACE,
BLOCK_SHROOMLIGHT_HIT,
BLOCK_SHROOMLIGHT_FALL,
ITEM_SHOVEL_FLATTEN,
ENTITY_SHULKER_AMBIENT,
BLOCK_SHULKER_BOX_CLOSE,
@ -627,13 +766,31 @@ public enum Sound {
BLOCK_SLIME_BLOCK_HIT,
BLOCK_SLIME_BLOCK_PLACE,
BLOCK_SLIME_BLOCK_STEP,
ENTITY_MAGMA_CUBE_DEATH_SMALL,
ENTITY_MAGMA_CUBE_HURT_SMALL,
ENTITY_MAGMA_CUBE_SQUISH_SMALL,
BLOCK_SOUL_SAND_BREAK,
BLOCK_SOUL_SAND_STEP,
BLOCK_SOUL_SAND_PLACE,
BLOCK_SOUL_SAND_HIT,
BLOCK_SOUL_SAND_FALL,
BLOCK_SOUL_SOIL_BREAK,
BLOCK_SOUL_SOIL_STEP,
BLOCK_SOUL_SOIL_PLACE,
BLOCK_SOUL_SOIL_HIT,
BLOCK_SOUL_SOIL_FALL,
PARTICLE_SOUL_ESCAPE,
ENTITY_STRIDER_AMBIENT,
ENTITY_STRIDER_HAPPY,
ENTITY_STRIDER_RETREAT,
ENTITY_STRIDER_DEATH,
ENTITY_STRIDER_HURT,
ENTITY_STRIDER_STEP,
ENTITY_STRIDER_STEP_LAVA,
ENTITY_STRIDER_EAT,
ENTITY_STRIDER_SADDLE,
ENTITY_SLIME_DEATH_SMALL,
ENTITY_SLIME_HURT_SMALL,
ENTITY_SLIME_JUMP_SMALL,
ENTITY_SLIME_SQUISH_SMALL,
BLOCK_SMITHING_TABLE_USE,
BLOCK_SMOKER_SMOKE,
ENTITY_SNOWBALL_THROW,
BLOCK_SNOW_BREAK,
@ -642,6 +799,7 @@ public enum Sound {
ENTITY_SNOW_GOLEM_DEATH,
ENTITY_SNOW_GOLEM_HURT,
ENTITY_SNOW_GOLEM_SHOOT,
ENTITY_SNOW_GOLEM_SHEAR,
BLOCK_SNOW_HIT,
BLOCK_SNOW_PLACE,
BLOCK_SNOW_STEP,
@ -739,6 +897,7 @@ public enum Sound {
ENTITY_VINDICATOR_CELEBRATE,
ENTITY_VINDICATOR_DEATH,
ENTITY_VINDICATOR_HURT,
BLOCK_VINE_STEP,
BLOCK_LILY_PAD_PLACE,
ENTITY_WANDERING_TRADER_AMBIENT,
ENTITY_WANDERING_TRADER_DEATH,
@ -753,6 +912,11 @@ public enum Sound {
BLOCK_WATER_AMBIENT,
WEATHER_RAIN,
WEATHER_RAIN_ABOVE,
BLOCK_WET_GRASS_BREAK,
BLOCK_WET_GRASS_FALL,
BLOCK_WET_GRASS_HIT,
BLOCK_WET_GRASS_PLACE,
BLOCK_WET_GRASS_STEP,
ENTITY_WITCH_AMBIENT,
ENTITY_WITCH_CELEBRATE,
ENTITY_WITCH_DEATH,
@ -791,6 +955,17 @@ public enum Sound {
BLOCK_WOODEN_PRESSURE_PLATE_CLICK_OFF,
BLOCK_WOODEN_PRESSURE_PLATE_CLICK_ON,
BLOCK_WOOD_STEP,
BLOCK_WOOL_BREAK,
BLOCK_WOOL_FALL,
BLOCK_WOOL_HIT,
BLOCK_WOOL_PLACE,
BLOCK_WOOL_STEP,
ENTITY_ZOGLIN_AMBIENT,
ENTITY_ZOGLIN_ANGRY,
ENTITY_ZOGLIN_ATTACK,
ENTITY_ZOGLIN_DEATH,
ENTITY_ZOGLIN_HURT,
ENTITY_ZOGLIN_STEP,
ENTITY_ZOMBIE_AMBIENT,
ENTITY_ZOMBIE_ATTACK_WOODEN_DOOR,
ENTITY_ZOMBIE_ATTACK_IRON_DOOR,
@ -803,10 +978,10 @@ public enum Sound {
ENTITY_ZOMBIE_HORSE_HURT,
ENTITY_ZOMBIE_HURT,
ENTITY_ZOMBIE_INFECT,
ENTITY_ZOMBIE_PIGMAN_AMBIENT,
ENTITY_ZOMBIE_PIGMAN_ANGRY,
ENTITY_ZOMBIE_PIGMAN_DEATH,
ENTITY_ZOMBIE_PIGMAN_HURT,
ENTITY_ZOMBIFIED_PIGLIN_AMBIENT,
ENTITY_ZOMBIFIED_PIGLIN_ANGRY,
ENTITY_ZOMBIFIED_PIGLIN_DEATH,
ENTITY_ZOMBIFIED_PIGLIN_HURT,
ENTITY_ZOMBIE_STEP,
ENTITY_ZOMBIE_VILLAGER_AMBIENT,
ENTITY_ZOMBIE_VILLAGER_CONVERTED,

View File

@ -23,6 +23,7 @@ public enum StatisticType {
HORSE_ONE_CM,
AVIATE_ONE_CM,
SWIM_ONE_CM,
STRIDER_ONE_CM,
JUMP,
DROP,
DAMAGE_DEALT,
@ -74,7 +75,9 @@ public enum StatisticType {
RAID_TRIGGER,
RAID_WIN,
INTERACT_WITH_ANVIL,
INTERACT_WITH_GRINDSTONE;
INTERACT_WITH_GRINDSTONE,
TARGET_HIT,
INTERACT_WITH_SMITHING_TABLE;
private static Int2ObjectOpenHashMap<StatisticType> map = new Int2ObjectOpenHashMap();

View File

@ -283,7 +283,7 @@ public class Utils {
}
}
public static long[] encodeBlocks(int[] blocks, int bitsPerEntry) {
/*public static long[] encodeBlocks(int[] blocks, int bitsPerEntry) {
long maxEntryValue = (1L << bitsPerEntry) - 1;
int length = (int) Math.ceil(blocks.length * bitsPerEntry / 64.0);
@ -303,6 +303,48 @@ public class Utils {
}
return data;
}
}*/
private static final int[] MAGIC = {
-1, -1, 0, Integer.MIN_VALUE, 0, 0, 1431655765, 1431655765, 0, Integer.MIN_VALUE,
0, 1, 858993459, 858993459, 0, 715827882, 715827882, 0, 613566756, 613566756,
0, Integer.MIN_VALUE, 0, 2, 477218588, 477218588, 0, 429496729, 429496729, 0,
390451572, 390451572, 0, 357913941, 357913941, 0, 330382099, 330382099, 0, 306783378,
306783378, 0, 286331153, 286331153, 0, Integer.MIN_VALUE, 0, 3, 252645135, 252645135,
0, 238609294, 238609294, 0, 226050910, 226050910, 0, 214748364, 214748364, 0,
204522252, 204522252, 0, 195225786, 195225786, 0, 186737708, 186737708, 0, 178956970,
178956970, 0, 171798691, 171798691, 0, 165191049, 165191049, 0, 159072862, 159072862,
0, 153391689, 153391689, 0, 148102320, 148102320, 0, 143165576, 143165576, 0,
138547332, 138547332, 0, Integer.MIN_VALUE, 0, 4, 130150524, 130150524, 0, 126322567,
126322567, 0, 122713351, 122713351, 0, 119304647, 119304647, 0, 116080197, 116080197,
0, 113025455, 113025455, 0, 110127366, 110127366, 0, 107374182, 107374182, 0,
104755299, 104755299, 0, 102261126, 102261126, 0, 99882960, 99882960, 0, 97612893,
97612893, 0, 95443717, 95443717, 0, 93368854, 93368854, 0, 91382282, 91382282,
0, 89478485, 89478485, 0, 87652393, 87652393, 0, 85899345, 85899345, 0,
84215045, 84215045, 0, 82595524, 82595524, 0, 81037118, 81037118, 0, 79536431,
79536431, 0, 78090314, 78090314, 0, 76695844, 76695844, 0, 75350303, 75350303,
0, 74051160, 74051160, 0, 72796055, 72796055, 0, 71582788, 71582788, 0,
70409299, 70409299, 0, 69273666, 69273666, 0, 68174084, 68174084, 0, Integer.MIN_VALUE,
0, 5 };
public static long[] encodeBlocks(int[] blocks, int bitsPerEntry) {
long maxEntryValue = (1L << bitsPerEntry) - 1;
char valuesPerLong = (char) (64 / bitsPerEntry);
int magicIndex = 3 * (valuesPerLong - 1);
long divideMul = Integer.toUnsignedLong(MAGIC[magicIndex]);
long divideAdd = Integer.toUnsignedLong(MAGIC[magicIndex + 1]);
int divideShift = MAGIC[magicIndex + 2];
int size = (blocks.length + valuesPerLong - 1) / valuesPerLong;
long[] data = new long[size];
for (int i = 0; i < blocks.length; i++) {
long value = blocks[i];
int cellIndex = (int) (i * divideMul + divideAdd >> 32L >> divideShift);
int bitIndex = (i - cellIndex * valuesPerLong) * bitsPerEntry;
data[cellIndex] = data[cellIndex] & ~(maxEntryValue << bitIndex) | (value & maxEntryValue) << bitIndex;
}
return data;
}
}