Make brush types varied and colored in player hotbars
This commit is contained in:
parent
7baf3bad30
commit
98929f043f
@ -64,15 +64,53 @@ public class MorphBobRoss extends MorphGadget
|
||||
/** The number of seconds for which quotes are displayed */
|
||||
private static final int QUOTE_PERSISTENCE = 9;
|
||||
|
||||
/** Quote attribution for bob */
|
||||
private static final String ATTRIBUTION = C.cGray + "- " + C.cYellow + "Bob Ross";
|
||||
|
||||
/** Cooldown key for changing paint colors */
|
||||
private static final String COLOR_KEY = "Change Paint Color";
|
||||
|
||||
/** Cooldown key for cleaning and putting paint on the brush */
|
||||
private static final String PAINT_KEY = "Beat The Devil Out Of It";
|
||||
|
||||
/** Cooldown key for displaying a Bob Ross quote above head */
|
||||
private static final String QUOTE_KEY = "Bob Ross Quote";
|
||||
|
||||
/** Quote attribution for bob */
|
||||
private static final String ATTRIBUTION = C.cGray + "- " + C.cYellow + "Bob Ross";
|
||||
|
||||
/** Formatted name for the clean brush */
|
||||
private static final String BRUSH_NAME = C.cYellow + "Clean Paintbrush";
|
||||
|
||||
/** Paint colors for displaying in players' hotbars */
|
||||
private static final String[] PAINT_COLORS = {
|
||||
C.cBlackB + "Midnight Black",
|
||||
C.cRedB + "Alizarin Crimson",
|
||||
C.cDGreenB + "Sap Green",
|
||||
C.cGoldB + "Van Dyke Brown",
|
||||
C.cDBlueB + "Prussian Blue",
|
||||
C.cDPurpleB + "Studio Purple",
|
||||
C.cDAquaB + "Phthalo Green",
|
||||
C.cGrayB + "Dusty Gray",
|
||||
C.cDGrayB + "Tundora Gray",
|
||||
C.cPurpleB + "Soft Flower Pink",
|
||||
C.cGreenB + "Lima Green",
|
||||
C.cYellowB + "Cadmium Yellow",
|
||||
C.cBlueB + "Danube Blue",
|
||||
C.cPurpleB + "Soft Magenta",
|
||||
C.cGoldB + "Yellow Ochre",
|
||||
C.cWhiteB + "Titanium White"
|
||||
};
|
||||
|
||||
/** Brush types for displaying in players' hotbars */
|
||||
private static final String[] PAINT_BRUSHES = {
|
||||
"Landscape Brush",
|
||||
"Foliage Brush",
|
||||
"Background Brush",
|
||||
"Blender Brush",
|
||||
"Oval Brush",
|
||||
"Round Brush",
|
||||
"Fan Brush",
|
||||
"Painting Knife"
|
||||
};
|
||||
|
||||
/** List of wholesome Bob Ross quotes. */
|
||||
private static final String[][] QUOTES = {
|
||||
{"We don't make mistakes,", "just happy little accidents."},
|
||||
@ -133,6 +171,9 @@ public class MorphBobRoss extends MorphGadget
|
||||
/** Blocks that have been painted */
|
||||
private final List<PaintedBlock> _paintBlocks = new ArrayList<>();
|
||||
|
||||
/** Hologram quotes that are currently above players' heads */
|
||||
private final Map<UUID, Collection<Hologram>> _spokenQuotes = new HashMap<>();
|
||||
|
||||
private final HologramManager _holograms;
|
||||
|
||||
public MorphBobRoss(GadgetManager manager, HologramManager holograms)
|
||||
@ -146,7 +187,8 @@ public class MorphBobRoss extends MorphGadget
|
||||
C.cGreen + "Right click " + C.cWhite + "on your " + C.cYellow + "Paint" + C.cWhite + " (dyes) to stop painting",
|
||||
"",
|
||||
C.cGreen + "Left click " + C.cWhite + "on your " + C.cYellow + "Paint " + C.cWhite + "to change paintbrush colors.",
|
||||
|
||||
"",
|
||||
C.cWhite + "Hold " + C.cGreen + " crouch " + C.cWhite + "to say a Bob Ross quote."
|
||||
}, LineFormat.LORE), -14, Material.PAINTING, (byte) 0, YearMonth.of(2017, Month.JUNE));
|
||||
|
||||
_holograms = holograms;
|
||||
@ -349,7 +391,10 @@ public class MorphBobRoss extends MorphGadget
|
||||
byte data = item.getData().getData();
|
||||
data++;
|
||||
if (data > 15) data = 0;
|
||||
ItemStack newItem = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, data, 1, getPaintColor(data) + " Paintbrush");
|
||||
|
||||
ItemStack newItem = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, data, 1,
|
||||
PAINT_COLORS[data] + " " + PAINT_BRUSHES[ThreadLocalRandom.current().nextInt(0, PAINT_BRUSHES.length)]);
|
||||
|
||||
_inventoryItems.put(player.getUniqueId(), newItem);
|
||||
player.getInventory().remove(item);
|
||||
player.getInventory().setItem(PAINT_BRUSH_SLOT, newItem);
|
||||
@ -367,11 +412,12 @@ public class MorphBobRoss extends MorphGadget
|
||||
if (item.getType() == Material.STICK)
|
||||
{
|
||||
byte data = ((byte) ThreadLocalRandom.current().nextInt(0, 16));
|
||||
newItem = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, data, 1, getPaintColor(data) + " Paintbrush");
|
||||
newItem = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, data, 1,
|
||||
PAINT_COLORS[data] + " " + PAINT_BRUSHES[ThreadLocalRandom.current().nextInt(0, PAINT_BRUSHES.length)]);
|
||||
}
|
||||
else
|
||||
{
|
||||
newItem = ItemStackFactory.Instance.CreateStack(Material.STICK, (byte) 0, 1, "Clean Paintbrush");
|
||||
newItem = ItemStackFactory.Instance.CreateStack(Material.STICK, (byte) 0, 1, BRUSH_NAME);
|
||||
}
|
||||
|
||||
_inventoryItems.put(player.getUniqueId(), newItem);
|
||||
@ -387,7 +433,7 @@ public class MorphBobRoss extends MorphGadget
|
||||
{
|
||||
if (!_inventoryItems.containsKey(player.getUniqueId()))
|
||||
{
|
||||
ItemStack item = ItemStackFactory.Instance.CreateStack(Material.STICK, (byte) 0, 1, "Clean Paintbrush");
|
||||
ItemStack item = ItemStackFactory.Instance.CreateStack(Material.STICK, (byte) 0, 1, BRUSH_NAME);
|
||||
player.getInventory().setItem(PAINT_BRUSH_SLOT, item);
|
||||
_inventoryItems.put(player.getUniqueId(), item);
|
||||
player.updateInventory();
|
||||
@ -414,56 +460,6 @@ public class MorphBobRoss extends MorphGadget
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a paint color name base mainly on Bob Ross's common color selections,
|
||||
* and on standard paint color names when the former is not available.
|
||||
*
|
||||
* @param color The data value of the dye for which to get a name.
|
||||
*
|
||||
* @return A string with a paint name
|
||||
*/
|
||||
private String getPaintColor(byte color)
|
||||
{
|
||||
switch(color)
|
||||
{
|
||||
case 0:
|
||||
return "Midnight Black";
|
||||
case 1:
|
||||
return "Alizarin Crimson";
|
||||
case 2:
|
||||
return "Sap Green";
|
||||
case 3:
|
||||
return "Van Dyke Brown";
|
||||
case 4:
|
||||
return "Prussian Blue";
|
||||
case 5:
|
||||
return "Studio Purple";
|
||||
case 6:
|
||||
return "Phthalo Green";
|
||||
case 7:
|
||||
return "Dusty Gray";
|
||||
case 8:
|
||||
return "Tundora Gray";
|
||||
case 9:
|
||||
return "Soft Flower Pink";
|
||||
case 10:
|
||||
return "Lima Green";
|
||||
case 11:
|
||||
return "Cadmium Yellow";
|
||||
case 12:
|
||||
return "Danube Blue";
|
||||
case 13:
|
||||
return "Soft Magenta";
|
||||
case 14:
|
||||
return "Yellow Ochre";
|
||||
case 15:
|
||||
return "Titanium White";
|
||||
default:
|
||||
return "Mystery";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Data class holding information on blocks which have been painted
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user