mirror of
				https://github.com/mt-mods/homedecor_modpack.git
				synced 2025-11-04 13:05:31 +01:00 
			
		
		
		
	Fix signs' text overflowing at bottom.
This commit is contained in:
		@@ -65,7 +65,7 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
local math_max = math.max
 | 
					local math_max = math.max
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local homedecor_generate_line = function(s, ypos)
 | 
					local homedecor_generate_line = function(s, lineno)
 | 
				
			||||||
    local i = 1
 | 
					    local i = 1
 | 
				
			||||||
    local parsed = {}
 | 
					    local parsed = {}
 | 
				
			||||||
    local width = 0
 | 
					    local width = 0
 | 
				
			||||||
@@ -100,16 +100,18 @@ local homedecor_generate_line = function(s, ypos)
 | 
				
			|||||||
    local xpos = start_xpos
 | 
					    local xpos = start_xpos
 | 
				
			||||||
    local linepos = 0
 | 
					    local linepos = 0
 | 
				
			||||||
    for i = 1, #parsed do
 | 
					    for i = 1, #parsed do
 | 
				
			||||||
 | 
							if lineno >= NUMBER_OF_LINES then break end
 | 
				
			||||||
 | 
							local ypos = 12 + (LINE_HEIGHT * lineno)
 | 
				
			||||||
        table.insert(texture, (":%d,%d=%s.png"):format(xpos, ypos, parsed[i]))
 | 
					        table.insert(texture, (":%d,%d=%s.png"):format(xpos, ypos, parsed[i]))
 | 
				
			||||||
        xpos = xpos + CHAR_WIDTH + 1
 | 
					        xpos = xpos + CHAR_WIDTH + 1
 | 
				
			||||||
        linepos = linepos + 1
 | 
					        linepos = linepos + 1
 | 
				
			||||||
        if linepos > max_chars then
 | 
					        if linepos > max_chars then
 | 
				
			||||||
			xpos = start_xpos
 | 
								xpos = start_xpos
 | 
				
			||||||
			linepos = 0
 | 
								linepos = 0
 | 
				
			||||||
			ypos = ypos + LINE_HEIGHT
 | 
								lineno = lineno + 1
 | 
				
			||||||
		end
 | 
							end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    return table.concat(texture, ""), ypos
 | 
					    return table.concat(texture, ""), lineno
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
local function copy ( t )
 | 
					local function copy ( t )
 | 
				
			||||||
@@ -126,11 +128,12 @@ end
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
local homedecor_generate_texture = function(lines)
 | 
					local homedecor_generate_texture = function(lines)
 | 
				
			||||||
    local texture = { ("[combine:%dx%d"):format(SIGN_WIDTH, SIGN_WIDTH) }
 | 
					    local texture = { ("[combine:%dx%d"):format(SIGN_WIDTH, SIGN_WIDTH) }
 | 
				
			||||||
    local ypos = 12
 | 
					    local lineno = 0
 | 
				
			||||||
    for i = 1, #lines do
 | 
					    for i = 1, #lines do
 | 
				
			||||||
        local linetex, yp = homedecor_generate_line(lines[i], ypos)
 | 
							if lineno >= NUMBER_OF_LINES then break end
 | 
				
			||||||
 | 
					        local linetex, ln = homedecor_generate_line(lines[i], lineno)
 | 
				
			||||||
        table.insert(texture, linetex)
 | 
					        table.insert(texture, linetex)
 | 
				
			||||||
        ypos = yp + LINE_HEIGHT
 | 
					        lineno = ln + 1
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    return table.concat(texture, "")
 | 
					    return table.concat(texture, "")
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user