Update and clean up data values.

This commit is contained in:
Steven Smith 2016-03-04 18:32:10 -08:00
parent 97c0a69294
commit 4ed72deb75
105 changed files with 371 additions and 969 deletions

View file

@ -6,7 +6,7 @@ import org.spacehq.mc.auth.exception.request.RequestException;
import org.spacehq.mc.auth.exception.request.ServiceUnavailableException;
import org.spacehq.mc.auth.service.SessionService;
import org.spacehq.mc.protocol.data.SubProtocol;
import org.spacehq.mc.protocol.data.game.HandshakeIntent;
import org.spacehq.mc.protocol.data.handshake.HandshakeIntent;
import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
import org.spacehq.mc.protocol.data.status.handler.ServerInfoHandler;
import org.spacehq.mc.protocol.data.status.handler.ServerPingTimeHandler;

View file

@ -103,7 +103,7 @@ import org.spacehq.mc.protocol.packet.ingame.server.world.ServerMultiBlockChange
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerNotifyClientPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerOpenTileEntityEditorPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlayEffectPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundEventPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlayBuiltinSoundPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerPlaySoundPacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnParticlePacket;
import org.spacehq.mc.protocol.packet.ingame.server.world.ServerSpawnPositionPacket;
@ -137,7 +137,6 @@ import java.security.Key;
import java.util.UUID;
public class MinecraftProtocol extends PacketProtocol {
private SubProtocol subProtocol = SubProtocol.HANDSHAKE;
private PacketHeader header = new DefaultPacketHeader();
private AESEncryption encrypt;
@ -387,7 +386,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerIncoming(68, ServerUpdateTimePacket.class);
this.registerIncoming(69, ServerTitlePacket.class);
this.registerIncoming(70, ServerUpdateSignPacket.class);
this.registerIncoming(71, ServerPlaySoundEventPacket.class);
this.registerIncoming(71, ServerPlayBuiltinSoundPacket.class);
this.registerIncoming(72, ServerPlayerListDataPacket.class);
this.registerIncoming(73, ServerEntityCollectItemPacket.class);
this.registerIncoming(74, ServerEntityTeleportPacket.class);
@ -529,7 +528,7 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(68, ServerUpdateTimePacket.class);
this.registerOutgoing(69, ServerTitlePacket.class);
this.registerOutgoing(70, ServerUpdateSignPacket.class);
this.registerOutgoing(71, ServerPlaySoundEventPacket.class);
this.registerOutgoing(71, ServerPlayBuiltinSoundPacket.class);
this.registerOutgoing(72, ServerPlayerListDataPacket.class);
this.registerOutgoing(73, ServerEntityCollectItemPacket.class);
this.registerOutgoing(74, ServerEntityTeleportPacket.class);
@ -552,5 +551,4 @@ public class MinecraftProtocol extends PacketProtocol {
this.registerOutgoing(0, StatusResponsePacket.class);
this.registerOutgoing(1, StatusPongPacket.class);
}
}

View file

@ -1,5 +1,13 @@
package org.spacehq.mc.protocol.data.game;
package org.spacehq.mc.protocol.data;
import org.spacehq.mc.protocol.data.game.BossBarAction;
import org.spacehq.mc.protocol.data.game.BossBarColor;
import org.spacehq.mc.protocol.data.game.BossBarDivision;
import org.spacehq.mc.protocol.data.game.ClientRequest;
import org.spacehq.mc.protocol.data.game.MessageType;
import org.spacehq.mc.protocol.data.game.PlayerListEntryAction;
import org.spacehq.mc.protocol.data.game.ResourcePackStatus;
import org.spacehq.mc.protocol.data.game.TitleAction;
import org.spacehq.mc.protocol.data.game.entity.Effect;
import org.spacehq.mc.protocol.data.game.entity.EntityStatus;
import org.spacehq.mc.protocol.data.game.entity.EquipmentSlot;
@ -63,17 +71,19 @@ import org.spacehq.mc.protocol.data.game.world.effect.SmokeEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.SoundEffect;
import org.spacehq.mc.protocol.data.game.world.notify.ClientNotification;
import org.spacehq.mc.protocol.data.game.world.notify.DemoMessageValue;
import org.spacehq.mc.protocol.data.game.world.sound.GenericSound;
import org.spacehq.mc.protocol.data.game.world.notify.EnterCreditsValue;
import org.spacehq.mc.protocol.data.game.world.sound.BuiltinSound;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.mc.protocol.data.game.world.sound.SoundEvent;
import org.spacehq.mc.protocol.data.handshake.HandshakeIntent;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
public class MagicValues {
private static final Map<Enum<?>, Object> values = new HashMap<Enum<?>, Object>();
private static final Map<Enum<?>, List<Object>> values = new HashMap<Enum<?>, List<Object>>();
static {
register(AttributeType.MAX_HEALTH, "generic.maxHealth");
@ -83,6 +93,7 @@ public class MagicValues {
register(AttributeType.ATTACK_DAMAGE, "generic.attackDamage");
register(AttributeType.ATTACK_SPEED, "generic.attackSpeed");
register(AttributeType.ARMOR, "generic.armor");
register(AttributeType.LUCK, "generic.luck");
register(AttributeType.HORSE_JUMP_STRENGTH, "horse.jumpStrength");
register(AttributeType.ZOMBIE_SPAWN_REINFORCEMENTS_CHANCE, "zombie.spawnReinforcements");
@ -478,6 +489,8 @@ public class MagicValues {
register(UpdatedTileType.SKULL, 4);
register(UpdatedTileType.FLOWER_POT, 5);
register(UpdatedTileType.BANNER, 6);
register(UpdatedTileType.STRUCTURE_BLOCK, 7);
register(UpdatedTileType.END_GATEWAY, 8);
register(ClientNotification.INVALID_BED, 0);
register(ClientNotification.START_RAIN, 1);
@ -488,12 +501,16 @@ public class MagicValues {
register(ClientNotification.ARROW_HIT_PLAYER, 6);
register(ClientNotification.RAIN_STRENGTH, 7);
register(ClientNotification.THUNDER_STRENGTH, 8);
register(ClientNotification.AFFECTED_BY_ELDER_GUARDIAN, 10);
register(DemoMessageValue.WELCOME, 0);
register(DemoMessageValue.MOVEMENT_CONTROLS, 101);
register(DemoMessageValue.JUMP_CONTROL, 102);
register(DemoMessageValue.INVENTORY_CONTROL, 103);
register(EnterCreditsValue.SEEN_BEFORE, 0);
register(EnterCreditsValue.FIRST_TIME, 1);
register(Achievement.OPEN_INVENTORY, "achievement.openInventory");
register(Achievement.GET_WOOD, "achievement.mineWood");
register(Achievement.MAKE_WORKBENCH, "achievement.buildWorkBench");
@ -598,210 +615,6 @@ public class MagicValues {
register(Particle.DAMAGE_INDICATOR, 44);
register(Particle.SWEEP_ATTACK, 45);
register(GenericSound.CLICK, "random.click");
register(GenericSound.FIZZ, "random.fizz");
register(GenericSound.FIRE_AMBIENT, "fire.fire");
register(GenericSound.IGNITE_FIRE, "fire.ignite");
register(GenericSound.WATER_AMBIENT, "liquid.water");
register(GenericSound.LAVA_AMBIENT, "liquid.lava");
register(GenericSound.LAVA_POP, "liquid.lavapop");
register(GenericSound.HARP, "note.harp");
register(GenericSound.BASS_DRUM, "note.bd");
register(GenericSound.SNARE_DRUM, "note.snare");
register(GenericSound.HI_HAT, "note.hat");
register(GenericSound.DOUBLE_BASS, "note.bassattack");
register(GenericSound.PISTON_EXTEND, "tile.piston.out");
register(GenericSound.PISTON_RETRACT, "tile.piston.in");
register(GenericSound.PORTAL_AMBIENT, "portal.portal");
register(GenericSound.TNT_PRIMED, "game.tnt.primed");
register(GenericSound.BOW_HIT, "random.bowhit");
register(GenericSound.COLLECT_ITEM, "random.pop");
register(GenericSound.COLLECT_EXP, "random.orb");
register(GenericSound.SUCCESSFUL_HIT, "random.successful_hit");
register(GenericSound.FIREWORK_BLAST, "fireworks.blast");
register(GenericSound.FIREWORK_LARGE_BLAST, "fireworks.largeBlast");
register(GenericSound.FIREWORK_FAR_BLAST, "fireworks.blast_far");
register(GenericSound.FIREWORK_FAR_LARGE_BLAST, "fireworks.largeBlast_far");
register(GenericSound.FIREWORK_TWINKLE, "fireworks.twinkle");
register(GenericSound.FIREWORK_FAR_TWINKLE, "fireworks.twinkle_far");
register(GenericSound.RAIN_AMBIENT, "ambient.weather.rain");
register(GenericSound.WITHER_SPAWN, "mob.wither.spawn");
register(GenericSound.ENDER_DRAGON_DEATH, "mob.enderdragon.end");
register(GenericSound.FIRE_PROJECTILE, "random.bow");
register(GenericSound.DOOR_OPEN, "random.door_open");
register(GenericSound.DOOR_CLOSE, "random.door_close");
register(GenericSound.GHAST_CHARGE, "mob.ghast.charge");
register(GenericSound.GHAST_FIRE, "mob.ghast.fireball");
register(GenericSound.POUND_WOODEN_DOOR, "mob.zombie.wood");
register(GenericSound.POUND_METAL_DOOR, "mob.zombie.metal");
register(GenericSound.BREAK_WOODEN_DOOR, "mob.zombie.woodbreak");
register(GenericSound.WITHER_SHOOT, "mob.wither.shoot");
register(GenericSound.BAT_TAKE_OFF, "mob.bat.takeoff");
register(GenericSound.INFECT_VILLAGER, "mob.zombie.infect");
register(GenericSound.DISINFECT_VILLAGER, "mob.zombie.unfect");
register(GenericSound.ANVIL_BREAK, "random.anvil_break");
register(GenericSound.ANVIL_USE, "random.anvil_use");
register(GenericSound.ANVIL_LAND, "random.anvil_land");
register(GenericSound.BREAK_SPLASH_POTION, "game.potion.smash");
register(GenericSound.THORNS_DAMAGE, "damage.thorns");
register(GenericSound.EXPLOSION, "random.explode");
register(GenericSound.CAVE_AMBIENT, "ambient.cave.cave");
register(GenericSound.OPEN_CHEST, "random.chestopen");
register(GenericSound.CLOSE_CHEST, "random.chestclosed");
register(GenericSound.DIG_STONE, "dig.stone");
register(GenericSound.DIG_WOOD, "dig.wood");
register(GenericSound.DIG_GRAVEL, "dig.gravel");
register(GenericSound.DIG_GRASS, "dig.grass");
register(GenericSound.DIG_CLOTH, "dig.cloth");
register(GenericSound.DIG_SAND, "dig.sand");
register(GenericSound.DIG_SNOW, "dig.snow");
register(GenericSound.DIG_GLASS, "dig.glass");
register(GenericSound.ANVIL_STEP, "step.anvil");
register(GenericSound.LADDER_STEP, "step.ladder");
register(GenericSound.STONE_STEP, "step.stone");
register(GenericSound.WOOD_STEP, "step.wood");
register(GenericSound.GRAVEL_STEP, "step.gravel");
register(GenericSound.GRASS_STEP, "step.grass");
register(GenericSound.CLOTH_STEP, "step.cloth");
register(GenericSound.SAND_STEP, "step.sand");
register(GenericSound.SNOW_STEP, "step.snow");
register(GenericSound.BURP, "random.burp");
register(GenericSound.SADDLE_HORSE, "mob.horse.leather");
register(GenericSound.ENDER_DRAGON_FLAP_WINGS, "mob.enderdragon.wings");
register(GenericSound.THUNDER_AMBIENT, "ambient.weather.thunder");
register(GenericSound.LAUNCH_FIREWORKS, "fireworks.launch");
register(GenericSound.CREEPER_PRIMED, "creeper.primed");
register(GenericSound.ENDERMAN_STARE, "mob.endermen.stare");
register(GenericSound.ENDERMAN_TELEPORT, "mob.endermen.portal");
register(GenericSound.IRON_GOLEM_THROW, "mob.irongolem.throw");
register(GenericSound.IRON_GOLEM_WALK, "mob.irongolem.walk");
register(GenericSound.ZOMBIE_PIGMAN_ANGRY, "mob.zombiepig.zpigangry");
register(GenericSound.SILVERFISH_STEP, "mob.silverfish.step");
register(GenericSound.SKELETON_STEP, "mob.skeleton.step");
register(GenericSound.SPIDER_STEP, "mob.spider.step");
register(GenericSound.ZOMBIE_STEP, "mob.zombie.step");
register(GenericSound.ZOMBIE_CURE, "mob.zombie.remedy");
register(GenericSound.CHICKEN_LAY_EGG, "mob.chicken.plop");
register(GenericSound.CHICKEN_STEP, "mob.chicken.step");
register(GenericSound.COW_STEP, "mob.cow.step");
register(GenericSound.HORSE_EATING, "eating");
register(GenericSound.HORSE_LAND, "mob.horse.land");
register(GenericSound.HORSE_WEAR_ARMOR, "mob.horse.armor");
register(GenericSound.HORSE_GALLOP, "mob.horse.gallop");
register(GenericSound.HORSE_BREATHE, "mob.horse.breathe");
register(GenericSound.HORSE_WOOD_STEP, "mob.horse.wood");
register(GenericSound.HORSE_SOFT_STEP, "mob.horse.soft");
register(GenericSound.HORSE_JUMP, "mob.horse.jump");
register(GenericSound.SHEAR_SHEEP, "mob.sheep.shear");
register(GenericSound.PIG_STEP, "mob.pig.step");
register(GenericSound.SHEEP_STEP, "mob.sheep.step");
register(GenericSound.VILLAGER_YES, "mob.villager.yes");
register(GenericSound.VILLAGER_NO, "mob.villager.no");
register(GenericSound.WOLF_STEP, "mob.wolf.step");
register(GenericSound.WOLF_SHAKE, "mob.wolf.shake");
register(GenericSound.DRINK, "random.drink");
register(GenericSound.EAT, "random.eat");
register(GenericSound.LEVEL_UP, "random.levelup");
register(GenericSound.FISH_HOOK_SPLASH, "random.splash");
register(GenericSound.ITEM_BREAK, "random.break");
register(GenericSound.SWIM, "game.neutral.swim");
register(GenericSound.SPLASH, "game.neutral.swim.splash");
register(GenericSound.HURT, "game.neutral.hurt");
register(GenericSound.DEATH, "game.neutral.die");
register(GenericSound.BIG_FALL, "game.neutral.hurt.fall.big");
register(GenericSound.SMALL_FALL, "game.neutral.hurt.fall.small");
register(GenericSound.MOB_SWIM, "game.hostile.swim");
register(GenericSound.MOB_SPLASH, "game.hostile.swim.splash");
register(GenericSound.PLAYER_SWIM, "game.player.swim");
register(GenericSound.PLAYER_SPLASH, "game.player.swim.splash");
register(GenericSound.ENDER_DRAGON_GROWL, "mob.enderdragon.growl");
register(GenericSound.WITHER_IDLE, "mob.wither.idle");
register(GenericSound.BLAZE_BREATHE, "mob.blaze.breathe");
register(GenericSound.ENDERMAN_SCREAM, "mob.endermen.scream");
register(GenericSound.ENDERMAN_IDLE, "mob.endermen.idle");
register(GenericSound.GHAST_MOAN, "mob.ghast.moan");
register(GenericSound.ZOMBIE_PIGMAN_IDLE, "mob.zombiepig.zpig");
register(GenericSound.SILVERFISH_IDLE, "mob.silverfish.say");
register(GenericSound.SKELETON_IDLE, "mob.skeleton.say");
register(GenericSound.SPIDER_IDLE, "mob.spider.say");
register(GenericSound.WITCH_IDLE, "mob.witch.idle");
register(GenericSound.ZOMBIE_IDLE, "mob.zombie.say");
register(GenericSound.BAT_IDLE, "mob.bat.idle");
register(GenericSound.CHICKEN_IDLE, "mob.chicken.say");
register(GenericSound.COW_IDLE, "mob.cow.say");
register(GenericSound.HORSE_IDLE, "mob.horse.idle");
register(GenericSound.DONKEY_IDLE, "mob.horse.donkey.idle");
register(GenericSound.ZOMBIE_HORSE_IDLE, "mob.horse.zombie.idle");
register(GenericSound.SKELETON_HORSE_IDLE, "mob.horse.skeleton.idle");
register(GenericSound.OCELOT_PURR, "mob.cat.purr");
register(GenericSound.OCELOT_PURR_MEOW, "mob.cat.purreow");
register(GenericSound.OCELOT_MEOW, "mob.cat.meow");
register(GenericSound.PIG_IDLE, "mob.pig.say");
register(GenericSound.SHEEP_IDLE, "mob.sheep.say");
register(GenericSound.VILLAGER_HAGGLE, "mob.villager.haggle");
register(GenericSound.VILLAGER_IDLE, "mob.villager.idle");
register(GenericSound.WOLF_GROWL, "mob.wolf.growl");
register(GenericSound.WOLF_PANT, "mob.wolf.panting");
register(GenericSound.WOLF_WHINE, "mob.wolf.whine");
register(GenericSound.WOLF_BARK, "mob.wolf.bark");
register(GenericSound.MOB_BIG_FALL, "game.hostile.hurt.fall.big");
register(GenericSound.MOB_SMALL_FALL, "game.hostile.hurt.fall.small");
register(GenericSound.PLAYER_BIG_FALL, "game.player.hurt.fall.big");
register(GenericSound.PLAYER_SMALL_FALL, "game.player.hurt.fall.small");
register(GenericSound.ENDER_DRAGON_HURT, "mob.enderdragon.hit");
register(GenericSound.WITHER_HURT, "mob.wither.hurt");
register(GenericSound.WITHER_DEATH, "mob.wither.death");
register(GenericSound.BLAZE_HURT, "mob.blaze.hit");
register(GenericSound.BLAZE_DEATH, "mob.blaze.death");
register(GenericSound.CREEPER_HURT, "mob.creeper.say");
register(GenericSound.CREEPER_DEATH, "mob.creeper.death");
register(GenericSound.ENDERMAN_HURT, "mob.endermen.hit");
register(GenericSound.ENDERMAN_DEATH, "mob.endermen.death");
register(GenericSound.GHAST_HURT, "mob.ghast.scream");
register(GenericSound.GHAST_DEATH, "mob.ghast.death");
register(GenericSound.IRON_GOLEM_HURT, "mob.irongolem.hit");
register(GenericSound.IRON_GOLEM_DEATH, "mob.irongolem.death");
register(GenericSound.MOB_HURT, "game.hostile.hurt");
register(GenericSound.MOB_DEATH, "game.hostile.die");
register(GenericSound.ZOMBIE_PIGMAN_HURT, "mob.zombiepig.zpighurt");
register(GenericSound.ZOMBIE_PIGMAN_DEATH, "mob.zombiepig.zpigdeath");
register(GenericSound.SILVERFISH_HURT, "mob.silverfish.hit");
register(GenericSound.SILVERFISH_DEATH, "mob.silverfish.kill");
register(GenericSound.SKELETON_HURT, "mob.skeleton.hurt");
register(GenericSound.SKELETON_DEATH, "mob.skeleton.death");
register(GenericSound.SLIME, "mob.slime.small");
register(GenericSound.BIG_SLIME, "mob.slime.big");
register(GenericSound.SPIDER_DEATH, "mob.spider.death");
register(GenericSound.WITCH_HURT, "mob.witch.hurt");
register(GenericSound.WITCH_DEATH, "mob.witch.death");
register(GenericSound.ZOMBIE_HURT, "mob.zombie.hurt");
register(GenericSound.ZOMBIE_DEATH, "mob.zombie.death");
register(GenericSound.PLAYER_HURT, "game.player.hurt");
register(GenericSound.PLAYER_DEATH, "game.player.die");
register(GenericSound.WOLF_HURT, "mob.wolf.hurt");
register(GenericSound.WOLF_DEATH, "mob.wolf.death");
register(GenericSound.VILLAGER_HURT, "mob.villager.hit");
register(GenericSound.VILLAGER_DEATH, "mob.villager.death");
register(GenericSound.PIG_DEATH, "mob.pig.death");
register(GenericSound.OCELOT_HURT, "mob.cat.hitt");
register(GenericSound.HORSE_HURT, "mob.horse.hit");
register(GenericSound.DONKEY_HURT, "mob.horse.donkey.hit");
register(GenericSound.ZOMBIE_HORSE_HURT, "mob.horse.zombie.hit");
register(GenericSound.SKELETON_HORSE_HURT, "mob.horse.skeleton.hit");
register(GenericSound.HORSE_DEATH, "mob.horse.death");
register(GenericSound.DONKEY_DEATH, "mob.horse.donkey.death");
register(GenericSound.ZOMBIE_HORSE_DEATH, "mob.horse.zombie.death");
register(GenericSound.SKELETON_HORSE_DEATH, "mob.horse.skeleton.death");
register(GenericSound.COW_HURT, "mob.cow.hurt");
register(GenericSound.CHICKEN_HURT, "mob.chicken.hurt");
register(GenericSound.BAT_HURT, "mob.bat.hurt");
register(GenericSound.BAT_DEATH, "mob.bat.death");
register(GenericSound.RABBIT_HURT, "mob.rabbit.hurt");
register(GenericSound.RABBIT_HOP, "mob.rabbit.hop");
register(GenericSound.RABBIT_IDLE, "mob.rabbit.idle");
register(GenericSound.RABBIT_DEATH, "mob.rabbit.death");
register(GenericSound.MOB_ATTACK, "mob.attack");
register(NoteBlockValueType.HARP, 0);
register(NoteBlockValueType.DOUBLE_BASS, 1);
register(NoteBlockValueType.SNARE_DRUM, 2);
@ -824,27 +637,43 @@ public class MagicValues {
register(PistonValue.NORTH, 4);
register(PistonValue.EAST, 5);
register(SoundEffect.CLICK, 1000);
register(SoundEffect.EMPTY_DISPENSER_CLICK, 1001);
register(SoundEffect.FIRE_PROJECTILE, 1002);
register(SoundEffect.DOOR, 1003);
register(SoundEffect.FIZZLE, 1004);
register(SoundEffect.PLAY_RECORD, 1005);
register(SoundEffect.GHAST_CHARGE, 1007);
register(SoundEffect.GHAST_FIRE, 1008);
register(SoundEffect.BLAZE_FIRE, 1009);
register(SoundEffect.POUND_WOODEN_DOOR, 1010);
register(SoundEffect.POUND_METAL_DOOR, 1011);
register(SoundEffect.BREAK_WOODEN_DOOR, 1012);
register(SoundEffect.WITHER_SPAWN, 1013);
register(SoundEffect.WITHER_SHOOT, 1014);
register(SoundEffect.BAT_TAKE_OFF, 1015);
register(SoundEffect.INFECT_VILLAGER, 1016);
register(SoundEffect.DISINFECT_VILLAGER, 1017);
register(SoundEffect.ENDER_DRAGON_DEATH, 1018);
register(SoundEffect.ANVIL_BREAK, 1020);
register(SoundEffect.ANVIL_USE, 1021);
register(SoundEffect.ANVIL_LAND, 1022);
register(SoundEffect.BLOCK_DISPENSER_DISPENSE, 1000);
register(SoundEffect.BLOCK_DISPENSER_FAIL, 1001);
register(SoundEffect.BLOCK_DISPENSER_LAUNCH, 1002);
register(SoundEffect.ENTITY_ENDEREYE_LAUNCH, 1003);
register(SoundEffect.ENTITY_FIREWORK_SHOOT, 1004);
register(SoundEffect.BLOCK_IRON_DOOR_OPEN, 1005);
register(SoundEffect.BLOCK_WOODEN_DOOR_OPEN, 1006);
register(SoundEffect.BLOCK_WOODEN_TRAPDOOR_OPEN, 1007);
register(SoundEffect.BLOCK_FENCE_GATE_OPEN, 1008);
register(SoundEffect.BLOCK_FIRE_EXTINGUISH, 1009);
register(SoundEffect.RECORD, 1010);
register(SoundEffect.BLOCK_IRON_DOOR_CLOSE, 1011);
register(SoundEffect.BLOCK_WOODEN_DOOR_CLOSE, 1012);
register(SoundEffect.BLOCK_WOODEN_TRAPDOOR_CLOSE, 1013);
register(SoundEffect.BLOCK_FENCE_GATE_CLOSE, 1014);
register(SoundEffect.ENTITY_GHAST_WARN, 1015);
register(SoundEffect.ENTITY_GHAST_SHOOT, 1016);
register(SoundEffect.ENTITY_ENDERDRAGON_SHOOT, 1017);
register(SoundEffect.ENTITY_BLAZE_SHOOT, 1018);
register(SoundEffect.ENTITY_ZOMBIE_ATTACK_DOOR_WOOD, 1019);
register(SoundEffect.ENTITY_ZOMBIE_ATTACK_DOOR_IRON, 1020);
register(SoundEffect.ENTITY_ZOMBIE_BREAK_DOOR_WOOD, 1021);
register(SoundEffect.ENTITY_WITHER_BREAK_BLOCK, 1022);
register(SoundEffect.ENTITY_WITHER_SHOOT, 1024);
register(SoundEffect.ENTITY_BAT_TAKEOFF, 1025);
register(SoundEffect.ENTITY_ZOMBIE_INFECT, 1026);
register(SoundEffect.ENTITY_ZOMBIE_VILLAGER_CONVERTED, 1027);
register(SoundEffect.BLOCK_ANVIL_DESTROY, 1029);
register(SoundEffect.BLOCK_ANVIL_USE, 1030);
register(SoundEffect.BLOCK_ANVIL_LAND, 1031);
register(SoundEffect.BLOCK_PORTAL_TRAVEL, 1032);
register(SoundEffect.BLOCK_CHORUS_FLOWER_GROW, 1033);
register(SoundEffect.BLOCK_CHORUS_FLOWER_DEATH, 1034);
register(SoundEffect.BLOCK_BREWING_STAND_BREW, 1035);
register(SoundEffect.BLOCK_IRON_TRAPDOOR_CLOSE, 1036);
register(SoundEffect.BLOCK_IRON_TRAPDOOR_OPEN, 1037);
register(SoundEffect.ENTITY_ENDERDRAGON_GROWL, 3001);
register(ParticleEffect.SMOKE, 2000);
register(ParticleEffect.BREAK_BLOCK, 2001);
@ -852,7 +681,8 @@ public class MagicValues {
register(ParticleEffect.BREAK_EYE_OF_ENDER, 2003);
register(ParticleEffect.MOB_SPAWN, 2004);
register(ParticleEffect.BONEMEAL_GROW, 2005);
register(ParticleEffect.HARD_LANDING_DUST, 2006);
register(ParticleEffect.ENDERDRAGON_FIREBALL_EXPLODE, 2006);
register(ParticleEffect.END_GATEWAY_SPAWN, 3000);
register(SmokeEffectData.SOUTH_EAST, 0);
register(SmokeEffectData.SOUTH, 1);
@ -968,28 +798,33 @@ public class MagicValues {
register(SoundCategory.AMBIENT, 8);
register(SoundCategory.VOICE, 9);
int soundEventId = 0;
for(SoundEvent event : SoundEvent.values()) {
register(event, soundEventId++);
for(BuiltinSound sound : BuiltinSound.values()) {
register(sound, sound.ordinal());
register(sound, sound.name().toLowerCase().replace('_', '.'));
}
}
private static void register(Enum<?> key, Object value) {
values.put(key, value);
if(!values.containsKey(key)) {
values.put(key, new ArrayList<Object>());
}
values.get(key).add(value);
}
@SuppressWarnings({ "unchecked" })
public static <T extends Enum<?>> T key(Class<T> keyType, Object value) {
for(Enum<?> key : values.keySet()) {
Object val = values.get(key);
if(keyType.isAssignableFrom(key.getClass())) {
if(val == value || val.equals(value)) {
return (T) key;
} else if(Number.class.isAssignableFrom(val.getClass()) && Number.class.isAssignableFrom(value.getClass())) {
Number num = (Number) val;
Number num2 = (Number) value;
if(num.doubleValue() == num2.doubleValue()) {
for(Object val : values.get(key)) {
if(val == value || val.equals(value)) {
return (T) key;
} else if(Number.class.isAssignableFrom(val.getClass()) && Number.class.isAssignableFrom(value.getClass())) {
Number num = (Number) val;
Number num2 = (Number) value;
if(num.doubleValue() == num2.doubleValue()) {
return (T) key;
}
}
}
}
@ -1000,28 +835,28 @@ public class MagicValues {
@SuppressWarnings("unchecked")
public static <T> T value(Class<T> valueType, Enum<?> key) {
Object val = values.get(key);
if(val != null) {
if(valueType.isAssignableFrom(val.getClass())) {
return (T) val;
} else if(Number.class.isAssignableFrom(val.getClass())) {
if(valueType == Byte.class) {
return (T) (Object) ((Number) val).byteValue();
} else if(valueType == Short.class) {
return (T) (Object) ((Number) val).shortValue();
} else if(valueType == Integer.class) {
return (T) (Object) ((Number) val).intValue();
} else if(valueType == Long.class) {
return (T) (Object) ((Number) val).longValue();
} else if(valueType == Float.class) {
return (T) (Object) ((Number) val).floatValue();
} else if(valueType == Double.class) {
return (T) (Object) ((Number) val).doubleValue();
if(values.containsKey(key)) {
for(Object val : values.get(key)) {
if(valueType.isAssignableFrom(val.getClass())) {
return (T) val;
} else if(Number.class.isAssignableFrom(val.getClass())) {
if(valueType == Byte.class) {
return (T) (Object) ((Number) val).byteValue();
} else if(valueType == Short.class) {
return (T) (Object) ((Number) val).shortValue();
} else if(valueType == Integer.class) {
return (T) (Object) ((Number) val).intValue();
} else if(valueType == Long.class) {
return (T) (Object) ((Number) val).longValue();
} else if(valueType == Float.class) {
return (T) (Object) ((Number) val).floatValue();
} else if(valueType == Double.class) {
return (T) (Object) ((Number) val).doubleValue();
}
}
}
}
throw new IllegalArgumentException("Key " + key + " has no mapping for value class " + valueType.getName() + ".");
}
}

View file

@ -1,9 +1,7 @@
package org.spacehq.mc.protocol.data.game;
public enum MessageType {
CHAT,
SYSTEM,
NOTIFICATION;
}

View file

@ -55,26 +55,15 @@ public class PlayerListEntry {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
PlayerListEntry entry = (PlayerListEntry) o;
if(ping != entry.ping) return false;
if(displayName != null ? !displayName.equals(entry.displayName) : entry.displayName != null) return false;
if(gameMode != entry.gameMode) return false;
if(!profile.equals(entry.profile)) return false;
return true;
return o instanceof PlayerListEntry && this.profile.equals(((PlayerListEntry) o).profile) && this.gameMode == ((PlayerListEntry) o).gameMode && this.ping == ((PlayerListEntry) o).ping && (this.displayName != null ? this.displayName.equals(((PlayerListEntry) o).displayName) : ((PlayerListEntry) o).displayName == null);
}
@Override
public int hashCode() {
int result = profile.hashCode();
result = 31 * result + (gameMode != null ? gameMode.hashCode() : 0);
result = 31 * result + ping;
result = 31 * result + (displayName != null ? displayName.hashCode() : 0);
int result = this.profile.hashCode();
result = 31 * result + (this.gameMode != null ? this.gameMode.hashCode() : 0);
result = 31 * result + this.ping;
result = 31 * result + (this.displayName != null ? this.displayName.hashCode() : 0);
return result;
}
}

View file

@ -1,5 +1,7 @@
package org.spacehq.mc.protocol.data.game.chunk;
import org.spacehq.mc.protocol.data.game.world.block.BlockState;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
@ -9,16 +11,18 @@ import java.util.Collections;
import java.util.List;
public class BlockStorage {
private static final BlockState AIR = new BlockState(0, 0);
private int bitsPerEntry;
private List<Integer> states;
private List<BlockState> states;
private FlexibleStorage storage;
public BlockStorage() {
this.bitsPerEntry = 4;
this.states = new ArrayList<Integer>();
this.states.add(0);
this.states = new ArrayList<BlockState>();
this.states.add(AIR);
this.storage = new FlexibleStorage(this.bitsPerEntry, 4096);
}
@ -26,10 +30,10 @@ public class BlockStorage {
public BlockStorage(NetInput in) throws IOException {
this.bitsPerEntry = in.readUnsignedByte();
this.states = new ArrayList<Integer>();
this.states = new ArrayList<BlockState>();
int stateCount = in.readVarInt();
for(int i = 0; i < stateCount; i++) {
this.states.add(in.readVarInt());
this.states.add(NetUtil.readBlockState(in));
}
this.storage = new FlexibleStorage(this.bitsPerEntry, in.readLongs(in.readVarInt()));
@ -39,8 +43,8 @@ public class BlockStorage {
out.writeByte(this.bitsPerEntry);
out.writeVarInt(this.states.size());
for(int state : this.states) {
out.writeVarInt(state);
for(BlockState state : this.states) {
NetUtil.writeBlockState(out, state);
}
long[] data = this.storage.getData();
@ -52,7 +56,7 @@ public class BlockStorage {
return this.bitsPerEntry;
}
public List<Integer> getStates() {
public List<BlockState> getStates() {
return Collections.unmodifiableList(this.states);
}
@ -60,21 +64,21 @@ public class BlockStorage {
return this.storage;
}
public int get(int x, int y, int z) {
public BlockState get(int x, int y, int z) {
int id = this.storage.get(index(x, y, z));
return this.bitsPerEntry <= 8 ? (id >= 0 && id < this.states.size() ? this.states.get(id) : 0) : id;
return this.bitsPerEntry <= 8 ? (id >= 0 && id < this.states.size() ? this.states.get(id) : AIR) : rawToState(id);
}
public void set(int x, int y, int z, int state) {
int id = this.bitsPerEntry <= 8 ? this.states.indexOf(state) : state;
public void set(int x, int y, int z, BlockState state) {
int id = this.bitsPerEntry <= 8 ? this.states.indexOf(state) : stateToRaw(state);
if(id == -1) {
this.states.add(state);
if(this.states.size() > 1 << this.bitsPerEntry) {
this.bitsPerEntry++;
List<Integer> oldStates = this.states;
List<BlockState> oldStates = this.states;
if(this.bitsPerEntry > 8) {
oldStates = new ArrayList<Integer>(this.states);
oldStates = new ArrayList<BlockState>(this.states);
this.states.clear();
this.bitsPerEntry = 13;
}
@ -82,12 +86,11 @@ public class BlockStorage {
FlexibleStorage oldStorage = this.storage;
this.storage = new FlexibleStorage(this.bitsPerEntry, this.storage.getSize());
for(int index = 0; index < this.storage.getSize(); index++) {
int value = oldStorage.get(index);
this.storage.set(index, this.bitsPerEntry <= 8 ? value : oldStates.get(value));
this.storage.set(index, this.bitsPerEntry <= 8 ? oldStorage.get(index) : stateToRaw(oldStates.get(index)));
}
}
id = this.bitsPerEntry <= 8 ? this.states.indexOf(state) : state;
id = this.bitsPerEntry <= 8 ? this.states.indexOf(state) : stateToRaw(state);
}
this.storage.set(index(x, y, z), id);
@ -107,9 +110,17 @@ public class BlockStorage {
return y << 8 | z << 4 | x;
}
private static BlockState rawToState(int raw) {
return new BlockState(raw >> 4, raw & 0xF);
}
private static int stateToRaw(BlockState state) {
return (state.getId() << 4) | (state.getData() & 0xF);
}
@Override
public boolean equals(Object o) {
return this == o || (o instanceof BlockStorage && this.bitsPerEntry == ((BlockStorage) o).bitsPerEntry && this.states.equals(((BlockStorage) o).states) && this.storage.equals(((BlockStorage) o).storage));
return o instanceof BlockStorage && this.bitsPerEntry == ((BlockStorage) o).bitsPerEntry && this.states.equals(((BlockStorage) o).states) && this.storage.equals(((BlockStorage) o).storage);
}
@Override

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.data.game.entity.attribute;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import java.util.UUID;

View file

@ -9,6 +9,7 @@ public enum AttributeType {
ATTACK_DAMAGE(2, 0, 2048),
ATTACK_SPEED(4, 0, 1024),
ARMOR(0, 0, 30),
LUCK(0, -1024, 1024),
HORSE_JUMP_STRENGTH(0.7, 0, 2),
ZOMBIE_SPAWN_REINFORCEMENTS_CHANCE(0, 0, 1);

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world;
public enum WorldType {
DEFAULT,
FLAT,
LARGE_BIOMES,
@ -9,5 +8,4 @@ public enum WorldType {
CUSTOMIZED,
DEBUG,
DEFAULT_1_1;
}

View file

@ -21,7 +21,7 @@ public class BlockChangeRecord {
@Override
public boolean equals(Object o) {
return this == o || (o instanceof BlockChangeRecord && this.position.equals(((BlockChangeRecord) o).position) && this.block.equals(((BlockChangeRecord) o).block));
return o instanceof BlockChangeRecord && this.position.equals(((BlockChangeRecord) o).position) && this.block.equals(((BlockChangeRecord) o).block);
}
@Override

View file

@ -19,7 +19,7 @@ public class BlockState {
@Override
public boolean equals(Object o) {
return this == o || (o instanceof BlockState && this.id == ((BlockState) o).id && this.data == ((BlockState) o).data);
return o instanceof BlockState && this.id == ((BlockState) o).id && this.data == ((BlockState) o).data;
}
@Override

View file

@ -25,7 +25,7 @@ public class ExplodedBlockRecord {
@Override
public boolean equals(Object o) {
return this == o || (o instanceof ExplodedBlockRecord && this.x == ((ExplodedBlockRecord) o).x && this.y == ((ExplodedBlockRecord) o).y && this.z == ((ExplodedBlockRecord) o).z);
return o instanceof ExplodedBlockRecord && this.x == ((ExplodedBlockRecord) o).x && this.y == ((ExplodedBlockRecord) o).y && this.z == ((ExplodedBlockRecord) o).z;
}
@Override

View file

@ -6,5 +6,7 @@ public enum UpdatedTileType {
BEACON,
SKULL,
FLOWER_POT,
BANNER;
BANNER,
STRUCTURE_BLOCK,
END_GATEWAY;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public class ChestValue implements BlockValue {
private int viewers;
public ChestValue(int viewers) {
@ -14,19 +13,11 @@ public class ChestValue implements BlockValue {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
ChestValue that = (ChestValue) o;
if(viewers != that.viewers) return false;
return true;
return o instanceof ChestValue && this.viewers == ((ChestValue) o).viewers;
}
@Override
public int hashCode() {
return viewers;
return this.viewers;
}
}

View file

@ -1,7 +1,5 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum ChestValueType implements BlockValueType {
VIEWING_PLAYER_COUNT;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public class GenericBlockValue implements BlockValue {
private int value;
public GenericBlockValue(int value) {
@ -14,19 +13,11 @@ public class GenericBlockValue implements BlockValue {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
GenericBlockValue that = (GenericBlockValue) o;
if(value != that.value) return false;
return true;
return o instanceof GenericBlockValue && this.value == ((GenericBlockValue) o).value;
}
@Override
public int hashCode() {
return value;
return this.value;
}
}

View file

@ -1,7 +1,5 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum GenericBlockValueType implements BlockValueType {
GENERIC;
}

View file

@ -1,7 +1,5 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum MobSpawnerValueType implements BlockValueType {
RESET_DELAY;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public class NoteBlockValue implements BlockValue {
private int pitch;
public NoteBlockValue(int pitch) {
@ -18,19 +17,11 @@ public class NoteBlockValue implements BlockValue {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
NoteBlockValue that = (NoteBlockValue) o;
if(pitch != that.pitch) return false;
return true;
return o instanceof NoteBlockValue && this.pitch == ((NoteBlockValue) o).pitch;
}
@Override
public int hashCode() {
return pitch;
return this.pitch;
}
}

View file

@ -1,11 +1,9 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum NoteBlockValueType implements BlockValueType {
HARP,
DOUBLE_BASS,
SNARE_DRUM,
HI_HAT,
BASS_DRUM;
}

View file

@ -1,12 +1,10 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum PistonValue implements BlockValue {
DOWN,
UP,
SOUTH,
WEST,
NORTH,
EAST;
}

View file

@ -1,8 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.block.value;
public enum PistonValueType implements BlockValueType {
PUSHING,
PULLING;
}

View file

@ -0,0 +1,23 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public class BonemealGrowEffectData implements WorldEffectData {
private int particleCount;
public BonemealGrowEffectData(int particleCount) {
this.particleCount = particleCount;
}
public int getParticleCount() {
return this.particleCount;
}
@Override
public boolean equals(Object o) {
return o instanceof BonemealGrowEffectData && this.particleCount == ((BonemealGrowEffectData) o).particleCount;
}
@Override
public int hashCode() {
return this.particleCount;
}
}

View file

@ -1,32 +1,25 @@
package org.spacehq.mc.protocol.data.game.world.effect;
import org.spacehq.mc.protocol.data.game.world.block.BlockState;
public class BreakBlockEffectData implements WorldEffectData {
private BlockState blockState;
private int blockId;
public BreakBlockEffectData(int blockId) {
this.blockId = blockId;
public BreakBlockEffectData(BlockState blockState) {
this.blockState = blockState;
}
public int getBlockId() {
return this.blockId;
public BlockState getBlockState() {
return this.blockState;
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
BreakBlockEffectData that = (BreakBlockEffectData) o;
if(blockId != that.blockId) return false;
return true;
return o instanceof BreakBlockEffectData && this.blockState.equals(((BreakBlockEffectData) o).blockState);
}
@Override
public int hashCode() {
return blockId;
return this.blockState.hashCode();
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public class BreakPotionEffectData implements WorldEffectData {
private int potionId;
public BreakPotionEffectData(int potionId) {
@ -14,19 +13,11 @@ public class BreakPotionEffectData implements WorldEffectData {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
BreakPotionEffectData that = (BreakPotionEffectData) o;
if(potionId != that.potionId) return false;
return true;
return o instanceof BreakPotionEffectData && this.potionId == ((BreakPotionEffectData) o).potionId;
}
@Override
public int hashCode() {
return potionId;
return this.potionId;
}
}

View file

@ -1,32 +0,0 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public class HardLandingEffectData implements WorldEffectData {
private int damagingDistance;
public HardLandingEffectData(int damagingDistance) {
this.damagingDistance = damagingDistance;
}
public int getDamagingDistance() {
return this.damagingDistance;
}
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
HardLandingEffectData that = (HardLandingEffectData) o;
if(damagingDistance != that.damagingDistance) return false;
return true;
}
@Override
public int hashCode() {
return damagingDistance;
}
}

View file

@ -1,13 +1,12 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public enum ParticleEffect implements WorldEffect {
SMOKE,
BREAK_BLOCK,
BREAK_SPLASH_POTION,
BREAK_EYE_OF_ENDER,
MOB_SPAWN,
BONEMEAL_GROW,
HARD_LANDING_DUST;
ENDERDRAGON_FIREBALL_EXPLODE,
END_GATEWAY_SPAWN;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public class RecordEffectData implements WorldEffectData {
private int recordId;
public RecordEffectData(int recordId) {
@ -14,19 +13,11 @@ public class RecordEffectData implements WorldEffectData {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
RecordEffectData that = (RecordEffectData) o;
if(recordId != that.recordId) return false;
return true;
return o instanceof RecordEffectData && this.recordId == ((RecordEffectData) o).recordId;
}
@Override
public int hashCode() {
return recordId;
return this.recordId;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public enum SmokeEffectData implements WorldEffectData {
SOUTH_EAST,
SOUTH,
SOUTH_WEST,
@ -11,5 +10,4 @@ public enum SmokeEffectData implements WorldEffectData {
NORTH_EAST,
NORTH,
NORTH_WEST;
}

View file

@ -1,27 +1,41 @@
package org.spacehq.mc.protocol.data.game.world.effect;
public enum SoundEffect implements WorldEffect {
CLICK,
EMPTY_DISPENSER_CLICK,
FIRE_PROJECTILE,
DOOR,
FIZZLE,
PLAY_RECORD,
GHAST_CHARGE,
GHAST_FIRE,
BLAZE_FIRE,
POUND_WOODEN_DOOR,
POUND_METAL_DOOR,
BREAK_WOODEN_DOOR,
WITHER_SPAWN,
WITHER_SHOOT,
BAT_TAKE_OFF,
INFECT_VILLAGER,
DISINFECT_VILLAGER,
ENDER_DRAGON_DEATH,
ANVIL_BREAK,
ANVIL_USE,
ANVIL_LAND;
BLOCK_DISPENSER_DISPENSE,
BLOCK_DISPENSER_FAIL,
BLOCK_DISPENSER_LAUNCH,
ENTITY_ENDEREYE_LAUNCH,
ENTITY_FIREWORK_SHOOT,
BLOCK_IRON_DOOR_OPEN,
BLOCK_WOODEN_DOOR_OPEN,
BLOCK_WOODEN_TRAPDOOR_OPEN,
BLOCK_FENCE_GATE_OPEN,
BLOCK_FIRE_EXTINGUISH,
RECORD,
BLOCK_IRON_DOOR_CLOSE,
BLOCK_WOODEN_DOOR_CLOSE,
BLOCK_WOODEN_TRAPDOOR_CLOSE,
BLOCK_FENCE_GATE_CLOSE,
ENTITY_GHAST_WARN,
ENTITY_GHAST_SHOOT,
ENTITY_ENDERDRAGON_SHOOT,
ENTITY_BLAZE_SHOOT,
ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
ENTITY_ZOMBIE_ATTACK_DOOR_IRON,
ENTITY_ZOMBIE_BREAK_DOOR_WOOD,
ENTITY_WITHER_BREAK_BLOCK,
ENTITY_WITHER_SHOOT,
ENTITY_BAT_TAKEOFF,
ENTITY_ZOMBIE_INFECT,
ENTITY_ZOMBIE_VILLAGER_CONVERTED,
BLOCK_ANVIL_DESTROY,
BLOCK_ANVIL_USE,
BLOCK_ANVIL_LAND,
BLOCK_PORTAL_TRAVEL,
BLOCK_CHORUS_FLOWER_GROW,
BLOCK_CHORUS_FLOWER_DEATH,
BLOCK_BREWING_STAND_BREW,
BLOCK_IRON_TRAPDOOR_CLOSE,
BLOCK_IRON_TRAPDOOR_OPEN,
ENTITY_ENDERDRAGON_GROWL;
}

View file

@ -39,28 +39,16 @@ public class MapData {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
MapData mapData = (MapData) o;
if(columns != mapData.columns) return false;
if(rows != mapData.rows) return false;
if(x != mapData.x) return false;
if(y != mapData.y) return false;
if(!Arrays.equals(data, mapData.data)) return false;
return true;
return o instanceof MapData && this.columns == ((MapData) o).columns && this.rows == ((MapData) o).rows && this.x == ((MapData) o).x && this.y == ((MapData) o).y && Arrays.equals(this.data, ((MapData) o).data);
}
@Override
public int hashCode() {
int result = columns;
result = 31 * result + rows;
result = 31 * result + x;
result = 31 * result + y;
result = 31 * result + Arrays.hashCode(data);
int result = this.columns;
result = 31 * result + this.rows;
result = 31 * result + this.x;
result = 31 * result + this.y;
result = 31 * result + Arrays.hashCode(this.data);
return result;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.map;
public class MapPlayer {
private int centerX;
private int centerZ;
private int iconSize;
@ -32,26 +31,15 @@ public class MapPlayer {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
MapPlayer mapPlayer = (MapPlayer) o;
if(centerX != mapPlayer.centerX) return false;
if(centerZ != mapPlayer.centerZ) return false;
if(iconRotation != mapPlayer.iconRotation) return false;
if(iconSize != mapPlayer.iconSize) return false;
return true;
return o instanceof MapPlayer && this.centerX == ((MapPlayer) o).centerX && this.centerZ == ((MapPlayer) o).centerZ && this.iconSize == ((MapPlayer) o).iconSize && this.iconRotation == ((MapPlayer) o).iconRotation;
}
@Override
public int hashCode() {
int result = centerX;
result = 31 * result + centerZ;
result = 31 * result + iconSize;
result = 31 * result + iconRotation;
int result = this.centerX;
result = 31 * result + this.centerZ;
result = 31 * result + this.iconRotation;
result = 31 * result + this.iconSize;
return result;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.notify;
public enum ClientNotification {
INVALID_BED,
START_RAIN,
STOP_RAIN,
@ -10,6 +9,6 @@ public enum ClientNotification {
DEMO_MESSAGE,
ARROW_HIT_PLAYER,
RAIN_STRENGTH,
THUNDER_STRENGTH;
THUNDER_STRENGTH,
AFFECTED_BY_ELDER_GUARDIAN;
}

View file

@ -1,10 +1,8 @@
package org.spacehq.mc.protocol.data.game.world.notify;
public enum DemoMessageValue implements ClientNotificationValue {
WELCOME,
MOVEMENT_CONTROLS,
JUMP_CONTROL,
INVENTORY_CONTROL;
}

View file

@ -0,0 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.notify;
public enum EnterCreditsValue implements ClientNotificationValue {
SEEN_BEFORE,
FIRST_TIME;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.notify;
public class RainStrengthValue implements ClientNotificationValue {
private float strength;
public RainStrengthValue(float strength) {
@ -22,19 +21,11 @@ public class RainStrengthValue implements ClientNotificationValue {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
RainStrengthValue that = (RainStrengthValue) o;
if(Float.compare(that.strength, strength) != 0) return false;
return true;
return o instanceof RainStrengthValue && Float.compare(this.strength, ((RainStrengthValue) o).strength) == 0;
}
@Override
public int hashCode() {
return (strength != +0.0f ? Float.floatToIntBits(strength) : 0);
return this.strength != +0.0f ? Float.floatToIntBits(this.strength) : 0;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.notify;
public class ThunderStrengthValue implements ClientNotificationValue {
private float strength;
public ThunderStrengthValue(float strength) {
@ -22,19 +21,11 @@ public class ThunderStrengthValue implements ClientNotificationValue {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
ThunderStrengthValue that = (ThunderStrengthValue) o;
if(Float.compare(that.strength, strength) != 0) return false;
return true;
return o instanceof ThunderStrengthValue && Float.compare(this.strength, ((ThunderStrengthValue) o).strength) == 0;
}
@Override
public int hashCode() {
return (strength != +0.0f ? Float.floatToIntBits(strength) : 0);
return this.strength != +0.0f ? Float.floatToIntBits(this.strength) : 0;
}
}

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public enum SoundEvent {
public enum BuiltinSound implements Sound {
AMBIENT_CAVE,
BLOCK_ANVIL_BREAK,
BLOCK_ANVIL_DESTROY,
@ -72,6 +72,7 @@ public enum SoundEvent {
BLOCK_NOTE_BASS,
BLOCK_NOTE_HARP,
BLOCK_NOTE_HAT,
BLOCK_NOTE_PLING,
BLOCK_NOTE_SNARE,
BLOCK_PISTON_CONTRACT,
BLOCK_PISTON_EXTEND,
@ -133,6 +134,7 @@ public enum SoundEvent {
ENTITY_BAT_AMBIENT,
ENTITY_BAT_DEATH,
ENTITY_BAT_HURT,
ENTITY_BAT_LOOP,
ENTITY_BAT_TAKEOFF,
ENTITY_BLAZE_AMBIENT,
ENTITY_BLAZE_BURN,
@ -143,6 +145,7 @@ public enum SoundEvent {
ENTITY_BOBBER_THROW,
ENTITY_CAT_AMBIENT,
ENTITY_CAT_DEATH,
ENTITY_CAT_HISS,
ENTITY_CAT_HURT,
ENTITY_CAT_PURR,
ENTITY_CAT_PURREOW,
@ -216,6 +219,7 @@ public enum SoundEvent {
ENTITY_GHAST_AMBIENT,
ENTITY_GHAST_DEATH,
ENTITY_GHAST_HURT,
ENTITY_GHAST_SCREAM,
ENTITY_GHAST_SHOOT,
ENTITY_GHAST_WARN,
ENTITY_GUARDIAN_AMBIENT,
@ -285,6 +289,7 @@ public enum SoundEvent {
ENTITY_PLAYER_ATTACK_SWEEP,
ENTITY_PLAYER_ATTACK_WEAK,
ENTITY_PLAYER_BIG_FALL,
ENTITY_PLAYER_BREATH,
ENTITY_PLAYER_BURP,
ENTITY_PLAYER_DEATH,
ENTITY_PLAYER_HURT,
@ -302,8 +307,6 @@ public enum SoundEvent {
ENTITY_SHEEP_HURT,
ENTITY_SHEEP_SHEAR,
ENTITY_SHEEP_STEP,
ENTITY_SHIELD_BLOCK,
ENTITY_SHIELD_BREAK,
ENTITY_SHULKER_AMBIENT,
ENTITY_SHULKER_CLOSE,
ENTITY_SHULKER_DEATH,
@ -336,6 +339,7 @@ public enum SoundEvent {
ENTITY_SMALL_MAGMACUBE_SQUISH,
ENTITY_SMALL_SLIME_DEATH,
ENTITY_SMALL_SLIME_HURT,
ENTITY_SMALL_SLIME_JUMP,
ENTITY_SMALL_SLIME_SQUISH,
ENTITY_SNOWBALL_THROW,
ENTITY_SNOWMAN_AMBIENT,
@ -372,6 +376,7 @@ public enum SoundEvent {
ENTITY_WOLF_AMBIENT,
ENTITY_WOLF_DEATH,
ENTITY_WOLF_GROWL,
ENTITY_WOLF_HOWL,
ENTITY_WOLF_HURT,
ENTITY_WOLF_PANT,
ENTITY_WOLF_SHAKE,
@ -381,12 +386,10 @@ public enum SoundEvent {
ENTITY_ZOMBIE_ATTACK_DOOR_WOOD,
ENTITY_ZOMBIE_ATTACK_IRON_DOOR,
ENTITY_ZOMBIE_BREAK_DOOR_WOOD,
ENTITY_ZOMBIE_CURE,
ENTITY_ZOMBIE_DEATH,
ENTITY_ZOMBIE_HURT,
ENTITY_ZOMBIE_INFECT,
ENTITY_ZOMBIE_STEP,
ENTITY_ZOMBIE_UNFECT,
ENTITY_ZOMBIE_HORSE_AMBIENT,
ENTITY_ZOMBIE_HORSE_DEATH,
ENTITY_ZOMBIE_HORSE_HURT,
@ -394,6 +397,12 @@ public enum SoundEvent {
ENTITY_ZOMBIE_PIG_ANGRY,
ENTITY_ZOMBIE_PIG_DEATH,
ENTITY_ZOMBIE_PIG_HURT,
ENTITY_ZOMBIE_VILLAGER_AMBIENT,
ENTITY_ZOMBIE_VILLAGER_CONVERTED,
ENTITY_ZOMBIE_VILLAGER_CURE,
ENTITY_ZOMBIE_VILLAGER_DEATH,
ENTITY_ZOMBIE_VILLAGER_HURT,
ENTITY_ZOMBIE_VILLAGER_STEP,
ITEM_ARMOR_EQUIP_CHAIN,
ITEM_ARMOR_EQUIP_DIAMOND,
ITEM_ARMOR_EQUIP_GENERIC,
@ -410,6 +419,8 @@ public enum SoundEvent {
ITEM_FIRECHARGE_USE,
ITEM_FLINTANDSTEEL_USE,
ITEM_HOE_TILL,
ITEM_SHIELD_BLOCK,
ITEM_SHIELD_BREAK,
ITEM_SHOVEL_FLATTEN,
MUSIC_CREATIVE,
MUSIC_CREDITS,

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public class CustomSound implements Sound {
private String name;
public CustomSound(String name) {
@ -14,19 +13,11 @@ public class CustomSound implements Sound {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
CustomSound that = (CustomSound) o;
if(!name.equals(that.name)) return false;
return true;
return o instanceof CustomSound && this.name.equals(((CustomSound) o).name);
}
@Override
public int hashCode() {
return name.hashCode();
return this.name.hashCode();
}
}

View file

@ -1,209 +0,0 @@
package org.spacehq.mc.protocol.data.game.world.sound;
public enum GenericSound implements Sound {
CLICK,
FIZZ,
FIRE_AMBIENT,
IGNITE_FIRE,
WATER_AMBIENT,
LAVA_AMBIENT,
LAVA_POP,
HARP,
BASS_DRUM,
SNARE_DRUM,
HI_HAT,
DOUBLE_BASS,
PISTON_EXTEND,
PISTON_RETRACT,
PORTAL_AMBIENT,
TNT_PRIMED,
BOW_HIT,
COLLECT_ITEM,
COLLECT_EXP,
SUCCESSFUL_HIT,
FIREWORK_BLAST,
FIREWORK_LARGE_BLAST,
FIREWORK_FAR_BLAST,
FIREWORK_FAR_LARGE_BLAST,
FIREWORK_TWINKLE,
FIREWORK_FAR_TWINKLE,
RAIN_AMBIENT,
WITHER_SPAWN,
ENDER_DRAGON_DEATH,
FIRE_PROJECTILE,
DOOR_OPEN,
DOOR_CLOSE,
GHAST_CHARGE,
GHAST_FIRE,
POUND_WOODEN_DOOR,
POUND_METAL_DOOR,
BREAK_WOODEN_DOOR,
WITHER_SHOOT,
BAT_TAKE_OFF,
INFECT_VILLAGER,
DISINFECT_VILLAGER,
ANVIL_BREAK,
ANVIL_USE,
ANVIL_LAND,
BREAK_SPLASH_POTION,
THORNS_DAMAGE,
EXPLOSION,
CAVE_AMBIENT,
OPEN_CHEST,
CLOSE_CHEST,
DIG_STONE,
DIG_WOOD,
DIG_GRAVEL,
DIG_GRASS,
DIG_CLOTH,
DIG_SAND,
DIG_SNOW,
DIG_GLASS,
ANVIL_STEP,
LADDER_STEP,
STONE_STEP,
WOOD_STEP,
GRAVEL_STEP,
GRASS_STEP,
CLOTH_STEP,
SAND_STEP,
SNOW_STEP,
BURP,
SADDLE_HORSE,
ENDER_DRAGON_FLAP_WINGS,
THUNDER_AMBIENT,
LAUNCH_FIREWORKS,
CREEPER_PRIMED,
ENDERMAN_STARE,
ENDERMAN_TELEPORT,
IRON_GOLEM_THROW,
IRON_GOLEM_WALK,
ZOMBIE_PIGMAN_ANGRY,
SILVERFISH_STEP,
SKELETON_STEP,
SPIDER_STEP,
ZOMBIE_STEP,
ZOMBIE_CURE,
CHICKEN_LAY_EGG,
CHICKEN_STEP,
COW_STEP,
HORSE_EATING,
HORSE_LAND,
HORSE_WEAR_ARMOR,
HORSE_GALLOP,
HORSE_BREATHE,
HORSE_WOOD_STEP,
HORSE_SOFT_STEP,
HORSE_JUMP,
SHEAR_SHEEP,
PIG_STEP,
SHEEP_STEP,
VILLAGER_YES,
VILLAGER_NO,
WOLF_STEP,
WOLF_SHAKE,
DRINK,
EAT,
LEVEL_UP,
FISH_HOOK_SPLASH,
ITEM_BREAK,
SWIM,
SPLASH,
HURT,
DEATH,
BIG_FALL,
SMALL_FALL,
MOB_SWIM,
MOB_SPLASH,
PLAYER_SWIM,
PLAYER_SPLASH,
ENDER_DRAGON_GROWL,
WITHER_IDLE,
BLAZE_BREATHE,
ENDERMAN_SCREAM,
ENDERMAN_IDLE,
GHAST_MOAN,
ZOMBIE_PIGMAN_IDLE,
SILVERFISH_IDLE,
SKELETON_IDLE,
SPIDER_IDLE,
WITCH_IDLE,
ZOMBIE_IDLE,
BAT_IDLE,
CHICKEN_IDLE,
COW_IDLE,
HORSE_IDLE,
DONKEY_IDLE,
ZOMBIE_HORSE_IDLE,
SKELETON_HORSE_IDLE,
OCELOT_PURR,
OCELOT_PURR_MEOW,
OCELOT_MEOW,
PIG_IDLE,
SHEEP_IDLE,
VILLAGER_HAGGLE,
VILLAGER_IDLE,
WOLF_GROWL,
WOLF_PANT,
WOLF_WHINE,
WOLF_BARK,
MOB_BIG_FALL,
MOB_SMALL_FALL,
PLAYER_BIG_FALL,
PLAYER_SMALL_FALL,
ENDER_DRAGON_HURT,
WITHER_HURT,
WITHER_DEATH,
BLAZE_HURT,
BLAZE_DEATH,
CREEPER_HURT,
CREEPER_DEATH,
ENDERMAN_HURT,
ENDERMAN_DEATH,
GHAST_HURT,
GHAST_DEATH,
IRON_GOLEM_HURT,
IRON_GOLEM_DEATH,
MOB_HURT,
MOB_DEATH,
ZOMBIE_PIGMAN_HURT,
ZOMBIE_PIGMAN_DEATH,
SILVERFISH_HURT,
SILVERFISH_DEATH,
SKELETON_HURT,
SKELETON_DEATH,
SLIME,
BIG_SLIME,
SPIDER_DEATH,
WITCH_HURT,
WITCH_DEATH,
ZOMBIE_HURT,
ZOMBIE_DEATH,
PLAYER_HURT,
PLAYER_DEATH,
WOLF_HURT,
WOLF_DEATH,
VILLAGER_HURT,
VILLAGER_DEATH,
PIG_DEATH,
OCELOT_HURT,
HORSE_HURT,
DONKEY_HURT,
ZOMBIE_HORSE_HURT,
SKELETON_HORSE_HURT,
HORSE_DEATH,
DONKEY_DEATH,
ZOMBIE_HORSE_DEATH,
SKELETON_HORSE_DEATH,
COW_HURT,
CHICKEN_HURT,
BAT_HURT,
BAT_DEATH,
RABBIT_IDLE,
RABBIT_HOP,
RABBIT_HURT,
RABBIT_DEATH,
MOB_ATTACK;
}

View file

@ -1,8 +1,6 @@
package org.spacehq.mc.protocol.data.game;
package org.spacehq.mc.protocol.data.handshake;
public enum HandshakeIntent {
STATUS,
LOGIN;
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public enum ChatColor {
BLACK,
DARK_BLUE,
DARK_GREEN,
@ -35,5 +34,4 @@ public enum ChatColor {
return null;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public enum ChatFormat {
BOLD,
UNDERLINED,
STRIKETHROUGH,
@ -23,5 +22,4 @@ public enum ChatFormat {
return null;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public enum ClickAction {
RUN_COMMAND,
SUGGEST_COMMAND,
OPEN_URL,
@ -22,5 +21,4 @@ public enum ClickAction {
return null;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public class ClickEvent implements Cloneable {
private ClickAction action;
private String value;
@ -25,22 +24,13 @@ public class ClickEvent implements Cloneable {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
ClickEvent that = (ClickEvent) o;
if(action != that.action) return false;
if(!value.equals(that.value)) return false;
return true;
return o instanceof ClickEvent && this.action == ((ClickEvent) o).action && this.value.equals(((ClickEvent) o).value);
}
@Override
public int hashCode() {
int result = action.hashCode();
result = 31 * result + value.hashCode();
int result = this.action.hashCode();
result = 31 * result + this.value.hashCode();
return result;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public enum HoverAction {
SHOW_TEXT,
SHOW_ITEM,
SHOW_ACHIEVEMENT,
@ -22,5 +21,4 @@ public enum HoverAction {
return null;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.message;
public class HoverEvent implements Cloneable {
private HoverAction action;
private Message value;
@ -25,22 +24,13 @@ public class HoverEvent implements Cloneable {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
HoverEvent that = (HoverEvent) o;
if(action != that.action) return false;
if(!value.equals(that.value)) return false;
return true;
return o instanceof HoverEvent && this.action == ((HoverEvent) o).action && this.value.equals(((HoverEvent) o).value);
}
@Override
public int hashCode() {
int result = action.hashCode();
result = 31 * result + value.hashCode();
int result = this.action.hashCode();
result = 31 * result + this.value.hashCode();
return result;
}
}

View file

@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.List;
public abstract class Message implements Cloneable {
private MessageStyle style = new MessageStyle();
private List<Message> extra = new ArrayList<Message>();
@ -77,21 +76,13 @@ public abstract class Message implements Cloneable {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
Message message = (Message) o;
if(!extra.equals(message.extra)) return false;
if(!style.equals(message.style)) return false;
return true;
return o instanceof Message && this.style.equals(((Message) o).style) && this.extra.equals(((Message) o).extra);
}
@Override
public int hashCode() {
int result = style.hashCode();
result = 31 * result + extra.hashCode();
int result = this.style.hashCode();
result = 31 * result + this.extra.hashCode();
return result;
}
@ -218,5 +209,4 @@ public abstract class Message implements Cloneable {
throw new IllegalArgumentException("Cannot convert " + e.getClass().getSimpleName() + " to a message.");
}
}
}

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
public class MessageStyle implements Cloneable {
private static final MessageStyle DEFAULT = new MessageStyle();
private ChatColor color = ChatColor.WHITE;
@ -103,30 +102,17 @@ public class MessageStyle implements Cloneable {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
MessageStyle style = (MessageStyle) o;
if(click != null ? !click.equals(style.click) : style.click != null) return false;
if(color != style.color) return false;
if(!formats.equals(style.formats)) return false;
if(hover != null ? !hover.equals(style.hover) : style.hover != null) return false;
if(insertion != null ? !insertion.equals(style.insertion) : style.insertion != null) return false;
if(!parent.equals(style.parent)) return false;
return true;
return o instanceof MessageStyle && this.color == ((MessageStyle) o).color && this.formats.equals(((MessageStyle) o).formats) && (this.click != null ? this.click.equals(((MessageStyle) o).click) : ((MessageStyle) o).click == null) && (this.hover != null ? this.hover.equals(((MessageStyle) o).hover) : ((MessageStyle) o).hover == null) && (this.insertion != null ? this.insertion.equals(((MessageStyle) o).insertion) : ((MessageStyle) o).insertion == null) && this.parent.equals(((MessageStyle) o).parent);
}
@Override
public int hashCode() {
int result = color != null ? color.hashCode() : 0;
result = 31 * result + formats.hashCode();
result = 31 * result + (click != null ? click.hashCode() : 0);
result = 31 * result + (hover != null ? hover.hashCode() : 0);
result = 31 * result + (insertion != null ? insertion.hashCode() : 0);
result = 31 * result + parent.hashCode();
int result = this.color.hashCode();
result = 31 * result + this.formats.hashCode();
result = 31 * result + (this.click != null ? this.click.hashCode() : 0);
result = 31 * result + (this.hover != null ? this.hover.hashCode() : 0);
result = 31 * result + (this.insertion != null ? this.insertion.hashCode() : 0);
result = 31 * result + this.parent.hashCode();
return result;
}
}

View file

@ -5,7 +5,6 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
public class TextMessage extends Message {
private String text;
public TextMessage(String text) {
@ -40,22 +39,13 @@ public class TextMessage extends Message {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
if(!super.equals(o)) return false;
TextMessage that = (TextMessage) o;
if(!text.equals(that.text)) return false;
return true;
return o instanceof TextMessage && super.equals(o) && this.text.equals(((TextMessage) o).text);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + text.hashCode();
result = 31 * result + this.text.hashCode();
return result;
}
}

View file

@ -7,7 +7,6 @@ import com.google.gson.JsonObject;
import java.util.Arrays;
public class TranslationMessage extends Message {
private String translationKey;
private Message translationParams[];
@ -73,24 +72,14 @@ public class TranslationMessage extends Message {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
if(!super.equals(o)) return false;
TranslationMessage that = (TranslationMessage) o;
if(!translationKey.equals(that.translationKey)) return false;
if(!Arrays.equals(translationParams, that.translationParams)) return false;
return true;
return o instanceof TranslationMessage && super.equals(o) && this.translationKey.equals(((TranslationMessage) o).translationKey) && Arrays.deepEquals(this.translationParams, ((TranslationMessage) o).translationParams);
}
@Override
public int hashCode() {
int result = super.hashCode();
result = 31 * result + translationKey.hashCode();
result = 31 * result + Arrays.hashCode(translationParams);
result = 31 * result + this.translationKey.hashCode();
result = 31 * result + Arrays.deepHashCode(this.translationParams);
return result;
}
}

View file

@ -5,7 +5,6 @@ import org.spacehq.mc.auth.data.GameProfile;
import java.util.Arrays;
public class PlayerInfo {
private int max;
private int online;
private GameProfile players[];
@ -30,24 +29,14 @@ public class PlayerInfo {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
PlayerInfo that = (PlayerInfo) o;
if(max != that.max) return false;
if(online != that.online) return false;
if(!Arrays.equals(players, that.players)) return false;
return true;
return o instanceof PlayerInfo && this.max == ((PlayerInfo) o).max && this.online == ((PlayerInfo) o).online && Arrays.deepEquals(this.players, ((PlayerInfo) o).players);
}
@Override
public int hashCode() {
int result = max;
result = 31 * result + online;
result = 31 * result + Arrays.hashCode(players);
int result = this.max;
result = 31 * result + this.online;
result = 31 * result + Arrays.deepHashCode(this.players);
return result;
}
}

View file

@ -5,7 +5,6 @@ import org.spacehq.mc.protocol.data.message.Message;
import java.awt.image.BufferedImage;
public class ServerStatusInfo {
private VersionInfo version;
private PlayerInfo players;
private Message description;
@ -36,26 +35,15 @@ public class ServerStatusInfo {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
ServerStatusInfo that = (ServerStatusInfo) o;
if(!description.equals(that.description)) return false;
if(icon != null ? !icon.equals(that.icon) : that.icon != null) return false;
if(!players.equals(that.players)) return false;
if(!version.equals(that.version)) return false;
return true;
return o instanceof ServerStatusInfo && this.version.equals(((ServerStatusInfo) o).version) && this.players.equals(((ServerStatusInfo) o).players) && this.description.equals(((ServerStatusInfo) o).description) && (this.icon != null ? this.icon.equals(((ServerStatusInfo) o).icon) : ((ServerStatusInfo) o).icon == null);
}
@Override
public int hashCode() {
int result = version.hashCode();
result = 31 * result + players.hashCode();
result = 31 * result + description.hashCode();
result = 31 * result + (icon != null ? icon.hashCode() : 0);
int result = this.version.hashCode();
result = 31 * result + this.players.hashCode();
result = 31 * result + this.description.hashCode();
result = 31 * result + (this.icon != null ? this.icon.hashCode() : 0);
return result;
}
}

View file

@ -1,7 +1,6 @@
package org.spacehq.mc.protocol.data.status;
public class VersionInfo {
private String name;
private int protocol;
@ -20,22 +19,13 @@ public class VersionInfo {
@Override
public boolean equals(Object o) {
if(this == o) return true;
if(o == null || getClass() != o.getClass()) return false;
VersionInfo that = (VersionInfo) o;
if(protocol != that.protocol) return false;
if(!name.equals(that.name)) return false;
return true;
return o instanceof VersionInfo && this.name.equals(((VersionInfo) o).name) && this.protocol == ((VersionInfo) o).protocol;
}
@Override
public int hashCode() {
int result = name.hashCode();
result = 31 * result + protocol;
int result = this.name.hashCode();
result = 31 * result + this.protocol;
return result;
}
}

View file

@ -4,7 +4,5 @@ import org.spacehq.mc.protocol.data.status.ServerStatusInfo;
import org.spacehq.packetlib.Session;
public interface ServerInfoBuilder {
public ServerStatusInfo buildInfo(Session session);
}

View file

@ -5,7 +5,5 @@ import org.spacehq.packetlib.Session;
public interface ServerInfoHandler {
public void handle(Session session, ServerStatusInfo info);
}

View file

@ -3,7 +3,5 @@ package org.spacehq.mc.protocol.data.status.handler;
import org.spacehq.packetlib.Session;
public interface ServerPingTimeHandler {
public void handle(Session session, long pingTime);
}

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.handshake.client;
import org.spacehq.mc.protocol.data.game.HandshakeIntent;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.handshake.HandshakeIntent;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client;
import org.spacehq.mc.protocol.data.game.ClientRequest;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.client;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.ResourcePackStatus;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.setting.ChatVisibility;
import org.spacehq.mc.protocol.data.game.setting.SkinPart;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.entity.player.PlayerAction;
import org.spacehq.mc.protocol.data.game.world.block.BlockFace;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.InteractAction;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.world.block.BlockFace;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.PlayerState;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client.player;
import org.spacehq.mc.protocol.data.game.entity.player.Hand;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.client.window;
import org.spacehq.mc.protocol.data.game.entity.metadata.ItemStack;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.window.ClickItemParam;
import org.spacehq.mc.protocol.data.game.window.CreativeGrabParam;
import org.spacehq.mc.protocol.data.game.window.DropItemParam;

View file

@ -3,7 +3,7 @@ package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.BossBarAction;
import org.spacehq.mc.protocol.data.game.BossBarColor;
import org.spacehq.mc.protocol.data.game.BossBarDivision;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.MessageType;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.CombatState;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.setting.Difficulty;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.GameMode;
import org.spacehq.mc.protocol.data.game.setting.Difficulty;
import org.spacehq.mc.protocol.data.game.world.WorldType;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.auth.data.GameProfile;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.PlayerListEntry;
import org.spacehq.mc.protocol.data.game.PlayerListEntryAction;
import org.spacehq.mc.protocol.data.game.entity.player.GameMode;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.GameMode;
import org.spacehq.mc.protocol.data.game.setting.Difficulty;
import org.spacehq.mc.protocol.data.game.world.WorldType;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.statistic.Achievement;
import org.spacehq.mc.protocol.data.game.statistic.BreakBlockStatistic;
import org.spacehq.mc.protocol.data.game.statistic.BreakItemStatistic;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.TitleAction;
import org.spacehq.mc.protocol.data.message.Message;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.Animation;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.Effect;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.entity.metadata.ItemStack;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.EquipmentSlot;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;

View file

@ -2,7 +2,7 @@ package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.entity.attribute.Attribute;
import org.spacehq.mc.protocol.data.game.entity.attribute.AttributeModifier;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.attribute.AttributeType;
import org.spacehq.mc.protocol.data.game.entity.attribute.ModifierOperation;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.Effect;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.EntityStatus;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.player;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.PositionElement;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.type.GlobalEntityType;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
import org.spacehq.mc.protocol.data.game.entity.metadata.EntityMetadata;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.type.MobType;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.type.object.FallingBlockData;
import org.spacehq.mc.protocol.data.game.entity.type.object.HangingDirection;
import org.spacehq.mc.protocol.data.game.entity.type.object.MinecartType;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.entity.spawn;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.entity.type.PaintingType;
import org.spacehq.mc.protocol.data.game.entity.type.object.HangingDirection;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.scoreboard;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.scoreboard.ScoreboardPosition;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.scoreboard;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.scoreboard.ObjectiveAction;
import org.spacehq.mc.protocol.data.game.scoreboard.ScoreType;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.scoreboard;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.scoreboard.CollisionRule;
import org.spacehq.mc.protocol.data.game.scoreboard.NameTagVisibility;
import org.spacehq.mc.protocol.data.game.scoreboard.TeamAction;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.scoreboard;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.scoreboard.ScoreboardAction;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.window;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.window.WindowType;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,6 +1,6 @@
package org.spacehq.mc.protocol.packet.ingame.server.window;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.window.property.WindowProperty;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.BlockBreakStage;
import org.spacehq.mc.protocol.util.NetUtil;
import org.spacehq.packetlib.io.NetInput;

View file

@ -1,7 +1,7 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.world.block.value.BlockValue;
import org.spacehq.mc.protocol.data.game.world.block.value.BlockValueType;
import org.spacehq.mc.protocol.data.game.world.block.value.ChestValue;

View file

@ -1,10 +1,11 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.player.GameMode;
import org.spacehq.mc.protocol.data.game.world.notify.ClientNotification;
import org.spacehq.mc.protocol.data.game.world.notify.ClientNotificationValue;
import org.spacehq.mc.protocol.data.game.world.notify.DemoMessageValue;
import org.spacehq.mc.protocol.data.game.world.notify.EnterCreditsValue;
import org.spacehq.mc.protocol.data.game.world.notify.RainStrengthValue;
import org.spacehq.mc.protocol.data.game.world.notify.ThunderStrengthValue;
import org.spacehq.packetlib.io.NetInput;
@ -43,6 +44,8 @@ public class ServerNotifyClientPacket implements Packet {
this.value = MagicValues.key(GameMode.class, (int) value);
} else if(this.notification == ClientNotification.DEMO_MESSAGE) {
this.value = MagicValues.key(DemoMessageValue.class, (int) value);
} else if(this.notification == ClientNotification.ENTER_CREDITS) {
this.value = MagicValues.key(EnterCreditsValue.class, (int) value);
} else if(this.notification == ClientNotification.RAIN_STRENGTH) {
this.value = new RainStrengthValue(value);
} else if(this.notification == ClientNotification.THUNDER_STRENGTH) {
@ -54,19 +57,11 @@ public class ServerNotifyClientPacket implements Packet {
public void write(NetOutput out) throws IOException {
out.writeByte(MagicValues.value(Integer.class, this.notification));
float value = 0;
if(this.value instanceof GameMode) {
if(this.value instanceof Enum<?>) {
value = MagicValues.value(Integer.class, (Enum<?>) this.value);
}
if(this.value instanceof DemoMessageValue) {
value = MagicValues.value(Integer.class, (Enum<?>) this.value);
}
if(this.value instanceof RainStrengthValue) {
} else if(this.value instanceof RainStrengthValue) {
value = ((RainStrengthValue) this.value).getStrength();
}
if(this.value instanceof ThunderStrengthValue) {
} else if(this.value instanceof ThunderStrengthValue) {
value = ((ThunderStrengthValue) this.value).getStrength();
}

View file

@ -1,17 +1,17 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.mc.protocol.data.game.world.sound.SoundEvent;
import org.spacehq.mc.protocol.data.game.world.sound.BuiltinSound;
import org.spacehq.packetlib.io.NetInput;
import org.spacehq.packetlib.io.NetOutput;
import org.spacehq.packetlib.packet.Packet;
import java.io.IOException;
public class ServerPlaySoundEventPacket implements Packet {
public class ServerPlayBuiltinSoundPacket implements Packet {
private SoundEvent sound;
private BuiltinSound sound;
private SoundCategory category;
private double x;
private double y;
@ -20,10 +20,10 @@ public class ServerPlaySoundEventPacket implements Packet {
private float pitch;
@SuppressWarnings("unused")
private ServerPlaySoundEventPacket() {
private ServerPlayBuiltinSoundPacket() {
}
public ServerPlaySoundEventPacket(SoundEvent sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
public ServerPlayBuiltinSoundPacket(BuiltinSound sound, SoundCategory category, double x, double y, double z, float volume, float pitch) {
this.sound = sound;
this.category = category;
this.x = x;
@ -33,7 +33,7 @@ public class ServerPlaySoundEventPacket implements Packet {
this.pitch = pitch;
}
public SoundEvent getSound() {
public BuiltinSound getSound() {
return this.sound;
}
@ -63,7 +63,7 @@ public class ServerPlaySoundEventPacket implements Packet {
@Override
public void read(NetInput in) throws IOException {
this.sound = MagicValues.key(SoundEvent.class, in.readVarInt());
this.sound = MagicValues.key(BuiltinSound.class, in.readVarInt());
this.category = MagicValues.key(SoundCategory.class, in.readVarInt());
this.x = in.readInt() / 8D;
this.y = in.readInt() / 8D;

View file

@ -1,10 +1,11 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.entity.metadata.Position;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.game.world.block.BlockState;
import org.spacehq.mc.protocol.data.game.world.effect.BonemealGrowEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.BreakBlockEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.BreakPotionEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.HardLandingEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.ParticleEffect;
import org.spacehq.mc.protocol.data.game.world.effect.RecordEffectData;
import org.spacehq.mc.protocol.data.game.world.effect.SmokeEffectData;
@ -67,16 +68,16 @@ public class ServerPlayEffectPacket implements Packet {
this.position = NetUtil.readPosition(in);
int value = in.readInt();
if(this.effect == SoundEffect.PLAY_RECORD) {
if(this.effect == SoundEffect.RECORD) {
this.data = new RecordEffectData(value);
} else if(this.effect == ParticleEffect.SMOKE) {
this.data = MagicValues.key(SmokeEffectData.class, value);
} else if(this.effect == ParticleEffect.BREAK_BLOCK) {
this.data = new BreakBlockEffectData(value);
this.data = new BreakBlockEffectData(new BlockState(value & 4095, (value >> 12) & 255));
} else if(this.effect == ParticleEffect.BREAK_SPLASH_POTION) {
this.data = new BreakPotionEffectData(value);
} else if(this.effect == ParticleEffect.HARD_LANDING_DUST) {
this.data = new HardLandingEffectData(value);
} else if(this.effect == ParticleEffect.BONEMEAL_GROW) {
this.data = new BonemealGrowEffectData(value);
}
this.broadcast = in.readBoolean();
@ -99,11 +100,11 @@ public class ServerPlayEffectPacket implements Packet {
} else if(this.data instanceof SmokeEffectData) {
value = MagicValues.value(Integer.class, (SmokeEffectData) this.data);
} else if(this.data instanceof BreakBlockEffectData) {
value = ((BreakBlockEffectData) this.data).getBlockId();
value = (((BreakBlockEffectData) this.data).getBlockState().getId() & 4095) | ((((BreakBlockEffectData) this.data).getBlockState().getData() & 255) << 12);
} else if(this.data instanceof BreakPotionEffectData) {
value = ((BreakPotionEffectData) this.data).getPotionId();
} else if(this.data instanceof HardLandingEffectData) {
value = ((HardLandingEffectData) this.data).getDamagingDistance();
} else if(this.data instanceof BonemealGrowEffectData) {
value = ((BonemealGrowEffectData) this.data).getParticleCount();
}
out.writeInt(value);

View file

@ -1,8 +1,8 @@
package org.spacehq.mc.protocol.packet.ingame.server.world;
import org.spacehq.mc.protocol.data.game.MagicValues;
import org.spacehq.mc.protocol.data.MagicValues;
import org.spacehq.mc.protocol.data.game.world.sound.BuiltinSound;
import org.spacehq.mc.protocol.data.game.world.sound.CustomSound;
import org.spacehq.mc.protocol.data.game.world.sound.GenericSound;
import org.spacehq.mc.protocol.data.game.world.sound.Sound;
import org.spacehq.mc.protocol.data.game.world.sound.SoundCategory;
import org.spacehq.packetlib.io.NetInput;
@ -67,7 +67,7 @@ public class ServerPlaySoundPacket implements Packet {
public void read(NetInput in) throws IOException {
String value = in.readString();
try {
this.sound = MagicValues.key(GenericSound.class, value);
this.sound = MagicValues.key(BuiltinSound.class, value);
} catch(IllegalArgumentException e) {
this.sound = new CustomSound(value);
}
@ -85,8 +85,8 @@ public class ServerPlaySoundPacket implements Packet {
String value = "";
if(this.sound instanceof CustomSound) {
value = ((CustomSound) this.sound).getName();
} else if(this.sound instanceof GenericSound) {
value = MagicValues.value(String.class, (GenericSound) this.sound);
} else if(this.sound instanceof BuiltinSound) {
value = MagicValues.value(String.class, (BuiltinSound) this.sound);
}
out.writeString(value);

Some files were not shown because too many files have changed in this diff Show more