75 lines
2.6 KiB
Diff
75 lines
2.6 KiB
Diff
--- ../src-base/minecraft/net/minecraft/inventory/Slot.java
|
|
+++ ../src-work/minecraft/net/minecraft/inventory/Slot.java
|
|
@@ -89,7 +89,7 @@
|
|
@SideOnly(Side.CLIENT)
|
|
public String func_178171_c()
|
|
{
|
|
- return null;
|
|
+ return backgroundName;
|
|
}
|
|
|
|
public ItemStack func_75209_a(int p_75209_1_)
|
|
@@ -112,4 +112,63 @@
|
|
{
|
|
return true;
|
|
}
|
|
+
|
|
+ /*========================================= FORGE START =====================================*/
|
|
+ protected String backgroundName = null;
|
|
+ protected net.minecraft.util.ResourceLocation backgroundLocation = null;
|
|
+ protected Object backgroundMap;
|
|
+ /**
|
|
+ * Gets the path of the texture file to use for the background image of this slot when drawing the GUI.
|
|
+ * @return The resource location for the background image
|
|
+ */
|
|
+ @SideOnly(Side.CLIENT)
|
|
+ public net.minecraft.util.ResourceLocation getBackgroundLocation()
|
|
+ {
|
|
+ return (backgroundLocation == null ? net.minecraft.client.renderer.texture.TextureMap.field_110575_b : backgroundLocation);
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets the texture file to use for the background image of the slot when it's empty.
|
|
+ * @param texture the resourcelocation for the texture
|
|
+ */
|
|
+ @SideOnly(Side.CLIENT)
|
|
+ public void setBackgroundLocation(net.minecraft.util.ResourceLocation texture)
|
|
+ {
|
|
+ this.backgroundLocation = texture;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Sets which icon index to use as the background image of the slot when it's empty.
|
|
+ * @param name The icon to use, null for none
|
|
+ */
|
|
+ public void setBackgroundName(String name)
|
|
+ {
|
|
+ this.backgroundName = name;
|
|
+ }
|
|
+
|
|
+ @SideOnly(Side.CLIENT)
|
|
+ public net.minecraft.client.renderer.texture.TextureAtlasSprite getBackgroundSprite()
|
|
+ {
|
|
+ String name = func_178171_c();
|
|
+ return name == null ? null : getBackgroundMap().func_110572_b(name);
|
|
+ }
|
|
+
|
|
+ @SideOnly(Side.CLIENT)
|
|
+ protected net.minecraft.client.renderer.texture.TextureMap getBackgroundMap()
|
|
+ {
|
|
+ if (backgroundMap == null) backgroundMap = net.minecraft.client.Minecraft.func_71410_x().func_147117_R();
|
|
+ return (net.minecraft.client.renderer.texture.TextureMap)backgroundMap;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Retrieves the index in the inventory for this slot, this value should typically not
|
|
+ * be used, but can be useful for some occasions.
|
|
+ *
|
|
+ * @return Index in associated inventory for this slot.
|
|
+ */
|
|
+ public int getSlotIndex()
|
|
+ {
|
|
+ return field_75225_a;
|
|
+ }
|
|
+ /*========================================= FORGE END =====================================*/
|
|
}
|