blob: 8337dc23fc6c46467910b9ee0b0a6ae3e22a8a26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package binnie.craftgui.minecraft.control;
import binnie.core.genetics.IItemStackRepresentitive;
import binnie.craftgui.controls.tab.ControlTab;
import binnie.craftgui.controls.tab.ControlTabBar;
import binnie.craftgui.core.geometry.IPoint;
import binnie.craftgui.core.geometry.Position;
import net.minecraft.item.ItemStack;
public class ControlTabIcon<T>
extends ControlTab<T>
{
private ControlItemDisplay item;
public ControlTabIcon(ControlTabBar<T> parent, float x, float y, float w, float h, T value)
{
super(parent, x, y, w, h, value);
this.item = new ControlItemDisplay(this, -8.0F + w / 2.0F, -8.0F + h / 2.0F);
this.item.hastooltip = false;
}
public ItemStack getItemStack()
{
if ((this.value instanceof IItemStackRepresentitive)) {
return ((IItemStackRepresentitive)this.value).getItemStackRepresentitive();
}
return null;
}
public void onUpdateClient()
{
super.onUpdateClient();
this.item.setItemStack(getItemStack());
float x = ((ControlTabBar)getParent()).getDirection().x();
this.item.setOffset(new IPoint((isCurrentSelection()) || (isMouseOver()) ? 0.0F : -4.0F * x, 0.0F));
}
public boolean hasOutline()
{
return false;
}
public int getOutlineColour()
{
return 16777215;
}
}
|