mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Fix custom payloads not being handled on the server in the game state. Closes #9948
Fix villagers not opening trade guis. Closes #9946
This commit is contained in:
4 files changed
+17
-2
No files matched your search
@@ -37,3 +37,11 @@
|
||||
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_296589_.mask());
|
||||
this.broadcastChatMessage(playerchatmessage1);
|
||||
});
|
||||
@@ -1797,6 +_,7 @@
|
||||
|
||||
@Override
|
||||
public void handleCustomPayload(ServerboundCustomPayloadPacket p_329963_) {
|
||||
+ net.minecraftforge.common.ForgeHooks.onCustomPayload(p_329963_, this.connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,7 +5,7 @@
|
||||
CriteriaTriggers.TRADE.trigger((ServerPlayer)this.tradingPlayer, this, p_35274_.getResult());
|
||||
}
|
||||
+
|
||||
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.TradeWithVillagerEvent(this.tradingPlayer, p_35274_, this));
|
||||
+ net.minecraftforge.event.ForgeEventFactory.onPlayerTradeWithVillager(this.tradingPlayer, p_35274_, this);
|
||||
}
|
||||
|
||||
protected abstract void rewardTradeXp(MerchantOffer p_35299_);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
public InteractionResult mobInteract(Player p_35472_, InteractionHand p_35473_) {
|
||||
ItemStack itemstack = p_35472_.getItemInHand(p_35473_);
|
||||
- if (itemstack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping()) {
|
||||
+ if (itemstack.getItem() != Items.VILLAGER_SPAWN_EGG && this.isAlive() && !this.isTrading() && !this.isSleeping() && !p_35472_.isSecondaryUseActive()) {
|
||||
+ if (itemstack.is(Items.VILLAGER_SPAWN_EGG) || !this.isAlive() || this.isTrading() || this.isSleeping() || p_35472_.isSecondaryUseActive()) {
|
||||
return super.mobInteract(p_35472_, p_35473_);
|
||||
} else if (this.isBaby()) {
|
||||
this.setUnhappy();
|
||||
|
||||
@@ -74,6 +74,7 @@ import net.minecraft.world.entity.SpawnGroupData;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.entity.monster.Zombie;
|
||||
import net.minecraft.world.entity.npc.AbstractVillager;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.FishingHook;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
@@ -87,6 +88,7 @@ import net.minecraft.world.item.TooltipFlag;
|
||||
import net.minecraft.world.item.alchemy.PotionBrewing.Builder;
|
||||
import net.minecraft.world.item.context.UseOnContext;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.item.trading.MerchantOffer;
|
||||
import net.minecraft.world.level.BaseSpawner;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
@@ -178,6 +180,7 @@ import net.minecraftforge.event.entity.player.PlayerWakeUpEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerXpEvent;
|
||||
import net.minecraftforge.event.entity.player.SleepingLocationCheckEvent;
|
||||
import net.minecraftforge.event.entity.player.SleepingTimeCheckEvent;
|
||||
import net.minecraftforge.event.entity.player.TradeWithVillagerEvent;
|
||||
import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent;
|
||||
import net.minecraftforge.event.level.AlterGroundEvent;
|
||||
import net.minecraftforge.event.level.BlockEvent;
|
||||
@@ -1053,4 +1056,8 @@ public final class ForgeEventFactory {
|
||||
public static AnvilRepairEvent onAnvilRepair(Player player, @NotNull ItemStack output, @NotNull ItemStack left, @NotNull ItemStack right) {
|
||||
return fire(new AnvilRepairEvent(player, left, right, output));
|
||||
}
|
||||
|
||||
public static void onPlayerTradeWithVillager(Player player, MerchantOffer offer, AbstractVillager villager) {
|
||||
post(new TradeWithVillagerEvent(player, offer, villager));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user