-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
91 additions
and
5 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
8 changes: 8 additions & 0 deletions
8
src/main/java/com/almostreliable/kubeaa/extension/TileEntityEmpowererExtension.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,8 @@ | ||
package com.almostreliable.kubeaa.extension; | ||
|
||
import java.util.UUID; | ||
|
||
public interface TileEntityEmpowererExtension { | ||
|
||
void kjsaa$setPlayer(UUID uuid); | ||
} |
4 changes: 4 additions & 0 deletions
4
src/main/java/com/almostreliable/kubeaa/extension/package-info.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,4 @@ | ||
@NonnullDefault | ||
package com.almostreliable.kubeaa.extension; | ||
|
||
import org.lwjgl.system.NonnullDefault; |
38 changes: 38 additions & 0 deletions
38
src/main/java/com/almostreliable/kubeaa/mixin/BlockDisplayStandMixin.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,38 @@ | ||
package com.almostreliable.kubeaa.mixin; | ||
|
||
import com.almostreliable.kubeaa.extension.TileEntityEmpowererExtension; | ||
import com.llamalad7.mixinextras.sugar.Local; | ||
import de.ellpeck.actuallyadditions.mod.blocks.BlockDisplayStand; | ||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityInventoryBase; | ||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.ItemInteractionResult; | ||
import net.minecraft.world.entity.player.Player; | ||
import net.minecraft.world.item.ItemStack; | ||
import net.minecraft.world.level.Level; | ||
import net.minecraft.world.level.block.state.BlockState; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Mixin(BlockDisplayStand.class) | ||
public class BlockDisplayStandMixin { | ||
|
||
@Shadow | ||
@Final | ||
private boolean isEmpowerer; | ||
|
||
@Inject(method = "useItemOn", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/player/Player;isCreative()Z")) | ||
private void onItemInsert( | ||
ItemStack stack, BlockState state, Level level, BlockPos pos, Player player, InteractionHand hand, | ||
BlockHitResult hitResult, CallbackInfoReturnable<ItemInteractionResult> cir, | ||
@Local TileEntityInventoryBase blockEntity | ||
) { | ||
if (!isEmpowerer) return; | ||
((TileEntityEmpowererExtension) blockEntity).kjsaa$setPlayer(player.getUUID()); | ||
} | ||
} |
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