diff --git a/src/main/java/org/spacehq/mc/protocol/ClientListener.java b/src/main/java/org/spacehq/mc/protocol/ClientListener.java index ddf9385e..de7719c8 100644 --- a/src/main/java/org/spacehq/mc/protocol/ClientListener.java +++ b/src/main/java/org/spacehq/mc/protocol/ClientListener.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/MinecraftProtocol.java b/src/main/java/org/spacehq/mc/protocol/MinecraftProtocol.java index e29fc1b5..89320fab 100644 --- a/src/main/java/org/spacehq/mc/protocol/MinecraftProtocol.java +++ b/src/main/java/org/spacehq/mc/protocol/MinecraftProtocol.java @@ -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); } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/MagicValues.java b/src/main/java/org/spacehq/mc/protocol/data/MagicValues.java similarity index 69% rename from src/main/java/org/spacehq/mc/protocol/data/game/MagicValues.java rename to src/main/java/org/spacehq/mc/protocol/data/MagicValues.java index af6c12c6..648d5725 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/MagicValues.java +++ b/src/main/java/org/spacehq/mc/protocol/data/MagicValues.java @@ -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, Object> values = new HashMap, Object>(); + private static final Map, List> values = new HashMap, List>(); 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()); + } + + values.get(key).add(value); } @SuppressWarnings({ "unchecked" }) public static > T key(Class 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 value(Class 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() + "."); } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/MessageType.java b/src/main/java/org/spacehq/mc/protocol/data/game/MessageType.java index 0e5f47a8..11f978fd 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/MessageType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/MessageType.java @@ -1,9 +1,7 @@ package org.spacehq.mc.protocol.data.game; public enum MessageType { - CHAT, SYSTEM, NOTIFICATION; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/PlayerListEntry.java b/src/main/java/org/spacehq/mc/protocol/data/game/PlayerListEntry.java index 9b7a5bfd..2f353ab1 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/PlayerListEntry.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/PlayerListEntry.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/chunk/BlockStorage.java b/src/main/java/org/spacehq/mc/protocol/data/game/chunk/BlockStorage.java index 386217a7..ae1dc42b 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/chunk/BlockStorage.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/chunk/BlockStorage.java @@ -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 states; + private List states; private FlexibleStorage storage; public BlockStorage() { this.bitsPerEntry = 4; - this.states = new ArrayList(); - this.states.add(0); + this.states = new ArrayList(); + 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(); + this.states = new ArrayList(); 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 getStates() { + public List 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 oldStates = this.states; + List oldStates = this.states; if(this.bitsPerEntry > 8) { - oldStates = new ArrayList(this.states); + oldStates = new ArrayList(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 diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeModifier.java b/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeModifier.java index 371aea69..6b29ecf4 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeModifier.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeModifier.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeType.java b/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeType.java index 8001bd1d..451e1a9b 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/entity/attribute/AttributeType.java @@ -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); diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/WorldType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/WorldType.java index b133bd06..494f633f 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/WorldType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/WorldType.java @@ -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; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockChangeRecord.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockChangeRecord.java index a5dfa062..90e0a176 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockChangeRecord.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockChangeRecord.java @@ -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 diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockState.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockState.java index 73cc107c..0fcd0968 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockState.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/BlockState.java @@ -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 diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/ExplodedBlockRecord.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/ExplodedBlockRecord.java index 909b9118..aaf0011c 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/ExplodedBlockRecord.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/ExplodedBlockRecord.java @@ -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 diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/UpdatedTileType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/UpdatedTileType.java index d6b719b0..695a24da 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/UpdatedTileType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/UpdatedTileType.java @@ -6,5 +6,7 @@ public enum UpdatedTileType { BEACON, SKULL, FLOWER_POT, - BANNER; + BANNER, + STRUCTURE_BLOCK, + END_GATEWAY; } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValue.java index 7ec130d7..0595bbf7 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValue.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValueType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValueType.java index d05f5ee7..6f1fbaf4 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValueType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/ChestValueType.java @@ -1,7 +1,5 @@ package org.spacehq.mc.protocol.data.game.world.block.value; public enum ChestValueType implements BlockValueType { - VIEWING_PLAYER_COUNT; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValue.java index e4c8dc82..8af98fc3 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValue.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValueType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValueType.java index 8256ca9b..ad4479ca 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValueType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/GenericBlockValueType.java @@ -1,7 +1,5 @@ package org.spacehq.mc.protocol.data.game.world.block.value; public enum GenericBlockValueType implements BlockValueType { - GENERIC; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/MobSpawnerValueType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/MobSpawnerValueType.java index 75dd7ca0..d16ac911 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/MobSpawnerValueType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/MobSpawnerValueType.java @@ -1,7 +1,5 @@ package org.spacehq.mc.protocol.data.game.world.block.value; public enum MobSpawnerValueType implements BlockValueType { - RESET_DELAY; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValue.java index 566aae2a..ace28a9b 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValue.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValueType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValueType.java index 0d074126..c6278550 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValueType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/NoteBlockValueType.java @@ -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; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValue.java index 124c3217..0013e75e 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValue.java @@ -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; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValueType.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValueType.java index a19bbaac..c8c53481 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValueType.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/block/value/PistonValueType.java @@ -1,8 +1,6 @@ package org.spacehq.mc.protocol.data.game.world.block.value; public enum PistonValueType implements BlockValueType { - PUSHING, PULLING; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BonemealGrowEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BonemealGrowEffectData.java new file mode 100644 index 00000000..75db175d --- /dev/null +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BonemealGrowEffectData.java @@ -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; + } +} diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakBlockEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakBlockEffectData.java index c0a0a276..20b95841 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakBlockEffectData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakBlockEffectData.java @@ -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(); } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakPotionEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakPotionEffectData.java index 5cc95a0f..da996e3a 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakPotionEffectData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/BreakPotionEffectData.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/HardLandingEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/HardLandingEffectData.java deleted file mode 100644 index 429b62d9..00000000 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/HardLandingEffectData.java +++ /dev/null @@ -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; - } - -} diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/ParticleEffect.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/ParticleEffect.java index 61f0797e..4c932f2d 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/ParticleEffect.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/ParticleEffect.java @@ -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; } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/RecordEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/RecordEffectData.java index c31738cc..aa95e31f 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/RecordEffectData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/RecordEffectData.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SmokeEffectData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SmokeEffectData.java index bc9595ae..4f36f720 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SmokeEffectData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SmokeEffectData.java @@ -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; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SoundEffect.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SoundEffect.java index dfc93a60..07a30ce2 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SoundEffect.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/effect/SoundEffect.java @@ -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; } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapData.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapData.java index 4fc7ad01..0e7c591e 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapData.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapData.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapPlayer.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapPlayer.java index bcaa456f..3ca85d04 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapPlayer.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/map/MapPlayer.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ClientNotification.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ClientNotification.java index d9e3440c..d8c4fa11 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ClientNotification.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ClientNotification.java @@ -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; } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/DemoMessageValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/DemoMessageValue.java index be4fae5b..24048688 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/DemoMessageValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/DemoMessageValue.java @@ -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; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/EnterCreditsValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/EnterCreditsValue.java new file mode 100644 index 00000000..04eb00d7 --- /dev/null +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/EnterCreditsValue.java @@ -0,0 +1,6 @@ +package org.spacehq.mc.protocol.data.game.world.notify; + +public enum EnterCreditsValue implements ClientNotificationValue { + SEEN_BEFORE, + FIRST_TIME; +} diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/RainStrengthValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/RainStrengthValue.java index 8c87d92f..63522ae7 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/RainStrengthValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/RainStrengthValue.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ThunderStrengthValue.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ThunderStrengthValue.java index 48a5337a..34938ed3 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ThunderStrengthValue.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/notify/ThunderStrengthValue.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/SoundEvent.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/BuiltinSound.java similarity index 96% rename from src/main/java/org/spacehq/mc/protocol/data/game/world/sound/SoundEvent.java rename to src/main/java/org/spacehq/mc/protocol/data/game/world/sound/BuiltinSound.java index 03f445e5..ec1cac1b 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/SoundEvent.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/BuiltinSound.java @@ -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, diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/CustomSound.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/CustomSound.java index 8ba20be4..774f1759 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/CustomSound.java +++ b/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/CustomSound.java @@ -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(); } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/GenericSound.java b/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/GenericSound.java deleted file mode 100644 index 26292e45..00000000 --- a/src/main/java/org/spacehq/mc/protocol/data/game/world/sound/GenericSound.java +++ /dev/null @@ -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; - -} diff --git a/src/main/java/org/spacehq/mc/protocol/data/game/HandshakeIntent.java b/src/main/java/org/spacehq/mc/protocol/data/handshake/HandshakeIntent.java similarity index 53% rename from src/main/java/org/spacehq/mc/protocol/data/game/HandshakeIntent.java rename to src/main/java/org/spacehq/mc/protocol/data/handshake/HandshakeIntent.java index 40eb6cf6..55b09b24 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/game/HandshakeIntent.java +++ b/src/main/java/org/spacehq/mc/protocol/data/handshake/HandshakeIntent.java @@ -1,8 +1,6 @@ -package org.spacehq.mc.protocol.data.game; +package org.spacehq.mc.protocol.data.handshake; public enum HandshakeIntent { - STATUS, LOGIN; - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/ChatColor.java b/src/main/java/org/spacehq/mc/protocol/data/message/ChatColor.java index c1b825ff..d5bca399 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/ChatColor.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/ChatColor.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/ChatFormat.java b/src/main/java/org/spacehq/mc/protocol/data/message/ChatFormat.java index 59e45394..ec242b52 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/ChatFormat.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/ChatFormat.java @@ -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; } - } \ No newline at end of file diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/ClickAction.java b/src/main/java/org/spacehq/mc/protocol/data/message/ClickAction.java index f3139f6e..9618d8fd 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/ClickAction.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/ClickAction.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/ClickEvent.java b/src/main/java/org/spacehq/mc/protocol/data/message/ClickEvent.java index 49b2a3e4..4f278cd5 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/ClickEvent.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/ClickEvent.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/HoverAction.java b/src/main/java/org/spacehq/mc/protocol/data/message/HoverAction.java index b6a54da0..260d2063 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/HoverAction.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/HoverAction.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/HoverEvent.java b/src/main/java/org/spacehq/mc/protocol/data/message/HoverEvent.java index 8961571f..136c30c9 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/HoverEvent.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/HoverEvent.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/Message.java b/src/main/java/org/spacehq/mc/protocol/data/message/Message.java index 2f0dbf8b..0851b2d6 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/Message.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/Message.java @@ -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 extra = new ArrayList(); @@ -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."); } } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/MessageStyle.java b/src/main/java/org/spacehq/mc/protocol/data/message/MessageStyle.java index 80b05f59..0b9b99d6 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/MessageStyle.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/MessageStyle.java @@ -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; } - } \ No newline at end of file diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/TextMessage.java b/src/main/java/org/spacehq/mc/protocol/data/message/TextMessage.java index 86c849dc..457a9ecb 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/TextMessage.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/TextMessage.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/message/TranslationMessage.java b/src/main/java/org/spacehq/mc/protocol/data/message/TranslationMessage.java index 2f30e2b5..56f4fdf0 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/message/TranslationMessage.java +++ b/src/main/java/org/spacehq/mc/protocol/data/message/TranslationMessage.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/PlayerInfo.java b/src/main/java/org/spacehq/mc/protocol/data/status/PlayerInfo.java index f570ad55..33a59e39 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/PlayerInfo.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/PlayerInfo.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/ServerStatusInfo.java b/src/main/java/org/spacehq/mc/protocol/data/status/ServerStatusInfo.java index ac58ce46..a9c2b606 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/ServerStatusInfo.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/ServerStatusInfo.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/VersionInfo.java b/src/main/java/org/spacehq/mc/protocol/data/status/VersionInfo.java index 76047b28..383650ad 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/VersionInfo.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/VersionInfo.java @@ -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; } - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoBuilder.java b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoBuilder.java index 74a52902..1dc24250 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoBuilder.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoBuilder.java @@ -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); - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoHandler.java b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoHandler.java index c6a471ff..a5f09d6d 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoHandler.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerInfoHandler.java @@ -5,7 +5,5 @@ import org.spacehq.packetlib.Session; public interface ServerInfoHandler { - public void handle(Session session, ServerStatusInfo info); - } diff --git a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerPingTimeHandler.java b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerPingTimeHandler.java index 9435167a..b19124e2 100644 --- a/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerPingTimeHandler.java +++ b/src/main/java/org/spacehq/mc/protocol/data/status/handler/ServerPingTimeHandler.java @@ -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); - } diff --git a/src/main/java/org/spacehq/mc/protocol/packet/handshake/client/HandshakePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/handshake/client/HandshakePacket.java index 59b438f7..9d746039 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/handshake/client/HandshakePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/handshake/client/HandshakePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientRequestPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientRequestPacket.java index 3e800c96..71f716a4 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientRequestPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientRequestPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientResourcePackStatusPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientResourcePackStatusPacket.java index 975964b7..7f410651 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientResourcePackStatusPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientResourcePackStatusPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientSettingsPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientSettingsPacket.java index 3298a8af..a96f90dc 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientSettingsPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/ClientSettingsPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerActionPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerActionPacket.java index 168b53a7..3a91f883 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerActionPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerActionPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerInteractEntityPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerInteractEntityPacket.java index 80c91dd9..14f65882 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerInteractEntityPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerInteractEntityPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerPlaceBlockPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerPlaceBlockPacket.java index 2b809c25..19685f69 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerPlaceBlockPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerPlaceBlockPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerStatePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerStatePacket.java index fbeaf984..fc8c8aae 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerStatePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerStatePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerSwingArmPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerSwingArmPacket.java index c162471d..081535fa 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerSwingArmPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerSwingArmPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerUseItemPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerUseItemPacket.java index 9dacdf50..8eb3ebe6 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerUseItemPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/player/ClientPlayerUseItemPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/window/ClientWindowActionPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/window/ClientWindowActionPacket.java index 8905f5db..85a12e8b 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/window/ClientWindowActionPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/client/window/ClientWindowActionPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerBossBarPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerBossBarPacket.java index e1b8a1b0..fcac6783 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerBossBarPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerBossBarPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerChatPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerChatPacket.java index d64d2586..a4461e4c 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerChatPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerChatPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerCombatPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerCombatPacket.java index 4750ed94..b191ecce 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerCombatPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerCombatPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerDifficultyPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerDifficultyPacket.java index f806591f..89e075cf 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerDifficultyPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerDifficultyPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java index 00d048e0..e20e16a6 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerJoinGamePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java index 35417314..c01a9933 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerPlayerListEntryPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerRespawnPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerRespawnPacket.java index 4d3cc8ea..8ed4fbbb 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerRespawnPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerRespawnPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerStatisticsPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerStatisticsPacket.java index 999dedb1..3902d395 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerStatisticsPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerStatisticsPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerTitlePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerTitlePacket.java index 7a40d351..014156e1 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerTitlePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/ServerTitlePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityAnimationPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityAnimationPacket.java index 9e819457..f59c6d11 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityAnimationPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityAnimationPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEffectPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEffectPacket.java index 65e983a6..418acb73 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEffectPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEffectPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEquipmentPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEquipmentPacket.java index dbe955a3..5f7700cb 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEquipmentPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityEquipmentPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityPropertiesPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityPropertiesPacket.java index 0a113e34..9fe251e8 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityPropertiesPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityPropertiesPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityRemoveEffectPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityRemoveEffectPacket.java index 053f845f..c105108d 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityRemoveEffectPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityRemoveEffectPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityStatusPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityStatusPacket.java index 110c8783..652508fb 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityStatusPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/ServerEntityStatusPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/player/ServerPlayerPositionRotationPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/player/ServerPlayerPositionRotationPacket.java index c52f7a43..6e898bb9 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/player/ServerPlayerPositionRotationPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/player/ServerPlayerPositionRotationPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java index 5763a261..73cd6e37 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnGlobalEntityPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java index 1b49d2f6..0c407bea 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnMobPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java index 6efe246c..0f6378e9 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnObjectPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java index 483d4598..994699c5 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/entity/spawn/ServerSpawnPaintingPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerDisplayScoreboardPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerDisplayScoreboardPacket.java index 0123f1e0..9d3ba547 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerDisplayScoreboardPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerDisplayScoreboardPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerScoreboardObjectivePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerScoreboardObjectivePacket.java index 9fb2c82a..c6287164 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerScoreboardObjectivePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerScoreboardObjectivePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerTeamPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerTeamPacket.java index 6b5425ee..f8363a3e 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerTeamPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerTeamPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerUpdateScorePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerUpdateScorePacket.java index 5a78eda2..27716e85 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerUpdateScorePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/scoreboard/ServerUpdateScorePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerOpenWindowPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerOpenWindowPacket.java index 6edc7c4f..780683d4 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerOpenWindowPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerOpenWindowPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java index 03fcca9d..2cff3a67 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/window/ServerWindowPropertyPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java index ddf2bb44..efedce99 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockBreakAnimPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockValuePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockValuePacket.java index b40c2f74..4e7c94ce 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockValuePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerBlockValuePacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerNotifyClientPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerNotifyClientPacket.java index 0a016956..81ce0403 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerNotifyClientPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerNotifyClientPacket.java @@ -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(); } diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundEventPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayBuiltinSoundPacket.java similarity index 80% rename from src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundEventPacket.java rename to src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayBuiltinSoundPacket.java index eb96c9ec..74a53fd1 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundEventPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayBuiltinSoundPacket.java @@ -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; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayEffectPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayEffectPacket.java index 674970a8..3ee91fbb 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayEffectPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlayEffectPacket.java @@ -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); diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java index ba4993f9..05864e07 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerPlaySoundPacket.java @@ -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); diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerSpawnParticlePacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerSpawnParticlePacket.java index 0d1817da..49424860 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerSpawnParticlePacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerSpawnParticlePacket.java @@ -1,6 +1,6 @@ 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.Particle; import org.spacehq.packetlib.io.NetInput; import org.spacehq.packetlib.io.NetOutput; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerUpdateTileEntityPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerUpdateTileEntityPacket.java index cbd3bb95..15f0d40e 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerUpdateTileEntityPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerUpdateTileEntityPacket.java @@ -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.UpdatedTileType; import org.spacehq.mc.protocol.util.NetUtil; import org.spacehq.opennbt.tag.builtin.CompoundTag; diff --git a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java index b73ccdad..75361a6f 100644 --- a/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java +++ b/src/main/java/org/spacehq/mc/protocol/packet/ingame/server/world/ServerWorldBorderPacket.java @@ -1,6 +1,6 @@ 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.WorldBorderAction; import org.spacehq.packetlib.io.NetInput; import org.spacehq.packetlib.io.NetOutput; diff --git a/src/main/java/org/spacehq/mc/protocol/util/CryptUtil.java b/src/main/java/org/spacehq/mc/protocol/util/CryptUtil.java index fe751a0a..3afebbfa 100644 --- a/src/main/java/org/spacehq/mc/protocol/util/CryptUtil.java +++ b/src/main/java/org/spacehq/mc/protocol/util/CryptUtil.java @@ -18,7 +18,6 @@ import java.security.PublicKey; import java.security.spec.X509EncodedKeySpec; public class CryptUtil { - public static SecretKey generateSharedKey() { try { KeyGenerator gen = KeyGenerator.getInstance("AES"); @@ -89,5 +88,4 @@ public class CryptUtil { throw new Error("Failed to encrypt data.", e); } } - } diff --git a/src/main/java/org/spacehq/mc/protocol/util/NetUtil.java b/src/main/java/org/spacehq/mc/protocol/util/NetUtil.java index 1dc5fe73..7e241f5c 100644 --- a/src/main/java/org/spacehq/mc/protocol/util/NetUtil.java +++ b/src/main/java/org/spacehq/mc/protocol/util/NetUtil.java @@ -9,7 +9,7 @@ import org.spacehq.mc.protocol.data.game.chunk.BlockStorage; import org.spacehq.mc.protocol.data.game.chunk.Chunk; import org.spacehq.mc.protocol.data.game.chunk.Column; import org.spacehq.mc.protocol.data.game.chunk.NibbleArray3d; -import org.spacehq.mc.protocol.data.game.MagicValues; +import org.spacehq.mc.protocol.data.MagicValues; import org.spacehq.mc.protocol.data.game.entity.metadata.MetadataType; import org.spacehq.mc.protocol.data.game.world.block.BlockFace; import org.spacehq.mc.protocol.data.message.Message; @@ -30,7 +30,6 @@ import java.util.List; import java.util.UUID; public class NetUtil { - private static final int POSITION_X_SIZE = 38; private static final int POSITION_Y_SIZE = 26; private static final int POSITION_Z_SIZE = 38; @@ -327,5 +326,4 @@ public class NetUtil { this.out.writeByte(b); } } - }