-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #476 from jchung01/vanilla-tweaks
Fix block interactions with Better Placement tweak
- Loading branch information
Showing
5 changed files
with
49 additions
and
13 deletions.
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
6 changes: 6 additions & 0 deletions
6
src/main/java/mod/acgaming/universaltweaks/tweaks/blocks/betterplacement/IInteractable.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,6 @@ | ||
package mod.acgaming.universaltweaks.tweaks.blocks.betterplacement; | ||
|
||
public interface IInteractable | ||
{ | ||
boolean isInteractable(); | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...cgaming/universaltweaks/tweaks/blocks/betterplacement/mixin/UTInteractableBlockMixin.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,31 @@ | ||
package mod.acgaming.universaltweaks.tweaks.blocks.betterplacement.mixin; | ||
|
||
import mod.acgaming.universaltweaks.tweaks.blocks.betterplacement.IInteractable; | ||
import net.minecraft.block.Block; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(value = Block.class) | ||
public class UTInteractableBlockMixin implements IInteractable | ||
{ | ||
@Unique | ||
private boolean ut$interactable = true; | ||
|
||
@Override | ||
public boolean isInteractable() | ||
{ | ||
return ut$interactable; | ||
} | ||
|
||
/** | ||
* @reason Block is assumed NOT interactable if the default/super implementation is called. | ||
*/ | ||
@Inject(method = "onBlockActivated", at = @At(value = "HEAD")) | ||
private void utSetInteractable(CallbackInfoReturnable<Boolean> cir) | ||
{ | ||
ut$interactable = false; | ||
} | ||
} |
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,7 @@ | ||
{ | ||
"package": "mod.acgaming.universaltweaks.tweaks.blocks.betterplacement.mixin", | ||
"refmap": "universaltweaks.refmap.json", | ||
"minVersion": "0.8", | ||
"compatibilityLevel": "JAVA_8", | ||
"client": ["UTInteractableBlockMixin"] | ||
} |