Changed sneak right click support for reactor as items don't support it by default
This commit is contained in:
parent
0d7dd572c0
commit
e3980c1bd8
|
@ -1,18 +1,13 @@
|
|||
package resonantinduction.atomic.items;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import resonant.lib.render.EnumColor;
|
||||
import net.minecraft.world.World;
|
||||
import resonant.api.IReactor;
|
||||
import resonant.lib.prefab.item.ItemTooltip;
|
||||
import resonant.lib.utility.LanguageUtility;
|
||||
import resonantinduction.atomic.Atomic;
|
||||
|
||||
public class ItemCell extends Item
|
||||
public class ItemCell extends ItemTooltip
|
||||
{
|
||||
public ItemCell(int itemID)
|
||||
{
|
||||
|
@ -21,21 +16,9 @@ public class ItemCell extends Item
|
|||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack itemStack, EntityPlayer par2EntityPlayer, List list, boolean par4)
|
||||
public boolean shouldPassSneakingClickToBlock(World world, int x, int y, int z)
|
||||
{
|
||||
String tooltip = LanguageUtility.getLocal(getUnlocalizedName(itemStack) + ".tooltip");
|
||||
|
||||
if (tooltip != null && tooltip.length() > 0)
|
||||
{
|
||||
if (!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))
|
||||
{
|
||||
list.add(LanguageUtility.getLocal("tooltip.noShift").replace("%0", EnumColor.AQUA.toString()).replace("%1", EnumColor.GREY.toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
list.addAll(LanguageUtility.splitStringPerWord(tooltip, 5));
|
||||
}
|
||||
}
|
||||
return world.getBlockTileEntity(x, y, z) instanceof IReactor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -110,9 +110,9 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
{
|
||||
TileReactorCell tile = getMultiBlock().get();
|
||||
|
||||
if (player.isSneaking())
|
||||
if (player.inventory.getCurrentItem() != null)
|
||||
{
|
||||
if (player.inventory.getCurrentItem() != null)
|
||||
if (tile.getStackInSlot(0) == null)
|
||||
{
|
||||
if (player.inventory.getCurrentItem().getItem() instanceof IReactorComponent)
|
||||
{
|
||||
|
@ -123,15 +123,17 @@ public class TileReactorCell extends TileInventory implements IMultiBlockStructu
|
|||
return true;
|
||||
}
|
||||
}
|
||||
else if (tile.getStackInSlot(0) != null)
|
||||
{
|
||||
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
|
||||
tile.setInventorySlotContents(0, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
player.openGui(Atomic.INSTANCE, 0, world(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
else if (player.isSneaking() && tile.getStackInSlot(0) != null)
|
||||
{
|
||||
InventoryUtility.dropItemStack(world(), new Vector3(player), tile.getStackInSlot(0), 0);
|
||||
tile.setInventorySlotContents(0, null);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.openGui(Atomic.INSTANCE, 0, world(), tile.xCoord, tile.yCoord, tile.zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue