From 74e1a7d3260d404e1957dccb4556b1ab57a57b29 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 15 Nov 2017 03:12:31 +0100 Subject: [PATCH] Take grass block when enderman took dry grass b. --- mods/ENTITIES/mobs_mc/0_gameconfig.lua | 16 ++++++++++++++++ mods/ENTITIES/mobs_mc/enderman.lua | 6 +++++- mods/ENTITIES/mobs_mc_gameconfig/init.lua | 4 +++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mods/ENTITIES/mobs_mc/0_gameconfig.lua b/mods/ENTITIES/mobs_mc/0_gameconfig.lua index aa7c5bd40..f9624abc5 100644 --- a/mods/ENTITIES/mobs_mc/0_gameconfig.lua +++ b/mods/ENTITIES/mobs_mc/0_gameconfig.lua @@ -241,6 +241,19 @@ mobs_mc.enderman_takable = { "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. -- Only works for cube-shaped nodes and nodeboxes. -- 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 mobs_mc.enderman_takable = mobs_mc.override.enderman_takable 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 mobs_mc.enderman_block_texture_overrides = mobs_mc.override.enderman_block_texture_overrides end diff --git a/mods/ENTITIES/mobs_mc/enderman.lua b/mods/ENTITIES/mobs_mc/enderman.lua index 1e9fab03e..f0294c5b9 100644 --- a/mods/ENTITIES/mobs_mc/enderman.lua +++ b/mods/ENTITIES/mobs_mc/enderman.lua @@ -213,7 +213,11 @@ mobs:register_mob("mobs_mc:enderman", { local node = minetest.get_node(take_pos) local dug = minetest.dig_node(take_pos) if dug then - self._taken_node = node.name + 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 + end local def = minetest.registered_nodes[self._taken_node] -- Update animation and texture accordingly (adds visibly carried block) local block_type diff --git a/mods/ENTITIES/mobs_mc_gameconfig/init.lua b/mods/ENTITIES/mobs_mc_gameconfig/init.lua index 49cf115ad..f953eb884 100644 --- a/mods/ENTITIES/mobs_mc_gameconfig/init.lua +++ b/mods/ENTITIES/mobs_mc_gameconfig/init.lua @@ -170,7 +170,9 @@ mobs_mc.override.enderman_takable = { -- Generic handling, useful for entensions "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 -- and the textures have tranparent pixels.