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 -> {
|
||||
ServerPlayerEntity player = context.getSource().getPlayer();
|
||||
assert player != null;
|
||||
|
||||
if (player.getVehicle() != null) { // 防止重复的坐下行为
|
||||
return 1;
|
||||
}
|
||||
|
||||
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);
|
||||
world.spawnEntity(armorStandEntity);
|
||||
player.setSneaking(false);
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.stat.Stat;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -19,6 +20,8 @@ import static com.github.zly2006.carpetslsaddition.ServerMain.*;
|
||||
public abstract class MixinPlayerEntity implements PlayerAccess {
|
||||
@Shadow public abstract ItemStack getEquippedStack(EquipmentSlot slot);
|
||||
|
||||
@Shadow public abstract void resetStat(Stat<?> stat);
|
||||
|
||||
@Override
|
||||
public boolean holdingObsidianPickaxe() {
|
||||
ItemStack itemStack = getEquippedStack(EquipmentSlot.MAINHAND);
|
||||
|
||||
Reference in new issue
Block a user