-
-
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.
- Loading branch information
1 parent
69c94c2
commit 0ec4456
Showing
17 changed files
with
336 additions
and
140 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
30 changes: 30 additions & 0 deletions
30
src/main/java/net/zekromaster/minecraft/ironchests/mixin/ChestMixin.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,30 @@ | ||
package net.zekromaster.minecraft.ironchests.mixin; | ||
|
||
import net.minecraft.block.ChestBlock; | ||
import net.minecraft.block.entity.ChestBlockEntity; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.World; | ||
import net.zekromaster.minecraft.ironchests.ChestUpgrade; | ||
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; | ||
|
||
@Mixin(ChestBlock.class) | ||
public class ChestMixin { | ||
|
||
@Inject(method = "onUse", at=@At("HEAD"), cancellable = true) | ||
void onUseMixin(World world, int x, int y, int z, PlayerEntity player, CallbackInfoReturnable<Boolean> cir) { | ||
var chest = (ChestBlockEntity) world.getBlockEntity(x, y, z); | ||
var hand = player.getHand(); | ||
if (hand != null) { | ||
if (hand.getItem() instanceof ChestUpgrade upgrade) { | ||
if (upgrade.upgrade(world, x, y, z, player, chest)) { | ||
hand.count--; | ||
} | ||
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
113 changes: 0 additions & 113 deletions
113
src/main/kotlin/net/zekromaster/minecraft/ironchests/entrypoints.kt
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.