Skip to content

Commit

Permalink
修复: optimizedDragonRespawn 导致的游戏崩溃 #27
Browse files Browse the repository at this point in the history
  • Loading branch information
1024-byteeeee committed Jun 12, 2023
1 parent b7676da commit 40d2fc1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
package club.mcams.carpet.mixin.rule.optimizedDragonRespawn;
package club.mcams.carpet.function;

import club.mcams.carpet.mixin.rule.optimizedDragonRespawn.BlockPatternTestTransformInvoker;

import com.google.common.cache.LoadingCache;

Expand All @@ -7,6 +9,7 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.WorldView;

public class BlockPatternHelper {
public static BlockPattern.Result partialSearchAround(BlockPattern pattern, WorldView world, BlockPos pos) {
LoadingCache<BlockPos, CachedBlockPosition> loadingCache = BlockPattern.makeCache(world, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Invoker;

@Mixin(BlockPattern.class)
public interface BlockPatternTestTransformInvoker {
@Invoker("testTransform")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package club.mcams.carpet.mixin.rule.optimizedDragonRespawn;

import club.mcams.carpet.AmsServerSettings;
import club.mcams.carpet.function.BlockPatternHelper;

import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.EndGatewayBlockEntity;
Expand Down Expand Up @@ -90,7 +91,7 @@ public abstract class EnderDragonFightMixin {
if(AmsServerSettings.optimizedDragonRespawn && notFirstSearch) {
//#if MC>=12000
//&& result2 = BlockPatternHelper.partialSearchAround(this.endPortalPattern, this.world, new BlockPos(EndPortalFeature.offsetOrigin(BlockPos.ORIGIN)).getY();, j, EndPortalFeature.offsetOrigin(BlockPos.ORIGIN).getZ()));
//#elseORIGIN
//#else
result2 = BlockPatternHelper.partialSearchAround(this.endPortalPattern, this.world, new BlockPos(EndPortalFeature.ORIGIN.getX(), j, EndPortalFeature.ORIGIN.getZ()));
//#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/amscarpet.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"mixins": [
"carpet.SettingsManagerMixin",
"interaction.ThreadedAnvilChunkStorageMixin",
"rule.antiFireTotem_itemAntiExplosion.ItemEntityMixin",
"rule.bambooCollisionBoxDisable.BambooBlockMixin",
"rule.bambooModelNoOffset.BambooBlockMixin",
"rule.blockChunkLoader.BellBlockMixin",
Expand Down Expand Up @@ -35,7 +36,6 @@
"rule.sharedVillagerDiscounts.VillagerGossipsMixin",
"rule.softBlock.AbstractBlockStateMixin",
"rule.superBow.InfinityEnchantmentMixin",
"rule.antiFireTotem_itemAntiExplosion.ItemEntityMixin",
"rule.weakBlocks.CollectBlocksAndDamageEntitiesMixin"
],
"client": [],
Expand Down

0 comments on commit 40d2fc1

Please sign in to comment.