forked from Minecraft-AMS/Carpet-AMS-Addition
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e26f35
commit 0800cff
Showing
7 changed files
with
47 additions
and
65 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/main/java/club/mcams/carpet/mixin/rule/optimizedDragonRespawn/BlockPatternHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package club.mcams.carpet.mixin.rule.optimizedDragonRespawn; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
import net.minecraft.block.pattern.BlockPattern; | ||
import net.minecraft.block.pattern.CachedBlockPosition; | ||
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); | ||
int i = Math.max(Math.max(pattern.getWidth(), pattern.getHeight()), pattern.getDepth()); | ||
for (BlockPos blockPos : BlockPos.iterate(pos, pos.add(i - 1, 0, i - 1))) { | ||
for (Direction direction : Direction.values()) { | ||
for (Direction direction2 : Direction.values()) { | ||
BlockPattern.Result result; | ||
if (direction2 == direction || direction2 == direction.getOpposite() || (result = ((BlockPatternTestTransformInvoker)pattern).invokeTestTransform(blockPos, direction, direction2, loadingCache)) == null) continue; | ||
return result; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
} |
37 changes: 0 additions & 37 deletions
37
src/main/java/club/mcams/carpet/mixin/rule/optimizedDragonRespawn/BlockPatternMixin.java
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...club/mcams/carpet/mixin/rule/optimizedDragonRespawn/BlockPatternTestTransformInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package club.mcams.carpet.mixin.rule.optimizedDragonRespawn; | ||
|
||
import com.google.common.cache.LoadingCache; | ||
import net.minecraft.block.pattern.BlockPattern; | ||
import net.minecraft.block.pattern.CachedBlockPosition; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.math.Direction; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(BlockPattern.class) | ||
public interface BlockPatternTestTransformInvoker { | ||
@Invoker("testTransform") | ||
BlockPattern.Result invokeTestTransform(BlockPos frontTopLeft, Direction forwards, Direction up, LoadingCache<BlockPos, CachedBlockPosition> cache); | ||
} |
15 changes: 0 additions & 15 deletions
15
...ava/club/mcams/carpet/mixin/rule/optimizedDragonRespawn/BlockPatternTranslateInvoker.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters