Skip to content

Commit 4b52d45

Browse files
authored
Merge pull request #8 from DevPieter/dev
🔧 Refactor interaction event parameters in ClientPlayerInteractionMan…
2 parents 731341a + cd1aeb4 commit 4b52d45

File tree

4 files changed

+7
-31
lines changed

4 files changed

+7
-31
lines changed

src/main/java/nl/devpieter/utilize/events/sound/PlaySoundEvent.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import net.minecraft.client.sound.SoundInstance;
44
import nl.devpieter.sees.Event.CancelableEventBase;
55

6+
@Deprecated(since = "1.0.10", forRemoval = true)
67
public class PlaySoundEvent extends CancelableEventBase {
78

89
private final SoundInstance sound;

src/main/java/nl/devpieter/utilize/mixins/ClientPlayerInteractionManagerMixin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,37 +65,37 @@ private void onAttackBlock(BlockPos pos, Direction direction, CallbackInfoReturn
6565

6666
@Inject(at = @At("HEAD"), method = "interactBlock", cancellable = true)
6767
private void onInteractBlock(ClientPlayerEntity player, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> cir) {
68-
if (!this.sees.call(new InteractBlockEvent(player, hand, hitResult))) return;
68+
if (!this.sees.call(new InteractBlockEvent(hand, hitResult))) return;
6969
cir.setReturnValue(ActionResult.FAIL);
7070
cir.cancel();
7171
}
7272

7373
@Inject(at = @At("HEAD"), method = "interactItem", cancellable = true)
7474
private void onInteractItem(PlayerEntity player, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
75-
if (!this.sees.call(new InteractItemEvent(player, hand))) return;
75+
if (!this.sees.call(new InteractItemEvent(hand))) return;
7676
cir.setReturnValue(ActionResult.FAIL);
7777
cir.cancel();
7878
}
7979

8080
@Inject(at = @At("HEAD"), method = "attackEntity", cancellable = true)
8181
private void onAttackEntity(PlayerEntity player, Entity target, CallbackInfo ci) {
8282
System.out.println("AttackEntityEvent called for " + target.getName().getString() + " by " + player.getName().getString());
83-
if (!this.sees.call(new AttackEntityEvent(player, target))) return;
83+
if (!this.sees.call(new AttackEntityEvent(target))) return;
8484

8585
ci.cancel();
8686
Utilize.blockSwingHandOnce();
8787
}
8888

8989
@Inject(at = @At("HEAD"), method = "interactEntity", cancellable = true)
9090
private void onInteractEntity(PlayerEntity player, Entity target, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
91-
if (!this.sees.call(new InteractEntityEvent(player, target, hand))) return;
91+
if (!this.sees.call(new InteractEntityEvent(target, hand))) return;
9292
cir.setReturnValue(ActionResult.FAIL);
9393
cir.cancel();
9494
}
9595

9696
@Inject(at = @At("HEAD"), method = "clickSlot", cancellable = true)
9797
private void onClickSlot(int syncId, int slotId, int button, SlotActionType actionType, PlayerEntity player, CallbackInfo ci) {
98-
if (!this.sees.call(new SlotClickEvent(syncId, slotId, button, actionType, player))) return;
98+
if (!this.sees.call(new SlotClickEvent(syncId, slotId, button, actionType))) return;
9999
ci.cancel();
100100
}
101101

src/main/java/nl/devpieter/utilize/mixins/SoundSystemMixin.java

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/main/resources/utilize.mixins.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
"ClientPlayerEntityMixin",
99
"ClientPlayerInteractionManagerMixin",
1010
"DebugRendererMixin",
11-
"MinecraftClientMixin",
12-
"SoundSystemMixin"
11+
"MinecraftClientMixin"
1312
],
1413
"injectors": {
1514
"defaultRequire": 1

0 commit comments

Comments
 (0)