|
1 | 1 | package dev.ryanhcode.sable.neoforge.mixin.compatibility.create.airflow; |
2 | 2 |
|
| 3 | +import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod; |
| 4 | +import com.llamalad7.mixinextras.injector.wrapoperation.Operation; |
3 | 5 | import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType; |
4 | | -import com.simibubi.create.content.kinetics.fan.processing.FanProcessingTypeRegistry; |
5 | 6 | import dev.ryanhcode.sable.ActiveSableCompanion; |
6 | 7 | import dev.ryanhcode.sable.Sable; |
7 | 8 | import net.minecraft.core.BlockPos; |
8 | 9 | import net.minecraft.world.level.Level; |
9 | 10 | import org.spongepowered.asm.mixin.Mixin; |
10 | | -import org.spongepowered.asm.mixin.Overwrite; |
11 | 11 |
|
12 | 12 | @Mixin(FanProcessingType.class) |
13 | 13 | public interface FanProcessingTypeMixin { |
14 | | - |
15 | | - /** |
16 | | - * @author Cyvack |
17 | | - * @reason Easier implementation for subLevel compatibility for fans. Might cause issues with addons if they decide to overwrite this method as well. |
18 | | - */ |
19 | | - @Overwrite |
20 | | - static FanProcessingType getAt(final Level level, final BlockPos pos) { |
21 | | - ActiveSableCompanion helper = Sable.HELPER; |
22 | | - return helper.runIncludingSubLevels(level, pos.getCenter(), true, helper.getContaining(level, pos), (subLevel, relativePos) -> { |
23 | | - for (final FanProcessingType type : FanProcessingTypeRegistry.SORTED_TYPES_VIEW) { |
24 | | - if (type != null && type.isValidAt(level, relativePos)) { |
25 | | - return type; |
26 | | - } |
27 | | - } |
28 | | - |
29 | | - return null; |
30 | | - }); |
31 | | - } |
32 | | - |
| 14 | + @WrapMethod(method = "getAt") |
| 15 | + private static FanProcessingType getAt(Level level, BlockPos pos, Operation<FanProcessingType> original) { |
| 16 | + ActiveSableCompanion helper = Sable.HELPER; |
| 17 | + return helper.runIncludingSubLevels(level, pos.getCenter(), true, helper.getContaining(level, pos), |
| 18 | + (subLevel, relativePos) -> original.call(level, relativePos)); |
| 19 | + } |
33 | 20 | } |
0 commit comments