-
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vibration source and destination positions are rounded to the center of the respective blocks (same as wool occlusion checks). If the line drawn between the two positions intersects the Bergamute's spherical area of effect, the vibration is occluded.
- Loading branch information
1 parent
8db1a22
commit 6afa016
Showing
5 changed files
with
67 additions
and
1 deletion.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
Xplat/src/main/java/vazkii/botania/mixin/VibrationSystemListenerMixin.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,26 @@ | ||
package vazkii.botania.mixin; | ||
|
||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.gameevent.vibrations.VibrationSystem; | ||
import net.minecraft.world.phys.Vec3; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
import vazkii.botania.common.block.flower.functional.BergamuteBlockEntity; | ||
|
||
@Mixin(VibrationSystem.Listener.class) | ||
public class VibrationSystemListenerMixin { | ||
/** | ||
* Check if any active Bergamutes are near the direct line of sight between a vibration source | ||
* and the vibration listener currently checking whether it can receive the vibration. | ||
*/ | ||
@Inject(method = "isOccluded", at = @At("HEAD"), cancellable = true) | ||
private static void checkBergamuteOcclusion(Level level, Vec3 sourcePos, Vec3 destPos, CallbackInfoReturnable<Boolean> cir) { | ||
if (BergamuteBlockEntity.isBergamuteOccludingVibration(level, sourcePos, destPos)) { | ||
cir.setReturnValue(true); | ||
} | ||
} | ||
} |
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