Refactor PistionStructureResolver API for better Compatiblity (#1775)

* Implement better handling for custom block interactions within the `PistionStructureResolver`

- Switch to a opt in system for piston interaction methods by moving to a dedicated interface and removing mixin that injects such into every block
- Default to vanilla code for slime blocks and honey blocks behavior.
- Keep `BlockBehaviourInterface` and `BlockBehaviour_customStickyMixin` for compatibility reasons
This commit is contained in:
Blodhgarm authored and GitHub committed 2023-08-01 13:29:49 +02:00
1 parent 1a73edbf76
commit f564a9c491
9 files changed
+57 -114

No files matched your search

@@ -1,9 +1,9 @@
package carpet.mixins;
import carpet.fakes.BlockPistonBehaviourInterface;
import org.spongepowered.asm.mixin.Mixin;
import carpet.CarpetSettings;
import carpet.fakes.BlockBehaviourInterface;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@@ -16,7 +16,7 @@ import net.minecraft.world.level.block.state.properties.ChestType;
import static net.minecraft.world.level.block.ChestBlock.getConnectedDirection;
@Mixin(ChestBlock.class)
public class ChestBlock_customStickyMixin implements BlockBehaviourInterface {
public class ChestBlock_customStickyMixin implements BlockPistonBehaviourInterface {
@Override
public boolean isSticky(BlockState state) {
@@ -35,6 +35,7 @@ public class ChestBlock_customStickyMixin implements BlockBehaviourInterface {
if (type == ChestType.SINGLE || neighborType == ChestType.SINGLE) {
return false;
}
return getConnectedDirection(state) == dir;
}
}