From 4701c4d6e75c14a5ca68779f135344ce75f26aa1 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sun, 8 Jan 2023 20:39:20 -0500 Subject: [PATCH] Built basic lectern model, texture, and node definition. Created crafting recipe. Marked Lecterns as WIP. Started defining placement. Added in README.txt. --- mods/ITEMS/mcl_lectern/README.txt | 15 ++ mods/ITEMS/mcl_lectern/init.lua | 102 ++++++++ mods/ITEMS/mcl_lectern/mod.conf | 3 + .../models/mcl_lectern_lectern.obj | 223 ++++++++++++++++++ .../textures/mcl_lectern_lectern.png | Bin 0 -> 1108 bytes 5 files changed, 343 insertions(+) create mode 100644 mods/ITEMS/mcl_lectern/README.txt create mode 100644 mods/ITEMS/mcl_lectern/init.lua create mode 100644 mods/ITEMS/mcl_lectern/mod.conf create mode 100644 mods/ITEMS/mcl_lectern/models/mcl_lectern_lectern.obj create mode 100644 mods/ITEMS/mcl_lectern/textures/mcl_lectern_lectern.png diff --git a/mods/ITEMS/mcl_lectern/README.txt b/mods/ITEMS/mcl_lectern/README.txt new file mode 100644 index 000000000..8afe7108e --- /dev/null +++ b/mods/ITEMS/mcl_lectern/README.txt @@ -0,0 +1,15 @@ + +--- +# Mineclone2-Lectern +--- +A ground up creation of a lectern to be used in MineClone 2. Requires Minetest and Mineclone2. +--- + +Created by Michieal (FaerRaven) @ DateTime: 01/07/2023 (07JAN2023) + +* Made for MineClone 2 by Michieal. +* Texture made by Michieal; The model borrows the top from NathanS21's (Nathan Salapat) Lectern model; The rest of the + lectern model was created by Michieal. +* Creation date: 01/07/2023 (07JAN2023) +* License for Code: GPL3 +* License for Media: CC-BY-SA 4 diff --git a/mods/ITEMS/mcl_lectern/init.lua b/mods/ITEMS/mcl_lectern/init.lua new file mode 100644 index 000000000..127d1b575 --- /dev/null +++ b/mods/ITEMS/mcl_lectern/init.lua @@ -0,0 +1,102 @@ +-- Made for MineClone 2 by Michieal. +-- Texture made by Michieal; The model borrows the top from NathanS21's (Nathan Salapat) Lectern model; The rest of the +-- lectern model was created by Michieal. +-- Creation date: 01/07/2023 (07JAN2023) +-- License for Code: GPL3 +-- License for Media: CC-BY-SA 4 + +-- LOCALS +local modname = minetest.get_current_modname() +local S = minetest.get_translator(modname) +local node_sound = mcl_sounds.node_sound_wood_defaults() +local pi = 3.1415926 + +local lectern_def = { + description = S("Lectern"), + _tt_help = S("Lecterns not only look good, but are job site blocks for Librarians."), + _doc_items_longdesc = S("Lecterns not only look good, but are job site blocks for Librarians."), + _doc_items_usagehelp = S("Place the Lectern on a solid node for best results. May attract villagers, so it's best to place outside of where you call 'home'."), + sounds = node_sound, + paramtype = "light", + use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false, + paramtype2 = "facedir", + drawtype = "mesh", + mesh = "mcl_lectern_lectern.obj", + tiles = {"mcl_lectern_lectern.png", }, + groups = {handy = 1, axey = 1, flammable = 2, fire_encouragement = 5, fire_flammability = 5}, + drops = "mcl_lectern:lectern", + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + node_prediction = "", + _mcl_blast_resistance = 3, + _mcl_hardness = 2, + on_place = function(itemstack, placer, pointed_thing) + local above = pointed_thing.above + local under = pointed_thing.under + + local pos = under + local pname = placer:get_player_name() + if minetest.is_protected(pos, pname) then + minetest.record_protection_violation(pos, pname) + return + end + + -- Use pointed node's on_rightclick function first, if present + local node = minetest.get_node(pointed_thing.under) + if placer and not placer:get_player_control().sneak then + if minetest.registered_nodes[node.name] and minetest.registered_nodes[node.name].on_rightclick then + return minetest.registered_nodes[node.name].on_rightclick(pointed_thing.under, node, placer, itemstack) or itemstack + end + end + local dir = vector.subtract(under, above) + local wdir = minetest.dir_to_wallmounted(dir) + local fdir = minetest.dir_to_facedir(dir) + if wdir == 0 then + return itemstack + -- IE., no Hanging Lecterns for you! + end + if wdir == 1 then + -- (only make standing nodes...) + -- Determine the rotation based on player's yaw + local yaw = pi * 2 - placer:get_look_horizontal() + + -- Convert to 16 dir. + local rotation_level = math.round((yaw / (pi * 2)) * 16) + + -- put the rotation level within bounds. + if rotation_level > 15 then + rotation_level = 0 + elseif rotation_level < 0 then + rotation_level = 15 + end + + fdir = math.floor(rotation_level / 4) -- collapse that to 4 dir. + local lectern_node = ItemStack(itemstack) + -- Place the node! + local _, success = minetest.item_place_node(lectern_node, placer, pointed_thing, fdir) + if not success then + return itemstack + end + if not minetest.is_creative_enabled(placer:get_player_name()) then + itemstack:take_item() + end + end + return itemstack + end, + +} +minetest.register_node("mcl_lectern:lectern", lectern_def) +mcl_wip.register_wip_item("mcl_lectern:lectern") + +minetest.register_craft({ + output = "mcl_lectern:lectern", + recipe = { + {"group:slab", "group:slab", "group:slab"}, + {"", "mcl_books:bookshelf", ""}, + {"", "group:slab", ""}, + } +}) + +-- Base Aliases. +minetest.register_alias("lectern", "mcl_lectern:lectern") diff --git a/mods/ITEMS/mcl_lectern/mod.conf b/mods/ITEMS/mcl_lectern/mod.conf new file mode 100644 index 000000000..93cc24041 --- /dev/null +++ b/mods/ITEMS/mcl_lectern/mod.conf @@ -0,0 +1,3 @@ +name = mcl_lectern +depends = mcl_core, mcl_sounds, mcl_tools +author = Michieal \ No newline at end of file diff --git a/mods/ITEMS/mcl_lectern/models/mcl_lectern_lectern.obj b/mods/ITEMS/mcl_lectern/models/mcl_lectern_lectern.obj new file mode 100644 index 000000000..94e1db8e1 --- /dev/null +++ b/mods/ITEMS/mcl_lectern/models/mcl_lectern_lectern.obj @@ -0,0 +1,223 @@ +# Blender 3.5.0 Alpha +# www.blender.org +mtllib mcl_lectern_lectern.mtl +o Lectern_Cube.012 +v 0.179604 0.312500 -0.062500 +v -0.179604 0.312500 -0.062500 +v 0.179604 0.363193 0.205629 +v -0.179604 0.363193 0.205629 +v 0.179604 -0.375000 -0.062500 +v -0.179604 -0.375000 -0.062500 +v 0.179604 -0.375000 0.205629 +v -0.179604 -0.375000 0.205629 +v 0.311850 -0.500000 0.312500 +v 0.311850 -0.375000 0.312500 +v -0.311649 -0.500000 0.312500 +v -0.311649 -0.375000 0.312500 +v 0.311850 -0.500000 -0.312500 +v 0.311850 -0.375000 -0.312500 +v -0.311649 -0.500000 -0.312500 +v -0.311649 -0.375000 -0.312500 +v 0.312500 0.186356 -0.272278 +v 0.312500 0.245087 -0.293654 +v 0.312500 0.400118 0.315030 +v 0.312500 0.458849 0.293654 +v -0.312500 0.186356 -0.272278 +v -0.312500 0.245087 -0.293654 +v -0.312500 0.400118 0.315030 +v -0.312500 0.458849 0.293654 +v 0.312500 0.207732 -0.213547 +v 0.312500 0.266463 -0.234923 +v -0.312500 0.207732 -0.213547 +v -0.312500 0.266463 -0.234923 +v -0.312500 0.325194 -0.256299 +v -0.312500 0.303817 -0.315030 +v 0.312500 0.303817 -0.315030 +v 0.312500 0.325194 -0.256299 +v 0.151506 0.084133 0.146440 +v -0.157381 0.084133 0.146440 +v -0.157381 -0.203113 0.146441 +v 0.151506 -0.203113 0.146441 +v 0.151523 0.084130 -0.062500 +v -0.157397 0.084130 -0.062500 +v 0.151523 -0.203120 -0.062500 +v -0.157397 -0.203120 -0.062500 +v 0.151768 0.044855 0.077978 +v 0.064092 -0.203638 0.077978 +v 0.151797 0.044842 -0.062023 +v 0.064120 -0.203654 -0.062023 +v 0.028419 -0.191051 0.077979 +v 0.116095 0.057441 0.077979 +v 0.116124 0.057428 -0.062022 +v 0.028447 -0.191068 -0.062022 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -0.0000 -1.0000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vn -0.0000 0.3420 0.9397 +vn -0.0000 -0.3420 -0.9397 +vn -0.0000 -0.9397 0.3420 +vn -0.0000 0.9397 -0.3420 +vn -0.0000 -1.0000 -0.0000 +vn -1.0000 -0.0000 -0.0001 +vn 1.0000 -0.0000 -0.0001 +vn 0.9430 -0.3327 0.0002 +vn -0.9430 0.3327 -0.0002 +vn 0.3327 0.9430 -0.0000 +vn -0.3327 -0.9430 -0.0000 +vt 0.000000 0.000000 +vt 0.343750 -0.000000 +vt 0.312500 0.000000 +vt -0.000000 -0.000000 +vt 0.312500 0.000000 +vt 0.000000 0.000000 +vt 0.312500 0.000000 +vt 0.000000 0.000000 +vt 0.000000 0.437500 +vt 0.343750 0.625000 +vt 0.312500 0.437500 +vt -0.000000 0.625000 +vt 0.312500 0.437500 +vt 0.000000 0.437500 +vt 0.312500 0.437500 +vt 0.000000 0.437500 +vt 0.312500 0.593750 +vt 0.000000 0.593750 +vt 0.312500 0.656250 +vt 0.000000 0.656250 +vt 1.000000 1.000000 +vt 0.000000 0.593750 +vt 0.312500 0.593750 +vt 0.000000 0.656250 +vt 0.312500 0.656250 +vt 1.000000 0.437500 +vt 0.000000 0.593750 +vt 0.312500 0.593750 +vt 0.000000 0.656250 +vt 0.312500 0.656250 +vt 0.437500 1.000000 +vt 0.000000 0.593750 +vt 0.312500 0.593750 +vt 0.000000 0.656250 +vt 0.312500 0.656250 +vt 0.437500 0.437500 +vt 0.125000 1.000000 +vt 0.125000 0.687500 +vt 0.062500 0.687500 +vt 0.187500 1.000000 +vt 0.125000 1.000000 +vt 0.312500 1.000000 +vt 0.437500 1.000000 +vt 0.062500 1.000000 +vt 0.250000 1.000000 +vt 1.000000 1.000000 +vt 0.125000 0.687500 +vt 0.062500 0.687500 +vt 0.187500 0.687500 +vt 0.312500 0.687500 +vt 0.437500 0.437500 +vt 0.125000 1.000000 +vt 0.250000 0.687500 +vt 1.000000 0.437500 +vt 0.062500 1.000000 +vt 1.000000 1.000000 +vt 0.062500 1.000000 +vt 0.125000 0.718750 +vt 0.437500 1.000000 +vt 0.062500 0.718750 +vt 1.000000 0.437500 +vt 0.062500 0.687500 +vt 0.125000 0.718750 +vt 0.437500 0.437500 +vt 0.062500 0.718750 +vt 0.437500 0.687500 +vt -0.000000 0.718750 +vt 0.375000 0.687500 +vt -0.000000 0.687500 +vt 0.312500 0.687500 +vt 0.250000 0.687500 +vt 0.312500 1.000000 +vt -0.000000 0.687500 +vt 0.250000 1.000000 +vt 0.375000 1.000000 +vt -0.000000 0.718750 +vt 0.687500 0.375000 +vt 0.312500 0.375000 +vt 0.687500 0.375000 +vt 0.312500 0.000000 +vt 0.312500 0.375000 +vt 0.687500 0.000000 +vt 0.687500 0.375000 +vt 0.312500 0.375000 +vt 0.312500 0.218750 +vt 0.687500 -0.000000 +vt 0.031250 0.218750 +vt 0.312500 -0.000000 +vt 0.687500 -0.000000 +vt 0.312500 0.468750 +vt 0.687500 -0.000000 +vt 0.312500 -0.000000 +vt 0.031250 0.468750 +vt 0.312500 -0.000000 +vt 0.937500 -0.000000 +vt 0.937500 0.437500 +vt 0.937500 0.437500 +vt 1.000000 0.437500 +vt 0.687500 0.000000 +vt 0.937500 0.218750 +vt 0.750000 0.000000 +vt 0.687500 0.437500 +vt 0.750000 0.437500 +vt 1.000000 0.218750 +vt 0.937500 0.000000 +vt 1.000000 0.437500 +vt 0.937500 0.437500 +vt 0.937500 0.437500 +vt 1.000000 -0.000000 +vt 1.000000 0.437500 +vt 0.687500 0.437500 +vt 1.000000 0.218750 +vt 0.687500 0.000000 +vt 0.687500 0.000000 +vt 0.687500 0.437500 +vt 0.937500 0.218750 +s 0 +usemtl Material +f 1/1/1 3/5/1 7/13/1 5/9/1 +f 3/6/2 4/7/2 8/15/2 7/14/2 +f 9/17/2 10/19/2 12/24/2 11/22/2 +f 36/82/3 35/80/3 34/78/3 33/77/3 +f 8/16/4 4/8/4 2/3/4 6/11/4 +f 11/23/4 12/25/4 16/34/4 15/32/4 +f 15/33/3 16/35/3 14/29/3 13/27/3 +f 13/28/1 14/30/1 10/20/1 9/18/1 +f 16/36/5 12/26/5 10/21/5 14/31/5 +f 25/58/1 26/60/1 20/44/1 19/41/1 +f 19/42/6 20/45/6 24/53/6 23/50/6 +f 27/63/4 28/65/4 22/48/4 21/47/4 +f 21/47/7 22/49/7 18/40/7 17/37/7 +f 22/48/4 28/65/4 29/67/4 30/69/4 +f 25/56/8 19/43/8 23/51/8 27/61/8 +f 17/37/8 25/57/8 27/62/8 21/47/8 +f 24/54/9 20/46/9 26/59/9 28/64/9 +f 23/52/4 24/55/4 28/65/4 27/63/4 +f 17/38/1 18/39/1 26/60/1 25/58/1 +f 29/68/9 32/75/9 31/72/9 30/70/9 +f 28/66/6 26/59/6 32/75/6 29/68/6 +f 26/60/1 18/39/1 31/73/1 32/76/1 +f 18/40/7 22/49/7 30/71/7 31/74/7 +f 37/85/3 38/87/3 2/4/3 1/2/3 +f 39/90/3 37/85/3 1/2/3 5/10/3 +f 40/93/3 39/90/3 5/10/3 6/12/3 +f 38/87/3 40/93/3 6/12/3 2/4/3 +f 33/77/10 34/78/10 38/88/10 37/86/10 +f 35/81/5 36/83/5 39/91/5 40/94/5 +f 36/84/11 33/77/11 37/86/11 39/92/11 +f 34/79/12 35/81/12 40/94/12 38/89/12 +f 44/102/13 43/99/13 41/95/13 42/97/13 +f 45/105/14 46/108/14 47/111/14 48/114/14 +f 41/95/2 46/109/2 45/106/2 42/97/2 +f 43/100/15 47/112/15 46/110/15 41/96/15 +f 44/103/3 48/115/3 47/113/3 43/101/3 +f 42/98/16 45/107/16 48/116/16 44/104/16 diff --git a/mods/ITEMS/mcl_lectern/textures/mcl_lectern_lectern.png b/mods/ITEMS/mcl_lectern/textures/mcl_lectern_lectern.png new file mode 100644 index 0000000000000000000000000000000000000000..236c414f812bf4f98261396c61ba02e8e8db035c GIT binary patch literal 1108 zcmV-a1grarP)Il(_zI!|T_dbF-~ntp~RI2@nLRr7;+j zbLLdu9WVGsW__`six8tCBCIZ#SU2Kxcr#)MinY#=A};fv zl-dBOwG$Q@%;>=8c25dIccJ%=s1j6Z{d8VM6#;&KcS9K`LQsaB0AaNnP?@s=xLU8s zIU(LLhiN|{;dH)^6AB=rym@s=%8{`&+ze9%;N9D6Vhohh*z6`&s|B0U&_fwC}r|VZ1#vma*CKJD;4(U?8hzZwqU9a9CA*i7*IHgPeVe>RJq+v{PxFt zK*&*9EC*Wa?6xDNRNh~2i8=D(vn4SlLI`u~b!VE&>AX2{7%~z9i#X5d-sefBDy%LB zI*@~6X1F<}6l!VUPEcX77zi;w;eYw{dqm*tZ(aewcD@QW^Q-yk$8W(wTkp6TqJjpc zvpco5NPc<4^X?%4b0{K=Z9TY(V)aKHDXjs?L>5*YJp3om1CXe>}0796Z%aG#1<9))@bz^h8 zXFrxFp72xrv1R@+gfn`=r`aA`XY+*rxBh!IXY+(}xt|^`*rN)Z$rIvmDB`2+AAUTW zC*&~Z?@BIrqVUJh@JycYs0bZY9!79JPk5{c$kTUmHcxm|{f7?e4;s;#JmG`(>wdH% a0RI4`Sz