build in script load from resources, added 2 more events, added event test

This commit is contained in:
gnembon committed 2019-10-11 02:23:45 -03:00
1 parent 87eb46b773
commit fc66ec9c93
8 files changed
+487 -341

No files matched your search

@@ -22,6 +22,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import static carpet.script.CarpetEventServer.Event.PLAYER_ATTACKS_ENTITY;
import static carpet.script.CarpetEventServer.Event.PLAYER_CLICKS_BLOCK;
import static carpet.script.CarpetEventServer.Event.PLAYER_DEPLOYS_ELYTRA;
import static carpet.script.CarpetEventServer.Event.PLAYER_DROPS_ITEM;
import static carpet.script.CarpetEventServer.Event.PLAYER_DROPS_STACK;
import static carpet.script.CarpetEventServer.Event.PLAYER_INERACTSW_WITH_ENTITY;
import static carpet.script.CarpetEventServer.Event.PLAYER_RELEASED_ITEM;
import static carpet.script.CarpetEventServer.Event.PLAYER_RIDES;
@@ -49,6 +51,30 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
}
}
@Inject(method = "onPlayerAction", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Lnet/minecraft/entity/ItemEntity;",
ordinal = 0,
shift = At.Shift.BEFORE
))
private void onQItem(PlayerActionC2SPacket playerActionC2SPacket_1, CallbackInfo ci)
{
PLAYER_DROPS_ITEM.onPlayerEvent(player);
}
@Inject(method = "onPlayerAction", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;dropSelectedItem(Z)Lnet/minecraft/entity/ItemEntity;",
ordinal = 1,
shift = At.Shift.BEFORE
))
private void onCtrlQItem(PlayerActionC2SPacket playerActionC2SPacket_1, CallbackInfo ci)
{
PLAYER_DROPS_STACK.onPlayerEvent(player);
}
@Inject(method = "onPlayerMove", at = @At(
value = "INVOKE",
target = "Lnet/minecraft/server/network/ServerPlayerEntity;jump()V"