Commit 0c61d35a by Jonathan Thomas

Ridable best friends now ignore Tameable entities (dogs, cats, etc... so you can…

Ridable best friends now ignore Tameable entities (dogs, cats, etc... so you can right-click and sit them)
parent f8a4d053
Pipeline #12718 passed with stages
in 2 minutes 20 seconds
...@@ -8,7 +8,7 @@ All notable changes to **CreatureChat** are documented in this file. The format ...@@ -8,7 +8,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
### Added ### Added
- New LEAD behavior, to guide a player to a random location (and show message when destination is reached) - New LEAD behavior, to guide a player to a random location (and show message when destination is reached)
- Best friends are now rideable! Right click with an empty hand. - Best friends are now rideable! Right click with an empty hand. Excludes tameable entities (dogs, cats, etc...)
- Villager trades are now affected by friendship! Be nice! - Villager trades are now affected by friendship! Be nice!
### Changed ### Changed
......
...@@ -3,6 +3,7 @@ package com.owlmaddie.mixin; ...@@ -3,6 +3,7 @@ package com.owlmaddie.mixin;
import com.owlmaddie.chat.ChatDataManager; import com.owlmaddie.chat.ChatDataManager;
import com.owlmaddie.network.ServerPackets; import com.owlmaddie.network.ServerPackets;
import net.minecraft.entity.mob.MobEntity; import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.entity.passive.VillagerEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
...@@ -27,8 +28,8 @@ public class MixinMobEntity { ...@@ -27,8 +28,8 @@ public class MixinMobEntity {
ItemStack itemStack = player.getStackInHand(hand); ItemStack itemStack = player.getStackInHand(hand);
MobEntity thisEntity = (MobEntity) (Object) this; MobEntity thisEntity = (MobEntity) (Object) this;
// Don't interact with Villagers (avoid issues with trade system) // Don't interact with Villagers (avoid issues with trade UI) OR Tameable (i.e. sit / no-sit)
if (thisEntity instanceof VillagerEntity) { if (thisEntity instanceof VillagerEntity || thisEntity instanceof TameableEntity) {
return; return;
} }
...@@ -75,13 +76,10 @@ public class MixinMobEntity { ...@@ -75,13 +76,10 @@ public class MixinMobEntity {
ServerPackets.generate_chat("N/A", chatData, serverPlayer, thisEntity, giveItemMessage, true); ServerPackets.generate_chat("N/A", chatData, serverPlayer, thisEntity, giveItemMessage, true);
} }
} else if (itemStack.isEmpty()) { } else if (itemStack.isEmpty() && chatData.friendship == 3) {
// Player's hand is empty // Player's hand is empty, Ride your best friend!
if (chatData.friendship == 3) {
// Ride your best friend!
player.startRiding(thisEntity, true); player.startRiding(thisEntity, true);
} }
} }
} }
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment