Fix weird-looking cactus when held by enderman

This commit is contained in:
Wuzzy 2017-08-23 04:34:06 +02:00
parent 6d84a139d6
commit e2b57327fe
5 changed files with 42 additions and 7 deletions

View File

@ -241,6 +241,13 @@ mobs_mc.enderman_takable = {
"nether:rack", "nether:rack",
} }
-- A table which can be used to override block textures of blocks carried by endermen.
-- Only works for cube-shaped nodes and nodeboxes.
-- Key: itemstrings of the blocks to replace
-- Value: A table with the texture overrides (6 textures)
mobs_mc.enderman_block_texture_overrides = {
}
-- List of nodes on which mobs can spawn -- List of nodes on which mobs can spawn
mobs_mc.spawn = { mobs_mc.spawn = {
solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing) solid = { "group:cracky", "group:crumbly", "group:shovely", "group:pickaxey" }, -- spawn on "solid" nodes (this is mostly just guessing)
@ -300,5 +307,8 @@ if minetest.get_modpath("mobs_mc_gameconfig") and mobs_mc.override then
if mobs_mc.override.enderman_takable then if mobs_mc.override.enderman_takable then
mobs_mc.enderman_takable = mobs_mc.override.enderman_takable mobs_mc.enderman_takable = mobs_mc.override.enderman_takable
end end
if mobs_mc.enderman_block_texture_overrides then
mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides
end
end end

View File

@ -39,15 +39,21 @@ local create_enderman_textures = function(block_type, itemstring)
local tiles = minetest.registered_nodes[itemstring].tiles local tiles = minetest.registered_nodes[itemstring].tiles
local textures = {} local textures = {}
local last local last
for i = 1, 6 do if mobs_mc.enderman_block_texture_overrides[itemstring] then
if type(tiles[i]) == "string" then -- Texture override available? Use these instead!
last = tiles[i] textures = mobs_mc.enderman_block_texture_overrides[itemstring]
elseif type(tiles[i]) == "table" then else
if tiles[i].name then -- Extract the texture names
last = tiles[i].name for i = 1, 6 do
if type(tiles[i]) == "string" then
last = tiles[i]
elseif type(tiles[i]) == "table" then
if tiles[i].name then
last = tiles[i].name
end
end end
table.insert(textures, last)
end end
table.insert(textures, last)
end end
return { return {
"blank.png", "blank.png",

View File

@ -1 +1,2 @@
mcl_init mcl_init
mcl_core

View File

@ -169,6 +169,24 @@ mobs_mc.override.enderman_takable = {
"group:enderman_takable", "group:enderman_takable",
} }
-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox
-- and the textures have tranparent pixels.
local cbackground = "mobs_mc_gameconfig_enderman_cactus_background.png"
local ctiles = minetest.registered_nodes["mcl_core:cactus"].tiles
local ctable = {}
local last
for i=1, 6 do
if ctiles[i] then
last = ctiles[i]
end
table.insert(ctable, cbackground .. "^" .. last)
end
mobs_mc.override.enderman_block_texture_overrides = {
["mcl_core:cactus"] = ctable,
}
-- List of nodes on which mobs can spawn -- List of nodes on which mobs can spawn
mobs_mc.override.spawn = { mobs_mc.override.spawn = {
solid = { "group:solid", }, -- spawn on "solid" nodes solid = { "group:solid", }, -- spawn on "solid" nodes

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B