-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move to 1.20.1 Rename to rcc-protection
- Loading branch information
Showing
7 changed files
with
106 additions
and
37 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
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
2 changes: 1 addition & 1 deletion
2
...ain/java/ct/protection/RCCProtection.java → ...reconnected/protection/RCCProtection.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package ct.protection; | ||
package cc.reconnected.protection; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
|
||
|
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
24 changes: 24 additions & 0 deletions
24
src/main/java/cc/reconnected/protection/mixin/FlanPlethoraProtect.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,24 @@ | ||
package cc.reconnected.protection.mixin; | ||
|
||
import io.github.flemmli97.flan.api.ClaimHandler; | ||
import io.github.flemmli97.flan.api.permission.BuiltinPermission; | ||
import io.sc3.plethora.gameplay.modules.laser.LaserEntity; | ||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.server.network.ServerPlayerEntity; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(LaserEntity.class) | ||
public abstract class FlanPlethoraProtect { | ||
@Shadow protected abstract PlayerEntity getShooterPlayer(); | ||
|
||
@Inject(at = @At("HEAD"), method = "canDamageEntity", cancellable = true) | ||
private void InjectDamageEntity(Entity entity, CallbackInfoReturnable<Boolean> cir) { | ||
if (entity.isPlayer()) cir.setReturnValue(!ClaimHandler.canInteract((ServerPlayerEntity) getShooterPlayer(), entity.getBlockPos(), BuiltinPermission.HURTPLAYER)); | ||
else cir.setReturnValue(!ClaimHandler.canInteract((ServerPlayerEntity) getShooterPlayer(), entity.getBlockPos(), BuiltinPermission.HURTANIMAL)); | ||
} | ||
} |
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