Skip to content

Commit c751b9e

Browse files
committedMay 20, 2017
Fixed floppy disk name and JEI tab icon. Also updated JEI integration and removed code which is no longer necessary.

File tree

6 files changed

+50
-104
lines changed

6 files changed

+50
-104
lines changed
 

‎src/main/scala/li/cil/oc/common/item/FloppyDisk.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import net.minecraftforge.fml.relauncher.SideOnly
1515

1616
class FloppyDisk(val parent: Delegator) extends traits.Delegate with CustomModel with traits.FileSystemLike {
1717
// Necessary for anonymous subclasses used for loot disks.
18-
override def unlocalizedName = "FloppyDisk"
18+
override def unlocalizedName = "floppydisk"
1919

2020
val kiloBytes = Settings.get.floppySize
2121

‎src/main/scala/li/cil/oc/integration/jei/CallbackDocHandler.scala

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ object CallbackDocHandler {
105105

106106
def initialize(guiHelper: IGuiHelper) {
107107
background = guiHelper.createBlankDrawable(recipeWidth, recipeHeight)
108-
icon = new DrawableAnimatedIcon(new ResourceLocation(Settings.resourceDomain, "textures/items/tablet_on.png"), 0, 0, 16, 16, 16, 32, new TickTimer(20, 1, countDown = true), 0, 16)
108+
icon = new DrawableAnimatedIcon(new ResourceLocation(Settings.resourceDomain, "textures/items/tablet_on.png"), 0, 0, 16, 16, 16, 32,
109+
guiHelper.createTickTimer(20, 1, true), 0, 16)
109110
}
110111

111112
override def getIcon: IDrawable = icon
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package li.cil.oc.integration.jei
2+
3+
import mezz.jei.api.gui.IDrawableAnimated
4+
import mezz.jei.api.gui.ITickTimer
5+
import net.minecraft.client.Minecraft
6+
import net.minecraft.client.gui.Gui
7+
import net.minecraft.util.ResourceLocation
8+
import net.minecraftforge.fml.relauncher.Side
9+
import net.minecraftforge.fml.relauncher.SideOnly
10+
11+
/**
12+
* Used to simulate an animated texture.
13+
*
14+
* @author Vexatos
15+
*/
16+
class DrawableAnimatedIcon(resourceLocation: ResourceLocation, u: Int, v: Int, width: Int, height: Int, textureWidth: Int, textureHeight: Int,
17+
tickTimer: ITickTimer, uOffset: Int, vOffset: Int,
18+
paddingTop: Int = 0, paddingBottom: Int = 0, paddingLeft: Int = 0, paddingRight: Int = 0) extends IDrawableAnimated {
19+
20+
override def getWidth: Int = width + paddingLeft + paddingRight
21+
22+
override def getHeight: Int = height + paddingTop + paddingBottom
23+
24+
@SideOnly(Side.CLIENT)
25+
override def draw(minecraft: Minecraft): Unit = draw(minecraft, 0, 0)
26+
27+
@SideOnly(Side.CLIENT)
28+
override def draw(minecraft: Minecraft, xOffset: Int, yOffset: Int) {
29+
val animationValue = tickTimer.getValue
30+
31+
val uOffsetTotal = uOffset * animationValue
32+
val vOffsetTotal = vOffset * animationValue
33+
34+
minecraft.getTextureManager.bindTexture(resourceLocation)
35+
val x = xOffset + this.paddingLeft
36+
val y = yOffset + this.paddingTop
37+
val u = this.u + uOffsetTotal
38+
val v = this.v + vOffsetTotal
39+
Gui.drawModalRectWithCustomSizedTexture(x, y, u, v, width, height, textureWidth, textureHeight)
40+
}
41+
}

‎src/main/scala/li/cil/oc/integration/jei/DrawableIcon.scala

-97
This file was deleted.

‎src/main/scala/li/cil/oc/integration/jei/LootDiskCyclingRecipeHandler.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import mezz.jei.api.recipe.BlankRecipeWrapper
1111
import mezz.jei.api.recipe.IRecipeHandler
1212
import mezz.jei.api.recipe.IRecipeWrapper
1313
import mezz.jei.api.recipe.VanillaRecipeCategoryUid
14-
import mezz.jei.api.recipe.wrapper.ICraftingRecipeWrapper
1514
import net.minecraft.item.ItemStack
1615

1716
import scala.collection.convert.WrapAsJava._
@@ -27,7 +26,7 @@ object LootDiskCyclingRecipeHandler extends IRecipeHandler[LootDiskCyclingRecipe
2726

2827
override def isRecipeValid(recipe: LootDiskCyclingRecipe): Boolean = true
2928

30-
class LootDiskCyclingRecipeWrapper(val recipe: LootDiskCyclingRecipe) extends BlankRecipeWrapper with ICraftingRecipeWrapper {
29+
class LootDiskCyclingRecipeWrapper(val recipe: LootDiskCyclingRecipe) extends BlankRecipeWrapper {
3130

3231
def getInputs: util.List[util.List[ItemStack]] = List(seqAsJavaList(Loot.disksForCycling), seqAsJavaList(List(api.Items.get(Constants.ItemName.Wrench).createItemStack(1))))
3332

‎src/main/scala/li/cil/oc/integration/jei/ManualUsageHandler.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ object ManualUsageHandler {
3232
}.flatten.toList
3333

3434
object ManualUsageRecipeHandler extends IRecipeHandler[ManualUsageRecipe] {
35-
override def getRecipeWrapper(recipe: ManualUsageRecipe) = recipe
35+
override def getRecipeWrapper(recipe: ManualUsageRecipe): ManualUsageRecipe = recipe
3636

3737
override def getRecipeCategoryUid(recipe: ManualUsageRecipe): String = ManualUsageRecipeCategory.getUid
3838

3939
override def isRecipeValid(recipe: ManualUsageRecipe) = true
4040

41-
override def getRecipeClass = classOf[ManualUsageRecipe]
41+
override def getRecipeClass: Class[ManualUsageRecipe] = classOf[ManualUsageRecipe]
4242
}
4343

4444
class ManualUsageRecipe(val stack: ItemStack, val path: String) extends BlankRecipeWrapper {
@@ -72,11 +72,13 @@ object ManualUsageHandler {
7272

7373
def initialize(guiHelper: IGuiHelper) {
7474
background = guiHelper.createBlankDrawable(recipeWidth, recipeHeight)
75-
icon = new DrawableIcon(new ResourceLocation(Settings.resourceDomain, "textures/items/manual.png"), 0, 0, 16, 16, 16, 16)
75+
icon = guiHelper.createDrawable(new ResourceLocation(Settings.resourceDomain, "textures/items/manual.png"), 0, 0, 16, 16, 16, 16)
7676
}
7777

7878
override def getBackground: IDrawable = background
7979

80+
override def getIcon: IDrawable = icon
81+
8082
override def setRecipe(recipeLayout: IRecipeLayout, recipeWrapper: ManualUsageRecipe, ingredients: IIngredients) {
8183
}
8284

0 commit comments

Comments
 (0)
Please sign in to comment.