fix: 各种坐下指令的bug
This commit is contained in:
1 parent
93a84a3682
commit
a0ffb5eb6a
2 files changed
+9
-1
No files matched your search
@@ -130,9 +130,14 @@ public class ServerMain implements ModInitializer, CarpetExtension {
|
|||||||
.executes(context -> {
|
.executes(context -> {
|
||||||
ServerPlayerEntity player = context.getSource().getPlayer();
|
ServerPlayerEntity player = context.getSource().getPlayer();
|
||||||
assert player != null;
|
assert player != null;
|
||||||
|
|
||||||
|
if (player.getVehicle() != null) { // 防止重复的坐下行为
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
World world = player.getWorld();
|
World world = player.getWorld();
|
||||||
|
|
||||||
ArmorStandEntity armorStandEntity = new ArmorStandEntity(world, player.getX(), player.getY() - 0.16, player.getZ());
|
ArmorStandEntity armorStandEntity = new ArmorStandEntity(world, player.getX(), player.getY(), player.getZ());
|
||||||
((SitEntity) armorStandEntity).setSitEntity(true);
|
((SitEntity) armorStandEntity).setSitEntity(true);
|
||||||
world.spawnEntity(armorStandEntity);
|
world.spawnEntity(armorStandEntity);
|
||||||
player.setSneaking(false);
|
player.setSneaking(false);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import net.minecraft.entity.EquipmentSlot;
|
|||||||
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.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.stat.Stat;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@@ -19,6 +20,8 @@ import static com.github.zly2006.carpetslsaddition.ServerMain.*;
|
|||||||
public abstract class MixinPlayerEntity implements PlayerAccess {
|
public abstract class MixinPlayerEntity implements PlayerAccess {
|
||||||
@Shadow public abstract ItemStack getEquippedStack(EquipmentSlot slot);
|
@Shadow public abstract ItemStack getEquippedStack(EquipmentSlot slot);
|
||||||
|
|
||||||
|
@Shadow public abstract void resetStat(Stat<?> stat);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean holdingObsidianPickaxe() {
|
public boolean holdingObsidianPickaxe() {
|
||||||
ItemStack itemStack = getEquippedStack(EquipmentSlot.MAINHAND);
|
ItemStack itemStack = getEquippedStack(EquipmentSlot.MAINHAND);
|
||||||
|
|||||||
Reference in new issue
Block a user