fixed on_damage for all and on_death for multiplayer players. Fixes #177
This commit is contained in:
1 parent
893122fe1f
commit
c7603038da
2 files changed
+9
-1
No files matched your search
@@ -1,7 +1,9 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
import carpet.fakes.EntityInterface;
|
import carpet.fakes.EntityInterface;
|
||||||
|
import carpet.script.EntityEventsGroup;
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
import net.minecraft.entity.damage.DamageSource;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
@@ -55,6 +57,12 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
|
|||||||
STATISTICS.onPlayerStatistic((ServerPlayerEntity) (Object)this, stat, amount);
|
STATISTICS.onPlayerStatistic((ServerPlayerEntity) (Object)this, stat, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "onDeath", at = @At("HEAD"))
|
||||||
|
private void onDeathEvent(DamageSource source, CallbackInfo ci)
|
||||||
|
{
|
||||||
|
((EntityInterface)this).getEventContainer().onEvent(EntityEventsGroup.EntityEventType.ON_DEATH, this, source.name);
|
||||||
|
}
|
||||||
|
|
||||||
@Redirect(method = "method_14218", at = @At(
|
@Redirect(method = "method_14218", at = @At(
|
||||||
value = "INVOKE",
|
value = "INVOKE",
|
||||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSneaking(Z)V"
|
target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSneaking(Z)V"
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public class EntityEventsGroup
|
|||||||
},
|
},
|
||||||
ON_REMOVED("on_removed", 0),
|
ON_REMOVED("on_removed", 0),
|
||||||
ON_TICK("on_tick", 0),
|
ON_TICK("on_tick", 0),
|
||||||
ON_DAMAGE("on_damaged", 2)
|
ON_DAMAGE("on_damaged", 3)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public List<Value> makeArgs(Entity entity, Object... providedArgs)
|
public List<Value> makeArgs(Entity entity, Object... providedArgs)
|
||||||
|
|||||||
Reference in new issue
Block a user