1.6.1 Modding対応メモ: ColorBoxの場合
Eclipseさんが赤線を引いたのは
・BlockColorBox extends BlockContainer
・TileEntityColorBox extends TileEntity
・GuiColorBox extends GuiContainer
・TileColorBoxRenderer extends TileEntitySpecialRenderer
の4つ
BlockColorBox
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack)
↓
public void onBlockPlacedBy(World world, int i, int j, int k, EntityLivingBase entityLiving, ItemStack itemStack)
引数のEntityLivingがその親クラスの指定に変わったらしい。
public Icon getBlockTextureFromSideAndMetadata(int side, int metadata)
↓
public Icon getIcon(int side, int metadata)
短くて可視性は高くなったが引数が何なのかはpar1とかだとわかりづらいから一長一短。私はこっちのほうが好き
TileEntityColorBox
IInventoryの
public boolean func_94041_b(int i, ItemStack itemstack)
public boolean func_94042_c()
↓
public boolean isStackValidForSlot(int i, ItemStack itemStack)
public boolean isInvNameLocalized()
これは1.6.1というか私のMCPのリネームテーブルが古かっただけかな
GuiColorBox
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.renderEngine.func_98187_b("/gui/container.png"); int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.inventoryRows * 18 + 17); this.drawTexturedModalRect(k, l + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); }
↓
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.func_110434_K().func_110577_a(new ResourceLocation("textures/gui/container/generic_54.png"));; int k = (this.width - this.xSize) / 2; int l = (this.height - this.ySize) / 2; this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.inventoryRows * 18 + 17); this.drawTexturedModalRect(k, l + this.inventoryRows * 18 + 17, 0, 126, this.xSize, 96); }
新たにResourceLocationというシステムが導入されているのでGuiChestを参考に改修。
TileColorBoxRenderer
... bindTextureByName(ColorBox.TEX_PATH); ...
↓
... func_110628_a(new ResourceLocation(ColorBox.TEX_PATH)); ...
こちらもTileEntityChestRendererを参考にResourceLocationを使った処理に改修。
しかしこれ、Forge757現在、動きませんね
assets内に画像がロケールされないとResourceLocation化できないみたいで、ファイルパス指定でできてた今までの手法がどうにか使えないか今調べてるところです
あと、アイテムの名前がローカライズされない問題もあるので、それらの問題についてはまた別に記事かくと思います。