Restrict banner layers to 3 if has a gradient
This commit is contained in:
parent
c6111039ab
commit
dca095171c
2 changed files with 15 additions and 1 deletions
|
@ -5,6 +5,9 @@
|
|||
-- Maximum number of layers which can be put on a banner by crafting.
|
||||
local max_layers_crafting = 6
|
||||
|
||||
-- Maximum number of layers when banner includes a gradient (workaround, see below).
|
||||
local max_layers_gradient = 3
|
||||
|
||||
-- Max. number lines in the descriptions for the banner layers.
|
||||
-- This is done to avoid huge tooltips.
|
||||
local max_layer_lines = 6
|
||||
|
@ -386,6 +389,16 @@ local banner_pattern_craft = function(itemstack, player, old_craft_grid, craft_i
|
|||
if #layers >= max_layers_crafting then
|
||||
return ItemStack("")
|
||||
end
|
||||
-- Lower layer limit when banner includes any gradient.
|
||||
-- Workaround to circumvent bug #340 (gradients are likely to cause transparent pixels).
|
||||
-- FIXME: Remove this restriction when bug #340 is fixed.
|
||||
if #layers >= max_layers_gradient then
|
||||
for l=1, #layers do
|
||||
if layers[l].pattern == "gradient" or layers[l].pattern == "gradient_up" then
|
||||
return ItemStack("")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local matching_pattern
|
||||
local max_i = player:get_inventory():get_size("craft")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue