View Issue Details

IDProjectCategoryView StatusLast Update
0001720Industrial-Craft²machinespublic2015-09-10 21:33
ReporterArtmoneyse Assigned ToAroma1997  
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionwon't fix 
Summary0001720: MolecularTransformer + ItemBuffer = Crash server
DescriptionArray Index Out Of Bounds Exception.
Details can be seen in this video https://youtu.be/2aOQ1Hfc-7A
Additional InformationServer #1
cauldron-1.7.10-1.1207
AdvancedSolarPanel-1.7.10-3.5.1
industrialcraft-2-2.2.736-experimental

Server #2
KCauldron-1.7.10-1481
AdvancedSolarPanel-1.7.10-3.5.1
industrialcraft-2-2.2.767-experimental
TagsNo tags attached.
Minecraft Version

Activities

Artmoneyse

2015-09-07 22:10

reporter  

crash-2015-09-08_00.12.28-server.txt (8,939 bytes)   
---- Minecraft Crash Report ----
// You're mean.

Time: 08.09.15 0:12
Description: Ticking block entity

java.lang.ArrayIndexOutOfBoundsException: -1
	at advsolar.common.tiles.TileEntityMolecularTransformer.func_70301_a(TileEntityMolecularTransformer.java:715)
	at ic2.core.util.StackUtil.getInventorySlots(StackUtil.java:356)
	at ic2.core.util.StackUtil.transfer(StackUtil.java:144)
	at ic2.core.item.ItemUpgradeModule.onTick(ItemUpgradeModule.java:330)
	at ic2.core.block.machine.tileentity.TileEntityItemBuffer.func_145845_h(TileEntityItemBuffer.java:63)
	at net.minecraft.world.World.func_72939_s(World.java:2492)
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669)
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:943)
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658)
	at java.lang.Thread.run(Unknown Source)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
	at advsolar.common.tiles.TileEntityMolecularTransformer.func_70301_a(TileEntityMolecularTransformer.java:715)
	at ic2.core.util.StackUtil.getInventorySlots(StackUtil.java:356)
	at ic2.core.util.StackUtil.transfer(StackUtil.java:144)
	at ic2.core.item.ItemUpgradeModule.onTick(ItemUpgradeModule.java:330)
	at ic2.core.block.machine.tileentity.TileEntityItemBuffer.func_145845_h(TileEntityItemBuffer.java:63)

-- Block entity being ticked --
Details:
	Name: Item Buffer // ic2.core.block.machine.tileentity.TileEntityItemBuffer
	Block type: ID #231 (blockMachine3 // ic2.core.block.machine.BlockMachine3)
	Block data value: 6 / 0x6 / 0b0110
	Block location: World: (542,71,-10), Chunk: (at 14,4,6 in 33,-1; contains blocks 528,0,-16 to 543,255,-1), Region: (1,-1; contains chunks 32,-32 to 63,-1, blocks 512,0,-512 to 1023,255,-1)
	Actual block type: ID #231 (blockMachine3 // ic2.core.block.machine.BlockMachine3)
	Actual block data value: 6 / 0x6 / 0b0110
Stacktrace:
	at net.minecraft.world.World.func_72939_s(World.java:2492)
	at net.minecraft.world.WorldServer.func_72939_s(WorldServer.java:669)

-- Affected level --
Details:
	Level name: world
	All players: 4 total; [EntityPlayerMP['Artmoneyse'/60, l='world', x=544,01, y=69,00, z=-11,82](Artmoneyse at 544.005175440452,69.0,-11.820013644013311), EntityPlayerMP['Antsev'/279, l='world', x=335,30, y=61,20, z=-242,76](Antsev at 335.30000001192093,61.20000004768375,-242.7629822534347), EntityPlayerMP['Bahmak'/535, l='world', x=542,42, y=68,95, z=-11,40](Bahmak at 542.4190094516694,68.94999998807907,-11.39741136528705), EntityPlayerMP['Andrek'/544, l='world', x=682,90, y=88,00, z=-3270,04](Andrek at 682.9034255873845,88.0,-3270.038546823222)]
	Chunk stats: ServerChunkCache: 944 Drop: 0
	Level seed: -6853958084155560198
	Level generator: ID 00 - default, ver 1. Features enabled: true
	Level generator options: 
	Level spawn location: World: (0,72,0), Chunk: (at 0,4,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 370231034 game time, 375722536 day time
	Level dimension: 0
	Level storage version: 0x04ABD - Anvil
	Level weather: Rain time: 38557 (now: false), thunder time: 103255 (now: false)
	Level game mode: Game mode: survival (ID 0). Hardcore: false. Cheats: false
Stacktrace:
	at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:943)
	at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.java:423)
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:798)
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:658)
	at java.lang.Thread.run(Unknown Source)

-- System Details --
Details:
	Minecraft Version: 1.7.10
	Operating System: Windows Server 2008 R2 (amd64) version 6.1
	Java Version: 1.7.0_75, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 668108864 bytes (637 MB) / 1056309248 bytes (1007 MB) up to 5351276544 bytes (5103 MB)
	JVM Flags: 8 total; -XX:+UseParNewGC -XX:+CMSIncrementalPacing -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=2 -XX:+AggressiveOpts -Xincgc -Xmx5G -Xms1024M
	AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
	IntCache: cache: 0, tcache: 0, allocated: 15, tallocated: 95
	FML: MCP v9.05 FML v7.10.25.1207 Minecraft Forge 10.13.0.1207 19 mods loaded, 19 mods active
	mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	FML{7.10.25.1207} [Forge Mod Loader] (cauldron-1.7.10-1.1207.01.187-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	Forge{10.13.0.1207} [Minecraft Forge] (cauldron-1.7.10-1.1207.01.187-server.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	CodeChickenCore{1.0.4.29} [CodeChicken Core] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	MobiusCore{1.2.5} [MobiusCore] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	NotEnoughItems{1.0.3.76} [Not Enough Items] (NotEnoughItems-1.7.10-1.0.3.76-universal.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	IC2{2.2.736-experimental} [IndustrialCraft 2] (industrialcraft-2-2.2.736-experimental.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	AdvancedSolarPanel{1.7.10-3.5.1} [Advanced Solar Panels] (AdvancedSolarPanel-1.7.10-3.5.1.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Core{6.0.17} [BuildCraft] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Transport{6.0.17} [BC Transport] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Silicon{6.0.17} [BC Silicon] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Builders{6.0.17} [BC Builders] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Factory{6.0.17} [BC Factory] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	BuildCraft|Energy{6.0.17} [BC Energy] (buildcraft-6.0.17.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	Dynmap{2.1-alpha-1-84} [Dynmap] (Dynmap-2.1-alpha-1-forge-1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	GraviSuite{1.7.10-2.0.3} [Graviation Suite] (GraviSuite-1.7.10-2.0.3.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	IronChest{6.0.41.729} [Iron Chest] (iron_chests_mod_1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	MapWriter{2.1.2} [MapWriter] (Opis-1.2.5_1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	Opis{1.2.5} [Opis] (Opis-1.2.5_1.7.10.jar) Unloaded->Constructed->Pre-initialized->Initialized->Post-initialized->Available->Available->Available->Available
	Profiler Position: N/A (disabled)
	Vec3 Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
	Player Count: 4 / 100; [EntityPlayerMP['Artmoneyse'/60, l='world', x=544,01, y=69,00, z=-11,82](Artmoneyse at 544.005175440452,69.0,-11.820013644013311), EntityPlayerMP['Antsev'/279, l='world', x=335,30, y=61,20, z=-242,76](Antsev at 335.30000001192093,61.20000004768375,-242.7629822534347), EntityPlayerMP['Bahmak'/535, l='world', x=542,42, y=68,95, z=-11,40](Bahmak at 542.4190094516694,68.94999998807907,-11.39741136528705), EntityPlayerMP['Andrek'/544, l='world', x=682,90, y=88,00, z=-3270,04](Andrek at 682.9034255873845,88.0,-3270.038546823222)]
	Is Modded: Definitely; Server brand changed to 'cauldron,craftbukkit,mcpc,fml,forge'
	Type: Dedicated Server (map_server.txt)

Artmoneyse

2015-09-07 23:32

reporter   ~0004185

It works in single player. Electricity is not necessary.
P.S. Sorry for bad english.

Chocohead

2015-09-08 16:01

developer   ~0004186

Looks a lot like an advanced solars bug not IC2, caused by KCauldron which is known to break things.

Artmoneyse

2015-09-08 16:20

reporter  

TileEntityMolecularTransformer.txt (21,079 bytes)   
package advsolar.common.tiles;

import advsolar.common.AdvancedSolarPanel;
import advsolar.common.container.ContainerMolecularTransformer;
import advsolar.network.IReceiveServerEvents;
import advsolar.network.PacketChangeState;
import advsolar.utils.MTRecipeManager;
import advsolar.utils.MTRecipeRecord;
import cpw.mods.fml.common.eventhandler.EventBus;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.network.INetworkDataProvider;
import ic2.api.network.INetworkTileEntityEventListener;
import ic2.api.network.INetworkUpdateListener;
import ic2.api.tile.IWrenchable;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
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.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;

public class TileEntityMolecularTransformer
  extends TileEntityBase
  implements IEnergyTile, IWrenchable, IInventory, IEnergySink, ISidedInventory, INetworkDataProvider, INetworkUpdateListener, INetworkTileEntityEventListener, IReceiveServerEvents
{
  private static final int[] slots_top = { 0 };
  private static final int[] slots_bottom = { 1, 1 };
  private static final int[] slots_sides = { 1 };
  public static Random randomizer = new Random();
  public int ticker;
  public boolean initialized;
  private short facing;
  public boolean addedToEnergyNet;
  private boolean created;
  public boolean doWork;
  public boolean waitOutputSlot;
  public ItemStack lastRecipeInput;
  public ItemStack lastRecipeOutput;
  public int lastRecipeEnergyUsed;
  public int lastRecipeEnergyPerOperation;
  public int lastRecipeNumber;
  private int machineTire;
  private ItemStack[] workSlots;
  private int lastX;
  private int lastY;
  private int lastZ;
  private Boolean deactiveTimer = Boolean.valueOf(false);
  private int deactiveTicker = 0;
  private int deactiveTickrate = 40;
  private int energyTicker = 0;
  private int energyTickRate = 60;
  public short lastProgress;
  public int energyBuffer;
  private boolean isActive;
  private boolean prevActiveState;
  public int inputEU;
  public boolean loaded = false;
  
  public TileEntityMolecularTransformer()
  {
    this.created = false;
    this.facing = 2;
    
    this.workSlots = new ItemStack[2];
    this.initialized = false;
    this.machineTire = Integer.MAX_VALUE;
    this.ticker = randomizer.nextInt(tickRate());
    this.lastX = this.field_145851_c;
    this.lastY = this.field_145848_d;
    this.lastZ = this.field_145849_e;
  }
  
  public void func_145829_t()
  {
    super.func_145829_t();
    if ((func_145837_r()) || (!this.field_145850_b.func_72899_e(this.field_145851_c, this.field_145848_d, this.field_145849_e))) {
      return;
    }
    onLoaded();
  }
  
  public void func_145843_s()
  {
    if (this.loaded) {
      onUnloaded();
    }
    super.func_145843_s();
  }
  
  public void onLoaded()
  {
    if (!this.field_145850_b.field_72995_K)
    {
      MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
      this.addedToEnergyNet = true;
    }
    this.loaded = true;
  }
  
  public void onChunkUnload()
  {
    if (this.loaded) {
      onUnloaded();
    }
    super.onChunkUnload();
  }
  
  public void onUnloaded()
  {
    if ((!this.field_145850_b.field_72995_K) && (this.addedToEnergyNet))
    {
      MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
      
      this.addedToEnergyNet = false;
    }
    this.loaded = false;
  }
  
  public void intialize()
  {
    updateVisibility();
    this.initialized = true;
    if (!this.addedToEnergyNet) {
      onLoaded();
    }
  }
  
  public void func_145845_h()
  {
    super.func_145845_h();
    if ((!this.initialized) && (this.field_145850_b != null)) {
      intialize();
    }
    if (!AdvancedSolarPanel.isSimulating()) {
      return;
    }
    if ((this.lastX != this.field_145851_c) || (this.lastZ != this.field_145849_e) || (this.lastY != this.field_145848_d))
    {
      this.lastX = this.field_145851_c;
      this.lastY = this.field_145848_d;
      this.lastZ = this.field_145849_e;
      
      onUnloaded();
      intialize();
    }
    flushSlots();
    if ((!this.doWork) && (this.workSlots[0] != null))
    {
      if (canSmelt())
      {
        this.workSlots[0].field_77994_a -= this.lastRecipeInput.field_77994_a;
        this.lastRecipeEnergyUsed = 0;
        this.waitOutputSlot = false;
        this.lastProgress = 0;
        this.doWork = true;
        this.deactiveTimer = Boolean.valueOf(false);
      }
    }
    else if (this.doWork)
    {
      if (this.energyBuffer > 0)
      {
        this.energyTicker = 0;
        if (!this.waitOutputSlot) {
          setActive(true, true);
        }
      }
      else
      {
        this.energyTicker += 1;
        if (this.energyTicker >= this.energyTickRate)
        {
          this.energyTicker = 0;
          if (this.isActive) {
            setActive(false, true);
          }
        }
      }
      this.energyBuffer = gainFuel(this.energyBuffer);
    }
    if (this.deactiveTimer.booleanValue() == true) {
      checkDeactivateMachine();
    }
  }
  
  public void checkDeactivateMachine()
  {
    if (this.deactiveTimer.booleanValue())
    {
      this.deactiveTicker += 1;
      if (this.deactiveTicker == this.deactiveTickrate)
      {
        this.deactiveTicker = 0;
        this.deactiveTimer = Boolean.valueOf(false);
        
        setActive(false, true);
      }
    }
  }
  
  private boolean canSmelt()
  {
    if (this.workSlots[0] == null) {
      return false;
    }
    for (int i = 0; i < MTRecipeManager.transformerRecipes.size(); i++)
    {
      ItemStack tmpItemStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack;
      if (isItemEqual(this.workSlots[0], tmpItemStack))
      {
        if (this.workSlots[1] != null) {
          if (isItemEqual(this.workSlots[1], ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack))
          {
            if (this.workSlots[1].field_77994_a + ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack.field_77994_a > this.workSlots[1].func_77976_d()) {
              return false;
            }
          }
          else {
            return false;
          }
        }
        if (this.workSlots[0].field_77994_a < ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack.field_77994_a) {
          return false;
        }
        this.lastRecipeInput = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack.func_77946_l();
        this.lastRecipeOutput = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack.func_77946_l();
        this.lastRecipeEnergyPerOperation = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).energyPerOperation;
        this.lastRecipeNumber = i;
        
        return true;
      }
    }
    return false;
  }
  
  public int gainFuel(int energyPacket)
  {
    int energyLeft = energyPacket;
    if (energyPacket >= 0) {
      if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed > energyPacket)
      {
        energyLeft = 0;
        this.lastRecipeEnergyUsed += energyPacket;
      }
      else
      {
        energyLeft = energyPacket - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed);
        this.lastRecipeEnergyUsed = this.lastRecipeEnergyPerOperation;
        this.lastProgress = 100;
        this.waitOutputSlot = true;
        if (this.workSlots[1] != null)
        {
          if (isItemEqual(this.lastRecipeOutput, this.workSlots[1])) {
            if (this.workSlots[1].func_77976_d() >= this.workSlots[1].field_77994_a + this.lastRecipeOutput.field_77994_a)
            {
              this.workSlots[1].field_77994_a += this.lastRecipeOutput.field_77994_a;
              this.doWork = false;
              this.deactiveTicker = 0;
              this.deactiveTimer = Boolean.valueOf(true);
              super.func_70296_d();
              this.waitOutputSlot = false;
            }
            else if (isActive())
            {
              setActive(false, true);
            }
          }
        }
        else
        {
          this.workSlots[1] = this.lastRecipeOutput.func_77946_l();
          this.doWork = false;
          this.deactiveTicker = 0;
          this.deactiveTimer = Boolean.valueOf(true);
          this.waitOutputSlot = false;
          
          super.func_70296_d();
        }
      }
    }
    updateProgress();
    
    return energyLeft;
  }
  
  private void updateProgress()
  {
    if (this.doWork)
    {
      float tmpProgress = this.lastRecipeEnergyUsed / this.lastRecipeEnergyPerOperation * 100.0F;
      this.lastProgress = ((short)Math.round(tmpProgress));
      if (this.lastRecipeEnergyUsed == this.lastRecipeEnergyPerOperation) {
        this.lastProgress = 100;
      }
    }
    else
    {
      this.lastProgress = 0;
      if (this.isActive)
      {
        this.deactiveTicker = 0;
        this.deactiveTimer = Boolean.valueOf(true);
      }
    }
  }
  
  private void flushSlots()
  {
    if ((this.workSlots[0] != null) && 
      (this.workSlots[0].field_77994_a <= 0)) {
      this.workSlots[0] = null;
    }
    if ((this.workSlots[1] != null) && 
      (this.workSlots[1].field_77994_a <= 0)) {
      this.workSlots[1] = null;
    }
  }
  
  private boolean isItemEqual(ItemStack inputStack, ItemStack outputStack)
  {
    if ((inputStack.func_77973_b() == outputStack.func_77973_b()) && (inputStack.func_77960_j() == outputStack.func_77960_j())) {
      return true;
    }
    return false;
  }
  
  public void updateVisibility() {}
  
  public void func_145839_a(NBTTagCompound nbttagcompound)
  {
    super.func_145839_a(nbttagcompound);
    
    this.lastX = nbttagcompound.func_74762_e("lastX");
    this.lastY = nbttagcompound.func_74762_e("lastY");
    this.lastZ = nbttagcompound.func_74762_e("lastZ");
    
    this.doWork = nbttagcompound.func_74767_n("doWork");
    this.lastRecipeEnergyUsed = nbttagcompound.func_74762_e("lastRecipeEnergyUsed");
    this.lastRecipeEnergyPerOperation = nbttagcompound.func_74762_e("lastRecipeEnergyPerOperation");
    this.lastProgress = nbttagcompound.func_74765_d("lastProgress");
    
    NBTTagList nbttaglist_recipe = nbttagcompound.func_150295_c("Recipes", 10);
    for (int i = 0; i < nbttaglist_recipe.func_74745_c(); i++)
    {
      NBTTagCompound nbttagcompound_recipe = nbttaglist_recipe.func_150305_b(i);
      if (i == 0) {
        this.lastRecipeInput = ItemStack.func_77949_a(nbttagcompound_recipe);
      }
      if (i == 1) {
        this.lastRecipeOutput = ItemStack.func_77949_a(nbttagcompound_recipe);
      }
    }
    if ((this.lastRecipeInput == null) || (this.lastRecipeOutput == null))
    {
      this.lastRecipeNumber = 0;
      this.doWork = false;
      this.lastProgress = 0;
      this.lastRecipeEnergyUsed = 0;
    }
    else
    {
      int i = searchRecipeNumber(this.lastRecipeInput, this.lastRecipeOutput);
      if (i < 0)
      {
        this.lastRecipeNumber = 0;
        this.doWork = false;
        this.lastProgress = 0;
        this.lastRecipeEnergyUsed = 0;
      }
      else
      {
        this.lastRecipeNumber = i;
      }
    }
    NBTTagList nbttaglist = nbttagcompound.func_150295_c("Items", 10);
    this.workSlots = new ItemStack[func_70302_i_()];
    for (int i = 0; i < nbttaglist.func_74745_c(); i++)
    {
      NBTTagCompound nbttagcompound1 = nbttaglist.func_150305_b(i);
      int j = nbttagcompound1.func_74771_c("Slot") & 0xFF;
      if ((j >= 0) && (j < this.workSlots.length)) {
        this.workSlots[j] = ItemStack.func_77949_a(nbttagcompound1);
      }
    }
  }
  
  public int searchRecipeNumber(ItemStack inputStack, ItemStack outputStack)
  {
    for (int i = 0; i < MTRecipeManager.transformerRecipes.size(); i++)
    {
      ItemStack tmpInputStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack;
      ItemStack tmpOutputStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack;
      if ((isItemEqual(inputStack, tmpInputStack)) && (isItemEqual(outputStack, tmpOutputStack))) {
        return i;
      }
    }
    return -1;
  }
  
  public void func_145841_b(NBTTagCompound nbttagcompound)
  {
    super.func_145841_b(nbttagcompound);
    NBTTagList nbttaglist = new NBTTagList();
    NBTTagList nbttaglist_recipe = new NBTTagList();
    
    nbttagcompound.func_74768_a("lastX", this.lastX);
    nbttagcompound.func_74768_a("lastY", this.lastY);
    nbttagcompound.func_74768_a("lastZ", this.lastZ);
    nbttagcompound.func_74757_a("doWork", this.doWork);
    nbttagcompound.func_74768_a("lastRecipeEnergyUsed", this.lastRecipeEnergyUsed);
    nbttagcompound.func_74768_a("lastRecipeEnergyPerOperation", this.lastRecipeEnergyPerOperation);
    nbttagcompound.func_74777_a("lastProgress", this.lastProgress);
    nbttagcompound.func_74768_a("lastRecipeNumber", this.lastRecipeNumber);
    
    NBTTagCompound nbttagcompound_recipe = new NBTTagCompound();
    if (this.lastRecipeInput != null)
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeInput", true);
      this.lastRecipeInput.func_77955_b(nbttagcompound_recipe);
    }
    else
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeInput", false);
    }
    nbttaglist_recipe.func_74742_a(nbttagcompound_recipe);
    
    nbttagcompound_recipe = new NBTTagCompound();
    if (this.lastRecipeOutput != null)
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeOutput", true);
      this.lastRecipeOutput.func_77955_b(nbttagcompound_recipe);
    }
    else
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeOutput", false);
    }
    nbttaglist_recipe.func_74742_a(nbttagcompound_recipe);
    
    nbttagcompound.func_74782_a("Recipes", nbttaglist_recipe);
    for (int i = 0; i < this.workSlots.length; i++) {
      if (this.workSlots[i] != null)
      {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.func_74774_a("Slot", (byte)i);
        this.workSlots[i].func_77955_b(nbttagcompound1);
        nbttaglist.func_74742_a(nbttagcompound1);
      }
    }
    nbttagcompound.func_74782_a("Items", nbttaglist);
  }
  
  public boolean isAddedToEnergyNet()
  {
    return this.addedToEnergyNet;
  }
  
  public boolean isActive()
  {
    return this.isActive;
  }
  
  public void setActive(boolean activeState, boolean network)
  {
    if ((network) && (activeState != this.isActive)) {
      PacketChangeState.issue(this, activeState == true ? 1 : 0, null);
    }
    if (activeState != this.isActive) {
      this.field_145850_b.func_147471_g(this.field_145851_c, this.field_145848_d, this.field_145849_e);
    }
    this.isActive = activeState;
    if (!activeState) {
      this.inputEU = 0;
    }
  }
  
  public int gaugeFuelScaled(int i)
  {
    return i;
  }
  
  public boolean func_70300_a(EntityPlayer entityplayer)
  {
    return entityplayer.func_70011_f(this.field_145851_c + 0.5D, this.field_145848_d + 0.5D, this.field_145849_e + 0.5D) <= 64.0D;
  }
  
  public int tickRate()
  {
    return 20;
  }
  
  public short getFacing()
  {
    return this.facing;
  }
  
  public void setFacing(short facing)
  {
    this.facing = facing;
  }
  
  public boolean wrenchCanSetFacing(EntityPlayer entityplayer, int i)
  {
    return false;
  }
  
  public boolean wrenchCanRemove(EntityPlayer entityplayer)
  {
    return true;
  }
  
  public float getWrenchDropRate()
  {
    return 1.0F;
  }
  
  public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
  {
    return new ItemStack(this.field_145850_b.func_147439_a(this.field_145851_c, this.field_145848_d, this.field_145849_e), 1, this.field_145850_b.func_72805_g(this.field_145851_c, this.field_145848_d, this.field_145849_e));
  }
  
  public ItemStack[] getContents()
  {
    return this.workSlots;
  }
  
  public int func_70302_i_()
  {
    return this.workSlots.length;
  }
  
  public ItemStack func_70301_a(int i)
  {
    return this.workSlots[i];
  }
  
  public ItemStack func_70298_a(int index, int amount)
  {
    ItemStack itemStack = func_70301_a(index);
    if (itemStack == null) {
      return null;
    }
    if (amount >= itemStack.field_77994_a)
    {
      func_70299_a(index, null);
      
      return itemStack;
    }
    itemStack.field_77994_a -= amount;
    
    ItemStack ret = itemStack.func_77946_l();
    ret.field_77994_a = amount;
    
    return ret;
  }
  
  public void func_70299_a(int i, ItemStack itemstack)
  {
    this.workSlots[i] = itemstack;
    if ((itemstack != null) && (itemstack.field_77994_a > func_70297_j_())) {
      itemstack.field_77994_a = func_70297_j_();
    }
  }
  
  public int func_70297_j_()
  {
    return 64;
  }
  
  public Container getGuiContainer(InventoryPlayer inventoryplayer)
  {
    return new ContainerMolecularTransformer(inventoryplayer, this);
  }
  
  public ItemStack func_70304_b(int var1)
  {
    if (this.workSlots[var1] != null)
    {
      ItemStack var2 = this.workSlots[var1];
      this.workSlots[var1] = null;
      return var2;
    }
    return null;
  }
  
  private static List<String> fields = Arrays.asList(new String[0]);
  
  public void onNetworkUpdate(String field) {}
  
  public List<String> getNetworkedFields()
  {
    return fields;
  }
  
  public void onServerEvent(int event, NBTTagCompound nbtData)
  {
    Thread.getAllStackTraces();
    switch (event)
    {
    case 0: 
      setActive(false, false);
      break;
    case 1: 
      setActive(true, false);
    }
  }
  
  public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
  {
    NBTTagCompound nbt = pkt.func_148857_g();
    this.isActive = nbt.func_74767_n("active");
  }
  
  public Packet func_145844_m()
  {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.func_74757_a("active", this.isActive);
    func_145841_b(nbttagcompound);
    
    return new S35PacketUpdateTileEntity(this.field_145851_c, this.field_145848_d, this.field_145849_e, 3, nbttagcompound);
  }
  
  public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
  {
    return true;
  }
  
  public double getDemandedEnergy()
  {
    if (!this.doWork)
    {
      this.inputEU = 0;
      return 0.0D;
    }
    if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed >= 0) {
      return this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed;
    }
    return 0.0D;
  }
  
  public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
  {
    this.inputEU = ((int)amount);
    if (!this.doWork) {
      return amount;
    }
    if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed >= amount)
    {
      this.energyBuffer = ((int)(this.energyBuffer + amount));
      return 0.0D;
    }
    this.energyBuffer = ((int)(this.energyBuffer + (amount - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed))));
    return amount - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed);
  }
  
  public int getSinkTier()
  {
    return this.machineTire;
  }
  
  public boolean func_94041_b(int i, ItemStack itemstack)
  {
    return i != 1;
  }
  
  public int[] func_94128_d(int side)
  {
    return side == 1 ? slots_top : side == 0 ? slots_bottom : slots_sides;
  }
  
  public boolean func_102007_a(int index, ItemStack itemStack, int side)
  {
    return index != 1;
  }
  
  public boolean func_102008_b(int index, ItemStack itemStack, int side)
  {
    return true;
  }
  
  public String func_145825_b()
  {
    return "Molecular Transformer";
  }
  
  public boolean func_145818_k_()
  {
    return false;
  }
  
  public void func_70295_k_() {}
  
  public void func_70305_f() {}
}

Artmoneyse

2015-09-08 16:24

reporter   ~0004187

Last edited: 2015-09-08 19:19

a developer of solar panels has thrown development of this add-on. I was hoping that there will help with the solution. Now it is very often used Cauldron or KCauldron. The Cauldron is not guilty! The bug is present in single player.

Artmoneyse

2015-09-08 17:54

reporter  

Deobfuscate_TileEntityMolecularTransformer.txt (21,079 bytes)   
package advsolar.common.tiles;

import advsolar.common.AdvancedSolarPanel;
import advsolar.common.container.ContainerMolecularTransformer;
import advsolar.network.IReceiveServerEvents;
import advsolar.network.PacketChangeState;
import advsolar.utils.MTRecipeManager;
import advsolar.utils.MTRecipeRecord;
import cpw.mods.fml.common.eventhandler.EventBus;
import ic2.api.energy.event.EnergyTileLoadEvent;
import ic2.api.energy.event.EnergyTileUnloadEvent;
import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile;
import ic2.api.network.INetworkDataProvider;
import ic2.api.network.INetworkTileEntityEventListener;
import ic2.api.network.INetworkUpdateListener;
import ic2.api.tile.IWrenchable;
import java.util.Arrays;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
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.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection;

public class TileEntityMolecularTransformer
  extends TileEntityBase
  implements IEnergyTile, IWrenchable, IInventory, IEnergySink, ISidedInventory, INetworkDataProvider, INetworkUpdateListener, INetworkTileEntityEventListener, IReceiveServerEvents
{
  private static final int[] slots_top = { 0 };
  private static final int[] slots_bottom = { 1, 1 };
  private static final int[] slots_sides = { 1 };
  public static Random randomizer = new Random();
  public int ticker;
  public boolean initialized;
  private short facing;
  public boolean addedToEnergyNet;
  private boolean created;
  public boolean doWork;
  public boolean waitOutputSlot;
  public ItemStack lastRecipeInput;
  public ItemStack lastRecipeOutput;
  public int lastRecipeEnergyUsed;
  public int lastRecipeEnergyPerOperation;
  public int lastRecipeNumber;
  private int machineTire;
  private ItemStack[] workSlots;
  private int lastX;
  private int lastY;
  private int lastZ;
  private Boolean deactiveTimer = Boolean.valueOf(false);
  private int deactiveTicker = 0;
  private int deactiveTickrate = 40;
  private int energyTicker = 0;
  private int energyTickRate = 60;
  public short lastProgress;
  public int energyBuffer;
  private boolean isActive;
  private boolean prevActiveState;
  public int inputEU;
  public boolean loaded = false;
  
  public TileEntityMolecularTransformer()
  {
    this.created = false;
    this.facing = 2;
    
    this.workSlots = new ItemStack[2];
    this.initialized = false;
    this.machineTire = Integer.MAX_VALUE;
    this.ticker = randomizer.nextInt(tickRate());
    this.lastX = this.field_145851_c;
    this.lastY = this.field_145848_d;
    this.lastZ = this.field_145849_e;
  }
  
  public void func_145829_t()
  {
    super.func_145829_t();
    if ((func_145837_r()) || (!this.field_145850_b.func_72899_e(this.field_145851_c, this.field_145848_d, this.field_145849_e))) {
      return;
    }
    onLoaded();
  }
  
  public void func_145843_s()
  {
    if (this.loaded) {
      onUnloaded();
    }
    super.func_145843_s();
  }
  
  public void onLoaded()
  {
    if (!this.field_145850_b.field_72995_K)
    {
      MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
      this.addedToEnergyNet = true;
    }
    this.loaded = true;
  }
  
  public void onChunkUnload()
  {
    if (this.loaded) {
      onUnloaded();
    }
    super.onChunkUnload();
  }
  
  public void onUnloaded()
  {
    if ((!this.field_145850_b.field_72995_K) && (this.addedToEnergyNet))
    {
      MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
      
      this.addedToEnergyNet = false;
    }
    this.loaded = false;
  }
  
  public void intialize()
  {
    updateVisibility();
    this.initialized = true;
    if (!this.addedToEnergyNet) {
      onLoaded();
    }
  }
  
  public void func_145845_h()
  {
    super.func_145845_h();
    if ((!this.initialized) && (this.field_145850_b != null)) {
      intialize();
    }
    if (!AdvancedSolarPanel.isSimulating()) {
      return;
    }
    if ((this.lastX != this.field_145851_c) || (this.lastZ != this.field_145849_e) || (this.lastY != this.field_145848_d))
    {
      this.lastX = this.field_145851_c;
      this.lastY = this.field_145848_d;
      this.lastZ = this.field_145849_e;
      
      onUnloaded();
      intialize();
    }
    flushSlots();
    if ((!this.doWork) && (this.workSlots[0] != null))
    {
      if (canSmelt())
      {
        this.workSlots[0].field_77994_a -= this.lastRecipeInput.field_77994_a;
        this.lastRecipeEnergyUsed = 0;
        this.waitOutputSlot = false;
        this.lastProgress = 0;
        this.doWork = true;
        this.deactiveTimer = Boolean.valueOf(false);
      }
    }
    else if (this.doWork)
    {
      if (this.energyBuffer > 0)
      {
        this.energyTicker = 0;
        if (!this.waitOutputSlot) {
          setActive(true, true);
        }
      }
      else
      {
        this.energyTicker += 1;
        if (this.energyTicker >= this.energyTickRate)
        {
          this.energyTicker = 0;
          if (this.isActive) {
            setActive(false, true);
          }
        }
      }
      this.energyBuffer = gainFuel(this.energyBuffer);
    }
    if (this.deactiveTimer.booleanValue() == true) {
      checkDeactivateMachine();
    }
  }
  
  public void checkDeactivateMachine()
  {
    if (this.deactiveTimer.booleanValue())
    {
      this.deactiveTicker += 1;
      if (this.deactiveTicker == this.deactiveTickrate)
      {
        this.deactiveTicker = 0;
        this.deactiveTimer = Boolean.valueOf(false);
        
        setActive(false, true);
      }
    }
  }
  
  private boolean canSmelt()
  {
    if (this.workSlots[0] == null) {
      return false;
    }
    for (int i = 0; i < MTRecipeManager.transformerRecipes.size(); i++)
    {
      ItemStack tmpItemStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack;
      if (isItemEqual(this.workSlots[0], tmpItemStack))
      {
        if (this.workSlots[1] != null) {
          if (isItemEqual(this.workSlots[1], ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack))
          {
            if (this.workSlots[1].field_77994_a + ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack.field_77994_a > this.workSlots[1].func_77976_d()) {
              return false;
            }
          }
          else {
            return false;
          }
        }
        if (this.workSlots[0].field_77994_a < ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack.field_77994_a) {
          return false;
        }
        this.lastRecipeInput = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack.func_77946_l();
        this.lastRecipeOutput = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack.func_77946_l();
        this.lastRecipeEnergyPerOperation = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).energyPerOperation;
        this.lastRecipeNumber = i;
        
        return true;
      }
    }
    return false;
  }
  
  public int gainFuel(int energyPacket)
  {
    int energyLeft = energyPacket;
    if (energyPacket >= 0) {
      if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed > energyPacket)
      {
        energyLeft = 0;
        this.lastRecipeEnergyUsed += energyPacket;
      }
      else
      {
        energyLeft = energyPacket - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed);
        this.lastRecipeEnergyUsed = this.lastRecipeEnergyPerOperation;
        this.lastProgress = 100;
        this.waitOutputSlot = true;
        if (this.workSlots[1] != null)
        {
          if (isItemEqual(this.lastRecipeOutput, this.workSlots[1])) {
            if (this.workSlots[1].func_77976_d() >= this.workSlots[1].field_77994_a + this.lastRecipeOutput.field_77994_a)
            {
              this.workSlots[1].field_77994_a += this.lastRecipeOutput.field_77994_a;
              this.doWork = false;
              this.deactiveTicker = 0;
              this.deactiveTimer = Boolean.valueOf(true);
              super.func_70296_d();
              this.waitOutputSlot = false;
            }
            else if (isActive())
            {
              setActive(false, true);
            }
          }
        }
        else
        {
          this.workSlots[1] = this.lastRecipeOutput.func_77946_l();
          this.doWork = false;
          this.deactiveTicker = 0;
          this.deactiveTimer = Boolean.valueOf(true);
          this.waitOutputSlot = false;
          
          super.func_70296_d();
        }
      }
    }
    updateProgress();
    
    return energyLeft;
  }
  
  private void updateProgress()
  {
    if (this.doWork)
    {
      float tmpProgress = this.lastRecipeEnergyUsed / this.lastRecipeEnergyPerOperation * 100.0F;
      this.lastProgress = ((short)Math.round(tmpProgress));
      if (this.lastRecipeEnergyUsed == this.lastRecipeEnergyPerOperation) {
        this.lastProgress = 100;
      }
    }
    else
    {
      this.lastProgress = 0;
      if (this.isActive)
      {
        this.deactiveTicker = 0;
        this.deactiveTimer = Boolean.valueOf(true);
      }
    }
  }
  
  private void flushSlots()
  {
    if ((this.workSlots[0] != null) && 
      (this.workSlots[0].field_77994_a <= 0)) {
      this.workSlots[0] = null;
    }
    if ((this.workSlots[1] != null) && 
      (this.workSlots[1].field_77994_a <= 0)) {
      this.workSlots[1] = null;
    }
  }
  
  private boolean isItemEqual(ItemStack inputStack, ItemStack outputStack)
  {
    if ((inputStack.func_77973_b() == outputStack.func_77973_b()) && (inputStack.func_77960_j() == outputStack.func_77960_j())) {
      return true;
    }
    return false;
  }
  
  public void updateVisibility() {}
  
  public void func_145839_a(NBTTagCompound nbttagcompound)
  {
    super.func_145839_a(nbttagcompound);
    
    this.lastX = nbttagcompound.func_74762_e("lastX");
    this.lastY = nbttagcompound.func_74762_e("lastY");
    this.lastZ = nbttagcompound.func_74762_e("lastZ");
    
    this.doWork = nbttagcompound.func_74767_n("doWork");
    this.lastRecipeEnergyUsed = nbttagcompound.func_74762_e("lastRecipeEnergyUsed");
    this.lastRecipeEnergyPerOperation = nbttagcompound.func_74762_e("lastRecipeEnergyPerOperation");
    this.lastProgress = nbttagcompound.func_74765_d("lastProgress");
    
    NBTTagList nbttaglist_recipe = nbttagcompound.func_150295_c("Recipes", 10);
    for (int i = 0; i < nbttaglist_recipe.func_74745_c(); i++)
    {
      NBTTagCompound nbttagcompound_recipe = nbttaglist_recipe.func_150305_b(i);
      if (i == 0) {
        this.lastRecipeInput = ItemStack.func_77949_a(nbttagcompound_recipe);
      }
      if (i == 1) {
        this.lastRecipeOutput = ItemStack.func_77949_a(nbttagcompound_recipe);
      }
    }
    if ((this.lastRecipeInput == null) || (this.lastRecipeOutput == null))
    {
      this.lastRecipeNumber = 0;
      this.doWork = false;
      this.lastProgress = 0;
      this.lastRecipeEnergyUsed = 0;
    }
    else
    {
      int i = searchRecipeNumber(this.lastRecipeInput, this.lastRecipeOutput);
      if (i < 0)
      {
        this.lastRecipeNumber = 0;
        this.doWork = false;
        this.lastProgress = 0;
        this.lastRecipeEnergyUsed = 0;
      }
      else
      {
        this.lastRecipeNumber = i;
      }
    }
    NBTTagList nbttaglist = nbttagcompound.func_150295_c("Items", 10);
    this.workSlots = new ItemStack[func_70302_i_()];
    for (int i = 0; i < nbttaglist.func_74745_c(); i++)
    {
      NBTTagCompound nbttagcompound1 = nbttaglist.func_150305_b(i);
      int j = nbttagcompound1.func_74771_c("Slot") & 0xFF;
      if ((j >= 0) && (j < this.workSlots.length)) {
        this.workSlots[j] = ItemStack.func_77949_a(nbttagcompound1);
      }
    }
  }
  
  public int searchRecipeNumber(ItemStack inputStack, ItemStack outputStack)
  {
    for (int i = 0; i < MTRecipeManager.transformerRecipes.size(); i++)
    {
      ItemStack tmpInputStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).inputStack;
      ItemStack tmpOutputStack = ((MTRecipeRecord)MTRecipeManager.transformerRecipes.get(i)).outputStack;
      if ((isItemEqual(inputStack, tmpInputStack)) && (isItemEqual(outputStack, tmpOutputStack))) {
        return i;
      }
    }
    return -1;
  }
  
  public void func_145841_b(NBTTagCompound nbttagcompound)
  {
    super.func_145841_b(nbttagcompound);
    NBTTagList nbttaglist = new NBTTagList();
    NBTTagList nbttaglist_recipe = new NBTTagList();
    
    nbttagcompound.func_74768_a("lastX", this.lastX);
    nbttagcompound.func_74768_a("lastY", this.lastY);
    nbttagcompound.func_74768_a("lastZ", this.lastZ);
    nbttagcompound.func_74757_a("doWork", this.doWork);
    nbttagcompound.func_74768_a("lastRecipeEnergyUsed", this.lastRecipeEnergyUsed);
    nbttagcompound.func_74768_a("lastRecipeEnergyPerOperation", this.lastRecipeEnergyPerOperation);
    nbttagcompound.func_74777_a("lastProgress", this.lastProgress);
    nbttagcompound.func_74768_a("lastRecipeNumber", this.lastRecipeNumber);
    
    NBTTagCompound nbttagcompound_recipe = new NBTTagCompound();
    if (this.lastRecipeInput != null)
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeInput", true);
      this.lastRecipeInput.func_77955_b(nbttagcompound_recipe);
    }
    else
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeInput", false);
    }
    nbttaglist_recipe.func_74742_a(nbttagcompound_recipe);
    
    nbttagcompound_recipe = new NBTTagCompound();
    if (this.lastRecipeOutput != null)
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeOutput", true);
      this.lastRecipeOutput.func_77955_b(nbttagcompound_recipe);
    }
    else
    {
      nbttagcompound_recipe.func_74757_a("lastRecipeOutput", false);
    }
    nbttaglist_recipe.func_74742_a(nbttagcompound_recipe);
    
    nbttagcompound.func_74782_a("Recipes", nbttaglist_recipe);
    for (int i = 0; i < this.workSlots.length; i++) {
      if (this.workSlots[i] != null)
      {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.func_74774_a("Slot", (byte)i);
        this.workSlots[i].func_77955_b(nbttagcompound1);
        nbttaglist.func_74742_a(nbttagcompound1);
      }
    }
    nbttagcompound.func_74782_a("Items", nbttaglist);
  }
  
  public boolean isAddedToEnergyNet()
  {
    return this.addedToEnergyNet;
  }
  
  public boolean isActive()
  {
    return this.isActive;
  }
  
  public void setActive(boolean activeState, boolean network)
  {
    if ((network) && (activeState != this.isActive)) {
      PacketChangeState.issue(this, activeState == true ? 1 : 0, null);
    }
    if (activeState != this.isActive) {
      this.field_145850_b.func_147471_g(this.field_145851_c, this.field_145848_d, this.field_145849_e);
    }
    this.isActive = activeState;
    if (!activeState) {
      this.inputEU = 0;
    }
  }
  
  public int gaugeFuelScaled(int i)
  {
    return i;
  }
  
  public boolean func_70300_a(EntityPlayer entityplayer)
  {
    return entityplayer.func_70011_f(this.field_145851_c + 0.5D, this.field_145848_d + 0.5D, this.field_145849_e + 0.5D) <= 64.0D;
  }
  
  public int tickRate()
  {
    return 20;
  }
  
  public short getFacing()
  {
    return this.facing;
  }
  
  public void setFacing(short facing)
  {
    this.facing = facing;
  }
  
  public boolean wrenchCanSetFacing(EntityPlayer entityplayer, int i)
  {
    return false;
  }
  
  public boolean wrenchCanRemove(EntityPlayer entityplayer)
  {
    return true;
  }
  
  public float getWrenchDropRate()
  {
    return 1.0F;
  }
  
  public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
  {
    return new ItemStack(this.field_145850_b.func_147439_a(this.field_145851_c, this.field_145848_d, this.field_145849_e), 1, this.field_145850_b.func_72805_g(this.field_145851_c, this.field_145848_d, this.field_145849_e));
  }
  
  public ItemStack[] getContents()
  {
    return this.workSlots;
  }
  
  public int func_70302_i_()
  {
    return this.workSlots.length;
  }
  
  public ItemStack func_70301_a(int i)
  {
    return this.workSlots[i];
  }
  
  public ItemStack func_70298_a(int index, int amount)
  {
    ItemStack itemStack = func_70301_a(index);
    if (itemStack == null) {
      return null;
    }
    if (amount >= itemStack.field_77994_a)
    {
      func_70299_a(index, null);
      
      return itemStack;
    }
    itemStack.field_77994_a -= amount;
    
    ItemStack ret = itemStack.func_77946_l();
    ret.field_77994_a = amount;
    
    return ret;
  }
  
  public void func_70299_a(int i, ItemStack itemstack)
  {
    this.workSlots[i] = itemstack;
    if ((itemstack != null) && (itemstack.field_77994_a > func_70297_j_())) {
      itemstack.field_77994_a = func_70297_j_();
    }
  }
  
  public int func_70297_j_()
  {
    return 64;
  }
  
  public Container getGuiContainer(InventoryPlayer inventoryplayer)
  {
    return new ContainerMolecularTransformer(inventoryplayer, this);
  }
  
  public ItemStack func_70304_b(int var1)
  {
    if (this.workSlots[var1] != null)
    {
      ItemStack var2 = this.workSlots[var1];
      this.workSlots[var1] = null;
      return var2;
    }
    return null;
  }
  
  private static List<String> fields = Arrays.asList(new String[0]);
  
  public void onNetworkUpdate(String field) {}
  
  public List<String> getNetworkedFields()
  {
    return fields;
  }
  
  public void onServerEvent(int event, NBTTagCompound nbtData)
  {
    Thread.getAllStackTraces();
    switch (event)
    {
    case 0: 
      setActive(false, false);
      break;
    case 1: 
      setActive(true, false);
    }
  }
  
  public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
  {
    NBTTagCompound nbt = pkt.func_148857_g();
    this.isActive = nbt.func_74767_n("active");
  }
  
  public Packet func_145844_m()
  {
    NBTTagCompound nbttagcompound = new NBTTagCompound();
    nbttagcompound.func_74757_a("active", this.isActive);
    func_145841_b(nbttagcompound);
    
    return new S35PacketUpdateTileEntity(this.field_145851_c, this.field_145848_d, this.field_145849_e, 3, nbttagcompound);
  }
  
  public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
  {
    return true;
  }
  
  public double getDemandedEnergy()
  {
    if (!this.doWork)
    {
      this.inputEU = 0;
      return 0.0D;
    }
    if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed >= 0) {
      return this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed;
    }
    return 0.0D;
  }
  
  public double injectEnergy(ForgeDirection directionFrom, double amount, double voltage)
  {
    this.inputEU = ((int)amount);
    if (!this.doWork) {
      return amount;
    }
    if (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed >= amount)
    {
      this.energyBuffer = ((int)(this.energyBuffer + amount));
      return 0.0D;
    }
    this.energyBuffer = ((int)(this.energyBuffer + (amount - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed))));
    return amount - (this.lastRecipeEnergyPerOperation - this.lastRecipeEnergyUsed);
  }
  
  public int getSinkTier()
  {
    return this.machineTire;
  }
  
  public boolean func_94041_b(int i, ItemStack itemstack)
  {
    return i != 1;
  }
  
  public int[] func_94128_d(int side)
  {
    return side == 1 ? slots_top : side == 0 ? slots_bottom : slots_sides;
  }
  
  public boolean func_102007_a(int index, ItemStack itemStack, int side)
  {
    return index != 1;
  }
  
  public boolean func_102008_b(int index, ItemStack itemStack, int side)
  {
    return true;
  }
  
  public String func_145825_b()
  {
    return "Molecular Transformer";
  }
  
  public boolean func_145818_k_()
  {
    return false;
  }
  
  public void func_70295_k_() {}
  
  public void func_70305_f() {}
}

Aroma1997

2015-09-10 21:33

developer   ~0004188

Adv. Solars bug.

Issue History

Date Modified Username Field Change
2015-09-07 22:10 Artmoneyse New Issue
2015-09-07 22:10 Artmoneyse File Added: crash-2015-09-08_00.12.28-server.txt
2015-09-07 23:32 Artmoneyse Note Added: 0004185
2015-09-08 16:01 Chocohead Note Added: 0004186
2015-09-08 16:20 Artmoneyse File Added: TileEntityMolecularTransformer.txt
2015-09-08 16:24 Artmoneyse Note Added: 0004187
2015-09-08 17:54 Artmoneyse File Added: Deobfuscate_TileEntityMolecularTransformer.txt
2015-09-08 19:19 Artmoneyse Note Edited: 0004187
2015-09-10 21:33 Aroma1997 Note Added: 0004188
2015-09-10 21:33 Aroma1997 Status new => closed
2015-09-10 21:33 Aroma1997 Assigned To => Aroma1997
2015-09-10 21:33 Aroma1997 Resolution open => won't fix