From 71018169b5ef65047fde6f67254d93c6e20f3269 Mon Sep 17 00:00:00 2001 From: ChristianFalegnami Date: Thu, 12 Mar 2026 23:51:35 +0100 Subject: [PATCH] Rabbit-1 Added Brown Rabbit model and a basic ai system. added toast variant, others have to be implemented. TODO: add other variants, add their spawn in the biomes, add IDS_RABBIT And change sounds. ADD color to the spwanegg. --- Minecraft.Client/Common/App_enums.h | 2 + .../Common/Colours/ColourTable.cpp | 3 + .../Common/UI/IUIScene_CreativeMenu.cpp | 2 + .../Common/res/1_2_2/mob/rabbit/black.png | Bin 0 -> 503 bytes .../Common/res/1_2_2/mob/rabbit/brown.png | Bin 0 -> 514 bytes .../res/1_2_2/mob/rabbit/caerbannog.png | Bin 0 -> 513 bytes .../Common/res/1_2_2/mob/rabbit/gold.png | Bin 0 -> 519 bytes .../Common/res/1_2_2/mob/rabbit/salt.png | Bin 0 -> 588 bytes .../Common/res/1_2_2/mob/rabbit/toast.png | Bin 0 -> 598 bytes .../Common/res/1_2_2/mob/rabbit/white.png | Bin 0 -> 512 bytes .../res/1_2_2/mob/rabbit/white_splotched.png | Bin 0 -> 625 bytes .../res/TitleUpdate/res/mob/rabbit/black.png | Bin 0 -> 503 bytes .../res/TitleUpdate/res/mob/rabbit/brown.png | Bin 0 -> 514 bytes .../TitleUpdate/res/mob/rabbit/caerbannog.png | Bin 0 -> 513 bytes .../res/TitleUpdate/res/mob/rabbit/gold.png | Bin 0 -> 519 bytes .../res/TitleUpdate/res/mob/rabbit/salt.png | Bin 0 -> 588 bytes .../res/TitleUpdate/res/mob/rabbit/toast.png | Bin 0 -> 598 bytes .../res/TitleUpdate/res/mob/rabbit/white.png | Bin 0 -> 512 bytes .../res/mob/rabbit/white_splotched.png | Bin 0 -> 625 bytes Minecraft.Client/EntityRenderDispatcher.cpp | 3 + Minecraft.Client/Minecraft.Client.vcxproj | 4 + .../Minecraft.Client.vcxproj.filters | 12 ++ Minecraft.Client/RabbitModel.cpp | 110 +++++++++++++++ Minecraft.Client/RabbitModel.h | 29 ++++ Minecraft.Client/RabbitRenderer.cpp | 51 +++++++ Minecraft.Client/RabbitRenderer.h | 27 ++++ Minecraft.Client/Textures.cpp | 11 ++ Minecraft.Client/Textures.h | 10 ++ Minecraft.World/Biome.cpp | 2 + Minecraft.World/Class.h | 2 + Minecraft.World/EntityIO.cpp | 7 + Minecraft.World/Minecraft.World.vcxproj | 2 + .../Minecraft.World.vcxproj.filters | 6 + Minecraft.World/Rabbit.cpp | 125 ++++++++++++++++++ Minecraft.World/Rabbit.h | 56 ++++++++ .../net.minecraft.world.entity.animal.h | 6 +- 36 files changed, 469 insertions(+), 1 deletion(-) create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/black.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/brown.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/caerbannog.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/gold.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/salt.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/toast.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/white.png create mode 100644 Minecraft.Client/Common/res/1_2_2/mob/rabbit/white_splotched.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/black.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/brown.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/caerbannog.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/gold.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/salt.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/toast.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/white.png create mode 100644 Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/white_splotched.png create mode 100644 Minecraft.Client/RabbitModel.cpp create mode 100644 Minecraft.Client/RabbitModel.h create mode 100644 Minecraft.Client/RabbitRenderer.cpp create mode 100644 Minecraft.Client/RabbitRenderer.h create mode 100644 Minecraft.World/Rabbit.cpp create mode 100644 Minecraft.World/Rabbit.h diff --git a/Minecraft.Client/Common/App_enums.h b/Minecraft.Client/Common/App_enums.h index 15a17978..fed940bb 100644 --- a/Minecraft.Client/Common/App_enums.h +++ b/Minecraft.Client/Common/App_enums.h @@ -438,6 +438,8 @@ enum eMinecraftColour eMinecraftColour_Mob_Witch_Colour2, eMinecraftColour_Mob_Horse_Colour1, eMinecraftColour_Mob_Horse_Colour2, + eMinecraftColour_Mob_Rabbit_Colour1, + eMinecraftColour_Mob_Rabbit_Colour2, eMinecraftColour_Armour_Default_Leather_Colour, diff --git a/Minecraft.Client/Common/Colours/ColourTable.cpp b/Minecraft.Client/Common/Colours/ColourTable.cpp index 07326b8c..9d079095 100644 --- a/Minecraft.Client/Common/Colours/ColourTable.cpp +++ b/Minecraft.Client/Common/Colours/ColourTable.cpp @@ -256,6 +256,9 @@ const wchar_t *ColourTable::ColourTableElements[eMinecraftColour_COUNT] = L"Mob_Witch_Colour2", L"Mob_Horse_Colour1", L"Mob_Horse_Colour2", + L"Mob_Rabbit_Colour1", + L"Mob_Rabbit_Colour2", + L"Armour_Default_Leather_Colour", L"Under_Water_Clear_Colour", diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 01666132..16437c55 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -392,9 +392,11 @@ void IUIScene_CreativeMenu::staticCtor() ITEM_AUX(Item::spawnEgg_Id, 96); // Mooshroom ITEM_AUX(Item::spawnEgg_Id, 98); // Ozelot ITEM_AUX(Item::spawnEgg_Id, 100); // Horse + ITEM_AUX(Item::spawnEgg_Id, 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12) ); // Donkey ITEM_AUX(Item::spawnEgg_Id, 100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule ITEM_AUX(Item::spawnEgg_Id, 120); // Villager + ITEM_AUX(Item::spawnEgg_Id, 101); // Rabbit Brown ITEM(Item::record_01_Id) ITEM(Item::record_02_Id) ITEM(Item::record_03_Id) diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/black.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/black.png new file mode 100644 index 0000000000000000000000000000000000000000..5e99fff9b42aed7b86cf99de305b0586a428b56b GIT binary patch literal 503 zcmV+#m<@y_Q}RaHz(OhQ6JGBPqKC@3HxAQ>1K6%`c#00930(PjVu00DGTPE!Ct z=GbNc00DbRL_t(|+I7$|Zrd;v#&M!cYq!~Yk=~%UXphit-CVa9usdaozSkD;*1pFK z*#eLpGMi68=D@s59w;d?66z0$dLVxS1i4z#!XP)a7VF^L>-}NfeRDNUDv$|)D%iv7 zM&NT0KY|skO9NY6(Fn4H=%2uDUjcs6m58eak(eg%X7jxQ`62%&AS@}xVMO=oGswpn zf5zJw2f$1zg$M*!RygHo?`%nZw`>Nx<=_kA5tSwy^+Qm{d{oq_Gt@zqB+ z##{W`*c*XCKGwB2_5Q;I#0MegN)Gjt1U?nZJkx|@eq@8SgV0yy5xL#vD9 tVFV9{HkkG=THv?VAHhVaSeY@OJp#*AGMTH>m}vk2002ovPDHLkV1g%o;-&xq literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/brown.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..76d8265af40775c266dbc1bd9b6be967dc088bb1 GIT binary patch literal 514 zcmV+d0{#7oP)+#m<@y_S8rIe(NbCiK%lzn20by|CAN@`g_V^l+7Q$txyJ5oqF4PqR_00001 zbW%=J06^y0W&i*IfJsC_RCwBT(7kRGK@`RD5e3*#(C{L>0Z)NKM-@I^z%J7Sp9=+U zBHc4IR7f+^(0ZoWj#uCjk}_@NVsbURo3)bNzr5?Cou4IZU8|O=5ZAY+wRi6McE8?z zbghyK!4W_j*uvTkz~?|efEBC@182CD0c3{gAHZhY0KUj2=~{t|X#_9MKQ+J)ycz+O zDaC$b_wPT%#~8oHKQZ<|RZ_}r2F3La80`pv8&XK>N}E|>`BKU$0MK<^o5xJjms%^% z@$GB^_N2{c@7$1n#?^cKMNo*3?cSMs^L7OEf#O`vq5UPor)s%J86e@KDb9mq$w7rG zK9z0`)MHUmh>D%h0q1LfxfL$l^fiUru0;S45MUVy6$BT7GE##2MG$21l*3{I!y}k6=?6;z&@y_S+*z2#AnDN%>x1gf7oS(Ozp|O~ov6q^$L{WAM z7q+&x|NsB>_4T_fWaM!h@+za0N(KaRTxawR>aA=u1uSIL?hQ>YAKR)ecRQPEaLlsi>WlHI~d9? zEn)x(e&raT(LicSQ+viPeAY2QLDHC_{DAXx=Mm^gi7CKZ|R%kpcOHoxpMFe@a zgQ)BkMU+82DU1v^=8m8^{hbZE!`xqV3GM>lN00000NkvXXu0mjf Dhq3XJ literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/gold.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/gold.png new file mode 100644 index 0000000000000000000000000000000000000000..68aa6e8209cd9b54688581500c0e62060efaa5de GIT binary patch literal 519 zcmV+i0{H!jP)11O|M$}P>8$_ov+>sH^4RO~&gcL8*7Vuz>f4_0;G^^8 zr~2!z{_nD0;A4dV0004WQchCLKXv$_iiyQ`hd+>^WliCS?+J4ul$k{1coo zBvP%q7UVC$Px!7(43R{YvwhzgR;_CFG8qzr*4dt9H?(i6f!PpJ8f938{o&Wc8|nhp z;!CdsQYkcsrm?=XD^>7pgHKPVfPgkNRImW8v)K^H(NIG*0a^u{XBVD7JwBP8RF&c7 zYhInKaiO2{OqL{qD#p15dK~kQbAXE1$L_L7B&r~y)dF6;Z-%H)BueU|vIG%PL{-s` zPEgS)DyVQ!AGcnX1!Kqd2Tr$}CNja;?=)|Cut8^=C-<39ilTL=sj6d9cgiJ-DA7(r z1v^%NV!t^-(P~TU=uyDR3h2?pO|vRmswgoEfR@|lDvU*<)U~ueWZRbI-Iue;wThF* zJ7(8MqpixdC=002ov JPDHLkV1oC%|33f# literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/salt.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/salt.png new file mode 100644 index 0000000000000000000000000000000000000000..b97048955901185d73975d1b2dce5f716977cb82 GIT binary patch literal 588 zcmV-S0<-;zP)tj?yVN*j{OgpHQeYB;NQb;*rS4nt0004WQchC5VhF>^==6r=SU>p}x0>8WB}h7F_&;jjqn_OOGV zVD(+FF4p0MN}=Jgir9Y(B#rze`WI24R0kTwi~Ccs_=r=rQZ ztC>+%ad`b_|DVw*Mf3T{{G3FfMNUwC>r`nT_B?$sDu^;GL=%;0v|cCC=m!{GaF`(~ z8bV5bCi~v0ts7>U^1kWp`@5~?Z@KvK!`s6?)ztk~;60+r-b*6g-lV_Uw5F}Q8|K~F zB^%EDnGHDMh0P8NdAS;3PYP`cC^$sxnmG&4qOIqw3Zs(ifkm++^wbMv=v)@%`UZz` zs1%2F$@Kt+{vyB}w5JI!3xuY$It8}_DPdgzD+?``YbT7Fs4QUT6h+$Q z>l0oL9&PsPFSq}oNsTJ*2#_1!-yMkD5lAOSP45UujGB8-@OL9V?i4l;B%1bknIhry ai@+a1>h!STGeK7X0000W?Y literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/toast.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/toast.png new file mode 100644 index 0000000000000000000000000000000000000000..1f8cc852b201e0988e32a777f28a7cb83331f98e GIT binary patch literal 598 zcmV-c0;&CpP)lew;o#oh*3{I!y}fjFbaHZXZ*OmIZfpIOzXBEi#EbA&_8@G*uys%;WJ8*5I?KqO0jk z_on0G-iY%c4>mqO^2vYY0VJtsH$5|pi!m88g004?LLanb4SBkOkA9%8#$pW!UENn%@ z>f1X{Y`t_B^#Zw{na4&cv_^eO0{q^!OSqvlUC$Pwv{F!AtttuN$=)--nFU&D3f+qK zW{Z)-=<0@6N@DWXfEYQq(kRV=c%yJr<(swRh%eZ!_KJRiwO?mB;Kc#z$-&um3Uz6! zT&YS~i*lvBZ-rL0%11*C1_1~j>{SYhN~ow*03m=>3ie9=KPnX@0Z4##xVJ>GmdpsT zHHkMl9`En%C$B48F>Gac-C`@dgkpZ^247F(3Lie)yx&i*x`DP8eMNwLXYlIwvEl^G ktr?l*6u|Aw>^}wg7oQ8Hknl$@_y7O^07*qoM6N<$g4iDv5&!@I literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/1_2_2/mob/rabbit/white.png b/Minecraft.Client/Common/res/1_2_2/mob/rabbit/white.png new file mode 100644 index 0000000000000000000000000000000000000000..96faf53880352de9c9224837725c9ec05002258f GIT binary patch literal 512 zcmV+b0{{JqP)21l*3{I!y}k6=?D5X$@z&|`*z5k<-v8g@|KsQX;^z0$*Z_4TN__>2Gm00DGTPE!Ct=GbNc00C@CL_t(|+P%@ciW@-`1kh8xQsBsD zHT(ZRINHcyY*|wV2Mxo3kdi$?zo3hIyJI@5xEI;%3;-KgvSu^7bUm4>DXCzu#PqS! zsMW{7)M_MRujqe(AGmxM22-^aaj+~4)9Mz{$aR=nisX2|?P5wQJ_{#PX%25N6x-O| z5Cdq?>;p6!NKI*KeNR>*;O-avtbKrjq%lSDiDP%i7U)QcDbfOofVj9~xmHYJCf-cn zw%_cHUasVwRnBb{5zKW0B-#Gh8$@X~Icv2dpem67ZXP>9MG0D=@vNMSstPJ1$g>qh zWveKn4B|;)WVkVB1jS)@H0TC%e$gqo3*@h;*9?RpNW5r7WDep*d8?p8C7Tk(f)yax z9E}8tBqT;g04pmXBLj|3B1niJ)Jy;*4}Kvq2dxl$O*|zzpC6nY4SP}cQV*Q$<&ZGw zS5_dKW8_N}sJ*<@g0L441t22=v|4GB0NVCg8~g*tC!=+|p9|Lj0000m45@hB)LARr(a7#I~56+%KnGBPsw)Y$&o-v8a<|KH>P;^z0$*ZG96z^x5o8OiXBKX#fBJ0002>_4U2Iz1Gy!;NIS+i;%_u0004WQchCqB>;_t!;L`Xvv3#uRn_5}U@ag(klV#5HfOuWAQf87b{TEA$T2AE9Icj&n)82zAm z&LjY8tr{j(!WDrzWQryru@!U9@1QE8sBzRT%C&w<5P+r3_uxLXyLZRbqnq!S1>yiw ziR(c{p9<;(I67&7BY{2>B%P*0KtRAlfj$wm-ggp60yN<3nMOx6@W?q7?ZvqN)e0jprf`$Drvg0jU(>>#bof)hirP0j2)A literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/black.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/black.png new file mode 100644 index 0000000000000000000000000000000000000000..5e99fff9b42aed7b86cf99de305b0586a428b56b GIT binary patch literal 503 zcmV+#m<@y_Q}RaHz(OhQ6JGBPqKC@3HxAQ>1K6%`c#00930(PjVu00DGTPE!Ct z=GbNc00DbRL_t(|+I7$|Zrd;v#&M!cYq!~Yk=~%UXphit-CVa9usdaozSkD;*1pFK z*#eLpGMi68=D@s59w;d?66z0$dLVxS1i4z#!XP)a7VF^L>-}NfeRDNUDv$|)D%iv7 zM&NT0KY|skO9NY6(Fn4H=%2uDUjcs6m58eak(eg%X7jxQ`62%&AS@}xVMO=oGswpn zf5zJw2f$1zg$M*!RygHo?`%nZw`>Nx<=_kA5tSwy^+Qm{d{oq_Gt@zqB+ z##{W`*c*XCKGwB2_5Q;I#0MegN)Gjt1U?nZJkx|@eq@8SgV0yy5xL#vD9 tVFV9{HkkG=THv?VAHhVaSeY@OJp#*AGMTH>m}vk2002ovPDHLkV1g%o;-&xq literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/brown.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..76d8265af40775c266dbc1bd9b6be967dc088bb1 GIT binary patch literal 514 zcmV+d0{#7oP)+#m<@y_S8rIe(NbCiK%lzn20by|CAN@`g_V^l+7Q$txyJ5oqF4PqR_00001 zbW%=J06^y0W&i*IfJsC_RCwBT(7kRGK@`RD5e3*#(C{L>0Z)NKM-@I^z%J7Sp9=+U zBHc4IR7f+^(0ZoWj#uCjk}_@NVsbURo3)bNzr5?Cou4IZU8|O=5ZAY+wRi6McE8?z zbghyK!4W_j*uvTkz~?|efEBC@182CD0c3{gAHZhY0KUj2=~{t|X#_9MKQ+J)ycz+O zDaC$b_wPT%#~8oHKQZ<|RZ_}r2F3La80`pv8&XK>N}E|>`BKU$0MK<^o5xJjms%^% z@$GB^_N2{c@7$1n#?^cKMNo*3?cSMs^L7OEf#O`vq5UPor)s%J86e@KDb9mq$w7rG zK9z0`)MHUmh>D%h0q1LfxfL$l^fiUru0;S45MUVy6$BT7GE##2MG$21l*3{I!y}k6=?6;z&@y_S+*z2#AnDN%>x1gf7oS(Ozp|O~ov6q^$L{WAM z7q+&x|NsB>_4T_fWaM!h@+za0N(KaRTxawR>aA=u1uSIL?hQ>YAKR)ecRQPEaLlsi>WlHI~d9? zEn)x(e&raT(LicSQ+viPeAY2QLDHC_{DAXx=Mm^gi7CKZ|R%kpcOHoxpMFe@a zgQ)BkMU+82DU1v^=8m8^{hbZE!`xqV3GM>lN00000NkvXXu0mjf Dhq3XJ literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/gold.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/gold.png new file mode 100644 index 0000000000000000000000000000000000000000..68aa6e8209cd9b54688581500c0e62060efaa5de GIT binary patch literal 519 zcmV+i0{H!jP)11O|M$}P>8$_ov+>sH^4RO~&gcL8*7Vuz>f4_0;G^^8 zr~2!z{_nD0;A4dV0004WQchCLKXv$_iiyQ`hd+>^WliCS?+J4ul$k{1coo zBvP%q7UVC$Px!7(43R{YvwhzgR;_CFG8qzr*4dt9H?(i6f!PpJ8f938{o&Wc8|nhp z;!CdsQYkcsrm?=XD^>7pgHKPVfPgkNRImW8v)K^H(NIG*0a^u{XBVD7JwBP8RF&c7 zYhInKaiO2{OqL{qD#p15dK~kQbAXE1$L_L7B&r~y)dF6;Z-%H)BueU|vIG%PL{-s` zPEgS)DyVQ!AGcnX1!Kqd2Tr$}CNja;?=)|Cut8^=C-<39ilTL=sj6d9cgiJ-DA7(r z1v^%NV!t^-(P~TU=uyDR3h2?pO|vRmswgoEfR@|lDvU*<)U~ueWZRbI-Iue;wThF* zJ7(8MqpixdC=002ov JPDHLkV1oC%|33f# literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/salt.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/salt.png new file mode 100644 index 0000000000000000000000000000000000000000..b97048955901185d73975d1b2dce5f716977cb82 GIT binary patch literal 588 zcmV-S0<-;zP)tj?yVN*j{OgpHQeYB;NQb;*rS4nt0004WQchC5VhF>^==6r=SU>p}x0>8WB}h7F_&;jjqn_OOGV zVD(+FF4p0MN}=Jgir9Y(B#rze`WI24R0kTwi~Ccs_=r=rQZ ztC>+%ad`b_|DVw*Mf3T{{G3FfMNUwC>r`nT_B?$sDu^;GL=%;0v|cCC=m!{GaF`(~ z8bV5bCi~v0ts7>U^1kWp`@5~?Z@KvK!`s6?)ztk~;60+r-b*6g-lV_Uw5F}Q8|K~F zB^%EDnGHDMh0P8NdAS;3PYP`cC^$sxnmG&4qOIqw3Zs(ifkm++^wbMv=v)@%`UZz` zs1%2F$@Kt+{vyB}w5JI!3xuY$It8}_DPdgzD+?``YbT7Fs4QUT6h+$Q z>l0oL9&PsPFSq}oNsTJ*2#_1!-yMkD5lAOSP45UujGB8-@OL9V?i4l;B%1bknIhry ai@+a1>h!STGeK7X0000W?Y literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/toast.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/toast.png new file mode 100644 index 0000000000000000000000000000000000000000..1f8cc852b201e0988e32a777f28a7cb83331f98e GIT binary patch literal 598 zcmV-c0;&CpP)lew;o#oh*3{I!y}fjFbaHZXZ*OmIZfpIOzXBEi#EbA&_8@G*uys%;WJ8*5I?KqO0jk z_on0G-iY%c4>mqO^2vYY0VJtsH$5|pi!m88g004?LLanb4SBkOkA9%8#$pW!UENn%@ z>f1X{Y`t_B^#Zw{na4&cv_^eO0{q^!OSqvlUC$Pwv{F!AtttuN$=)--nFU&D3f+qK zW{Z)-=<0@6N@DWXfEYQq(kRV=c%yJr<(swRh%eZ!_KJRiwO?mB;Kc#z$-&um3Uz6! zT&YS~i*lvBZ-rL0%11*C1_1~j>{SYhN~ow*03m=>3ie9=KPnX@0Z4##xVJ>GmdpsT zHHkMl9`En%C$B48F>Gac-C`@dgkpZ^247F(3Lie)yx&i*x`DP8eMNwLXYlIwvEl^G ktr?l*6u|Aw>^}wg7oQ8Hknl$@_y7O^07*qoM6N<$g4iDv5&!@I literal 0 HcmV?d00001 diff --git a/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/white.png b/Minecraft.Client/Common/res/TitleUpdate/res/mob/rabbit/white.png new file mode 100644 index 0000000000000000000000000000000000000000..96faf53880352de9c9224837725c9ec05002258f GIT binary patch literal 512 zcmV+b0{{JqP)21l*3{I!y}k6=?D5X$@z&|`*z5k<-v8g@|KsQX;^z0$*Z_4TN__>2Gm00DGTPE!Ct=GbNc00C@CL_t(|+P%@ciW@-`1kh8xQsBsD zHT(ZRINHcyY*|wV2Mxo3kdi$?zo3hIyJI@5xEI;%3;-KgvSu^7bUm4>DXCzu#PqS! zsMW{7)M_MRujqe(AGmxM22-^aaj+~4)9Mz{$aR=nisX2|?P5wQJ_{#PX%25N6x-O| z5Cdq?>;p6!NKI*KeNR>*;O-avtbKrjq%lSDiDP%i7U)QcDbfOofVj9~xmHYJCf-cn zw%_cHUasVwRnBb{5zKW0B-#Gh8$@X~Icv2dpem67ZXP>9MG0D=@vNMSstPJ1$g>qh zWveKn4B|;)WVkVB1jS)@H0TC%e$gqo3*@h;*9?RpNW5r7WDep*d8?p8C7Tk(f)yax z9E}8tBqT;g04pmXBLj|3B1niJ)Jy;*4}Kvq2dxl$O*|zzpC6nY4SP}cQV*Q$<&ZGw zS5_dKW8_N}sJ*<@g0L441t22=v|4GB0NVCg8~g*tC!=+|p9|Lj0000m45@hB)LARr(a7#I~56+%KnGBPsw)Y$&o-v8a<|KH>P;^z0$*ZG96z^x5o8OiXBKX#fBJ0002>_4U2Iz1Gy!;NIS+i;%_u0004WQchCqB>;_t!;L`Xvv3#uRn_5}U@ag(klV#5HfOuWAQf87b{TEA$T2AE9Icj&n)82zAm z&LjY8tr{j(!WDrzWQryru@!U9@1QE8sBzRT%C&w<5P+r3_uxLXyLZRbqnq!S1>yiw ziR(c{p9<;(I67&7BY{2>B%P*0KtRAlfj$wm-ggp60yN<3nMOx6@W?q7?ZvqN)e0jprf`$Drvg0jU(>>#bof)hirP0j2)A literal 0 HcmV?d00001 diff --git a/Minecraft.Client/EntityRenderDispatcher.cpp b/Minecraft.Client/EntityRenderDispatcher.cpp index 01972e56..b848ca6f 100644 --- a/Minecraft.Client/EntityRenderDispatcher.cpp +++ b/Minecraft.Client/EntityRenderDispatcher.cpp @@ -82,6 +82,7 @@ #include "ZombieRenderer.h" #include "BatRenderer.h" #include "CaveSpiderRenderer.h" +#include "RabbitRenderer.h" double EntityRenderDispatcher::xOff = 0.0; double EntityRenderDispatcher::yOff = 0.0; @@ -132,6 +133,8 @@ EntityRenderDispatcher::EntityRenderDispatcher() renderers[eTYPE_WITHERBOSS] = new WitherBossRenderer(); + renderers[eTYPE_RABBIT] = new RabbitRenderer(); + renderers[eTYPE_ENTITY] = new DefaultRenderer(); renderers[eTYPE_PAINTING] = new PaintingRenderer(); renderers[eTYPE_ITEM_FRAME] = new ItemFrameRenderer(); diff --git a/Minecraft.Client/Minecraft.Client.vcxproj b/Minecraft.Client/Minecraft.Client.vcxproj index d97cbc38..e24355eb 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj +++ b/Minecraft.Client/Minecraft.Client.vcxproj @@ -20711,6 +20711,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU + + true true @@ -37928,6 +37930,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CUtrue true + + true true diff --git a/Minecraft.Client/Minecraft.Client.vcxproj.filters b/Minecraft.Client/Minecraft.Client.vcxproj.filters index 23b754fa..9ea3d45b 100644 --- a/Minecraft.Client/Minecraft.Client.vcxproj.filters +++ b/Minecraft.Client/Minecraft.Client.vcxproj.filters @@ -3793,6 +3793,12 @@ Header Files + + net\minecraft\client\model + + + net\minecraft\client\renderer\entity + @@ -5949,6 +5955,12 @@ include\lce_filesystem + + net\minecraft\client\model + + + net\minecraft\client\renderer\entity + diff --git a/Minecraft.Client/RabbitModel.cpp b/Minecraft.Client/RabbitModel.cpp new file mode 100644 index 00000000..82ca5fa4 --- /dev/null +++ b/Minecraft.Client/RabbitModel.cpp @@ -0,0 +1,110 @@ +#include "stdafx.h" +#include "RabbitModel.h" +#include "ModelPart.h" +#include "..\Minecraft.World\Mth.h" +#include "../Minecraft.World/Rabbit.h" + +#define PI 3.14159265358979323846f + +RabbitModel::RabbitModel() : Model() +{ + this->texWidth = 64; + this->texHeight = 32; + + // head part + head = new ModelPart(this, 32, 0); + head->addBox(-2.5F, -4.0F, -5.0F, 5, 4, 5); + head->setPos(0.0F, 16.0F, -1.0F); + + rightEar = new ModelPart(this, 52, 0); + rightEar->addBox(-2.5F, -9.0F, -1.0F, 2, 5, 1); + rightEar->setPos(0.0F, 0.0F, 0.0F); + rightEar->yRot = -PI / 12.0f; + + leftEar = new ModelPart(this, 58, 0); + leftEar->addBox(0.5F, -9.0F, -1.0F, 2, 5, 1); + leftEar->setPos(0.0F, 0.0F, 0.0F); + leftEar->yRot = PI / 12.0f; + + nose = new ModelPart(this, 32, 9); + nose->addBox(-0.5F, -2.5F, -5.5F, 1, 1, 1); + nose->setPos(0.0F, 0.0F, 0.0F); + + head->addChild(rightEar); + head->addChild(leftEar); + head->addChild(nose); + + // body part + body = new ModelPart(this, 0, 0); + body->addBox(-3.0F, -2.0F, -10.0F, 6, 5, 10); + body->setPos(0.0F, 19.0F, 8.0F); + body->xRot = -PI / 9.0f; + + tail = new ModelPart(this, 52, 6); + tail->addBox(-1.5F, -1.5F, 0.0F, 3, 3, 2); + tail->setPos(0.0F, 20.0F, 7.0F); + tail->xRot = -0.3490659F; + + // front legs + leftHindThigh = new ModelPart(this, 30, 15); + leftHindThigh->addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5); + leftHindThigh->setPos(3.0F, 17.5F, 3.7F); + leftHindThigh->xRot = -0.36651915F; + + leftHindFoot = new ModelPart(this, 26, 24); + leftHindFoot->addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7); + leftHindFoot->setPos(0.0F, 0.0F, 0.0F); + leftHindFoot->xRot = 0.36651915F; + leftHindThigh->addChild(leftHindFoot); + + rightHindThigh = new ModelPart(this, 16, 15); + rightHindThigh->addBox(-1.0F, 0.0F, 0.0F, 2, 4, 5); + rightHindThigh->setPos(-3.0F, 17.5F, 3.7F); + rightHindThigh->xRot = -0.36651915F; + + rightHindFoot = new ModelPart(this, 8, 24); + rightHindFoot->addBox(-1.0F, 5.5F, -3.7F, 2, 1, 7); + rightHindFoot->setPos(0.0F, 0.0F, 0.0F); + rightHindFoot->xRot = 0.36651915F; + rightHindThigh->addChild(rightHindFoot); + + // back legs + leftFrontLeg = new ModelPart(this, 8, 15); + leftFrontLeg->addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2); + leftFrontLeg->setPos(3.0F, 17.0F, -1.0F); + leftFrontLeg->xRot = -0.19198622F; + + rightFrontLeg = new ModelPart(this, 0, 15); + rightFrontLeg->addBox(-1.0F, 0.0F, -1.0F, 2, 7, 2); + rightFrontLeg->setPos(-3.0F, 17.0F, -1.0F); + rightFrontLeg->xRot = -0.19198622F; +} + +void RabbitModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +{ + shared_ptr rabbit = dynamic_pointer_cast(entity); + + // head animation + head->xRot = xRot * (PI / 180.0f); + head->yRot = yRot * (PI / 180.0f); + + // jump animation + float jumpCompletion = 0.0f; + if (rabbit) jumpCompletion = rabbit->getJumpCompletion(bob); + + float jumpSin = Mth::sin(jumpCompletion * PI); + + leftHindThigh->xRot = -0.36651915F + (jumpSin * 50.0f * (PI / 180.0f)); + rightHindThigh->xRot = -0.36651915F + (jumpSin * 50.0f * (PI / 180.0f)); + leftFrontLeg->xRot = -0.19198622F + (jumpSin * -40.0f * (PI / 180.0f)); + rightFrontLeg->xRot = -0.19198622F + (jumpSin * -40.0f * (PI / 180.0f)); + + + head->render(scale, usecompiled); + body->render(scale, usecompiled); + tail->render(scale, usecompiled); + leftHindThigh->render(scale, usecompiled); + rightHindThigh->render(scale, usecompiled); + leftFrontLeg->render(scale, usecompiled); + rightFrontLeg->render(scale, usecompiled); +} \ No newline at end of file diff --git a/Minecraft.Client/RabbitModel.h b/Minecraft.Client/RabbitModel.h new file mode 100644 index 00000000..fdfe3a2f --- /dev/null +++ b/Minecraft.Client/RabbitModel.h @@ -0,0 +1,29 @@ +#pragma once +#include "Model.h" + +class RabbitModel : public Model +{ +private: + ModelPart *head; + ModelPart *nose; + ModelPart *leftEar; + ModelPart *rightEar; + + ModelPart *body; + ModelPart *tail; + ModelPart *leftFrontLeg; + ModelPart *rightFrontLeg; + + ModelPart *leftHindThigh; + ModelPart *leftHindFoot; + ModelPart *rightHindThigh; + ModelPart *rightHindFoot; + +public: + RabbitModel(); + + virtual void render(shared_ptr entity, + float time, float r, float bob, + float yRot, float xRot, + float scale, bool usecompiled) override; +}; \ No newline at end of file diff --git a/Minecraft.Client/RabbitRenderer.cpp b/Minecraft.Client/RabbitRenderer.cpp new file mode 100644 index 00000000..7f3d1331 --- /dev/null +++ b/Minecraft.Client/RabbitRenderer.cpp @@ -0,0 +1,51 @@ +#include "stdafx.h" +#include "RabbitRenderer.h" +#include "RabbitModel.h" +#include "MobRenderer.h" +#include "../Minecraft.World/Rabbit.h" + + +ResourceLocation RabbitRenderer::LOC_BROWN = ResourceLocation(TN_MOB_RABBIT_BROWN); +ResourceLocation RabbitRenderer::LOC_WHITE = ResourceLocation(TN_MOB_RABBIT_WHITE); +ResourceLocation RabbitRenderer::LOC_BLACK = ResourceLocation(TN_MOB_RABBIT_BLACK); +ResourceLocation RabbitRenderer::LOC_GOLD = ResourceLocation(TN_MOB_RABBIT_GOLD); +ResourceLocation RabbitRenderer::LOC_SALT = ResourceLocation(TN_MOB_RABBIT_SALT); +ResourceLocation RabbitRenderer::LOC_WHITE_SPLOTCHED = ResourceLocation(TN_MOB_RABBIT_WHITE_SPLOTCHED); +ResourceLocation RabbitRenderer::LOC_TOAST = ResourceLocation(TN_MOB_RABBIT_TOAST); +ResourceLocation RabbitRenderer::LOC_EVIL = ResourceLocation(TN_MOB_RABBIT_CAERBANNOG); + +RabbitRenderer::RabbitRenderer() : MobRenderer(new RabbitModel(), 0.3f) +{ + +} + +ResourceLocation *RabbitRenderer::getTextureLocation(shared_ptr entity) +{ + shared_ptr mob = dynamic_pointer_cast(entity); + if (mob == nullptr) return &LOC_BROWN; + + // easter egg toast + if (mob->hasCustomName() && mob->getCustomName() == L"Toast") + { + return &LOC_TOAST; + } + + // variants + switch (mob->getVariant()) + { + case Rabbit::Variant::WHITE: return &LOC_WHITE; + case Rabbit::Variant::BLACK: return &LOC_BLACK; + case Rabbit::Variant::GOLD: return &LOC_GOLD; + case Rabbit::Variant::SALT: return &LOC_SALT; + case Rabbit::Variant::WHITE_SPLOTCHED: return &LOC_WHITE_SPLOTCHED; + case Rabbit::Variant::EVIL: return &LOC_EVIL; + case Rabbit::Variant::BROWN: + default: return &LOC_BROWN; + } +} + +void RabbitRenderer::scale(shared_ptr _mob, float a) +{ + + glScalef(0.65f, 0.65f, 0.65f); +} \ No newline at end of file diff --git a/Minecraft.Client/RabbitRenderer.h b/Minecraft.Client/RabbitRenderer.h new file mode 100644 index 00000000..74e94083 --- /dev/null +++ b/Minecraft.Client/RabbitRenderer.h @@ -0,0 +1,27 @@ +#pragma once +#include "MobRenderer.h" + +class Rabbit; +class LivingEntity; + +class RabbitRenderer : public MobRenderer +{ +private: + + static ResourceLocation LOC_BROWN; + static ResourceLocation LOC_WHITE; + static ResourceLocation LOC_BLACK; + static ResourceLocation LOC_GOLD; + static ResourceLocation LOC_SALT; + static ResourceLocation LOC_WHITE_SPLOTCHED; + static ResourceLocation LOC_TOAST; + static ResourceLocation LOC_EVIL; + +public: + RabbitRenderer(); + + virtual ResourceLocation *getTextureLocation(shared_ptr entity) override; + +protected: + virtual void scale(shared_ptr mob, float a) override; +}; \ No newline at end of file diff --git a/Minecraft.Client/Textures.cpp b/Minecraft.Client/Textures.cpp index ba7c0282..13efd3e7 100644 --- a/Minecraft.Client/Textures.cpp +++ b/Minecraft.Client/Textures.cpp @@ -156,6 +156,17 @@ const wchar_t *Textures::preLoaded[TN_COUNT] = L"mob/wither/wither_armor", L"mob/wither/wither_invulnerable", + //TU31 + L"mob/rabbit/brown", + L"mob/rabbit/white", + L"mob/rabbit/black", + L"mob/rabbit/gold", + L"mob/rabbit/salt", + L"mob/rabbit/white_splotched", + L"mob/rabbit/toast", + L"mob/rabbit/caerbannog", + + L"item/trapped", L"item/trapped_double", //L"item/christmas", diff --git a/Minecraft.Client/Textures.h b/Minecraft.Client/Textures.h index 1fca5610..73cf15cd 100644 --- a/Minecraft.Client/Textures.h +++ b/Minecraft.Client/Textures.h @@ -146,6 +146,16 @@ typedef enum _TEXTURE_NAME TN_MOB_WITHER_ARMOR, TN_MOB_WITHER_INVULNERABLE, + //TU31 + TN_MOB_RABBIT_BROWN, + TN_MOB_RABBIT_WHITE, + TN_MOB_RABBIT_BLACK, + TN_MOB_RABBIT_GOLD, + TN_MOB_RABBIT_SALT, + TN_MOB_RABBIT_WHITE_SPLOTCHED, + TN_MOB_RABBIT_TOAST, + TN_MOB_RABBIT_CAERBANNOG, + TN_TILE_TRAP_CHEST, TN_TILE_LARGE_TRAP_CHEST, //TN_TILE_XMAS_CHEST, diff --git a/Minecraft.World/Biome.cpp b/Minecraft.World/Biome.cpp index 9e3bc4c5..388f0afa 100644 --- a/Minecraft.World/Biome.cpp +++ b/Minecraft.World/Biome.cpp @@ -116,6 +116,8 @@ Biome::Biome(int id) : id(id) friendlies_chicken.push_back(new MobSpawnerData(eTYPE_CHICKEN, 10, 4, 4)); // 4J - moved chickens to their own category friendlies.push_back(new MobSpawnerData(eTYPE_COW, 8, 4, 4)); + friendlies.push_back(new MobSpawnerData(eTYPE_RABBIT, 7, 1, 2)); + enemies.push_back(new MobSpawnerData(eTYPE_SPIDER, 10, 4, 4)); enemies.push_back(new MobSpawnerData(eTYPE_ZOMBIE, 10, 4, 4)); enemies.push_back(new MobSpawnerData(eTYPE_SKELETON, 10, 4, 4)); diff --git a/Minecraft.World/Class.h b/Minecraft.World/Class.h index 25802c3f..103c0f1b 100644 --- a/Minecraft.World/Class.h +++ b/Minecraft.World/Class.h @@ -136,6 +136,7 @@ enum eINSTANCEOF eTYPE_SHEEP = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x2, eTYPE_PIG = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x3, eTYPE_CHICKEN = eTYPE_ANIMAL | 0x4, + eTYPE_RABBIT = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | 0x5, eTYPE_COW = eTYPE_ANIMAL | eTYPE_ANIMALS_SPAWN_LIMIT_CHECK | BIT_COW, eTYPE_MUSHROOMCOW = eTYPE_COW | 0x1, @@ -409,6 +410,7 @@ public: classes->push_back( SUBCLASS(eTYPE_SHEEP )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) ); classes->push_back( SUBCLASS(eTYPE_PIG )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) ); classes->push_back( SUBCLASS(eTYPE_CHICKEN )->addParent( eTYPE_ANIMAL ) ); + classes->push_back( SUBCLASS(eTYPE_COW )->addParent( eTYPE_ANIMAL)->addParent(eTYPE_ANIMALS_SPAWN_LIMIT_CHECK ) ); classes->push_back( SUBCLASS(eTYPE_MUSHROOMCOW )->addParent( eTYPE_COW ) ); classes->push_back( SUBCLASS(eTYPE_WATERANIMAL )->addParent(eTYPE_PATHFINDER_MOB) ); diff --git a/Minecraft.World/EntityIO.cpp b/Minecraft.World/EntityIO.cpp index 9c7c64d4..876de250 100644 --- a/Minecraft.World/EntityIO.cpp +++ b/Minecraft.World/EntityIO.cpp @@ -104,6 +104,10 @@ void EntityIO::staticCtor() setId(Ocelot::create, eTYPE_OCELOT, L"Ozelot", 98, eMinecraftColour_Mob_Ocelot_Colour1, eMinecraftColour_Mob_Ocelot_Colour2, IDS_OZELOT); setId(VillagerGolem::create, eTYPE_VILLAGERGOLEM, L"VillagerGolem", 99); setId(EntityHorse::create, eTYPE_HORSE, L"EntityHorse", 100, eMinecraftColour_Mob_Horse_Colour1, eMinecraftColour_Mob_Horse_Colour2, IDS_HORSE); + setId(Rabbit::create, eTYPE_RABBIT, L"Rabbit", 101, + eMinecraftColour_Mob_Rabbit_Colour1, + eMinecraftColour_Mob_Rabbit_Colour2, IDS_HORSE);//change IDS_RABBIT later + setId(Villager::create, eTYPE_VILLAGER, L"Villager", 120, eMinecraftColour_Mob_Villager_Colour1, eMinecraftColour_Mob_Villager_Colour2, IDS_VILLAGER); @@ -112,6 +116,7 @@ void EntityIO::staticCtor() // 4J Added setId(DragonFireball::create, eTYPE_DRAGON_FIREBALL, L"DragonFireball", 1000); + // 4J-PB - moved to allow the eggs to be named and coloured in the Creative Mode menu // 4J Added for custom spawn eggs setId(EntityHorse::create, eTYPE_HORSE, L"EntityHorse", 100 | ((EntityHorse::TYPE_DONKEY + 1) << 12), eMinecraftColour_Mob_Horse_Colour1, eMinecraftColour_Mob_Horse_Colour2, IDS_DONKEY); @@ -125,6 +130,8 @@ void EntityIO::staticCtor() setId(Ocelot::create, eTYPE_OCELOT, L"Ozelot", 98 | ((Ocelot::TYPE_SIAMESE + 1) << 12), eMinecraftColour_Mob_Ocelot_Colour1, eMinecraftColour_Mob_Ocelot_Colour2, IDS_OZELOT ); setId(Spider::create, eTYPE_SPIDER, L"Spider", 52 | (2 << 12), eMinecraftColour_Mob_Spider_Colour1, eMinecraftColour_Mob_Spider_Colour2, IDS_SKELETON ); #endif + + } shared_ptr EntityIO::newEntity(const wstring& id, Level *level) diff --git a/Minecraft.World/Minecraft.World.vcxproj b/Minecraft.World/Minecraft.World.vcxproj index b6af9153..d3683776 100644 --- a/Minecraft.World/Minecraft.World.vcxproj +++ b/Minecraft.World/Minecraft.World.vcxproj @@ -2704,6 +2704,7 @@ + @@ -3629,6 +3630,7 @@ + diff --git a/Minecraft.World/Minecraft.World.vcxproj.filters b/Minecraft.World/Minecraft.World.vcxproj.filters index bf872596..c7273fdd 100644 --- a/Minecraft.World/Minecraft.World.vcxproj.filters +++ b/Minecraft.World/Minecraft.World.vcxproj.filters @@ -3197,6 +3197,9 @@ net\minecraft\world\inventory + + net\minecraft\world\entity\animal + @@ -5626,5 +5629,8 @@ net\minecraft\world\item + + net\minecraft\world\entity\animal + \ No newline at end of file diff --git a/Minecraft.World/Rabbit.cpp b/Minecraft.World/Rabbit.cpp new file mode 100644 index 00000000..881c9d8f --- /dev/null +++ b/Minecraft.World/Rabbit.cpp @@ -0,0 +1,125 @@ +#include "stdafx.h" +#include "Rabbit.h" +#include "SynchedEntityData.h" +#include "AttributeInstance.h" +#include "SharedMonsterAttributes.h" +#include "net.minecraft.world.item.h" +#include "net.minecraft.world.entity.ai.goal.h" +#include "net.minecraft.world.entity.ai.navigation.h" +#include "net.minecraft.world.level.h" +#include "com.mojang.nbt.h" +#include "SoundTypes.h" + +Rabbit::Rabbit(Level *level) : Animal(level) +{ + jumpCompletion = 0.0f; + jumpTicks = 0; + moreCarrotTicks = 0; + + + this->defineSynchedData(); + this->registerAttributes(); + this->setHealth(this->getMaxHealth()); + + this->setSize(0.4f, 0.5f); + this->getNavigation()->setAvoidWater(true); + + // AI Goals + goalSelector.addGoal(1, new FloatGoal(this)); + goalSelector.addGoal(2, new PanicGoal(this, 2.2f)); + goalSelector.addGoal(3, new BreedGoal(this, 0.8f)); + goalSelector.addGoal(4, new TemptGoal(this, 1.0f, Item::carrots_Id, false)); + goalSelector.addGoal(6, new RandomStrollGoal(this, 0.6f)); + goalSelector.addGoal(7, new LookAtPlayerGoal(this, typeid(Player), 10.0f)); +} + +float Rabbit::getJumpCompletion(float partialTick) const { + return jumpCompletion; +} + +Rabbit::Variant Rabbit::getVariant() const { + + return (Variant)entityData->getInteger(DATA_TYPE_ID); +} + +void Rabbit::setVariant(Variant v) { + entityData->set(DATA_TYPE_ID, (int)v); +} + +void Rabbit::defineSynchedData() { + Animal::defineSynchedData(); + entityData->define(DATA_TYPE_ID, (int)Variant::BROWN); +} + +void Rabbit::registerAttributes() { + Animal::registerAttributes(); + getAttribute(SharedMonsterAttributes::MAX_HEALTH)->setBaseValue(3.0); + + getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->setBaseValue(0.3); +} + +bool Rabbit::useNewAi() { + return true; +} + + + +void Rabbit::tick() { + Animal::tick(); + + if (!onGround) { + jumpTicks++; + } else { + + bool canJump = (tickCount % 5 == 0); + + if (!getNavigation()->isDone() && jumpTicks == 0 && canJump) { + + + this->yd = 0.32f; + + + float speed = (float)getAttribute(SharedMonsterAttributes::MOVEMENT_SPEED)->getValue(); + this->moveRelative(0.0f, 1.0f, speed); + + + this->hasImpulse = true; + } + jumpTicks = 0; + } + + + jumpCompletion = onGround ? jumpCompletion * 0.8f : (float)jumpTicks / 5.0f; + if (jumpCompletion > 1.0f) jumpCompletion = 1.0f; +} + +bool Rabbit::isFood(shared_ptr item) { + if (item == nullptr || item->getItem() == nullptr) return false; + + + int id = item->getItem()->id; + return id == Item::carrots_Id || id == Item::carrots_Id || id == Item::carrotGolden_Id; +} + +shared_ptr Rabbit::getBreedOffspring(shared_ptr target) { + if (level->canCreateMore(GetType(), Level::eSpawnType_Breed)) + return std::make_shared(level); + return nullptr; +} + + +int Rabbit::getAmbientSound() { return eSoundType_MOB_BAT_IDLE; } +int Rabbit::getHurtSound() { return eSoundType_MOB_BAT_HURT; } +int Rabbit::getDeathSound() { return eSoundType_MOB_BAT_DEATH; } + +void Rabbit::readAdditionalSaveData(CompoundTag *tag) { + Animal::readAdditionalSaveData(tag); + if (tag->contains(L"RabbitType")) { + setVariant((Variant)tag->getInt(L"RabbitType")); + } +} + +void Rabbit::addAdditonalSaveData(CompoundTag *tag) { + Animal::addAdditonalSaveData(tag); + tag->putInt(L"RabbitType", (int)getVariant()); +} \ No newline at end of file diff --git a/Minecraft.World/Rabbit.h b/Minecraft.World/Rabbit.h new file mode 100644 index 00000000..d60ca5f7 --- /dev/null +++ b/Minecraft.World/Rabbit.h @@ -0,0 +1,56 @@ +#pragma once +#include "Animal.h" + +class Rabbit : public Animal +{ +public: + enum class Variant + { + BROWN = 0, + WHITE = 1, + BLACK = 2, + GOLD = 3, + SALT = 4, + WHITE_SPLOTCHED = 5, + EVIL = 99, + }; + + eINSTANCEOF GetType() { return eTYPE_RABBIT; } + static Entity *create(Level *level) { return new Rabbit(level); } + +private: + static const int DATA_TYPE_ID = 16; + + float jumpCompletion; + int jumpTicks; + int moreCarrotTicks; + +public: + Rabbit(Level *level); + virtual ~Rabbit() {} + + float getJumpCompletion(float partialTick) const; + + Variant getVariant() const; + void setVariant(Variant v); + + virtual bool useNewAi() override; + virtual void tick() override; + +protected: + virtual void registerAttributes() override; + virtual void defineSynchedData() override; + + virtual int getAmbientSound() override; + virtual int getHurtSound() override; + virtual int getDeathSound() override; + virtual float getSoundVolume() override { return 0.6f; } + virtual bool makeStepSound() override { return true; } + +public: + virtual bool isFood(shared_ptr item) override; + virtual shared_ptr getBreedOffspring(shared_ptr target) override; + + virtual void readAdditionalSaveData(CompoundTag *tag) override; + virtual void addAdditonalSaveData(CompoundTag *tag) override; +}; \ No newline at end of file diff --git a/Minecraft.World/net.minecraft.world.entity.animal.h b/Minecraft.World/net.minecraft.world.entity.animal.h index 2bcb81f1..fc2c4de4 100644 --- a/Minecraft.World/net.minecraft.world.entity.animal.h +++ b/Minecraft.World/net.minecraft.world.entity.animal.h @@ -9,6 +9,7 @@ #include "WaterAnimal.h" #include "Wolf.h" + // 1.0.1 #include "Golem.h" #include "MushroomCow.h" @@ -19,4 +20,7 @@ #include "VillagerGolem.h" // 1.6.4 -#include "EntityHorse.h" \ No newline at end of file +#include "EntityHorse.h" + +//TU31 +#include "Rabbit.h" \ No newline at end of file