Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Scanner;
- import java.util.ArrayList;
- public class CustomMob extends MinecraftMobs{
- String name;
- String type;
- String hostility;
- String colour;
- public CustomMob (String name, String type, String colour, String hostility, String location){
- this.name = name;
- this.type = type;
- this.colour = colour;
- this.hostility = hostility;
- this.location = location;
- }
- public String getName (){
- return name;
- }
- public String changeName (){
- System.out.println();
- System.out.print("Please enter the new name for your mob: ");
- Scanner keyboard = new Scanner(System.in);
- name = keyboard.next();
- return name;
- }
- public String getType (){
- return type;
- }
- public String changeType (){
- System.out.println();
- System.out.print("Please enter the new type for your mob: ");
- Scanner keyboard = new Scanner(System.in);
- String newType = keyboard.next();
- type = newType;
- return type;
- }
- public String getColour(){
- return colour;
- }
- public String changeColour(){
- System.out.println();
- System.out.print("Please input the new colour for your mob: ");
- Scanner keyboard = new Scanner(System.in);
- String newColour = keyboard.next();
- colour = newColour;
- return colour;
- }
- public String getHostility (){
- return hostility;
- }
- public String changeHostility(){
- System.out.println();
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Select your mob's hostility level (1=friendly, 2=passive or 3=hostile): ");
- int hostilitySelection = keyboard.nextInt();
- if(hostilitySelection==1){
- hostility = "friendly";
- }else if (hostilitySelection==2){
- hostility = "passive";
- }else{
- hostility = "hostile";
- }
- return hostility;
- }
- public void getStats (CustomMob mob){
- System.out.println();
- HashMap<String, String> mobStats = new HashMap<>();
- mobStats.put("Name", mob.getName());
- mobStats.put("Type", mob.getType());
- mobStats.put("Colour", mob.getColour());
- mobStats.put("Hostility", mob.getHostility());
- mobStats.put("Location", mob.getLocation());
- for(String slot: mobStats.keySet()){
- System.out.println(slot + ": " + mobStats.get(slot));
- }
- }
- public static void main(String[] args) {
- System.out.println();
- System.out.println("This code helps you to create custom Minecraft mob");
- System.out.println("Lets create our new mob: ");
- System.out.print("Enter your mob's name: ");
- Scanner keyboard1 = new Scanner(System.in);
- String newName = keyboard1.next();
- System.out.print("Enter your mob's type: ");
- String newType = keyboard1.next();
- System.out.print("Enter your mob's colour: ");
- String newColour = keyboard1.next();
- System.out.print("Select your mob's hostility level (1=friendly, 2=passive or 3=hostile): ");
- int hostilitySelection = keyboard1.nextInt();
- String newHostility;
- if(hostilitySelection==1){
- newHostility = "friendly";
- }else if (hostilitySelection==2){
- newHostility = "passive";
- }else{
- newHostility = "hostile";
- }
- System.out.print("Enter your mob's preferred biome location: ");
- String newLocation = keyboard1.next();
- CustomMob mob = new CustomMob(newName, newType, newColour, newHostility, newLocation);
- System.out.println();
- System.out.println("Select your next action from the list below:");
- System.out.println("1) Check the name of your mob");
- System.out.println("2) Rename your mob");
- System.out.println("3) Check the type of your mob");
- System.out.println("4) Change the type of your mob");
- System.out.println("5) Check the colour of your mob");
- System.out.println("6) Change the colour of your mob");
- System.out.println("7) Check the hostility of your mob");
- System.out.println("8) Change the hostility of your mob");
- System.out.println("9) Check the location of your mob");
- System.out.println("10) Change the location of your mob");
- System.out.println("11) Print the stats of your mob");
- System.out.println("12) Exit the simulation");
- while(true) {
- Scanner keyboard = new Scanner(System.in);
- int option = keyboard.nextInt();
- if (option == 1) {
- System.out.println("The name of your mob is: " + mob.getName());
- } else if (option == 2) {
- System.out.println("The new name of your mob is: " + mob.changeName());
- } else if (option == 3) {
- System.out.println("Your mob is a " + mob.getType() + " type");
- } else if (option == 4) {
- System.out.println("The new type of your mob is: " + mob.changeType());
- } else if (option == 5) {
- System.out.println("Your mob's colour is: " + mob.getColour());
- } else if (option == 6) {
- System.out.println("The new colour of your mob is: " + mob.changeColour());
- } else if (option == 7) {
- System.out.println("Your mob's hostility is classed as: " + mob.getHostility());
- } else if (option == 8) {
- System.out.println("Your mob is now classed as a " + mob.changeHostility() + " mob");
- } else if (option == 9) {
- System.out.println("Your current mob's preferred location is: " + mob.getLocation());
- } else if (option == 10) {
- System.out.println("Your mob's new location is " + mob.changeLocation());
- } else if (option == 11) {
- System.out.println("The current stats for your new mob:");
- mob.getStats(mob);
- } else if (option == 12) {
- System.out.println("Thank you for choosing the Custom Mobinator Program");
- System.out.println("These are the final stats for your new mob:");
- mob.getStats(mob);
- break;
- } else {
- System.out.println("Please select a valid option from the menu");
- }
- System.out.println();
- System.out.print("Please choose again from the menu: ");
- }
- }
- }
- class MinecraftMobs {
- String location;
- public String getLocation(){
- return location;
- }
- public String changeLocation (){
- ArrayList<String> biomes = new ArrayList<>();
- biomes.add("Plains");
- biomes.add("Water");
- biomes.add("Underground");
- biomes.add("The Nether");
- biomes.add("The End");
- System.out.println("Choose the location you wish your mob to be most likely found in: ");
- for (int i = 0; i<biomes.size(); i++) {
- System.out.println((i+1) + ") " + biomes.get(i));
- }
- System.out.print("Enter the number: ");
- Scanner keyboard = new Scanner(System.in);
- int mobLocation = keyboard.nextInt();
- return biomes.get(mobLocation-1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement