reformatted all src files (#141)
This commit is contained in:
@@ -19,10 +19,6 @@
|
||||
package appeng.fluids.items;
|
||||
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IStorageChannel;
|
||||
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||
@@ -31,6 +27,9 @@ import appeng.fluids.helper.FluidCellConfig;
|
||||
import appeng.items.materials.MaterialType;
|
||||
import appeng.items.storage.AbstractStorageCell;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
|
||||
/**
|
||||
@@ -38,80 +37,70 @@ import appeng.util.InventoryAdaptor;
|
||||
* @version rv6 - 2018-01-17
|
||||
* @since rv6 2018-01-17
|
||||
*/
|
||||
public final class BasicFluidStorageCell extends AbstractStorageCell<IAEFluidStack>
|
||||
{
|
||||
public final class BasicFluidStorageCell extends AbstractStorageCell<IAEFluidStack> {
|
||||
|
||||
private final int perType;
|
||||
private final double idleDrain;
|
||||
private final int perType;
|
||||
private final double idleDrain;
|
||||
|
||||
public BasicFluidStorageCell( final MaterialType whichCell, final int kilobytes )
|
||||
{
|
||||
super( whichCell, kilobytes );
|
||||
switch( whichCell )
|
||||
{
|
||||
case FLUID_CELL1K_PART:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case FLUID_CELL4K_PART:
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 32;
|
||||
break;
|
||||
case FLUID_CELL16K_PART:
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 128;
|
||||
break;
|
||||
case FLUID_CELL64K_PART:
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 512;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
public BasicFluidStorageCell(final MaterialType whichCell, final int kilobytes) {
|
||||
super(whichCell, kilobytes);
|
||||
switch (whichCell) {
|
||||
case FLUID_CELL1K_PART:
|
||||
this.idleDrain = 0.5;
|
||||
this.perType = 8;
|
||||
break;
|
||||
case FLUID_CELL4K_PART:
|
||||
this.idleDrain = 1.0;
|
||||
this.perType = 32;
|
||||
break;
|
||||
case FLUID_CELL16K_PART:
|
||||
this.idleDrain = 1.5;
|
||||
this.perType = 128;
|
||||
break;
|
||||
case FLUID_CELL64K_PART:
|
||||
this.idleDrain = 2.0;
|
||||
this.perType = 512;
|
||||
break;
|
||||
default:
|
||||
this.idleDrain = 0.0;
|
||||
this.perType = 8;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBytesPerType( ItemStack cellItem )
|
||||
{
|
||||
return this.perType;
|
||||
}
|
||||
@Override
|
||||
public int getBytesPerType(ItemStack cellItem) {
|
||||
return this.perType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getIdleDrain()
|
||||
{
|
||||
return this.idleDrain;
|
||||
}
|
||||
@Override
|
||||
public double getIdleDrain() {
|
||||
return this.idleDrain;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IStorageChannel<IAEFluidStack> getChannel()
|
||||
{
|
||||
return AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class );
|
||||
}
|
||||
@Override
|
||||
public IStorageChannel<IAEFluidStack> getChannel() {
|
||||
return AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTotalTypes( final ItemStack cellItem )
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
@Override
|
||||
public int getTotalTypes(final ItemStack cellItem) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemHandler getConfigInventory( final ItemStack is )
|
||||
{
|
||||
return new FluidCellConfig( is );
|
||||
}
|
||||
@Override
|
||||
public IItemHandler getConfigInventory(final ItemStack is) {
|
||||
return new FluidCellConfig(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dropEmptyStorageCellCase( final InventoryAdaptor ia, final EntityPlayer player )
|
||||
{
|
||||
AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).ifPresent( is ->
|
||||
{
|
||||
final ItemStack extraA = ia.addItems( is );
|
||||
if( !extraA.isEmpty() )
|
||||
{
|
||||
player.dropItem( extraA, false );
|
||||
}
|
||||
} );
|
||||
}
|
||||
@Override
|
||||
protected void dropEmptyStorageCellCase(final InventoryAdaptor ia, final EntityPlayer player) {
|
||||
AEApi.instance().definitions().materials().emptyStorageCell().maybeStack(1).ifPresent(is ->
|
||||
{
|
||||
final ItemStack extraA = ia.addItems(is);
|
||||
if (!extraA.isEmpty()) {
|
||||
player.dropItem(extraA, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
package appeng.fluids.items;
|
||||
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -27,8 +28,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import appeng.items.AEBaseItem;
|
||||
|
||||
|
||||
/**
|
||||
* Dummy item to display the fluid Icon
|
||||
@@ -37,47 +36,37 @@ import appeng.items.AEBaseItem;
|
||||
* @version rv6 - 2018-01-22
|
||||
* @since rv6 2018-01-22
|
||||
*/
|
||||
public class FluidDummyItem extends AEBaseItem
|
||||
{
|
||||
@Override
|
||||
public String getItemStackDisplayName( ItemStack stack )
|
||||
{
|
||||
public class FluidDummyItem extends AEBaseItem {
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
|
||||
FluidStack fluidStack = this.getFluidStack( stack );
|
||||
if( fluidStack == null )
|
||||
{
|
||||
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME );
|
||||
}
|
||||
return fluidStack.getLocalizedName();
|
||||
}
|
||||
FluidStack fluidStack = this.getFluidStack(stack);
|
||||
if (fluidStack == null) {
|
||||
fluidStack = new FluidStack(FluidRegistry.WATER, Fluid.BUCKET_VOLUME);
|
||||
}
|
||||
return fluidStack.getLocalizedName();
|
||||
}
|
||||
|
||||
public FluidStack getFluidStack( ItemStack is )
|
||||
{
|
||||
if( is.hasTagCompound() )
|
||||
{
|
||||
NBTTagCompound tag = is.getTagCompound();
|
||||
return FluidStack.loadFluidStackFromNBT( tag );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public FluidStack getFluidStack(ItemStack is) {
|
||||
if (is.hasTagCompound()) {
|
||||
NBTTagCompound tag = is.getTagCompound();
|
||||
return FluidStack.loadFluidStackFromNBT(tag);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setFluidStack( ItemStack is, FluidStack fs )
|
||||
{
|
||||
if( fs == null )
|
||||
{
|
||||
is.setTagCompound( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
fs.writeToNBT( tag );
|
||||
is.setTagCompound( tag );
|
||||
}
|
||||
}
|
||||
public void setFluidStack(ItemStack is, FluidStack fs) {
|
||||
if (fs == null) {
|
||||
is.setTagCompound(null);
|
||||
} else {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
fs.writeToNBT(tag);
|
||||
is.setTagCompound(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void getCheckedSubItems( final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks )
|
||||
{
|
||||
// Don't show this item in CreativeTabs
|
||||
}
|
||||
@Override
|
||||
protected void getCheckedSubItems(final CreativeTabs creativeTab, final NonNullList<ItemStack> itemStacks) {
|
||||
// Don't show this item in CreativeTabs
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,11 +29,9 @@ import appeng.client.render.DummyFluidItemModel;
|
||||
* @version rv6 - 2018-01-22
|
||||
* @since rv6 2018-01-22
|
||||
*/
|
||||
public class FluidDummyItemRendering extends ItemRenderingCustomizer
|
||||
{
|
||||
@Override
|
||||
public void customize( IItemRendering rendering )
|
||||
{
|
||||
rendering.builtInModel( "models/item/dummy_fluid_item", new DummyFluidItemModel() );
|
||||
}
|
||||
public class FluidDummyItemRendering extends ItemRenderingCustomizer {
|
||||
@Override
|
||||
public void customize(IItemRendering rendering) {
|
||||
rendering.builtInModel("models/item/dummy_fluid_item", new DummyFluidItemModel());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user