2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.container.implementations;
|
|
|
|
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
2014-12-29 21:59:05 +01:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.container.AEBaseContainer;
|
|
|
|
import appeng.container.guisync.GuiSync;
|
2014-09-28 20:36:58 +02:00
|
|
|
import appeng.container.interfaces.IProgressProvider;
|
2014-09-24 02:26:27 +02:00
|
|
|
import appeng.container.slot.SlotRestrictedInput;
|
|
|
|
import appeng.tile.misc.TileVibrationChamber;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
|
2014-09-28 20:36:58 +02:00
|
|
|
public class ContainerVibrationChamber extends AEBaseContainer implements IProgressProvider
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
|
2014-09-29 09:54:34 +02:00
|
|
|
final TileVibrationChamber vibrationChamber;
|
2014-09-28 20:36:58 +02:00
|
|
|
private static final int MAX_BURN_TIME = 200;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-09-28 11:47:17 +02:00
|
|
|
public ContainerVibrationChamber(InventoryPlayer ip, TileVibrationChamber vibrationChamber) {
|
|
|
|
super( ip, vibrationChamber, null );
|
|
|
|
this.vibrationChamber = vibrationChamber;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.invPlayer ) );
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2014-12-29 15:13:47 +01:00
|
|
|
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
2014-09-29 09:54:34 +02:00
|
|
|
public final int aePerTick = 5;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
|
|
|
@GuiSync(0)
|
|
|
|
public int burnProgress = 0;
|
|
|
|
|
|
|
|
@GuiSync(1)
|
|
|
|
public int burnSpeed = 100;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void detectAndSendChanges()
|
|
|
|
{
|
|
|
|
if ( Platform.isServer() )
|
|
|
|
{
|
2014-09-28 11:47:17 +02:00
|
|
|
this.burnProgress = (int) (this.vibrationChamber.maxBurnTime <= 0 ? 0 : 12 * this.vibrationChamber.burnTime / this.vibrationChamber.maxBurnTime);
|
|
|
|
this.burnSpeed = this.vibrationChamber.burnSpeed;
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
super.detectAndSendChanges();
|
|
|
|
}
|
|
|
|
|
2014-09-28 20:36:58 +02:00
|
|
|
@Override
|
|
|
|
public int getCurrentProgress()
|
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
return this.burnProgress > 0 ? this.burnSpeed : 0;
|
2014-09-28 20:36:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getMaxProgress()
|
|
|
|
{
|
|
|
|
return MAX_BURN_TIME;
|
|
|
|
}
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|