Take grass block when enderman took dry grass b.

This commit is contained in:
Wuzzy 2017-11-15 03:12:31 +01:00
parent f53cf859c2
commit 74e1a7d326
3 changed files with 24 additions and 2 deletions

View File

@ -241,6 +241,19 @@ mobs_mc.enderman_takable = {
"nether:rack", "nether:rack",
} }
--[[ Table of nodes to replace when an enderman takes it.
If the enderman takes an indexed node, it the enderman will get the item in the value.
Table indexes: Original node, taken by enderman.
Table values: The item which the enderman *actually* gets
Example:
mobs_mc.enderman_node_replace = {
["default:dirt_with_dry_grass"] = "default_dirt_with_grass",
}
-- This means, if the enderman takes a dirt with dry grass, he will get a dirt with grass
-- on his hand instead.
]]
mobs_mc.enderman_replace_on_take = {} -- no replacements by default
-- A table which can be used to override block textures of blocks carried by endermen. -- A table which can be used to override block textures of blocks carried by endermen.
-- Only works for cube-shaped nodes and nodeboxes. -- Only works for cube-shaped nodes and nodeboxes.
-- Key: itemstrings of the blocks to replace -- Key: itemstrings of the blocks to replace
@ -307,6 +320,9 @@ 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.override.enderman_replace_on_take then
mobs_mc.enderman_replace_on_take = mobs_mc.override.enderman_replace_on_take
end
if mobs_mc.enderman_block_texture_overrides then if mobs_mc.enderman_block_texture_overrides then
mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides
end end

View File

@ -213,7 +213,11 @@ mobs:register_mob("mobs_mc:enderman", {
local node = minetest.get_node(take_pos) local node = minetest.get_node(take_pos)
local dug = minetest.dig_node(take_pos) local dug = minetest.dig_node(take_pos)
if dug then if dug then
if mobs_mc.enderman_replace_on_take[node.name] then
self._taken_node = mobs_mc.enderman_replace_on_take[node.name]
else
self._taken_node = node.name self._taken_node = node.name
end
local def = minetest.registered_nodes[self._taken_node] local def = minetest.registered_nodes[self._taken_node]
-- Update animation and texture accordingly (adds visibly carried block) -- Update animation and texture accordingly (adds visibly carried block)
local block_type local block_type

View File

@ -170,7 +170,9 @@ mobs_mc.override.enderman_takable = {
-- Generic handling, useful for entensions -- Generic handling, useful for entensions
"group:enderman_takable", "group:enderman_takable",
} }
mobs_mc.override.enderman_replace_on_take = {
["mcl_core:dirt_with_dry_grass"] = "mcl_core:dirt_with_grass",
}
-- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox -- Texuture overrides for enderman block. Required for cactus because it's original is a nodebox
-- and the textures have tranparent pixels. -- and the textures have tranparent pixels.