Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.76 KB | None | 0 0
  1. package fr.telozia.BastienR_;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Iterator;
  5. import java.util.LinkedHashSet;
  6. import java.util.List;
  7. import java.util.Set;
  8.  
  9. import org.lwjgl.input.Keyboard;
  10. import org.lwjgl.input.Mouse;
  11. import org.lwjgl.opengl.GL11;
  12.  
  13. import net.minecraft.client.entity.EntityClientPlayerMP;
  14. import net.minecraft.client.gui.GuiButton;
  15. import net.minecraft.client.gui.GuiScreen;
  16. import net.minecraft.client.gui.GuiTextField;
  17. import net.minecraft.client.gui.inventory.GuiContainer;
  18. import net.minecraft.client.gui.inventory.GuiInventory;
  19. import net.minecraft.client.resources.I18n;
  20. import net.minecraft.creativetab.CreativeTabs;
  21. import net.minecraft.enchantment.Enchantment;
  22. import net.minecraft.entity.player.EntityPlayer;
  23. import net.minecraft.init.Blocks;
  24. import net.minecraft.init.Items;
  25. import net.minecraft.inventory.Container;
  26. import net.minecraft.inventory.IInventory;
  27. import net.minecraft.inventory.InventoryBasic;
  28. import net.minecraft.inventory.InventoryCraftResult;
  29. import net.minecraft.inventory.Slot;
  30. import net.minecraft.item.Item;
  31. import net.minecraft.item.ItemStack;
  32. import net.minecraft.item.crafting.CraftingManager;
  33. import net.minecraft.item.crafting.FurnaceRecipes;
  34. import net.minecraft.item.crafting.IRecipe;
  35. import net.minecraft.item.crafting.ShapedRecipes;
  36. import net.minecraft.item.crafting.ShapelessRecipes;
  37. import net.minecraft.util.EnumChatFormatting;
  38. import net.minecraft.util.ResourceLocation;
  39.  
  40. public class GuiWiki
  41. extends GuiContainer
  42. {
  43. private static final ResourceLocation tabCraft = new ResourceLocation("textures/gui/wiki.png");
  44. private static final Set<IRecipe> recipes = new LinkedHashSet();
  45. private static InventoryBasic inventory = new InventoryBasic("tmp", true, 45);
  46. private static GuiTextField textField;
  47. private static boolean field_147057_D;
  48. private float field_147067_x;
  49. private boolean field_147066_y;
  50. private boolean field_147065_z;
  51. private static int field_147058_w = CreativeTabs.tabAllSearch.getTabIndex();
  52. private static EntityPlayer entity;
  53. private List field_147063_B;
  54. private Slot field_147064_C;
  55.  
  56. public GuiWiki(EntityClientPlayerMP thePlayer)
  57. {
  58. super(new ContainerCrafts(entity));
  59. field_147057_D = true;
  60. if (recipes.size() == 0)
  61. {
  62. Iterator var2 = CraftingManager.getInstance().getRecipeList().iterator();
  63. while (var2.hasNext())
  64. {
  65. IRecipe recipe = (IRecipe)var2.next();
  66. if (recipe.getRecipeOutput() != null) {
  67. recipes.add(recipe);
  68. }
  69. }
  70. }
  71. }
  72.  
  73. protected void func_146979_b(int p_146979_1_, int p_146979_2_)
  74. {
  75. GL11.glDisable(3042);
  76. this.fontRendererObj.drawString(I18n.format(EnumChatFormatting.DARK_RED + "Recherche :", new Object[0]), 8, 6, 4210752);
  77. }
  78.  
  79. protected void func_146976_a(float p_146976_1_, int p_146976_2_, int p_146976_3_)
  80. {
  81. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  82. this.mc.getTextureManager().bindTexture(tabCraft);
  83. drawTexturedModalRect(this.field_147003_i, this.field_147009_r, 0 , 0, 200 + 55, 190);
  84. textField.drawTextBox();
  85. int var9 = this.field_147003_i + 175;
  86. int var6 = this.field_147009_r + 18;
  87. int var7 = var6 + 112;
  88. this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tabs.png"));
  89. drawTexturedModalRect(var9, var6 + (int)((float)(var7 - var6 - 17) * this.field_147067_x), 232 + (this.func_147055_p() ? 0 : 12), 0, 12, 15);
  90. }
  91.  
  92. public void initGui()
  93. {
  94. super.initGui();
  95.  
  96. this.buttonList.clear();
  97. Keyboard.enableRepeatEvents(true);
  98. textField = new GuiTextField(this.fontRendererObj, this.field_147003_i + 82, this.field_147009_r + 6, 89, this.fontRendererObj.FONT_HEIGHT);
  99. textField.func_146203_f(15);
  100. textField.func_146185_a(false);
  101. textField.func_146189_e(false);
  102. textField.func_146193_g(16777215);
  103. int var1 = field_147058_w;
  104. func_147050_b(CreativeTabs.creativeTabArray[var1]);
  105.  
  106.  
  107. }
  108.  
  109. protected void actionPerformed(GuiButton p_146284_1_)
  110. {
  111.  
  112. //Bouton retour
  113. if (p_146284_1_.id == 3)
  114. {
  115. this.mc.displayGuiScreen(new GuiInventory(this.mc.thePlayer));
  116. }
  117.  
  118. //Bouton fermer
  119. if(p_146284_1_.id == 4)
  120. {
  121. this.mc.displayGuiScreen((GuiScreen)null);
  122. this.mc.setIngameFocus();
  123. }
  124.  
  125. }
  126.  
  127. public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_)
  128. {
  129. boolean var4 = Mouse.isButtonDown(0);
  130. int var5 = this.field_147003_i;
  131. int var6 = this.field_147009_r;
  132. int var7 = var5 + 175;
  133. int var8 = var6 + 18;
  134. int var9 = var7 + 14;
  135. int var10 = var8 + 112;
  136. if ((!this.field_147065_z) && (var4) && (p_73863_1_ >= var7) && (p_73863_2_ >= var8) && (p_73863_1_ < var9) && (p_73863_2_ < var10)) {
  137. this.field_147066_y = func_147055_p();
  138. }
  139. if (!var4) {
  140. this.field_147066_y = false;
  141. }
  142. this.field_147065_z = var4;
  143. if (this.field_147066_y)
  144. {
  145. this.field_147067_x = ((p_73863_2_ - var8 - 7.5F) / (var10 - var8 - 15.0F));
  146. if (this.field_147067_x < 0.0F) {
  147. this.field_147067_x = 0.0F;
  148. }
  149. if (this.field_147067_x > 0.77F) {
  150. this.field_147067_x = 0.77F;
  151. }
  152. ((ContainerCrafts)this.field_147002_h).func_148329_a(this.field_147067_x);
  153. }
  154. super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
  155. GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
  156. GL11.glDisable(2896);
  157. }
  158.  
  159. protected void keyTyped(char p_73869_1_, int p_73869_2_)
  160. {
  161. if (field_147057_D)
  162. {
  163. field_147057_D = false;
  164. textField.setText ("");
  165. }
  166. if (textField.textboxKeyTyped(p_73869_1_, p_73869_2_)) {
  167. func_147053_i();
  168. } else {
  169. super.keyTyped(p_73869_1_, p_73869_2_);
  170. }
  171. }
  172.  
  173. private void func_147053_i()
  174. {
  175. ContainerCrafts var1 = (ContainerCrafts)this.field_147002_h;
  176. var1.field_148330_a.clear();
  177. Iterator var2 = Item.itemRegistry.iterator();
  178. while (var2.hasNext())
  179. {
  180. Item var8 = (Item)var2.next();
  181. if ((var8 != null) && (var8.getCreativeTab() != null)) {
  182. var8.getSubItems(var8, null, var1.field_148330_a);
  183. }
  184. }
  185. Enchantment[] var101 = Enchantment.enchantmentsList;
  186. int var9 = var101.length;
  187. for (int var10 = 0; var10 < var9; var10++)
  188. {
  189. Enchantment var11 = var101[var10];
  190. if ((var11 != null) && (var11.type != null)) {
  191. Items.enchanted_book.func_92113_a(var11, var1.field_148330_a);
  192. }
  193. }
  194. var2 = var1.field_148330_a.iterator();
  195. String var111 = textField.getText().toLowerCase();
  196. while (var2.hasNext())
  197. {
  198. ItemStack var121 = (ItemStack)var2.next();
  199. boolean var12 = false;
  200. Iterator var6 = var121.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips).iterator();
  201. while (var6.hasNext())
  202. {
  203. String var7 = (String)var6.next();
  204. if (var7.toLowerCase().contains(var111)) {
  205. var12 = true;
  206. }
  207. }
  208. if (!var12) {
  209. var2.remove();
  210. }
  211. }
  212. this.field_147067_x = 0.0F;
  213. var1.func_148329_a(0.0F);
  214. }
  215.  
  216. private void func_147050_b(CreativeTabs p_147050_1_)
  217. {
  218. int var2 = field_147058_w;
  219. field_147058_w = p_147050_1_.getTabIndex();
  220. ContainerCrafts var3 = (ContainerCrafts)this.field_147002_h;
  221. this.field_147008_s.clear();
  222. var3.field_148330_a.clear();
  223. p_147050_1_.displayAllReleventItems(var3.field_148330_a);
  224. if (var2 == CreativeTabs.tabInventory.getTabIndex())
  225. {
  226. var3.inventorySlots = this.field_147063_B;
  227. this.field_147063_B = null;
  228. }
  229. if (textField != null) {
  230. if (p_147050_1_ == CreativeTabs.tabAllSearch)
  231. {
  232. textField.func_146189_e(true);
  233. textField.func_146205_d(false);
  234. textField.setFocused(true);
  235. textField.setText("");
  236. func_147053_i();
  237. }
  238. else
  239. {
  240. textField.func_146189_e(false);
  241. textField.func_146205_d(true);
  242. textField.setFocused(false);
  243. }
  244. }
  245. this.field_147067_x = 0.0F;
  246. var3.func_148329_a(0.0F);
  247. }
  248.  
  249. private boolean func_147055_p()
  250. {
  251. return (CreativeTabs.creativeTabArray[field_147058_w].shouldHidePlayerInventory()) && (((ContainerCrafts)this.field_147002_h).func_148328_e());
  252. }
  253.  
  254. public void handleMouseInput()
  255. {
  256. super.handleMouseInput();
  257. int var1 = Mouse.getEventDWheel();
  258. if ((var1 != 0) && (func_147055_p()))
  259. {
  260. int var2 = ((ContainerCrafts)this.field_147002_h).field_148330_a.size() / 4 - 1 + 1;
  261. if (var1 > 0) {
  262. var1 = 1;
  263. }
  264. if (var1 < 0) {
  265. var1 = -1;
  266. }
  267. this.field_147067_x = (float)((double)this.field_147067_x - (double)var1 / (double)var2);
  268. if (this.field_147067_x < 0.0F) {
  269. this.field_147067_x = 0.0F;
  270. }
  271. if (this.field_147067_x > 0.77F) {
  272. this.field_147067_x = 0.77F;
  273. }
  274. ((ContainerCrafts)this.field_147002_h).func_148329_a(this.field_147067_x);
  275. }
  276. }
  277.  
  278. protected void func_146984_a(Slot p_146984_1_, int p_146984_2_, int p_146984_3_, int p_146984_4_)
  279. {
  280. if ((p_146984_1_ != null) && (p_146984_1_.getHasStack()))
  281. {
  282. ContainerCrafts craft = (ContainerCrafts)this.field_147002_h;
  283. ItemStack stack = p_146984_1_.getStack();
  284. if (stack != null) {
  285. craft.setRecipe(stack);
  286. }
  287. }
  288. }
  289.  
  290. static class ContainerCrafts
  291. extends Container
  292. {
  293. public List field_148330_a = new ArrayList();
  294. public IInventory[] matrixs = new IInventory[9];
  295. public IInventory craftResult = new InventoryCraftResult();
  296.  
  297. public ContainerCrafts(EntityPlayer p_i1086_1_)
  298. {
  299. for (int var3 = 0; var3 < 5; var3++) {
  300. for (int i = 0; i < 9; i++) {
  301. addSlotToContainer(new Slot(GuiWiki.inventory, var3 * 9 + i, 9 + i * 18, 18 + var3 * 18));
  302. }
  303. }
  304. addSlotToContainer(new Slot(this.craftResult, 46, 128, 138));
  305. int i = 0;
  306. for (int var6 = 0; var6 < 3; var6++) {
  307. for (int var7 = 0; var7 < 3; var7++)
  308. {
  309. IInventory inventory = this.matrixs[i] = new InventoryCraftResult();
  310. addSlotToContainer(new Slot(inventory, i + 47, 30 + var7 * 18 + 4, 17 + var6 * 18 + 103));
  311. i++;
  312. }
  313. }
  314. func_148329_a(0.0F);
  315. }
  316.  
  317. public void func_148329_a(float p_148329_1_)
  318. {
  319. int var2 = this.field_148330_a.size() / 9 - 5 + 1;
  320. int var3 = (int)(p_148329_1_ * var2 * 1.25D + 0.5D);
  321. if (var3 < 0) {
  322. var3 = 0;
  323. }
  324. for (int var4 = 0; var4 < 5; var4++) {
  325. for (int var5 = 0; var5 < 9; var5++)
  326. {
  327. int var6 = var5 + (var4 + var3) * 9;
  328. if ((var6 >= 0) && (var6 < this.field_148330_a.size())) {
  329. GuiWiki.inventory.setInventorySlotContents(var5 + var4 * 9, (ItemStack)this.field_148330_a.get(var6));
  330. } else {
  331. GuiWiki.inventory.setInventorySlotContents(var5 + var4 * 9, null);
  332. }
  333. }
  334. }
  335. }
  336.  
  337. public void setRecipe(ItemStack stack)
  338. {
  339. clearMatrix();
  340. this.craftResult.setInventorySlotContents(0, stack);
  341. IRecipe recipe = null;
  342. Iterator shape = CraftingManager.getInstance().getRecipeList().iterator();
  343. while (shape.hasNext())
  344. {
  345. IRecipe stacks = (IRecipe)shape.next();
  346. if ((stacks != null) && (stacks.getRecipeOutput() != null) && (stacks.getRecipeOutput().getItem() != null) && (stacks.getRecipeOutput().getItem().equals(stack.getItem())))
  347. {
  348. recipe = stacks;
  349. break;
  350. }
  351. }
  352. if (recipe != null)
  353. {
  354. this.craftResult.setInventorySlotContents(0, recipe.getRecipeOutput());
  355. if ((recipe instanceof ShapedRecipes))
  356. {
  357. ShapedRecipes var10 = (ShapedRecipes)recipe;
  358. ItemStack[] var12 = var10.recipeItems;
  359. if ((!recipe.getRecipeOutput().getItem().equals(Items.wooden_sword)) && (!recipe.getRecipeOutput().getItem().equals(Items.stone_sword)) && (!recipe.getRecipeOutput().getItem().equals(Items.golden_sword)) && (!recipe.getRecipeOutput().getItem().equals(Items.iron_sword)) && (!recipe.getRecipeOutput().getItem().equals(Items.diamond_sword)))
  360. {
  361. if ((!recipe.getRecipeOutput().getItem().equals(Items.wooden_axe)) && (!recipe.getRecipeOutput().getItem().equals(Items.stone_axe)) && (!recipe.getRecipeOutput().getItem().equals(Items.golden_axe)) && (!recipe.getRecipeOutput().getItem().equals(Items.iron_axe)) && (!recipe.getRecipeOutput().getItem().equals(Items.diamond_axe)))
  362. {
  363. if ((!recipe.getRecipeOutput().getItem().equals(Items.wooden_hoe)) && (!recipe.getRecipeOutput().getItem().equals(Items.stone_hoe)) && (!recipe.getRecipeOutput().getItem().equals(Items.golden_hoe)) && (!recipe.getRecipeOutput().getItem().equals(Items.iron_hoe)) && (!recipe.getRecipeOutput().getItem().equals(Items.diamond_hoe)))
  364. {
  365. if ((!recipe.getRecipeOutput().getItem().equals(Items.wooden_shovel)) && (!recipe.getRecipeOutput().getItem().equals(Items.stone_shovel)) && (!recipe.getRecipeOutput().getItem().equals(Items.golden_shovel)) && (!recipe.getRecipeOutput().getItem().equals(Items.iron_shovel)) && (!recipe.getRecipeOutput().getItem().equals(Items.diamond_shovel)))
  366. {
  367. if ((!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.iron_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.gold_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.emerald_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.diamond_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.coal_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.redstone_block))) && (!recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.lapis_block))))
  368. {
  369. if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.sandstone)))
  370. {
  371. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  372. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  373. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  374. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  375. }
  376. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.sticky_piston)))
  377. {
  378. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  379. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  380. }
  381. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.wool)))
  382. {
  383. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  384. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  385. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  386. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  387. }
  388. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.brick_block)))
  389. {
  390. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  391. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  392. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  393. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  394. }
  395. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(50)))
  396. {
  397. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  398. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  399. }
  400. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(58)))
  401. {
  402. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  403. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  404. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  405. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  406. }
  407. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(69)))
  408. {
  409. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  410. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  411. }
  412. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(76)))
  413. {
  414. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  415. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  416. }
  417. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.snow)))
  418. {
  419. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  420. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  421. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  422. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  423. }
  424. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.clay)))
  425. {
  426. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  427. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  428. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  429. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  430. }
  431. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.glowstone)))
  432. {
  433. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  434. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  435. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  436. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  437. }
  438. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(91)))
  439. {
  440. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  441. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  442. }
  443. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(170)))
  444. {
  445. for (int i = 0; i < 9; i++) {
  446. this.matrixs[i].setInventorySlotContents(0, new ItemStack(var12[0].getItem(), 1));
  447. }
  448. }
  449. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.stonebrick)))
  450. {
  451. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  452. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  453. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  454. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  455. }
  456. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.nether_brick)))
  457. {
  458. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  459. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  460. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  461. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  462. }
  463. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(131)))
  464. {
  465. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  466. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  467. this.matrixs[6].setInventorySlotContents(0, var12[2]);
  468. }
  469. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.trapped_chest)))
  470. {
  471. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  472. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  473. }
  474. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemFromBlock(Blocks.quartz_block)))
  475. {
  476. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  477. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  478. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  479. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  480. }
  481. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(262)))
  482. {
  483. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  484. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  485. this.matrixs[6].setInventorySlotContents(0, var12[2]);
  486. }
  487. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(342)))
  488. {
  489. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  490. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  491. }
  492. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(343)))
  493. {
  494. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  495. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  496. }
  497. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(407)))
  498. {
  499. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  500. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  501. }
  502. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(408)))
  503. {
  504. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  505. this.matrixs[3].setInventorySlotContents(0, var12[1]);
  506. }
  507. else
  508. {
  509. int i = 0;
  510. ItemStack[] var6 = var12;
  511. int item = var12.length;
  512. for (int var8 = 0; var8 < item; var8++)
  513. {
  514. ItemStack item1 = var6[var8];
  515. this.matrixs[i].setInventorySlotContents(0, item1);
  516. i++;
  517. }
  518. }
  519. }
  520. else {
  521. for (int i = 0; i < 9; i++) {
  522. this.matrixs[i].setInventorySlotContents(0, new ItemStack(var12[0].getItem(), 1));
  523. }
  524. }
  525. }
  526. else
  527. {
  528. this.matrixs[1].setInventorySlotContents(0, var12[0]);
  529. this.matrixs[4].setInventorySlotContents(0, var12[1]);
  530. this.matrixs[7].setInventorySlotContents(0, var12[2]);
  531. }
  532. }
  533. else
  534. {
  535. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  536. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  537. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  538. this.matrixs[7].setInventorySlotContents(0, var12[3]);
  539. }
  540. }
  541. else
  542. {
  543. this.matrixs[0].setInventorySlotContents(0, var12[0]);
  544. this.matrixs[1].setInventorySlotContents(0, var12[1]);
  545. this.matrixs[3].setInventorySlotContents(0, var12[2]);
  546. this.matrixs[4].setInventorySlotContents(0, var12[3]);
  547. this.matrixs[7].setInventorySlotContents(0, var12[3]);
  548. }
  549. }
  550. else
  551. {
  552. this.matrixs[1].setInventorySlotContents(0, var12[0]);
  553. this.matrixs[4].setInventorySlotContents(0, var12[1]);
  554. this.matrixs[7].setInventorySlotContents(0, var12[2]);
  555. }
  556. }
  557. else if ((recipe instanceof ShapelessRecipes))
  558. {
  559. ShapelessRecipes var11 = (ShapelessRecipes)recipe;
  560. List var13 = var11.recipeItems;
  561. if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(259)))
  562. {
  563. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  564. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  565. }
  566. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(282)))
  567. {
  568. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  569. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  570. this.matrixs[6].setInventorySlotContents(0, (ItemStack)var13.get(2));
  571. }
  572. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(378)))
  573. {
  574. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  575. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  576. }
  577. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(381)))
  578. {
  579. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  580. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  581. }
  582. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(385)))
  583. {
  584. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  585. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  586. this.matrixs[6].setInventorySlotContents(0, (ItemStack)var13.get(2));
  587. }
  588. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(386)))
  589. {
  590. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  591. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  592. this.matrixs[6].setInventorySlotContents(0, (ItemStack)var13.get(2));
  593. }
  594. else if (recipe.getRecipeOutput().getItem().equals(Item.getItemById(400)))
  595. {
  596. this.matrixs[0].setInventorySlotContents(0, (ItemStack)var13.get(0));
  597. this.matrixs[3].setInventorySlotContents(0, (ItemStack)var13.get(1));
  598. this.matrixs[6].setInventorySlotContents(0, (ItemStack)var13.get(2));
  599. }
  600. else
  601. {
  602. int i = 0;
  603. for (Iterator var14 = var13.iterator(); var14.hasNext(); i++)
  604. {
  605. ItemStack var15 = (ItemStack)var14.next();
  606. this.matrixs[i].setInventorySlotContents(0, var15);
  607. }
  608. }
  609. }
  610. }
  611. }
  612.  
  613. private void clearMatrix()
  614. {
  615. IInventory[] var1 = this.matrixs;
  616. int var2 = var1.length;
  617. for (int var3 = 0; var3 < var2; var3++)
  618. {
  619. IInventory matrix = var1[var3];
  620. matrix.setInventorySlotContents(0, null);
  621. }
  622. }
  623.  
  624. public boolean isFurnace(ItemStack stack)
  625. {
  626. Iterator var2 = FurnaceRecipes.smelting().getSmeltingList().keySet().iterator();
  627. ItemStack item;
  628. do
  629. {
  630. if (!var2.hasNext()) {
  631. return false;
  632. }
  633. Object items = var2.next();
  634. item = (ItemStack)items;
  635. } while (!item.getItem().equals(stack.getItem()));
  636. return true;
  637. }
  638.  
  639. public boolean canInteractWith(EntityPlayer p_75145_1_)
  640. {
  641. return true;
  642. }
  643.  
  644. public boolean func_148328_e()
  645. {
  646. return this.field_148330_a.size() > 45;
  647. }
  648.  
  649. protected void retrySlotClick(int p_75133_1_, int p_75133_2_, boolean p_75133_3_, EntityPlayer p_75133_4_) {}
  650.  
  651. public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int p_82846_2_)
  652. {
  653. if ((p_82846_2_ >= this.inventorySlots.size() - 9) && (p_82846_2_ < this.inventorySlots.size()))
  654. {
  655. Slot var3 = (Slot)this.inventorySlots.get(p_82846_2_);
  656. if ((var3 != null) && (var3.getHasStack())) {
  657. var3.putStack(null);
  658. }
  659. }
  660. return null;
  661. }
  662.  
  663. public boolean canDragIntoSlot(Slot p_94531_1_)
  664. {
  665. return true;
  666. }
  667. }
  668. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement