Jump to content

TheCrafter4000

Forge Modder
  • Posts

    33
  • Joined

  • Last visited

Posts posted by TheCrafter4000

  1.   On 2/4/2016 at 4:26 PM, diesieben07 said:

    Why are you replacing the inventory? You can use other events to enhance it.

     

    What event?

     

      Quote

    Anyways, you need to send a packet to the server if you wish to do this.

     

    I know:

     

      Quote

    I'm working on a extended player inventory. It's working fine, but the container on server side is not loaded because it's not called, so i need to send a packet from cilent( code is fired at cilent side ) to server.

  2.   On 1/2/2016 at 4:00 PM, coolAlias said:

    It doesn't look like you ever add the EntityAISaveResources task to your villager's AI task list.

    Look at this, I called it in my VillagerWorker - class, because that's the class I'm using

    this.tasks.addTask(2, new EntityAISaveResources(this, output));

     

    I know that it cannot work if someone destroys the blocks the entity has to go to. I looked into EntityAIMoveToBlock, but I hadn't understood what some methodes do, for exsample the abstract methode func_179488_a(). And it looks like the destanationBlock is get randomly, but my Entity must go to a fixed position, in my case and just for debugging 0,0,0.

  3.   On 1/1/2016 at 11:59 PM, coolAlias said:

    1. Where do you call that code?

    1. In my EntityAISaveResources class, at startExecuting()

      Quote

    2. Does your entity have a movement speed attribute > 0 ?

    2. Yes, 0.5D

      Quote

    3. How about #getBlockPathWeight - what does your entity return for that?

    3. Does that methode exist?  ???

      Quote

    4. Are you calling super from all overridden update methods?

    4. Yes

     

     

    My Villager class

    public abstract class Villager extends EntityCreature {
    
    protected ItemStack[] inventory = new ItemStack[10];
    private WorkingState state = WorkingState.Config;
    
    public Villager(World worldIn,int GetResourcesMaximum) {
    	super(worldIn);
    	this.state.setMaximums( GetResourcesMaximum );
            this.setSize(0.6F, 1.8F);
            this.tasks.addTask(0, new EntityAISwimming(this));
            this.tasks.addTask(1, new EntityAIOpenDoor(this, true));
            this.setAIMoveSpeed(0.5f);
    }
    
    @Override protected void applyEntityAttributes() {
    	super.applyEntityAttributes();
    	this.getEntityAttribute( SharedMonsterAttributes.maxHealth ).setBaseValue(12);
    	this.getEntityAttribute( SharedMonsterAttributes.movementSpeed ).setBaseValue(0.5D);
    	this.getEntityAttribute( SharedMonsterAttributes.followRange ).setBaseValue(20D);
    }
    
    public ItemStack[] getVillagerInventory() {
    	return inventory;
    }
    
    @Override public void onStruckByLightning(EntityLightningBolt lightningBolt)
        {
            if (!this.worldObj.isRemote)
            {
                EntityWitch entitywitch = new EntityWitch(this.worldObj);
                entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
                entitywitch.func_180482_a(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
                this.worldObj.spawnEntityInWorld(entitywitch);
                this.setDead();
            }
        }
    
    @Override public boolean getAlwaysRenderNameTag() {
    	return true;
    }
    
        @Override protected String getLivingSound()
        {
            return "mob.villager.idle";
        }
    
        @Override protected String getHurtSound()
        {
            return "mob.villager.hit";
        }
    
        @Override protected String getDeathSound()
        {
            return "mob.villager.death";
        }
    
        public void setReady() {
        	if( this.state == WorkingState.Config ) WorkingState.increment(state);
        }
    
        public void increment() {
        	WorkingState.increment(state);
        }
    
        public WorkingState getState(){
        	return state;
        }
    
        public void setSave() {
        	this.state = WorkingState.SaveResources;
        }
    
    
        @Override public float getAIMoveSpeed() { 
    	return super.getAIMoveSpeed();
    }
    

     

    My Villager subclass( extends Villlager )

    public class VillagerWorker extends Villager {
    
    private ItemStack[] recipe = new ItemStack[9];
    private BlockPos workbench;
    private BlockPos[] input = new BlockPos[9];
    
    private ItemStack itemoutput;
    private BlockPos output;
    
    public VillagerWorker(World worldIn) {
    	super(worldIn, ;
    	this.setReady();
    	output = new BlockPos( 0, 0,0 );
    	this.setSave();
            this.tasks.addTask(2, new EntityAISaveResources(this, output));
    }
    }
    

     

    My EntityAISaveResources - class

    public class EntityAISaveResources extends EntityAIBase {
    
    private BlockPos pos;
    private Villager villager;
    
    public EntityAISaveResources(Villager villager, BlockPos pos) {
    	this.villager = villager;
    	this.pos = pos;
        this.setMutexBits(5);
    }
    
    @Override public boolean shouldExecute() {
    	return villager.getState() == WorkingState.SaveResources;
    }
    
    @Override public void startExecuting() {
    	System.out.println( pos.up(5) );
    	System.out.println( villager.getNavigator().tryMoveToXYZ(pos.getX(), pos.getY(), pos.getZ(), 0.5D) );
    	villager.increment();
    }	
    }
    

     

    WorkingState is just an Enum

    public enum WorkingState {
    GetResources,DoWork,SaveResources,Config;
    int GetResourcesCounter,GetResourcesMaximum;
    
    public void setMaximums( int GetResourcesMaximum ) {
    	this.GetResourcesCounter = 0;
    	this.GetResourcesMaximum = GetResourcesMaximum;
    }
    
    public static void increment( WorkingState state ){
    	 if( state == GetResources ) {
    		 if( state.GetResourcesCounter < state.GetResourcesMaximum ) {
    			 state.GetResourcesCounter++;
    		 }
    		 else {
    			 state.GetResourcesCounter = 0;
    			 state = DoWork;
    		 }
    	 }
    	 else if( state == SaveResources ) state = GetResources;
    	 else if( state == DoWork ) state = SaveResources;
    	 else if( state == Config ) state = GetResources;
    }
    }
    

     

    Hope thats helpful

  4. Hello,

     

    I just want to send a message to a player if a key is pressed, but, when I press the key nothing happends.

     

    My Event class:

    import net.minecraft.client.Minecraft;
    import net.minecraft.client.gui.GuiChat;
    import net.minecraft.client.settings.GameSettings;
    import net.minecraft.util.ChatComponentText;
    import net.minecraftforge.fml.client.FMLClientHandler;
    import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
    import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class KeyPressEvents {
    
    @SideOnly(Side.CLIENT)
    @SubscribeEvent(receiveCanceled=true)
    public void onKeyInput( KeyInputEvent event ) {
    	System.out.println( "called" );
    	if( Minecraft.getMinecraft().gameSettings.keyBindInventory.isPressed() )
    		if (!FMLClientHandler.instance().isGUIOpen(GuiChat.class)) 
    			Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( "Pressed" ) );
    }
    }
    

     

    I registered it at the FMLCommonHandler's EventBus

    FMLCommonHandler.instance().bus().register( new KeyPressEvents() );

     

    The

    System.out.println( "called" );

    is never showen

     

  5.   Quote
    if you put one item in, it won't smelt

     

    Yeah, your right.

     

      Quote
    What if the inventory slots are null? Always check if they are null.

     

    Your're right too.

     

    My Container Class:

     

    package tc4modpack.thecrafter4000.tc4ores.fusion;
    
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.Slot;
    import net.minecraft.inventory.SlotFurnaceFuel;
    import net.minecraft.inventory.SlotFurnaceOutput;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.BlockPos;
    import net.minecraft.world.World;
    
    public class FusionContainer extends Container {
    
    private FusionTileEntity entity;
    private IBlockState block;
    
    public FusionContainer( InventoryPlayer player, World world, BlockPos pos ) {
    	entity = (FusionTileEntity) world.getTileEntity(pos);
    	block = world.getBlockState(pos);
    	addSlotToContainer( new Slot( entity, 0, 26,18 ) );
    	addSlotToContainer( new SlotFurnaceFuel( entity, 2, 26,54 ) );
    
    	addSlotToContainer( new SlotFurnaceOutput( player.player, entity, 4, 44,26 ) );
    
    	addSlotToContainer( new Slot( entity, 1, 62,18 ) );
    	addSlotToContainer( new SlotFurnaceFuel( entity, 3, 62,54 ) );
    
    	for (int i = 0; i < 3; ++i)
    	{
    		for (int j = 0; j < 9; ++j)
    		{
    			addSlotToContainer(new Slot(player, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
    		}
    	}
    
    	for (int i = 0; i < 9; ++i)
    	{
    		addSlotToContainer(new Slot(player, i, 8 + i * 18, 142));
    	}
    }
    
    @Override public boolean canInteractWith(EntityPlayer playerIn) {
    	return true;
    }
    
    @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int fromSlot) {
    	ItemStack previous = null;
    	Slot slot = (Slot) inventorySlots.get(fromSlot);
    
    	if (slot != null && slot.getHasStack()) {
    		ItemStack current = slot.getStack();
    		previous = current.copy();
    
    		if (fromSlot < 14) {
    			// From TE Inventory to Player Inventory
    			if (!mergeItemStack(current,14, inventorySlots.size(), true))
    				return null;
    		} else {
    			// From Player Inventory to TE Inventory
    			if (!mergeItemStack(current, 0, 14, false))
    				return null;
    		}
    
    		if (current.stackSize == 0)
    			slot.putStack((ItemStack) null);
    		else
    			slot.onSlotChanged();
    
    		if (current.stackSize == previous.stackSize)
    			return null;
    		slot.onPickupFromSlot(playerIn, current);
    	}
    	return previous;
    }
    }

     

    My Gui Class:

     

    package tc4modpack.thecrafter4000.tc4ores.fusion;
    
    import net.minecraft.client.gui.inventory.GuiContainer;
    import net.minecraft.client.renderer.GlStateManager;
    import net.minecraft.entity.player.InventoryPlayer;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.World;
    
    public class FusionGui extends GuiContainer {
    
    private InventoryPlayer player;
    private FusionTileEntity entity;
    
    public FusionGui( InventoryPlayer player, World world, BlockPos pos ) {
    	super( new FusionContainer( player, world, pos ) );
    
    	this.player = player;
    	entity = (FusionTileEntity) world.getTileEntity(pos);
    
    	xSize = 176;
    	ySize = 166;
    }
    
    @Override protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
    	GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    	mc.getTextureManager().bindTexture( new ResourceLocation("tc4ores:textures/gui/fusion.png") );
    	this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
    }
    
    @Override protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
    	String s = entity.getDisplayName().getUnformattedText();
    	fontRendererObj.drawString(s, 88 - fontRendererObj.getStringWidth(s) / 2, 6, 4210752);            //#404040
    	fontRendererObj.drawString(player.getDisplayName().getUnformattedText(), 8, 72, 4210752);      //#404040
    }
    }
    

     

    My Block Class:

     

    package tc4modpack.thecrafter4000.tc4ores.fusion;
    
    import java.util.List;
    
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.block.properties.IProperty;
    import net.minecraft.block.properties.PropertyBool;
    import net.minecraft.block.properties.PropertyDirection;
    import net.minecraft.block.state.BlockState;
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.EnumFacing;
    import net.minecraft.world.World;
    import scala.actors.threadpool.Arrays;
    import tc4modpack.thecrafter4000.api.block.IMetaBlockName;
    import tc4modpack.thecrafter4000.tc4ores.TC4Ores;
    
    public class FusionFurnace extends BlockContainer implements IMetaBlockName{
    
    public static final PropertyDirection FACING = PropertyDirection.create("facing");
    public static final PropertyBool ACTIVATED = PropertyBool.create("activated");
    
    /** A List of all BlockStates the Block can have */
    private final IBlockState[] BlockStates = new IBlockState[] {
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.NORTH ).withProperty(FusionFurnace.ACTIVATED, true),
    		getDefaultState(),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.EAST ).withProperty(FusionFurnace.ACTIVATED, true),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.EAST ).withProperty(FusionFurnace.ACTIVATED, false),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.SOUTH ).withProperty(FusionFurnace.ACTIVATED, true),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.SOUTH ).withProperty(FusionFurnace.ACTIVATED, false),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.WEST ).withProperty(FusionFurnace.ACTIVATED, true),
    		getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.WEST ).withProperty(FusionFurnace.ACTIVATED, false)
    };
    
    public FusionFurnace( Material materialIn, String name ) {
    	super( materialIn );
    	setUnlocalizedName( name );
    	setDefaultState( super.getDefaultState().withProperty(FusionFurnace.FACING, EnumFacing.NORTH).withProperty(FusionFurnace.ACTIVATED, false) );
    }
    
    @Override public TileEntity createNewTileEntity(World worldIn, int meta) {
    	return new FusionTileEntity();
    }
    
    @Override public String getSpecialName(ItemStack stack) {
    	return "";
    }
    
    @Override public int getRenderType() {
    	return 3;
    }
    
    @Override protected BlockState createBlockState() {
    	return new BlockState( this, new IProperty[]{ FusionFurnace.FACING, FusionFurnace.ACTIVATED } );
    }
    
    @Override public IBlockState getStateFromMeta(int meta) {
    	return BlockStates[ meta ];
    }
    
    @Override public int getMetaFromState(IBlockState state) {
    	List<IBlockState> list = Arrays.asList(BlockStates);
    	int i = list.indexOf( state );
    	if( i == -1 ) i = 1;
    	return i;
    }
    
    @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
    	playerIn.openGui(TC4Ores.instance, 0, worldIn, pos.getX(), pos.getY(), pos.getZ());
    	return true;
    }
    
    @Override public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) {
    	switch( placer.getHorizontalFacing().getOpposite() ) {
    	case NORTH: return BlockStates[1];
    	case EAST:  return BlockStates[3];
    	case SOUTH: return BlockStates[5];
    	case WEST:  return BlockStates[7];
    	default: {
    		return getDefaultState();
    	}
    	}
    }
    
    static void activate( World world, BlockPos pos, boolean on ) {
    	System.out.println( "Aktive" );
    	world.setBlockState( pos, world.getBlockState( pos ).withProperty(FusionFurnace.ACTIVATED, on) );
    }
    }
    

     

    My GuiHandler Class:

     

    package tc4modpack.thecrafter4000.tc4ores;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.util.BlockPos;
    import net.minecraft.world.World;
    import net.minecraftforge.fml.common.network.IGuiHandler;
    import tc4modpack.thecrafter4000.tc4ores.fusion.FusionContainer;
    import tc4modpack.thecrafter4000.tc4ores.fusion.FusionGui;
    
    
    public class TC4GuiHandler implements IGuiHandler{
    
    public static final int FUSION_GUI = 0;
    
    @Override
    public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    	if( ID == TC4GuiHandler.FUSION_GUI ) return new FusionContainer( player.inventory, world, new BlockPos( x,y,z ));
    	return null;
    }
    
    @Override
    public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
    	if( ID == TC4GuiHandler.FUSION_GUI ) return new FusionGui( player.inventory , world, new BlockPos( x,y,z ));
    	return null;
    }
    
    }
    

  6. Hello guys,

     

    I'm making an furnace with 2 input and fuel slots, but when I wanted to set the burntime in a function it does not save it in my field.

     

    My Tile Entity class:

    package tc4modpack.thecrafter4000.tc4ores.fusion;
    
    import java.util.Arrays;
    
    import net.minecraft.block.state.IBlockState;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.init.Items;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.server.gui.IUpdatePlayerListBox;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.tileentity.TileEntityFurnace;
    import net.minecraft.util.BlockPos;
    import net.minecraft.util.ChatComponentText;
    import net.minecraft.util.IChatComponent;
    import net.minecraft.world.World;
    import net.minecraftforge.fml.relauncher.Side;
    import net.minecraftforge.fml.relauncher.SideOnly;
    
    public class FusionTileEntity extends TileEntity implements IInventory, IUpdatePlayerListBox{
    
    /** 0 = Input Left,
     *  1 = Input Right,
     *  2 = Fuel Left,
     *  3 = Fuel Right,
     *  4 = Fusion Output */
    private ItemStack[] inventory = new ItemStack[ getSizeInventory() ];
    /** The burntime for the left slot*/
    private int burntime0 = 0;
    /** The burntime for the right slot*/
    private int burntime1 = 0;
    private int cooktime = 0;
    
    @Override public void readFromNBT(NBTTagCompound compound) {
    	super.readFromNBT(compound);
    	int i = 0;
    	for( ItemStack s : inventory ) {
    		inventory[ i ] = null;
    		if( compound.hasKey( "slot_" +i ) ) inventory[ i ] = ItemStack.loadItemStackFromNBT( compound.getCompoundTag( "slot_" +i ) );
    		i++;
    	}
    	burntime0 = compound.getInteger("burntime0");
    	burntime1 = compound.getInteger("burntime1");
    	cooktime = compound.getInteger("cooktime");
    }
    
    @Override public void writeToNBT( NBTTagCompound tag ) {
    	super.writeToNBT( tag );
    	NBTTagCompound[] stacks = new NBTTagCompound[ getSizeInventory() ];
    	Arrays.fill( stacks, new NBTTagCompound() );
    	int i = 0;
    	for( NBTTagCompound c : stacks ) {
    		tag.removeTag( "slot_" + i );
    		if( inventory[ i ] != null ) {
    			inventory[ i ].writeToNBT( c );
    			tag.setTag("slot_" + i , c );
    		}
    		i++;
    	}
    	tag.setInteger("burntime0", burntime0);
    	tag.setInteger("burntime1", burntime1);
    	tag.setInteger("cooktime", cooktime);
    }
    
    @Override public String getName() {
    	return "Fusion Furnace";
    }
    
    @Override public boolean hasCustomName() {
    	return true;
    }
    
    @Override public IChatComponent getDisplayName() {
    	return new ChatComponentText( getName() );
    }
    
    @Override public int getSizeInventory() {
    	return 5;
    }
    
    @Override public ItemStack getStackInSlot(int index) {
    	return inventory[ index ];
    }
    
    @Override public ItemStack decrStackSize(int index, int count) {
    	if (inventory[index] != null)
    	{
    		ItemStack itemstack;
    
    		if (inventory[index].stackSize <= count)
    		{
    			itemstack = inventory[index];
    			inventory[index] = null;
    			markDirty();
    			return itemstack;
    		}
    		else
    		{
    			itemstack = inventory[index].splitStack(count);
    
    			if (inventory[index].stackSize == 0)
    			{
    				inventory[index] = null;
    			}
    
    			markDirty();
    			return itemstack;
    		}
    	}
    	else
    	{
    		return null;
    	}
    }
    
    @Override public ItemStack getStackInSlotOnClosing(int index) {
    	return getStackInSlot( index );
    }
    
    @Override public void setInventorySlotContents(int index, ItemStack stack) {
    	inventory[ index ] = stack;
    }
    
    @Override public int getInventoryStackLimit() {
    	return 64;
    }
    
    @Override public boolean isUseableByPlayer(EntityPlayer player) {
    	return true;
    }
    
    @Override public void openInventory(EntityPlayer player) {}
    
    @Override public void closeInventory(EntityPlayer player) {}
    
    @Override public boolean isItemValidForSlot(int index, ItemStack stack) {
    	switch( index ) {
    	case 0: return true;
    	case 1: return true;
    	case 2: return TileEntityFurnace.isItemFuel( stack );
    	case 3: return TileEntityFurnace.isItemFuel( stack );
    	default: return false;
    	}
    
    }
    
    @Override public int getField(int id) {
    	return (id==0) ? burntime0 : burntime1;
    }
    
    @Override public void setField(int id, int value) {
    	switch( id ) {
    	case 0: burntime0 = value;
    	case 1: burntime1 = value;
    	}
    }
    
    @Override public int getFieldCount() {
    	return 2;
    }
    
    @Override public void clear() {
    	inventory = new ItemStack[ getSizeInventory() ];
    }
    
    @Override public void update() {
    	if( !worldObj.isRemote ) { // Server Side
    		System.out.println( burntime0 + "," + burntime1 + "," + cooktime + "," + isAktivated() );
    		if( isAktivated() ) { // if it burns
    			if( burntime0 > 0 ) burntime0--; // increase burntime
    			else stopBurning();
    			if( burntime1 > 0 ) burntime1--;
    			else stopBurning();
    			if( inventory[0] != null && inventory[1] != null ) cooktime++; // if it burns it increase the cooktime
    			else cooktime = 0;
    			if( cooktime >= 200 ) { // if its finished
    				cooktime = 0;
    				if( inventory[0].stackSize > 1 ) inventory[0].stackSize = inventory[0].stackSize-1;
    				else inventory[0] = null;
    				if( inventory[1].stackSize > 1 ) inventory[1].stackSize = inventory[1].stackSize-1;
    				else inventory[1] = null;
    				inventory[4] = new ItemStack( Items.beef );
    			}
    		}
    		else if( cooktime > 0 ) cooktime--;
    		if( !isAktivated() && canSmelt() ) { // if it does not burn but it can
    			startBurning(); // it starts burning
    			System.out.println( "Startet Burning" );
    		}
    		System.out.println( burntime0 + "," + burntime1 + "," + cooktime + "," + isAktivated() );
    	}
    }
    
    protected boolean canSmelt() {
    	if( inventory[0] != null && inventory[1] != null && (inventory[2] != null || burntime0 > 0 ) && (inventory[3] != null || burntime1 > 0 ) ) return true;
    	return false;
    }
    
    protected boolean isAktivated() {
    	return (Boolean) worldObj.getBlockState(pos).getValue(FusionFurnace.ACTIVATED);
    }
    
    protected void startBurning() {
    	System.out.println( "An" );
    	FusionFurnace.activate( worldObj, pos, true );
    	if( burntime0 <= 0 && inventory[2] != null ) {
    //			burntime0 = TileEntityFurnace.getItemBurnTime( inventory[2] );
    		burntime0 = 1600;
    		if( inventory[2].stackSize > 1 ) inventory[2].stackSize = inventory[2].stackSize-1;
    		else inventory[2] = null;
    	}
    	if( burntime1 <= 0 && inventory[3] != null ) {
    //			burntime1 = TileEntityFurnace.getItemBurnTime( inventory[3] );
    		burntime1 = 1500;
    		if( inventory[3].stackSize > 1 ) inventory[3].stackSize = inventory[3].stackSize-1;
    		else inventory[3] = null;
    	}
    }
    
    protected void stopBurning() {
    	System.out.println( "Aus" );
    	FusionFurnace.activate( worldObj, pos, false );
    }
    
    public static boolean isBurning( FusionTileEntity entity ) {
    	return (entity.burntime0 > 0 && entity.burntime1 > 0);
    }
    }
    

     

    The output log is magic:

    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:update:165]: 0,0,0,false // First run
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:startBurning:202]: An // starts burning
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionFurnace:activate:91]: Aktive //sets blockState
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:update:185]: Startet Burning // stated burning
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:update:187]: 1600,1500,0,true // end of the first run
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:update:165]: 0,0,0,true // second run the values are zero! WHY?
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:stopBurning:220]: Aus
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionFurnace:activate:91]: Aktive
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:stopBurning:220]: Aus
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionFurnace:activate:91]: Aktive
    [22:13:09] [server thread/INFO] [sTDOUT]: [tc4modpack.thecrafter4000.tc4ores.fusion.FusionTileEntity:update:187]: 0,0,0,false
    

     

    After the first run the values are reset. I don't know [glow=red,2,300]WHY[/glow], can anybody help me?

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.