mirror of
https://github.com/FabricMC/fabric.git
synced 2025-04-21 03:10:54 -04:00
update mappings
This commit is contained in:
parent
373bb7da64
commit
d7b5916416
3 changed files with 14 additions and 14 deletions
build.gradle
src/main/java/net/fabricmc/fabric/mixin/events/playerinteraction
|
@ -38,7 +38,7 @@ minecraft {
|
|||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:$mcVersion"
|
||||
mappings "net.fabricmc:yarn:$mcVersion.3"
|
||||
mappings "net.fabricmc:yarn:$mcVersion.5"
|
||||
modCompile "net.fabricmc:fabric-loader:0.3.2.96"
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@ package net.fabricmc.fabric.mixin.events.playerinteraction;
|
|||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerArray;
|
||||
import net.minecraft.class_3965;
|
||||
import net.minecraft.class_3966;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
|
@ -31,6 +29,8 @@ import net.minecraft.server.network.packet.PlayerInteractBlockServerPacket;
|
|||
import net.minecraft.server.network.packet.PlayerInteractEntityServerPacket;
|
||||
import net.minecraft.server.network.packet.PlayerInteractItemServerPacket;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.BlockHitResult;
|
||||
import net.minecraft.util.EntityHitResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
@ -82,12 +82,12 @@ public class MixinClientPlayerInteractionManager {
|
|||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;", ordinal = 0), method = "interactBlock", cancellable = true)
|
||||
public void interactBlock(ClientPlayerEntity player, ClientWorld world, Hand hand, class_3965 blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
public void interactBlock(ClientPlayerEntity player, ClientWorld world, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
PlayerInteractionEvent.BlockPositioned[] backingArray = ((HandlerArray<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray();
|
||||
if (backingArray.length > 0) {
|
||||
Vec3d vec = blockHitResult.method_17784();
|
||||
BlockPos pos = blockHitResult.method_17777();
|
||||
Direction direction = blockHitResult.method_17780();
|
||||
Vec3d vec = blockHitResult.getPos();
|
||||
BlockPos pos = blockHitResult.getBlockPos();
|
||||
Direction direction = blockHitResult.getSide();
|
||||
|
||||
float hitX = (float) (vec.x - pos.getX());
|
||||
float hitY = (float) (vec.y - pos.getY());
|
||||
|
@ -137,9 +137,9 @@ public class MixinClientPlayerInteractionManager {
|
|||
}
|
||||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V", ordinal = 0), method = "interactEntityAtLocation", cancellable = true)
|
||||
public void interactEntityAtLocation(PlayerEntity player, Entity entity, class_3966 hitResult, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
public void interactEntityAtLocation(PlayerEntity player, Entity entity, EntityHitResult hitResult, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
// TODO: Remove double Vec3d creation?
|
||||
Vec3d hitVec = hitResult.method_17784().subtract(entity.x, entity.y, entity.z);
|
||||
Vec3d hitVec = hitResult.getPos().subtract(entity.x, entity.y, entity.z);
|
||||
|
||||
for (PlayerInteractionEvent.EntityPositioned handler : ((HandlerArray<PlayerInteractionEvent.EntityPositioned>) PlayerInteractionEvent.INTERACT_ENTITY_POSITIONED).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, player.getEntityWorld(), hand, entity, hitVec);
|
||||
|
|
|
@ -18,13 +18,13 @@ package net.fabricmc.fabric.mixin.events.playerinteraction;
|
|||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerArray;
|
||||
import net.minecraft.class_3965;
|
||||
import net.minecraft.client.network.packet.BlockUpdateClientPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.BlockHitResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
@ -58,11 +58,11 @@ public class MixinServerPlayerInteractionManager {
|
|||
}
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "interactBlock", cancellable = true)
|
||||
public void interactBlock(PlayerEntity player, World world, ItemStack stack, Hand hand, class_3965 blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
public void interactBlock(PlayerEntity player, World world, ItemStack stack, Hand hand, BlockHitResult blockHitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||
for (PlayerInteractionEvent.BlockPositioned handler : ((HandlerArray<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray()) {
|
||||
Vec3d vec = blockHitResult.method_17784();
|
||||
BlockPos pos = blockHitResult.method_17777();
|
||||
Direction direction = blockHitResult.method_17780();
|
||||
Vec3d vec = blockHitResult.getPos();
|
||||
BlockPos pos = blockHitResult.getBlockPos();
|
||||
Direction direction = blockHitResult.getSide();
|
||||
|
||||
float hitX = (float) (vec.x - pos.getX());
|
||||
float hitY = (float) (vec.y - pos.getY());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue