diff --git a/README.MD b/README.MD index 0f43b1a..9650ebe 100644 --- a/README.MD +++ b/README.MD @@ -11,6 +11,15 @@ You get speed 2 when doing damage. **Your superfood are uncooked meats.** 5. Cow When you hit a mob, there's a 30% chance of slowing them down. Works on players aswell. **Your superfoods are apples, golden apples, and carrots.** +## **Interactions** +1. headpats - You can also rightclick to headpat a animal. +2. kiss +3. bite +4. scratch +5. hug +6. cuddle +7. boop +8. nuzzle ## **Chat** Chat while you are a animal is very different. When you speak, your words will become furry-ified and every time you talk you'll have animal sounds come out of you. You can disable this via /chatmodoff, and turn it back on via /chatmodon. diff --git a/src/main/java/ovh/sad/animalrp/AnimalRP.java b/src/main/java/ovh/sad/animalrp/AnimalRP.java index e6fe243..390139d 100644 --- a/src/main/java/ovh/sad/animalrp/AnimalRP.java +++ b/src/main/java/ovh/sad/animalrp/AnimalRP.java @@ -13,7 +13,9 @@ import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents; import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents; import net.fabricmc.fabric.api.event.player.UseEntityCallback; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; +import net.minecraft.server.world.ServerWorld; import net.minecraft.sound.SoundCategory; import net.minecraft.text.Text; import net.minecraft.util.ActionResult; @@ -58,6 +60,7 @@ public class AnimalRP implements ModInitializer { public void onInitialize() { String catAscii = """ + |\\ _,,,---,,_ ZZZzz /,`.-'`' -. ;-;;,_ |,4- ) )-,_. ,\\ ( `'-' @@ -139,18 +142,12 @@ ZZZzz /,`.-'`' -. ;-;;,_ lastPetTimes.put(attackerId, currentTime); - attackee.sendMessage(AnimalRP.parseText( - String.format("%s petted you! %s", - "" + attacker.getName().getString() + "", - "" + attackerAnimal.catchphrase)), false); - attacker.sendMessage(AnimalRP.parseText( - String.format("You petted %s! %s", - "" + attackee.getName().getString() + "", - "" + attackeeAnimal.catchphrase)), false); - attacker.getWorld().playSound(attackee, attackee.getBlockPos(), - attackeeAnimal.moodSounds.get(Mood.CUTE), SoundCategory.PLAYERS, 1F, - 1); - + MinecraftServer server = attacker.getServer(); + if (server != null) { + server.execute(() -> { + server.getCommandManager().executeWithPrefix(attacker.getCommandSource((ServerWorld) world), "headpats " + attackee.getName().getString()); + }); + } System.out.println(attackee.getNameForScoreboard() + " was rightclicked by " + attacker.getNameForScoreboard()); return ActionResult.PASS; });