Skip to content

Commit 2489f23

Browse files
committed
Switch to WrapMethod for FanProcessingTypeMixin
- Fixes #13
1 parent d2a7669 commit 2489f23

1 file changed

Lines changed: 8 additions & 21 deletions

File tree

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,20 @@
11
package dev.ryanhcode.sable.neoforge.mixin.compatibility.create.airflow;
22

3+
import com.llamalad7.mixinextras.injector.wrapmethod.WrapMethod;
4+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
35
import com.simibubi.create.content.kinetics.fan.processing.FanProcessingType;
4-
import com.simibubi.create.content.kinetics.fan.processing.FanProcessingTypeRegistry;
56
import dev.ryanhcode.sable.ActiveSableCompanion;
67
import dev.ryanhcode.sable.Sable;
78
import net.minecraft.core.BlockPos;
89
import net.minecraft.world.level.Level;
910
import org.spongepowered.asm.mixin.Mixin;
10-
import org.spongepowered.asm.mixin.Overwrite;
1111

1212
@Mixin(FanProcessingType.class)
1313
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+
}
3320
}

0 commit comments

Comments
 (0)