From 1e6566d5d26bffba56e53ae990119d6bf2b3eab4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 27 Jul 2017 06:14:42 +0200 Subject: [PATCH] Add white banner --- mods/ITEMS/mcl_banners/README.txt | 7 + mods/ITEMS/mcl_banners/depends.txt | 3 + mods/ITEMS/mcl_banners/description.txt | 1 + mods/ITEMS/mcl_banners/init.lua | 124 ++++++++++++++++++ mods/ITEMS/mcl_banners/mod.conf | 1 + mods/ITEMS/mcl_banners/models/amc_banner.b3d | Bin 0 -> 3815 bytes .../textures/mcl_banners_banner_base.png | Bin 0 -> 814 bytes .../mcl_banners/textures/mcl_banners_base.png | Bin 0 -> 442 bytes .../textures/mcl_banners_item_base.png | Bin 0 -> 163 bytes .../textures/mcl_banners_item_overlay.png | Bin 0 -> 164 bytes tools/Texture_Conversion_Table.csv | 2 + 11 files changed, 138 insertions(+) create mode 100644 mods/ITEMS/mcl_banners/README.txt create mode 100644 mods/ITEMS/mcl_banners/depends.txt create mode 100644 mods/ITEMS/mcl_banners/description.txt create mode 100644 mods/ITEMS/mcl_banners/init.lua create mode 100644 mods/ITEMS/mcl_banners/mod.conf create mode 100644 mods/ITEMS/mcl_banners/models/amc_banner.b3d create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_banner_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png create mode 100644 mods/ITEMS/mcl_banners/textures/mcl_banners_item_overlay.png diff --git a/mods/ITEMS/mcl_banners/README.txt b/mods/ITEMS/mcl_banners/README.txt new file mode 100644 index 00000000..330f46d6 --- /dev/null +++ b/mods/ITEMS/mcl_banners/README.txt @@ -0,0 +1,7 @@ +License of code: WTFPL + +License of textures: See README.me in top directory of MineClone 2. + +License of models: GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html) +Models author: 22i. +Source: https://github.com/22i/amc diff --git a/mods/ITEMS/mcl_banners/depends.txt b/mods/ITEMS/mcl_banners/depends.txt new file mode 100644 index 00000000..4fe44438 --- /dev/null +++ b/mods/ITEMS/mcl_banners/depends.txt @@ -0,0 +1,3 @@ +mcl_sounds? +mcl_core? +mcl_wool? diff --git a/mods/ITEMS/mcl_banners/description.txt b/mods/ITEMS/mcl_banners/description.txt new file mode 100644 index 00000000..fd303145 --- /dev/null +++ b/mods/ITEMS/mcl_banners/description.txt @@ -0,0 +1 @@ +Adds decorative banners. diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua new file mode 100644 index 00000000..827085e3 --- /dev/null +++ b/mods/ITEMS/mcl_banners/init.lua @@ -0,0 +1,124 @@ +local node_sounds +if minetest.get_modpath("mcl_sounds") then + node_sounds = mcl_sounds.node_sound_wood_defaults() +end + +-- Helper function +local function round(num, idp) + local mult = 10^(idp or 0) + return math.floor(num * mult + 0.5) / mult +end + +-- Banner node +minetest.register_node("mcl_banners:standing_banner_white", { + description = "White Banner", + _doc_items_longdesc = "Banners are tall decorative blocks which can be placed on the floor.", + walkable = false, + is_ground_content = false, + paramtype = "light", + sunlight_propagates = true, + drawtype = "airlike", + inventory_image = "mcl_banners_item_base.png^mcl_banners_item_overlay.png", + wield_image = "mcl_banners_item_base.png^mcl_banners_item_overlay.png", + selection_box = {type = "fixed", fixed= {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2} }, + tiles = {"mcl_banners_banner_base.png"}, + groups = { deco_block = 1, attached_node = 1 }, + stack_max = 16, + sounds = node_sounds, + + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + -- Use pointed node's on_rightclick function first, if present + local node_under = minetest.get_node(under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then + return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack + end + end + + -- Place the node! + local _, success = minetest.item_place_node(itemstack, placer, pointed_thing) + if not success then + return itemstack + end + + local place_pos + if minetest.registered_nodes[node_under.name].buildable_to then + place_pos = under + else + place_pos = above + end + place_pos.y = place_pos.y - 0.5 + + local banner = minetest.add_entity(place_pos, "mcl_banners:banner") + + -- Determine the rotation based on player's yaw + local yaw = placer:get_look_horizontal() + -- Select one of 16 possible rotations (0-15) + local rotation_level = round((yaw / (math.pi*2)) * 16) + local final_yaw = (rotation_level * (math.pi/8)) + math.pi + banner:set_yaw(final_yaw) + + if not minetest.settings:get_bool("creative_mode") then + itemstack:take_item() + end + minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}) + + return itemstack + end, + on_destruct = function(pos) + local objects = minetest.get_objects_inside_radius(pos, 0.5) + for _, v in ipairs(objects) do + if v:get_entity_name() == "mcl_banners:banner" then + v:remove() + end + end + end, + _mcl_hardness = 1, + _mcl_blast_resistance = 5, +}) + +minetest.register_entity("mcl_banners:banner", { + physical = false, + collide_with_objects = false, + visual = "mesh", + mesh = "amc_banner.b3d", + visual_size = { x=2.5, y=2.5 }, + textures = { "mcl_banners_banner_base.png" }, + collisionbox = { 0, 0, 0, 0, 0, 0 }, + + _base_color = nil, + + get_staticdata = function(self) + local out = { _base_color = self._base_color } + return minetest.serialize(out) + end, + on_activate = function(self, staticdata) + if staticdata and staticdata ~= "" then + local inp = minetest.deserialize(staticdata) + self._base_color = inp._base_color + end + self.object:set_armor_groups({immortal=1}) + end, +}) + +if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_wool") then + minetest.register_craft({ + output = "mcl_banners:standing_banner_white", + recipe = { + { "mcl_wool:white", "mcl_wool:white", "mcl_wool:white" }, + { "mcl_wool:white", "mcl_wool:white", "mcl_wool:white" }, + { "", "mcl_core:stick", "" }, + } + }) + +end + +minetest.register_craft({ + type = "fuel", + recipe = "mcl_banners:standing_banner_white", + burntime = 15, +}) + diff --git a/mods/ITEMS/mcl_banners/mod.conf b/mods/ITEMS/mcl_banners/mod.conf new file mode 100644 index 00000000..21126658 --- /dev/null +++ b/mods/ITEMS/mcl_banners/mod.conf @@ -0,0 +1 @@ +name = mcl_banners diff --git a/mods/ITEMS/mcl_banners/models/amc_banner.b3d b/mods/ITEMS/mcl_banners/models/amc_banner.b3d new file mode 100644 index 0000000000000000000000000000000000000000..f726fc1adb89accc731eee60431c5b81803b41ab GIT binary patch literal 3815 zcmZ>AGIqJo$H2hIz`)=X6dJ6@0A&}I7H8-g7#K1zFf`bsVu%U`1_p-z|NsB@^LKHb z%g4arT$+@sXJB9q5=X`k3=9npXV09m^?9#n0+9e2$iU$18tjq62QefpC?uGN2VyYD zDNJC64f`Y9ee8Pw*B{V0D{K$L3=9o63=AqDM}g&~{{P<(lhZgWydUIZn0(n09tR|O zkUFS5$c%>lAbBM7LGmDTZ6J0)>_^fMa>ITG1`T_t`Su|9LFK`EA@*;ugUN%;N0JAr z+0VcLl1JDNl?R&*(GM~oEKksUko{2igUkk*Vb8#@0>yqLd9WIYJj8qg?gQJ8q#xaU zaQH*z!E&H@fP@_+en93U$wTc2+YJh1dn9>~90)_*4^{&WKaQ2W7h5dVYpgUu(HzCiwm znh$b2*bGScfz98~AIIjvz`y`X|6niTXJ7!ygKz^l{Gjq+If(rS>>z3y z?2*g|$wTc2$%D-&D34@6NIw`eFo5)<*bfRnupB5HAo&j>549gA53(PcKT+(*DG#+D zCJ(X$svm4V!T3S4A8a?oeW3UQ+YgI>Song}*kf@&NFHoABz!^T2iSgC_`%!<(hn`a zKx!Ib=7Z$HauEALJ0uqRLoj}k{14I(!uHVcW56ALAonvM%VTjrKKnu8 z50=Lfe{l0*{)43-kpJwV{sY+$lLy%kb~_|}gYq_t`5<|)UWh!{d|L(vl==;%AB-XO z14jJ{k^`BsA0m&af1vdXOdb^X4Nx`6^(#mogrV{f^Fj3|l76T>sBD19gUUZ7d650~ z(7X?>f05+Da**-~RDOWnhg|=HlqY09NFG{0gUknEX#I__A4wi$KU5xJ zKR$T^=7Y;esD6;yQ2W7lgTesw0#3^AK(ZdQ2PTR4>ccb zHza+5r;K{(i;K9Ja z;LX6m0OEt#ehdr@z6=ZuJ`4;D{tOHZAU=p4#K6E1$iTo5z`(!|%)r0^;)B>>3=9mR z3=9k*3=9n63=9k)K8PK~z`zj6z`zi}z`zjAz`y|FgV=El3=FXh3=A<03=HuM3=AMX Ghz$TgVF$DT literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_banner_base.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_banner_base.png new file mode 100644 index 0000000000000000000000000000000000000000..6624632eeddcccda1ac5f7fe9bd4dd29461ee874 GIT binary patch literal 814 zcmeAS@N?(olHy`uVBq!ia0y~yU~m9o7G?$ph6wkZw+svn1_3@Ht_%ze-`_rb_26ns zm`7ehpsk6PpOe||&rd(Sy!Ze2yGU>QYv*>pczk8cjOL@;=j~oO#iuLwJ_7@TKuM5a zFvEWo!0k5sS{h19b zIZX>Q0#fd19(bz!bWO#YIa3eUp5JG2RV#P?s&66xzvR?k>-@hYXG+zCAT5^qkFV<$ z_2Q4%3T1LiZkl1~)p7eevy0eet_zl8ED4i5Mdv6iJK-=fc$UPTJ^S{ADJZu~l(h6P zDv(^ZS(d9sRbYSu9*(PDw_H0)wma0o}hA3@m+$vJ5N}FDu#JZ@FP6ZKDh5k0X|*P3C+ z2Jx+5UotgdG8ADh95nJ(VR@sGAZtuGM=HRGN^W9l>u9o{-1hA-P8QKt!1W+p`$PqcTh!sVolv{Wsjz+997* z)cB0aZKLc1#b<&E>lPa&vF*sIWsNw!;Nd)@0;O7pJ*O1RW_d9={O1f{O=erk)b(9X zO7@*?#lJ@}Wf%NX8BDYEnBDqUX}^ftb^K>#|Ay-&V)flSm+hOKE3} z?bMpSgU~#jI!Rlof8Q-1=?<=Y>X& zgrrB0_B`8ocV(#FxpS+-ByZcql^;2JYGz~12YIdnkN&1W28M(0Ze>5o%IsobU|{fc L^>bP0l+XkK-mPu? literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_base.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_base.png new file mode 100644 index 0000000000000000000000000000000000000000..4a912ade6990116e5cd239e72ca0fa46cf0e3ef4 GIT binary patch literal 442 zcmeAS@N?(olHy`uVBq!ia0y~yU~m9o4rT@hhPm4t-!L#R*aY~5xH2#>{Qv(y)LEk? z)4|D5GCR?ssxYv>J)Cd0S9JmM7oU zcs&LN29c5=zhH*{3>e^nJ|8Co1EZv;i(^Oy^uM0#ZHx6 zQ?&ZKNW>4v+iU0UG4ef_v@@rC@y_eq+z|(|w#KdA-1xO>b6`62?YDW$&#^Jtx@R(c zVQApw=6J{al)+NbX2EQR-M?k0us6s~e9G{W(UI{k^MRiZE=C7_IWfdKm^YkaxXgNr zaYfX9Mz{TZ7NP?0tUF2?ln(tC@l*sv`gZ literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_item_base.png new file mode 100644 index 0000000000000000000000000000000000000000..47f4348996dda60a0fea8c083846f150ab296ad6 GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4kiW$h6xih%orFL*h+%@f*HUdZyEbU1_p)* zPZ!6K3dZCG94eNX;uX@N?9pOBW?X5DIw+VpH=y)LbBw;Sf|8^2#QB;62X~qj1TEUj zCNOb<;{DSa^S9M$@ER~HMOE#(ab2Rr<3fOJ4x`JKFD6dRPZ=1_7b$#+)n=#zS?1~L K=d#Wzp$P!mS1;rM literal 0 HcmV?d00001 diff --git a/mods/ITEMS/mcl_banners/textures/mcl_banners_item_overlay.png b/mods/ITEMS/mcl_banners/textures/mcl_banners_item_overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..9ed2c05d9833de7864ccb5ecd892541a34b084b4 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4h9AW2CEqh_A)RqFqH)P1v4;|O+IVEz`zje z>Eakt!Pt9(S;*N@fc3zg|1BHO9)0n)r8Q#z>DblFM9WTptgzYd&c^k*c*l=tay(^U zpX%OXc>8d2G*9B2qiow}NNjGty**-TP3N5*N7;@zRB;7y^E-+-Es+0sS@PN0DE;K_ Ryb~bnJzf1=);T3K0RSH2J>CES literal 0 HcmV?d00001 diff --git a/tools/Texture_Conversion_Table.csv b/tools/Texture_Conversion_Table.csv index 4c97a8dd..2e1b448a 100644 --- a/tools/Texture_Conversion_Table.csv +++ b/tools/Texture_Conversion_Table.csv @@ -842,3 +842,5 @@ Source path,Source file,Target path,Target file,xs,ys,xl,yl,xt,yt /assets/minecraft/textures/painting,paintings_kristoffer_zetterstrand.png,/mods/ITEMS/gemalde/textures,gemalde_24.png,128,192,64,64,0,0 /assets/minecraft/textures/painting,paintings_kristoffer_zetterstrand.png,/mods/ITEMS/gemalde/textures,gemalde_25.png,192,64,64,48,0,0 /assets/minecraft/textures/painting,paintings_kristoffer_zetterstrand.png,/mods/ITEMS/gemalde/textures,gemalde_26.png,192,112,64,48,0,0 +/assets/minecraft/textures/items,banner_base.png,/mods/ITEMS/mcl_banners/textures,mcl_banners_item_base.png,,,,,, +/assets/minecraft/textures/items,banner_overlay.png,/mods/ITEMS/mcl_banners/textures,mcl_banners_item_overlay.png,,,,,,