Don't inform owner of pokemon being killed out of battle

This commit is contained in:
Nick committed 2022-11-11 20:17:23 -08:00
1 parent 1d86b5c13c
commit 5aafbc2a6d
2 files changed
+28 -1

No files matched your search

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2022 Cobblemon Contributors
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package com.cobblemon.mod.common.mixin.entity;
import com.cobblemon.mod.common.entity.pokemon.PokemonEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(TameableEntity.class)
public class TameableEntityMixin {
@Redirect(method = "onDeath", at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;isClient:Z"))
public boolean cobblemon$checkIfPokemonBeforeSendingMessage(World world) {
return world.isClient || (this.getClass().isAssignableFrom(PokemonEntity.class));
}
}
@@ -16,7 +16,8 @@
"PlayerMixin",
"PointedDripstoneBlockMixin",
"ServerChunkManagerMixin",
"accessor.AccessorEntity"
"accessor.AccessorEntity",
"entity.TameableEntityMixin"
],
"injectors": {
"defaultRequire": 1