Skip to content

Commit

Permalink
Java client: sort item mappers by class name
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed Oct 16, 2023
1 parent 7de145d commit 67ed172
Show file tree
Hide file tree
Showing 3 changed files with 183 additions and 217 deletions.
141 changes: 65 additions & 76 deletions src/games/stendhal/client/entity/factory/EntityMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,102 +75,91 @@ public final class EntityMap {
* Fills EntityMap with initial values.
*/
private static void register() {
register("entity", null, null, Entity.class);

register("player", null, null, Player.class);

register("creature", "ent", null, BossCreature.class);
register("creature", null, null, Creature.class);

register("sheep", null, null, Sheep.class);

register("baby_dragon", null, null, Pet.class);
register("purple_dragon", null, null, Pet.class);
register("cat", null, null, Pet.class);
register("pet", null, null, Pet.class);

register("npc", null, null, NPC.class);
register("training_dummy", null, null, NPC.class);

register("plant_grower", null, null, PlantGrower.class);

register("flyover", null, null, FlyOverArea.class);
register("walkblocker", null, null, WalkBlocker.class);

register("growing_entity_spawner", "items/grower/carrot_grower", null,
CarrotGrower.class);
register("growing_entity_spawner", "items/grower/wood_grower", null,
CarrotGrower.class);
register("growing_entity_spawner", null, null, GrainField.class);

register("useable_entity", null, null, StatefulEntity.class);
// deprecated start
register("gold_source", null, null, StatefulEntity.class);
register("fish_source", null, null, StatefulEntity.class);
register("well_source", null, null, StatefulEntity.class);
// deprecated end

register("area", null, null, InvisibleEntity.class);
register("block", null, null, Block.class);

register("food", null, null, SheepFood.class);
register("chest", null, null, Chest.class);

register("corpse", null, null, Corpse.class);

register("blood", null, null, Blood.class);

register("blackboard", null, null, Sign.class);
register("sign", null, null, Sign.class);
register("rented_sign", null, null, Sign.class);
register("shop_sign", null, null, Sign.class);

// item
register("item", null, null, Item.class);
register("item", "ammunition", null, StackableItem.class);
register("item", "box", null, Box.class);
register("item", "ring", null, UseableRing.class);
register("item", "ring", "emerald-ring", BreakableRing.class);

register("item", "club", "wizard_staff", UseableItem.class);
register("item", "container", null, StackableItem.class);
// FIXME: `games.stendhal.server.entity.item.ItemTest` copy constructor test fails
//~ register("item", "documents", "coupon", StackableItem.class);
register("item", "drink", null, UseableItem.class);
register("item", "flower", null, StackableItem.class);
register("item", "food", null, UseableItem.class);
register("item", "tool", "foodmill", UseableItem.class);
register("item", "tool", "sugarmill", UseableItem.class);
register("item", "tool", "scrolleraser", UseableItem.class);
register("item", "tool", "rope", StackableItem.class);
register("item", "herb", null, StackableItem.class);
register("item", "jewellery", null, StackableItem.class);
register("item", "misc", null, StackableItem.class);
register("item", "money", null, StackableItem.class);
register("item", "misc", "bulb", UseableItem.class);
register("item", "misc", "seed", UseableItem.class);
register("item", "missile", null, StackableItem.class);
register("item", "ammunition", null, StackableItem.class);
register("item", "container", null, StackableItem.class);
register("item", "money", null, StackableItem.class);
register("item", "resource", null, StackableItem.class);
register("item", "ring", null, UseableRing.class);
register("item", "ring", "emerald-ring", BreakableRing.class);
register("item", "scroll", null, UseableItem.class);
register("item", "special", null, StackableItem.class);
register("item", "special", "mithril clasp", Item.class);
register("item", "club", "wizard_staff", UseableItem.class);
register("item", "misc", "seed", UseableItem.class);
register("item", "misc", "bulb", UseableItem.class);

register("item", "resource", null, StackableItem.class);
register("item", "token", null, Item.class);
register("item", "tool", "foodmill", UseableItem.class);
register("item", "tool", "rope", StackableItem.class);
register("item", "tool", "scrolleraser", UseableItem.class);
register("item", "tool", "sugarmill", UseableItem.class);

register("item", "scroll", null, UseableItem.class);
register("item", "jewellery", null, StackableItem.class);
// grower
register("growing_entity_spawner", null, null, GrainField.class);
register("growing_entity_spawner", "items/grower/carrot_grower", null, CarrotGrower.class);
register("growing_entity_spawner", "items/grower/wood_grower", null, CarrotGrower.class);
register("plant_grower", null, null, PlantGrower.class);

register("item", "token", null, Item.class);
// FIXME: `games.stendhal.server.entity.item.ItemTest` copy constructor test fails
//~ register("item", "documents", "coupon", StackableItem.class);
// sign
register("rented_sign", null, null, Sign.class);
register("shop_sign", null, null, Sign.class);
register("sign", null, null, Sign.class);

register("portal", null, null, Portal.class);
register("house_portal", null, null, HousePortal.class);
// portal & door
register("door", null, null, Door.class);
register("fire", null, null, Fire.class);
register("gate", null, null, Gate.class);
register("house_portal", null, null, HousePortal.class);
register("portal", null, null, Portal.class);

register("spell", null, null, Spell.class);
// NPC
register("baby_dragon", null, null, Pet.class);
register("cat", null, null, Pet.class);
register("npc", null, null, NPC.class);
register("pet", null, null, Pet.class);
register("purple_dragon", null, null, Pet.class);
register("sheep", null, null, Sheep.class);
register("training_dummy", null, null, NPC.class);

register("gate", null, null, Gate.class);
// creature
register("creature", null, null, Creature.class);
register("creature", "ent", null, BossCreature.class);

// misc
register("area", null, null, InvisibleEntity.class);
register("blackboard", null, null, Sign.class);
register("block", null, null, Block.class);
register("blood", null, null, Blood.class);
register("chest", null, null, Chest.class);
register("corpse", null, null, Corpse.class);
register("entity", null, null, Entity.class);
register("fire", null, null, Fire.class);
register("flyover", null, null, FlyOverArea.class);
register("food", null, null, SheepFood.class);
register("game_board", null, null, GameBoard.class);
register("looped_sound_source", null, null, LoopedSoundSource.class);
register("player", null, null, Player.class);
register("spell", null, null, Spell.class);
register("useable_entity", null, null, StatefulEntity.class);
register("walkblocker", null, null, WalkBlocker.class);
register("wall", null, null, Wall.class);
register("weather_entity", null, null, InvisibleEntity.class);

register("looped_sound_source", null, null, LoopedSoundSource.class);

// deprecated
register("fish_source", null, null, StatefulEntity.class);
register("gold_source", null, null, StatefulEntity.class);
register("well_source", null, null, StatefulEntity.class);
}

/**
Expand Down
147 changes: 68 additions & 79 deletions src/games/stendhal/client/gui/j2d/entity/EntityViewFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,103 +122,92 @@ static Class<? extends EntityView> getViewClass(final String type, final String
* Configure the view map.
*/
private static void configure() {
// item
register("item", null, null, Item2DView.class);
register("item", "ammunition", null, StackableItem2DView.class);
register("item", "book", "bestiary", UseableGenericItem2DView.class);
register("item", "box", null, Box2DView.class);
register("item", "club", "wizard_staff", UseableItem2DView.class);
register("item", "container", null, StackableItem2DView.class);
// FIXME: `games.stendhal.server.entity.item.ItemTest` copy constructor test fails
//~ register("item", "documents", "coupon", StackableItem2DView.class);
register("item", "drink", null, UseableItem2DView.class);
register("item", "flower", null, StackableItem2DView.class);
register("item", "food", null, UseableItem2DView.class);
register("item", "herb", null, StackableItem2DView.class);
register("item", "jewellery", null, StackableItem2DView.class);
register("item", "misc", null, StackableItem2DView.class);
register("item", "misc", "bulb", UseableItem2DView.class);
register("item", "misc", "seed", UseableItem2DView.class);
register("item", "misc", "snowglobe", UseableGenericItem2DView.class);
register("item", "misc", "teddy", UseableGenericItem2DView.class);
register("item", "missile", null, StackableItem2DView.class);
register("item", "money", null, StackableItem2DView.class);
register("item", "resource", null, StackableItem2DView.class);
register("item", "ring", null, Ring2DView.class);
register("item", "ring", "emerald-ring", BreakableRing2DView.class);
register("item", "ring", "wedding", UseableRing2DView.class);
register("item", "scroll", null, UseableItem2DView.class);
register("item", "special", null, StackableItem2DView.class);
register("item", "special", "mithril clasp", Item2DView.class);
register("item", "tool", "foodmill", UseableItem2DView.class);
register("item", "tool", "metal_detector", UseableGenericItem2DView.class);
register("item", "tool", "rope", StackableItem2DView.class);
register("item", "tool", "rotary_cutter", UseableGenericItem2DView.class);
register("item", "tool", "scrolleraser", UseableItem2DView.class);
register("item", "tool", "sugarmill", UseableItem2DView.class);

register("area", null, null, InvisibleEntity2DView.class);

register("block", null, null, LookableEntity2DView.class);
register("blood", null, null, Blood2DView.class);

register("creature", "ent", null, BossCreature2DView.class);

register("growing_entity_spawner", "items/grower/wood_grower", null, CarrotGrower2DView.class);
// grower
register("growing_entity_spawner", null, null, GrainField2DView.class);
register("growing_entity_spawner", "items/grower/carrot_grower", null, CarrotGrower2DView.class);
register("chest", null, null, Chest2DView.class);
register("corpse", null, null, Corpse2DView.class);
register("growing_entity_spawner", "items/grower/wood_grower", null, CarrotGrower2DView.class);
register("plant_grower", null, null, PlantGrower2DView.class);

register("creature", null, null, Creature2DView.class);
// sign
register("blackboard", null, null, Sign2DView.class);
register("rented_sign", null, null, Sign2DView.class);
register("shop_sign", null, null, ShopSign2DView.class);
register("sign", null, null, Sign2DView.class);

// portal & door
register("door", null, null, Door2DView.class);

register("fire", null, null, UseableEntity2DView.class);
register("fish_source", null, null, UseableEntity2DView.class);

register("game_board", null, null, GameBoard2DView.class);
register("gate", null, null, Gate2DView.class);

register("gold_source", null, null, UseableEntity2DView.class);

register("growing_entity_spawner", null, null, GrainField2DView.class);

register("house_portal", null, null, HousePortal2DView.class);
register("portal", null, null, Portal2DView.class);

register("item", "box", null, Box2DView.class);
register("item", "special", "mithril clasp", Item2DView.class);
register("item", null, null, Item2DView.class);
register("npc", null, null, NPC2DView.class);
register("training_dummy", null, null, TrainingDummy2DView.class);

// NPC
register("baby_dragon", null, null, Pet2DView.class);
register("cat", null, null, Pet2DView.class);
register("npc", null, null, NPC2DView.class);
register("pet", null, null, Pet2DView.class);
register("baby_dragon", null, null, Pet2DView.class);
register("purple_dragon", null, null, Pet2DView.class);
register("sheep", null, null, Sheep2DView.class);
register("training_dummy", null, null, TrainingDummy2DView.class);

register("plant_grower", null, null, PlantGrower2DView.class);

register("player", null, null, Player2DView.class);
// creature
register("creature", null, null, Creature2DView.class);
register("creature", "ent", null, BossCreature2DView.class);

register("portal", null, null, Portal2DView.class);
// resource sources
register("fish_source", null, null, UseableEntity2DView.class);
register("gold_source", null, null, UseableEntity2DView.class);
register("well_source", null, null, UseableEntity2DView.class);

register("sheep", null, null, Sheep2DView.class);
// misc
register("area", null, null, InvisibleEntity2DView.class);
register("block", null, null, LookableEntity2DView.class);
register("blood", null, null, Blood2DView.class);
register("chest", null, null, Chest2DView.class);
register("corpse", null, null, Corpse2DView.class);
register("fire", null, null, UseableEntity2DView.class);
register("flyover", null, null, FlyOverArea2DView.class);
register("food", null, null, SheepFood2DView.class);
register("game_board", null, null, GameBoard2DView.class);
register("player", null, null, Player2DView.class);
register("spell", null, null, Spell2DView.class);

register("sign", null, null, Sign2DView.class);
register("blackboard", null, null, Sign2DView.class);
register("rented_sign", null, null, Sign2DView.class);
register("shop_sign", null, null, ShopSign2DView.class);

register("item", "jewellery", null, StackableItem2DView.class);
register("item", "flower", null, StackableItem2DView.class);
register("item", "resource", null, StackableItem2DView.class);
register("item", "herb", null, StackableItem2DView.class);
register("item", "misc", null, StackableItem2DView.class);
register("item", "money", null, StackableItem2DView.class);
register("item", "missile", null, StackableItem2DView.class);
register("item", "ammunition", null, StackableItem2DView.class);
register("item", "container", null, StackableItem2DView.class);
register("item", "special", null, StackableItem2DView.class);
// FIXME: `games.stendhal.server.entity.item.ItemTest` copy constructor test fails
//~ register("item", "documents", "coupon", StackableItem2DView.class);

register("item", "club", "wizard_staff", UseableItem2DView.class);
register("item", "misc", "seed", UseableItem2DView.class);
register("item", "misc", "bulb", UseableItem2DView.class);

register("item", "scroll", null, UseableItem2DView.class);

register("item", "food", null, UseableItem2DView.class);
register("item", "drink", null, UseableItem2DView.class);
register("item", "tool", "foodmill", UseableItem2DView.class);
register("item", "tool", "sugarmill", UseableItem2DView.class);
register("item", "tool", "scrolleraser", UseableItem2DView.class);
register("item", "tool", "rope", StackableItem2DView.class);

register("item", "ring", null, Ring2DView.class);
register("item", "ring", "emerald-ring", BreakableRing2DView.class);
register("item", "ring", "wedding", UseableRing2DView.class);

register("item", "book", "bestiary", UseableGenericItem2DView.class);
register("item", "misc", "snowglobe", UseableGenericItem2DView.class);
register("item", "misc", "teddy", UseableGenericItem2DView.class);
register("item", "tool", "metal_detector", UseableGenericItem2DView.class);
register("item", "tool", "rotary_cutter", UseableGenericItem2DView.class);

register("useable_entity", null, null, UseableEntity2DView.class);

register("flyover", null, null, FlyOverArea2DView.class);
register("wall", null, null, Wall2DView.class);
register("walkblocker", null, null, WalkBlocker2DView.class);
register("well_source", null, null, UseableEntity2DView.class);
register("wall", null, null, Wall2DView.class);
}

/**
Expand Down
Loading

0 comments on commit 67ed172

Please sign in to comment.