Bonsoir,
Après avoir suivi le tuto sur le forum pour créer un four je suis coincé .
Je voudrais avoir que un slot en input et 1 slot en output.
J’ai donc modifier ici dans le tileentity:
public static final int INPUTS_SLOTS = 1;
public static final int FUEL_SLOTS = 1;
public static final int OUTPUT_SLOTS = 1;
Mais le soucis est que maintenant lorsque je veux ouvrir mon four j’ai un crash:
[19:26:27] [main/INFO] [GradleStart]: username: floriangabet
[19:26:27] [main/INFO] [GradleStart]: Extra: []
[19:26:27] [main/INFO] [GradleStart]: Running with arguments: [–userProperties, {}, --assetsDir, C:/Users/Admin/.gradle/caches/minecraft/assets, --assetIndex, 1.8, --accessToken, {REDACTED}, --version, 1.8, --username, floriangabet, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[19:26:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[19:26:27] [main/INFO] [FML]: Forge Mod Loader version 8.0.37.1334 for Minecraft 1.8 loading
[19:26:27] [main/INFO] [FML]: Java is Java HotSpot(TM) Client VM, version 1.8.0_45, running on Windows 7:x86:6.1, installed at C:\Program Files (x86)\Java\jdk1.8.0_45\jre
[19:26:27] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[19:26:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[19:26:27] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[19:26:27] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[19:26:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[19:26:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[19:26:27] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!
[19:26:28] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[19:26:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[19:26:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[19:26:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[19:26:28] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[19:26:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[19:26:28] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[19:26:28] [Client thread/INFO]: Setting user: floriangabet
[19:26:29] [Client thread/INFO]: LWJGL Version: 2.9.1
[19:26:30] [Client thread/INFO] [MinecraftForge]: Attempting early MinecraftForge initialization
[19:26:30] [Client thread/INFO] [FML]: MinecraftForge v11.14.1.1334 Initialized
[19:26:30] [Client thread/INFO] [FML]: Replaced 204 ore recipies
[19:26:30] [Client thread/INFO] [MinecraftForge]: Completed early MinecraftForge initialization
[19:26:30] [Client thread/INFO] [FML]: Searching C:\Users\Admin\Desktop\CSC\eclipse\mods for mods
[19:26:30] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load
[19:26:30] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, csc] at CLIENT
[19:26:30] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, csc] at SERVER
[19:26:31] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Cite Sous Controle
[19:26:31] [Client thread/INFO] [FML]: Processing ObjectHolder annotations
[19:26:31] [Client thread/INFO] [FML]: Found 384 ObjectHolder annotations
[19:26:31] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[19:26:31] [Client thread/INFO] [FML]: Applying holder lookups
[19:26:31] [Client thread/INFO] [FML]: Holder lookups applied
[19:26:31] [Sound Library Loader/INFO]: Starting up SoundSystem…
[19:26:31] [Thread-7/INFO]: Initializing LWJGL OpenAL
[19:26:31] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
[19:26:31] [Thread-7/INFO]: OpenAL initialized.
[19:26:31] [Sound Library Loader/INFO]: Sound engine started
[19:26:32] [Client thread/INFO]: Created: 1024x1024 textures-atlas
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_batonP#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_panierlinge#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_coli#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_balai#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_medic#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_belier#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_clefm#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:block_block1#normal not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_menotte#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:item_bfouille#inventory not found
[19:26:32] [Client thread/ERROR] [FML]: Model definition for location csc:block_block1#inventory not found
[19:26:32] [Client thread/INFO] [STDOUT]: [com.CSC.net.Main:init:71]:
[19:26:32] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods
[19:26:32] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Cite Sous Controle
[19:26:33] [Client thread/INFO]: SoundSystem shutting down…
[19:26:33] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com
[19:26:33] [Sound Library Loader/INFO]: Starting up SoundSystem…
[19:26:33] [Thread-9/INFO]: Initializing LWJGL OpenAL
[19:26:33] [Thread-9/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
[19:26:33] [Thread-9/INFO]: OpenAL initialized.
[19:26:33] [Sound Library Loader/INFO]: Sound engine started
[19:26:34] [Client thread/INFO]: Created: 1024x1024 textures-atlas
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_batonP#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_panierlinge#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_coli#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_balai#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:block_machinelaver#normal not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_medic#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_linge#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_belier#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_clefm#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:block_block1#normal not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_menotte#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:item_bfouille#inventory not found
[19:26:34] [Client thread/ERROR] [FML]: Model definition for location csc:block_block1#inventory not found
[19:26:35] [Server thread/INFO]: Starting integrated minecraft server version 1.8
[19:26:35] [Server thread/INFO]: Generating keypair
[19:26:36] [Server thread/INFO] [FML]: Injecting existing block and item data into this server instance
[19:26:36] [Server thread/INFO] [FML]: Applying holder lookups
[19:26:36] [Server thread/INFO] [FML]: Holder lookups applied
[19:26:36] [Server thread/INFO] [FML]: Loading dimension 0 (New World) (net.minecraft.server.integrated.IntegratedServer@44130)
[19:26:36] [Server thread/INFO] [FML]: Loading dimension 1 (New World) (net.minecraft.server.integrated.IntegratedServer@44130)
[19:26:36] [Server thread/INFO] [FML]: Loading dimension -1 (New World) (net.minecraft.server.integrated.IntegratedServer@44130)
[19:26:36] [Server thread/INFO]: Preparing start region for level 0
[19:26:36] [Server thread/INFO] [STDOUT]: [com.CSC.net.Main:onServerStarting:85]: ranksaveload
[19:26:37] [Server thread/INFO]: Changing view distance to 8, from 10
[19:26:37] [Netty Local Client IO #0/INFO] [FML]: Server protocol version 1
[19:26:37] [Netty Server IO #1/INFO] [FML]: Client protocol version 1
[19:26:37] [Netty Server IO #1/INFO] [FML]: Client attempting to join with 4 mods : csc@1.0,FML@8.0.37.1334,Forge@11.14.1.1334,mcp@9.05
[19:26:37] [Netty Local Client IO #0/INFO] [FML]: [Netty Local Client IO #0] Client side modded connection established
[19:26:37] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[19:26:37] [Server thread/INFO]: floriangabet[local:E:c5fa6839] logged in with entity id 326 at (-234.81899715385038, 66.0, 228.41021904200548)
[19:26:37] [Server thread/INFO]: floriangabet a rejoint la partie
[19:26:38] [Server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 3
java.util.concurrent.ExecutionException: java.lang.ArrayIndexOutOfBoundsException: 3
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.get(FutureTask.java:192) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:710) [FMLCommonHandler.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:726) [MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at com.CSC.net.block.TileEntityMachineLaver.getStackInSlot(TileEntityMachineLaver.java:99) ~[TileEntityMachineLaver.class:?]
at net.minecraft.inventory.Slot.getStack(Slot.java:79) ~[Slot.class:?]
at net.minecraft.inventory.Container.getInventory(Container.java:75) ~[Container.class:?]
at net.minecraft.inventory.Container.addCraftingToCrafters(Container.java:61) ~[Container.class:?]
at com.CSC.net.GUI.ContainerMachineLaver.addCraftingToCrafters(ContainerMachineLaver.java:92) ~[ContainerMachineLaver.class:?]
at net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(FMLNetworkHandler.java:92) ~[FMLNetworkHandler.class:?]
at net.minecraft.entity.player.EntityPlayer.openGui(EntityPlayer.java:2577) ~[EntityPlayer.class:?]
at com.CSC.net.block.Blockmachinelaver.onBlockActivated(Blockmachinelaver.java:55) ~[Blockmachinelaver.class:?]
at net.minecraft.server.management.ItemInWorldManager.activateBlockOrUseItem(ItemInWorldManager.java:476) ~[ItemInWorldManager.class:?]
at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:624) ~[NetHandlerPlayServer.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) ~[C08PacketPlayerBlockPlacement.class:?]
at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_45]
at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:709) ~[FMLCommonHandler.class:?]
… 5 more
[19:26:38] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraft.util.ReportedException: Ticking entity
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:780) ~[MinecraftServer.class:?]
at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) ~[MinecraftServer.class:?]
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) ~[IntegratedServer.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_45]
Caused by: java.lang.ArrayIndexOutOfBoundsException: 3
at com.CSC.net.block.TileEntityMachineLaver.getStackInSlot(TileEntityMachineLaver.java:99) ~[TileEntityMachineLaver.class:?]
at net.minecraft.inventory.Slot.getStack(Slot.java:79) ~[Slot.class:?]
at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:97) ~[Container.class:?]
at com.CSC.net.GUI.ContainerMachineLaver.detectAndSendChanges(ContainerMachineLaver.java:101) ~[ContainerMachineLaver.class:?]
at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:263) ~[EntityPlayerMP.class:?]
at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2024) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:758) ~[WorldServer.class:?]
at net.minecraft.world.World.updateEntity(World.java:1990) ~[World.class:?]
at net.minecraft.world.World.updateEntities(World.java:1816) ~[World.class:?]
at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:587) ~[WorldServer.class:?]
at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:774) ~[MinecraftServer.class:?]
… 4 more
[19:26:38] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Admin\Desktop\CSC\eclipse\.\crash-reports\crash-2016-09-25_19.26.38-server.txt
[19:26:38] [Server thread/INFO]: Stopping server
[19:26:38] [Server thread/INFO]: Saving players
[19:26:38] [Server thread/INFO]: Saving worlds
[19:26:38] [Server thread/INFO]: Saving chunks for level 'New World'/Overworld
[19:26:38] [Server thread/INFO]: Saving chunks for level 'New World'/Nether
[19:26:38] [Server thread/INFO]: Saving chunks for level 'New World'/The End
[19:26:39] [Server thread/INFO] [FML]: Unloading dimension 0
[19:26:39] [Server thread/INFO] [FML]: Unloading dimension -1
[19:26:39] [Server thread/INFO] [FML]: Unloading dimension 1
[19:26:39] [Server thread/INFO] [FML]: Applying holder lookups
[19:26:39] [Server thread/INFO] [FML]: Holder lookups applied
[19:26:39] [Server thread/INFO] [FML]: The state engine was in incorrect state SERVER_STOPPING and forced into state SERVER_STOPPED. Errors may have been discarded.
Ma classe tileentity:
package com.CSC.net.block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.gui.IUpdatePlayerListBox;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TileEntityMachineLaver extends TileEntity implements IUpdatePlayerListBox, ISidedInventory
{
private String customName;
public static final int INPUTS_SLOTS = 1;
public static final int FUEL_SLOTS = 1;
public static final int OUTPUT_SLOTS = 1;
private ItemStack[] contents = new ItemStack[INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS];
private int currentWorkingTime = 0;
private int totalWorkingTime = 300;
private int remainingFuelTime = 0;
private int totalCurrentFuelTime;
@Override
public void readFromNBT(NBTTagCompound compound)
{
super.readFromNBT(compound);
NBTTagList nbttaglist = compound.getTagList("Items", 10);
this.contents = new ItemStack[this.getSizeInventory()];
for (int i = 0; i < nbttaglist.tagCount(); ++i)
{
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.contents.length)
{
this.contents[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
}
}
this.currentWorkingTime = compound.getShort("CurrentWorkingTime");
this.totalWorkingTime = compound.getShort("TotalWorkingTime");
this.remainingFuelTime = compound.getShort("RemainingFuelTime");
this.totalCurrentFuelTime = compound.getShort("TotalCurrentFuelTime");
if (compound.hasKey("CustomName", 8))
{
this.customName = compound.getString("CustomName");
}
}
@Override
public void writeToNBT(NBTTagCompound compound)
{
super.writeToNBT(compound);
compound.setShort("CurrentWorkingTime", (short)this.currentWorkingTime);
compound.setShort("TotalWorkingTime", (short)this.totalWorkingTime);
compound.setShort("RemainingFuelTime", (short)this.remainingFuelTime);
compound.setShort("TotalCurrentFuelTime", (short)this.totalCurrentFuelTime);
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.contents.length; ++i)
{
if (this.contents* != null)
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte)i);
this.contents*.writeToNBT(nbttagcompound1);
nbttaglist.appendTag(nbttagcompound1);
}
}
compound.setTag("Items", nbttaglist);
if (this.hasCustomName())
{
compound.setString("CustomName", this.customName);
}
}
@Override
public int getSizeInventory() {
return this.contents.length;
}
@Override
public ItemStack getStackInSlot(int index) {
return this.contents[index];
}
@Override
public ItemStack decrStackSize(int index, int count) {
if (this.contents[index] != null)
{
ItemStack itemstack;
if (this.contents[index].stackSize <= count)
{
itemstack = this.contents[index];
this.contents[index] = null;
this.markDirty();
return itemstack;
}
else
{
itemstack = this.contents[index].splitStack(count);
if (this.contents[index].stackSize == 0)
{
this.contents[index] = null;
}
this.markDirty();
return itemstack;
}
}
else
{
return null;
}
}
@Override
public ItemStack getStackInSlotOnClosing(int index)
{
if (this.contents[index] != null)
{
ItemStack itemstack = this.contents[index];
this.contents[index] = null;
return itemstack;
}
else
{
return null;
}
}
@Override
public void setInventorySlotContents(int index, ItemStack stack)
{
this.contents[index] = stack;
if(stack != null && stack.stackSize > this.getInventoryStackLimit())
{
stack.stackSize = this.getInventoryStackLimit();
}
}
@Override
public int getInventoryStackLimit() {
return 64;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}
@Override
public void openInventory(EntityPlayer player) {}
@Override
public void closeInventory(EntityPlayer player) {}
@Override
public boolean isItemValidForSlot(int index, ItemStack stack) {
return index >= INPUTS_SLOTS + FUEL_SLOTS ? false : index >= INPUTS_SLOTS && !this.isFuel(stack) ? false : true;
}
@Override
public int getField(int id) {
switch(id)
{
case 0:
return this.currentWorkingTime;
case 1:
return this.totalWorkingTime;
case 2:
return this.remainingFuelTime;
case 3:
return this.totalCurrentFuelTime;
default:
return 0;
}
}
@Override
public void setField(int id, int value) {
switch(id)
{
case 0:
this.currentWorkingTime = value;
break;
case 1:
this.totalWorkingTime = value;
break;
case 2:
this.remainingFuelTime = value;
break;
case 3:
this.totalCurrentFuelTime = value;
}
}
@Override
public int getFieldCount() {
return 3;
}
@Override
public void clear() {
for(int i = 0; i < this.contents.length; i++)
{
this.contents* = null;
}
}
@Override
public String getName() {
return this.hasCustomName() ? this.customName : "machine.laver";
}
@Override
public boolean hasCustomName() {
return this.customName != null && this.customName.length() > 0;
}
public void setCustomInventoryName(String name)
{
this.customName = name;
}
@Override
public IChatComponent getDisplayName() {
return new ChatComponentText(this.getName());
}
@Override
public int[] getSlotsForFace(EnumFacing side) {
if(side == EnumFacing.UP) return this.getInputSlotsIds();
if(side == EnumFacing.DOWN) return this.getOutputSlotsIds();
return this.getFuelSlotsIds();
}
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction)
{
return this.isItemValidForSlot(index, stack);
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
for(int id : this.getOutputSlotsIds())
{
if(id == index) return true;
}
return false;
}
@Override
public void update()
{
if(this.isRemainingFuel()) {
–this.remainingFuelTime;
}
if(this.isWorking() && this.canWork()) {
++this.currentWorkingTime;
}
if(!this.isWorking() && this.canWork()) {
this.currentWorkingTime = 1;
}
if(this.canWork() && this.currentWorkingTime >= this.totalWorkingTime) {
this.applyRecipe();
this.currentWorkingTime = 0;
}
if(!this.canWork()) {
this.currentWorkingTime = 0;
}
this.markDirty();
}
private boolean isFuel(ItemStack stack) {
return stack == null ? false : stack.getItem() == Items.blaze_powder;
}
private int[] getInputSlotsIds() {
int[] ids = new int[INPUTS_SLOTS];
for(int i = 0; i < INPUTS_SLOTS; i++)
{
ids* = i;
}
return ids;
}
private int[] getFuelSlotsIds() {
int[] ids = new int[FUEL_SLOTS];
int k = 0;
for(int i = INPUTS_SLOTS; i < (INPUTS_SLOTS + FUEL_SLOTS); i++)
{
ids[k] = i;
k++;
}
return ids;
}
private int[] getOutputSlotsIds() {
int[] ids = new int[OUTPUT_SLOTS];
int k = 0;
for(int i = (INPUTS_SLOTS + FUEL_SLOTS); i < (INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS); i++)
{
ids[k] = i;
k++;
}
return ids;
}
private ItemStack[] getInputSlotsContents() {
ItemStack[] s = new ItemStack[INPUTS_SLOTS];
for(int i = 0; i < INPUTS_SLOTS; i++)
{
s* = this.getStackInSlot(i);
}
return s;
}
private ItemStack[] getOutputSlotsContents() {
ItemStack[] s = new ItemStack[OUTPUT_SLOTS];
int k = 0;
for(int i = (INPUTS_SLOTS + FUEL_SLOTS); i < (INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS); i++)
{
s[k] = this.getStackInSlot(i);
k++;
}
return s;
}
public boolean isWorking() {
return this.currentWorkingTime > 0;
}
private boolean hasNullInput() {
for(int i = 0; i < INPUTS_SLOTS; i++)
{
if(this.getStackInSlot(i) == null) return true;
}
return false;
}
private boolean areOutputsNull() {
for(int i = (INPUTS_SLOTS + FUEL_SLOTS); i < (INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS); i++)
{
if(this.getStackInSlot(i) != null) return false;
}
return true;
}
private boolean canCombineStacks(ItemStack[] stack1, ItemStack[] stack2) {
if(stack1.length != stack2.length) return false;
for(int i = 0; i < stack1.length; i++)
{
if(!this.canCombineItems(stack1*, stack2*))
{
return false;
}
}
return true;
}
private boolean canCombineItems(ItemStack item1, ItemStack item2) {
if (item1 == null) return true;
if (!item1.isItemEqual(item2)) return false;
int result = item1.stackSize + item2.stackSize;
return result <= getInventoryStackLimit() && result <= item1.getMaxStackSize();
}
private boolean outOfFuel() {
if(!this.isRemainingFuel()) {
for(int i = INPUTS_SLOTS; i < (INPUTS_SLOTS + FUEL_SLOTS); i++) {
if(this.getStackInSlot(i) != null) {
int duration = RecipesMachineLaver.instance().getFuelDuration(this.getStackInSlot(i));
if(duration > 0) {
this.remainingFuelTime += duration;
this.totalCurrentFuelTime = duration;
this.decrStackSize(i, 1);
}
}
}
}
this.markDirty();
return !this.isRemainingFuel();
}
public boolean isRemainingFuel() {
return this.remainingFuelTime > 0;
}
private boolean canWork() {
if(this.hasNullInput()) {
return false;
}
ItemStack[] itemstacks = RecipesMachineLaver.instance().getRecipeResult(this.getInputSlotsContents());
if (itemstacks == null) {
return false;
}
if(this.outOfFuel()) return false;
if (this.areOutputsNull()) return true;
if (!this.canCombineStacks(this.getOutputSlotsContents(), itemstacks)) return false;
return true;
}
private void applyRecipe() {
ItemStack[] itemstacks = RecipesMachineLaver.instance().getRecipeResult(this.getInputSlotsContents());
if(this.areOutputsNull()) {
int k = 0;
for(int i = (INPUTS_SLOTS + FUEL_SLOTS); i < (INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS); i++) {
this.setInventorySlotContents(i, itemstacks[k].copy());
k++;
}
}
else {
int k = 0;
for(int i = (INPUTS_SLOTS + FUEL_SLOTS); i < (INPUTS_SLOTS + FUEL_SLOTS + OUTPUT_SLOTS); i++) {
if(this.getStackInSlot(i) != null && itemstacks[k] != null) {
this.getStackInSlot(i).stackSize += itemstacks[k].copy().stackSize;
}
else if(this.getStackInSlot(i) == null) {
this.setInventorySlotContents(i, itemstacks[k].copy());;
}
k++;
}
}
for(int i = 0; i < INPUTS_SLOTS; i++) {
this.decrStackSize(i, 1);
}
this.markDirty();
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
this.writeToNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(this.getPos(), this.getBlockMetadata(), nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
this.readFromNBT(pkt.getNbtCompound());
this.worldObj.markBlockRangeForRenderUpdate(this.pos, this.pos);
}
@SideOnly(Side.CLIENT)
public int getRecipeProgress() {
return this.currentWorkingTime * 17 / this.totalWorkingTime;
}
@SideOnly(Side.CLIENT)
public int getFuelProgress()
{
return this.remainingFuelTime * 20 / this.totalCurrentFuelTime;
}
}
Merci