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-07-09 10:17:11 +02:00
|
|
|
package appeng.client.me;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2015-05-02 15:39:59 +02:00
|
|
|
import javax.annotation.Nonnull;
|
|
|
|
|
2014-07-09 10:17:11 +02:00
|
|
|
import net.minecraft.util.StatCollector;
|
2015-12-24 02:07:03 +01:00
|
|
|
|
2014-07-09 10:17:11 +02:00
|
|
|
import appeng.tile.inventory.AppEngInternalInventory;
|
2014-07-13 03:20:21 +02:00
|
|
|
import appeng.util.ItemSorters;
|
2014-07-09 10:17:11 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-07-13 03:20:21 +02:00
|
|
|
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
2014-07-09 10:17:11 +02:00
|
|
|
{
|
|
|
|
|
2015-10-08 15:42:42 +02:00
|
|
|
private final String unlocalizedName;
|
|
|
|
private final AppEngInternalInventory inventory;
|
|
|
|
|
|
|
|
private final long id;
|
|
|
|
private final long sortBy;
|
2014-07-09 10:17:11 +02:00
|
|
|
|
2015-09-30 14:24:40 +02:00
|
|
|
public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName )
|
2015-04-03 08:54:31 +02:00
|
|
|
{
|
2015-10-08 15:42:42 +02:00
|
|
|
this.inventory = new AppEngInternalInventory( null, size );
|
2014-07-09 10:17:11 +02:00
|
|
|
this.unlocalizedName = unlocalizedName;
|
|
|
|
this.id = id;
|
2014-07-13 03:20:21 +02:00
|
|
|
this.sortBy = sortBy;
|
2014-07-09 10:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public String getName()
|
|
|
|
{
|
2015-09-30 14:24:40 +02:00
|
|
|
final String s = StatCollector.translateToLocal( this.unlocalizedName + ".name" );
|
2015-04-03 08:54:31 +02:00
|
|
|
if( s.equals( this.unlocalizedName + ".name" ) )
|
2015-04-29 02:30:53 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
return StatCollector.translateToLocal( this.unlocalizedName );
|
2015-04-29 02:30:53 +02:00
|
|
|
}
|
2014-07-09 10:17:11 +02:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2014-07-13 03:20:21 +02:00
|
|
|
@Override
|
2015-09-30 14:24:40 +02:00
|
|
|
public int compareTo( @Nonnull final ClientDCInternalInv o )
|
2014-07-13 03:20:21 +02:00
|
|
|
{
|
2014-12-29 15:13:47 +01:00
|
|
|
return ItemSorters.compareLong( this.sortBy, o.sortBy );
|
2014-07-13 03:20:21 +02:00
|
|
|
}
|
2015-10-08 15:42:42 +02:00
|
|
|
|
|
|
|
public AppEngInternalInventory getInventory()
|
|
|
|
{
|
|
|
|
return this.inventory;
|
|
|
|
}
|
|
|
|
|
|
|
|
public long getId()
|
|
|
|
{
|
|
|
|
return this.id;
|
|
|
|
}
|
2014-07-09 10:17:11 +02:00
|
|
|
}
|