-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Custom Upgrade NBT with Comp Drawers, Tooltip
- Loading branch information
1 parent
786b44b
commit 284b182
Showing
6 changed files
with
62 additions
and
0 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
39 changes: 39 additions & 0 deletions
39
src/main/java/com/nomiceu/nomilabs/mixin/storagedrawers/ItemCompDrawersMixin.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,39 @@ | ||
package com.nomiceu.nomilabs.mixin.storagedrawers; | ||
|
||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.world.World; | ||
|
||
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 com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers; | ||
import com.jaquadro.minecraft.storagedrawers.item.ItemCompDrawers; | ||
import com.nomiceu.nomilabs.integration.storagedrawers.CustomUpgradeHandler; | ||
|
||
/** | ||
* Reads from Labs Upgrade NBT. | ||
* <p> | ||
* ItemCompDrawers doesn't inherit from ItemDrawers. | ||
*/ | ||
@Mixin(value = ItemCompDrawers.class, remap = false) | ||
public class ItemCompDrawersMixin { | ||
|
||
@Inject(method = "placeBlockAt", | ||
at = @At(value = "INVOKE", | ||
target = "Lnet/minecraft/world/World;getTileEntity(Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/tileentity/TileEntity;"), | ||
remap = true, | ||
require = 1) | ||
private void handleCustomNBT(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, | ||
float hitX, float hitY, float hitZ, IBlockState newState, | ||
CallbackInfoReturnable<Boolean> cir) { | ||
var te = world.getTileEntity(pos); | ||
if (!(te instanceof TileEntityDrawers teDrawers)) return; | ||
CustomUpgradeHandler.addCustomUpgradesToTile(teDrawers, stack.getTagCompound()); | ||
} | ||
} |
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
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