fix: 修复启动时崩服的问题
This commit is contained in:
1 parent
e91b2a49a3
commit
2967c021e5
5 files changed
+4
-11
No files matched your search
+1
-1
@@ -10,7 +10,7 @@ org.gradle.jvmargs=-Xmx1G
|
||||
# Mod Properties
|
||||
mod_version = 0.5.1
|
||||
maven_group = com.github.zly2006
|
||||
archives_base_name = Carpet-SLS-Addition
|
||||
archives_base_name = carpet-sls-addition
|
||||
|
||||
# Dependencies
|
||||
fabric_version=0.76.0+1.19.4
|
||||
|
||||
-4
@@ -2,18 +2,14 @@ package com.github.zly2006.carpetslsaddition.mixin.block;
|
||||
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.block.entity.SignBlockEntity;
|
||||
import net.minecraft.entity.InventoryOwner;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.inventory.Inventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.hit.BlockHitResult;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.github.zly2006.carpetslsaddition.mixin.block;
|
||||
|
||||
import carpet.patches.EntityPlayerMPFake;
|
||||
import com.github.zly2006.carpetslsaddition.PlayerAccess;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(value = EntityPlayerMPFake.class, remap = false)
|
||||
@Mixin(value = EntityPlayerMPFake.class)
|
||||
public class MixinFakePlayer {
|
||||
@Redirect(method = "createFake", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/UserCache;findByName(Ljava/lang/String;)Ljava/util/Optional;"))
|
||||
private static Optional<GameProfile> onCreate(UserCache instance, String name) {
|
||||
|
||||
+2
-4
@@ -7,9 +7,6 @@ import net.minecraft.entity.EquipmentSlot;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.GameMode;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -29,6 +26,7 @@ public abstract class MixinPlayerEntity implements PlayerAccess {
|
||||
return compound != null && compound.contains(ITEM_NAME) && compound.getString(ITEM_NAME).equals(OBSIDIAN_PICKAXE);
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "getBlockBreakingSpeed", at = @At("HEAD"), cancellable = true)
|
||||
private void onGetBlockBreakingSpeed(BlockState block, CallbackInfoReturnable<Float> cir) {
|
||||
if (holdingObsidianPickaxe() && block.isOf(Blocks.OBSIDIAN)) {
|
||||
@@ -36,11 +34,11 @@ public abstract class MixinPlayerEntity implements PlayerAccess {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "canHarvest", at = @At("HEAD"), cancellable = true)
|
||||
private void onGetCanMine(BlockState state, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (holdingObsidianPickaxe() && state.isOf(Blocks.OBSIDIAN)) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user