mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 20:22:36 +00:00
Allow the renaming of items and tools by using a nametag in a tool station/forge
This commit is contained in:
1 parent
ab98ec2b3a
commit
3b8777f8eb
4 files changed
+54
-5
No files matched your search
@@ -3,6 +3,7 @@ package tconstruct.tools.inventory;
|
||||
import java.util.Random;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.*;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -152,8 +153,18 @@ public class ToolStationContainer extends ActiveContainer
|
||||
else
|
||||
//Simply naming items
|
||||
{
|
||||
ItemStack stack2 = logic.getStackInSlot(1);
|
||||
int amount = logic.getStackInSlot(1).stackSize;
|
||||
logic.decrStackSize(1, amount);
|
||||
|
||||
if(!ToolStationLogic.canRename(stack2.getTagCompound(), stack2)) {
|
||||
for(int i = 0; i < logic.getSizeInventory(); i++) {
|
||||
if(logic.getStackInSlot(i) != null && logic.getStackInSlot(i).getItem() == Items.name_tag) {
|
||||
logic.decrStackSize(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user