Skip to content

Commit

Permalink
creeper
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeTheTech committed Sep 27, 2023
1 parent 3df6fed commit 1794b77
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/java/lee/code/pets/menus/menu/PetOptionMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private MenuButton createOptionButton(Player player, Option option) {
final String marking = PetDataUtil.getNextHorseMarking(targetData);
cachePets.updatePetData(petID, PetDataUtil.addNewPetData(entityType, petData, marking, option));
}
case BABY, SADDLE, CHEST, HORNS, ANGRY, STUNG, NECTAR, PUMPKIN, COLLAR -> {
case BABY, SADDLE, CHEST, HORNS, ANGRY, STUNG, NECTAR, PUMPKIN, COLLAR, POWERED -> {
final String petOption = String.valueOf(!Boolean.parseBoolean(targetData));
cachePets.updatePetData(petID, PetDataUtil.addNewPetData(entityType, petData, petOption, option));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public enum Option {
TYPE(Material.GRASS_BLOCK, "&e&lType"),
PROFESSION(Material.ANVIL, "&e&lProfession"),
LEVEL(Material.EXPERIENCE_BOTTLE, "&e&lLevel"),
COLLAR(Material.LEAD, "&e&lCollar")
COLLAR(Material.LEAD, "&e&lCollar"),
POWERED(Material.TNT, "&e&lPowered")

;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public enum OptionSelector {
TURTLE(new String[] {Option.NAME.name(), Option.BABY.name()}),
BLAZE(new String[] {Option.NAME.name()}),
CAVE_SPIDER(new String[] {Option.NAME.name()}),
CREEPER(new String[] {Option.NAME.name(), Option.POWERED.name()}),
;

@Getter private final String[] options;
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/lee/code/pets/utils/PetDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ public static String getPetData(EntityType entityType, String[] data, Option opt
case PUMPKIN -> {return data[2];}
}
}
case CREEPER -> {
switch (option) {
case NAME -> {return data[1];}
case POWERED -> {return data[2];}
}
}
case CAMEL, SKELETON_HORSE, STRIDER, ZOMBIE_HORSE -> {
switch (option) {
case NAME -> {return data[1];}
Expand Down Expand Up @@ -247,6 +253,10 @@ public static String serializePetData(Entity entity) {
final boolean hasPumpkin = entity instanceof Snowman snowman && !snowman.isDerp();
return startingData + sep + hasPumpkin;
}
case CREEPER -> {
final boolean charged = entity instanceof Creeper creeper && creeper.isPowered();
return startingData + sep + charged;
}
case VILLAGER -> {
final VillagerTypeUtil type = VillagerTypeUtil.getType(entity);
final VillagerProfessionUtil profession = VillagerProfessionUtil.getProfession(entity);
Expand Down Expand Up @@ -292,6 +302,12 @@ public static String addNewPetData(EntityType entityType, String[] data, String
case PUMPKIN -> {return data[0] + sep + data[1] + sep + newData;}
}
}
case CREEPER -> {
switch (option) {
case NAME -> {return data[0] + sep + newData + sep + data[2];}
case POWERED -> {return data[0] + sep + data[1] + sep + newData;}
}
}
case TROPICAL_FISH -> {
switch (option) {
case NAME -> {return data[0] + sep + newData + sep + data[2] + sep + data[3] + sep + data[4];}
Expand Down

0 comments on commit 1794b77

Please sign in to comment.