player actions
This commit is contained in:
1 parent
dc0dc9e406
commit
50d1d74579
10 files changed
+612
-1057
No files matched your search
@@ -0,0 +1,44 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.settings.CarpetSettings;
|
||||
import net.minecraft.client.network.packet.EntityPositionS2CPacket;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.mob.MobEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(PlayerEntity.class)
|
||||
public abstract class PlayerEntity_horseFixMixin extends Entity
|
||||
{
|
||||
|
||||
@Shadow public abstract ActionResult interact(Entity entity_1, Hand hand_1);
|
||||
|
||||
public PlayerEntity_horseFixMixin(EntityType<?> entityType_1, World world_1)
|
||||
{
|
||||
super(entityType_1, world_1);
|
||||
}
|
||||
|
||||
@Inject(method = "stopRiding", at = @At("HEAD"))
|
||||
private void resetNavigation(CallbackInfo ci)
|
||||
{
|
||||
if (this.getVehicle() != null && CarpetSettings.horseWanderingFix)
|
||||
{
|
||||
if (getVehicle() instanceof MobEntity)
|
||||
((MobEntity) getVehicle()).getNavigation().stop();
|
||||
if (!getEntityWorld().isClient)
|
||||
{
|
||||
((ServerWorld) getEntityWorld()).method_14178().sendToNearbyPlayers((Entity)(Object)this, new EntityPositionS2CPacket(getVehicle()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user