I'm writing a small script that makes shearing sheep drop 3-5 wool (the vanilla behavior is dropping 1-3 wool). Naturally, the color of the dropped wool should match the color of the sheep:
Ideally this would handle all colors uniformly, rather than splitting into 16 cases, but I wasn't able to find a way to do this, and so what should take 7 lines instead takes more than 30. There are two issues here:
Code:
on rightclick on a sheep:
if player's tool is shears:
set {_color} to color of clicked sheep
shear the clicked sheep
set {_woolToDrop} to random integer between 3 and 5
if {_color} is black:
drop {_woolToDrop} of black wool block
else if {_color} is light cyan:
drop {_woolToDrop} of light blue wool block
else if {_color} is yellow:
drop {_woolToDrop} of yellow wool block
[13 other cases]
- It would be useful to have a syntax that drops a wool block of a color specified by a variable name. Naively one might try
Code:
drop {_woolToDrop} of {_color} wool block
- Even with a syntax of the type in (1) there are several colors for which the value returned by color of clicked sheep is not the name used when specifying the color of the wool block (e.g., light cyan vs. light blue in the example above). These cases could each be handled separately, e.g., with code
Code:
if {_color} is light cyan: set {_color} to light blue
Is there a better way to achieve this?