Port to 1.11
This commit is contained in:
@@ -1,84 +1,84 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.ic2;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.TunnelType;
|
||||
import appeng.api.features.IP2PTunnelRegistry;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.integration.abstraction.IIC2;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
public class IC2Module implements IIC2
|
||||
{
|
||||
|
||||
private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
|
||||
|
||||
public IC2Module()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
||||
IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit()
|
||||
{
|
||||
final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
|
||||
for( String string : IC2_CABLE_TYPES )
|
||||
{
|
||||
reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
||||
}
|
||||
}
|
||||
|
||||
private ItemStack getItem( final String name, String variant )
|
||||
{
|
||||
return ic2.api.item.IC2Items.getItem( name, variant );
|
||||
}
|
||||
|
||||
private ItemStack getCable( final String type )
|
||||
{
|
||||
return this.getItem( "cable", "type:" + type );
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an IC2 power sink for the given external sink.
|
||||
*/
|
||||
@Override
|
||||
public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
||||
{
|
||||
return new IC2PowerSinkAdapter( tileEntity, externalSink );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void maceratorRecipe( ItemStack in, ItemStack out )
|
||||
{
|
||||
ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.ic2;
|
||||
//
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//
|
||||
//import ic2.api.recipe.RecipeInputItemStack;
|
||||
//
|
||||
//import appeng.api.AEApi;
|
||||
//import appeng.api.config.TunnelType;
|
||||
//import appeng.api.features.IP2PTunnelRegistry;
|
||||
//import appeng.integration.IntegrationHelper;
|
||||
//import appeng.integration.abstraction.IC2PowerSink;
|
||||
//import appeng.integration.abstraction.IIC2;
|
||||
//import appeng.tile.powersink.IExternalPowerSink;
|
||||
//
|
||||
//
|
||||
//public class IC2Module implements IIC2
|
||||
//{
|
||||
//
|
||||
// private static final String[] IC2_CABLE_TYPES = { "copper", "glass", "gold", "iron", "tin", "detector", "splitter" };
|
||||
//
|
||||
// public IC2Module()
|
||||
// {
|
||||
// IntegrationHelper.testClassExistence( this, ic2.api.energy.tile.IEnergyTile.class );
|
||||
// IntegrationHelper.testClassExistence( this, ic2.api.item.IC2Items.class );
|
||||
// IntegrationHelper.testClassExistence( this, ic2.api.recipe.Recipes.class );
|
||||
// IntegrationHelper.testClassExistence( this, ic2.api.recipe.RecipeInputItemStack.class );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void postInit()
|
||||
// {
|
||||
// final IP2PTunnelRegistry reg = AEApi.instance().registries().p2pTunnel();
|
||||
//
|
||||
// for( String string : IC2_CABLE_TYPES )
|
||||
// {
|
||||
// reg.addNewAttunement( this.getCable( string ), TunnelType.IC2_POWER );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private ItemStack getItem( final String name, String variant )
|
||||
// {
|
||||
// return ic2.api.item.IC2Items.getItem( name, variant );
|
||||
// }
|
||||
//
|
||||
// private ItemStack getCable( final String type )
|
||||
// {
|
||||
// return this.getItem( "cable", "type:" + type );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Create an IC2 power sink for the given external sink.
|
||||
// */
|
||||
// @Override
|
||||
// public IC2PowerSink createPowerSink( TileEntity tileEntity, IExternalPowerSink externalSink )
|
||||
// {
|
||||
// return new IC2PowerSinkAdapter( tileEntity, externalSink );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void maceratorRecipe( ItemStack in, ItemStack out )
|
||||
// {
|
||||
// ic2.api.recipe.Recipes.macerator.addRecipe( new RecipeInputItemStack( in, in.stackSize ), null, false, out );
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,94 +1,94 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.ic2;
|
||||
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import ic2.api.energy.prefab.BasicSink;
|
||||
import ic2.api.energy.tile.IEnergyEmitter;
|
||||
|
||||
import appeng.api.config.PowerUnits;
|
||||
import appeng.integration.abstraction.IC2PowerSink;
|
||||
import appeng.tile.powersink.IExternalPowerSink;
|
||||
|
||||
|
||||
/**
|
||||
* The real implementation of IC2PowerSink.
|
||||
*/
|
||||
public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
|
||||
{
|
||||
|
||||
private final IExternalPowerSink powerSink;
|
||||
|
||||
private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
|
||||
|
||||
public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
|
||||
{
|
||||
super( tileEntity, 0, Integer.MAX_VALUE );
|
||||
this.powerSink = powerSink;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate()
|
||||
{
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChunkUnload()
|
||||
{
|
||||
super.onChunkUnload();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad()
|
||||
{
|
||||
super.onLoaded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDemandedEnergy()
|
||||
{
|
||||
return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
||||
}
|
||||
|
||||
@Override
|
||||
public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||
{
|
||||
return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
|
||||
{
|
||||
return validFaces.contains( side );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setValidFaces( Set<EnumFacing> faces )
|
||||
{
|
||||
this.validFaces.clear();
|
||||
this.validFaces.addAll( faces );
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.ic2;
|
||||
//
|
||||
//
|
||||
//import java.util.EnumSet;
|
||||
//import java.util.Set;
|
||||
//
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.EnumFacing;
|
||||
//
|
||||
//import ic2.api.energy.prefab.BasicSink;
|
||||
//import ic2.api.energy.tile.IEnergyEmitter;
|
||||
//
|
||||
//import appeng.api.config.PowerUnits;
|
||||
//import appeng.integration.abstraction.IC2PowerSink;
|
||||
//import appeng.tile.powersink.IExternalPowerSink;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * The real implementation of IC2PowerSink.
|
||||
// */
|
||||
//public class IC2PowerSinkAdapter extends BasicSink implements IC2PowerSink
|
||||
//{
|
||||
//
|
||||
// private final IExternalPowerSink powerSink;
|
||||
//
|
||||
// private final Set<EnumFacing> validFaces = EnumSet.allOf( EnumFacing.class );
|
||||
//
|
||||
// public IC2PowerSinkAdapter( TileEntity tileEntity, IExternalPowerSink powerSink )
|
||||
// {
|
||||
// super( tileEntity, 0, Integer.MAX_VALUE );
|
||||
// this.powerSink = powerSink;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void invalidate()
|
||||
// {
|
||||
// super.onChunkUnload();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onChunkUnload()
|
||||
// {
|
||||
// super.onChunkUnload();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLoad()
|
||||
// {
|
||||
// super.onLoaded();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double getDemandedEnergy()
|
||||
// {
|
||||
// return powerSink.getExternalPowerDemand( PowerUnits.EU, Double.MAX_VALUE );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public double injectEnergy( EnumFacing directionFrom, double amount, double voltage )
|
||||
// {
|
||||
// return PowerUnits.EU.convertTo( PowerUnits.AE, powerSink.injectExternalPower( PowerUnits.EU, amount ) );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean acceptsEnergyFrom( IEnergyEmitter iEnergyEmitter, EnumFacing side )
|
||||
// {
|
||||
// return validFaces.contains( side );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setValidFaces( Set<EnumFacing> faces )
|
||||
// {
|
||||
// this.validFaces.clear();
|
||||
// this.validFaces.addAll( faces );
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -92,15 +92,10 @@ class CondenserCategory extends BlankRecipeCategory<CondenserOutputWrapper>
|
||||
return background;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations( Minecraft minecraft )
|
||||
{
|
||||
progress.draw( minecraft );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras( Minecraft minecraft )
|
||||
{
|
||||
progress.draw( minecraft );
|
||||
iconTrash.draw( minecraft );
|
||||
iconButton.draw( minecraft );
|
||||
}
|
||||
|
||||
@@ -55,12 +55,6 @@ class CondenserOutputHandler implements IRecipeHandler<CondenserOutput>
|
||||
return CondenserOutput.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return CondenserCategory.UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( CondenserOutput recipe )
|
||||
{
|
||||
|
||||
@@ -110,4 +110,10 @@ class FacadeRegistryPlugin implements IRecipeRegistryPlugin
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IRecipeWrapper> List<T> getRecipeWrappers( IRecipeCategory<T> recipeCategory )
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,13 +34,6 @@ class GrinderRecipeHandler implements IRecipeHandler<IGrinderRecipe>
|
||||
return IGrinderRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return GrinderRecipeCategory.UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( IGrinderRecipe recipe )
|
||||
{
|
||||
return GrinderRecipeCategory.UID;
|
||||
|
||||
@@ -80,7 +80,7 @@ class InscriberRecipeCategory extends BlankRecipeCategory<InscriberRecipeWrapper
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAnimations( Minecraft minecraft )
|
||||
public void drawExtras( Minecraft minecraft )
|
||||
{
|
||||
this.progress.draw( minecraft );
|
||||
}
|
||||
|
||||
@@ -34,12 +34,6 @@ class InscriberRecipeHandler implements IRecipeHandler<IInscriberRecipe>
|
||||
return IInscriberRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return InscriberRecipeCategory.UID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( IInscriberRecipe recipe )
|
||||
{
|
||||
|
||||
@@ -66,4 +66,10 @@ class InscriberRegistryPlugin implements IRecipeRegistryPlugin
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IRecipeWrapper> List<T> getRecipeWrappers( IRecipeCategory<T> recipeCategory )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ public class JEIPlugin extends BlankModPlugin
|
||||
@Override
|
||||
public void onRuntimeAvailable( IJeiRuntime jeiRuntime )
|
||||
{
|
||||
JEIModule jeiModule = (JEIModule) Integrations.jei();
|
||||
jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) );
|
||||
//JEIModule jeiModule = (JEIModule) Integrations.jei();
|
||||
//jeiModule.setJei( new JeiRuntimeAdapter( jeiRuntime ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import mezz.jei.api.gui.IGuiIngredient;
|
||||
import mezz.jei.api.gui.IRecipeLayout;
|
||||
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferError;
|
||||
import mezz.jei.api.recipe.transfer.IRecipeTransferHandler;
|
||||
|
||||
@@ -63,12 +62,6 @@ class RecipeTransferHandler<T extends Container> implements IRecipeTransferHandl
|
||||
return containerClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IRecipeTransferError transferRecipe( T container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer )
|
||||
|
||||
@@ -35,12 +35,6 @@ class ShapedRecipeHandler implements IRecipeHandler<ShapedRecipe>
|
||||
return ShapedRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( ShapedRecipe recipe )
|
||||
{
|
||||
|
||||
@@ -35,12 +35,6 @@ class ShapelessRecipeHandler implements IRecipeHandler<ShapelessRecipe>
|
||||
return ShapelessRecipe.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid()
|
||||
{
|
||||
return VanillaRecipeCategoryUid.CRAFTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeCategoryUid( ShapelessRecipe recipe )
|
||||
{
|
||||
|
||||
@@ -1,74 +1,74 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
|
||||
/**
|
||||
* Base implementation for {@link mcp.mobius.waila.api.IWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public abstract class BaseWailaDataProvider implements IWailaDataProvider
|
||||
{
|
||||
@Override
|
||||
public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Base implementation for {@link mcp.mobius.waila.api.IWailaDataProvider}
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public abstract class BaseWailaDataProvider implements IWailaDataProvider
|
||||
//{
|
||||
// @Override
|
||||
// public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
// {
|
||||
// return tag;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,198 +1,198 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.IPartWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.P2PStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.PartAccessor;
|
||||
import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider;
|
||||
import appeng.integration.modules.waila.part.Tracer;
|
||||
|
||||
|
||||
/**
|
||||
* Delegation provider for parts through {@link IPartWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Contains all providers
|
||||
*/
|
||||
private final List<IPartWailaDataProvider> providers;
|
||||
|
||||
/**
|
||||
* Can access parts through view-hits
|
||||
*/
|
||||
private final PartAccessor accessor = new PartAccessor();
|
||||
|
||||
/**
|
||||
* Traces views hit on blocks
|
||||
*/
|
||||
private final Tracer tracer = new Tracer();
|
||||
|
||||
/**
|
||||
* Initializes the provider list with all wanted providers
|
||||
*/
|
||||
public PartWailaDataProvider()
|
||||
{
|
||||
final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
|
||||
final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
|
||||
final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
|
||||
final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider();
|
||||
final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getMOP();
|
||||
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
ItemStack wailaStack = null;
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
wailaStack = provider.getWailaStack( part, config, wailaStack );
|
||||
}
|
||||
return wailaStack;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getMOP();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaHead( part, currentToolTip, accessor, config );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getMOP();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaBody( part, currentToolTip, accessor, config );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
final RayTraceResult mop = accessor.getMOP();
|
||||
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaTail( part, currentToolTip, accessor, config );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag, final World world, BlockPos pos )
|
||||
{
|
||||
final RayTraceResult mop = this.tracer.retraceBlock( world, player, pos );
|
||||
|
||||
if( mop != null )
|
||||
{
|
||||
final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
|
||||
if( maybePart.isPresent() )
|
||||
{
|
||||
final IPart part = maybePart.get();
|
||||
|
||||
for( final IPartWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getNBTData( player, part, te, tag, world, pos );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//import java.util.Optional;
|
||||
//
|
||||
//import com.google.common.collect.Lists;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.util.math.RayTraceResult;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.integration.modules.waila.part.ChannelWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.IPartWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.P2PStateWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.PartAccessor;
|
||||
//import appeng.integration.modules.waila.part.PartStackWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.PowerStateWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.StorageMonitorWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.part.Tracer;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Delegation provider for parts through {@link IPartWailaDataProvider}
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class PartWailaDataProvider implements IWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Contains all providers
|
||||
// */
|
||||
// private final List<IPartWailaDataProvider> providers;
|
||||
//
|
||||
// /**
|
||||
// * Can access parts through view-hits
|
||||
// */
|
||||
// private final PartAccessor accessor = new PartAccessor();
|
||||
//
|
||||
// /**
|
||||
// * Traces views hit on blocks
|
||||
// */
|
||||
// private final Tracer tracer = new Tracer();
|
||||
//
|
||||
// /**
|
||||
// * Initializes the provider list with all wanted providers
|
||||
// */
|
||||
// public PartWailaDataProvider()
|
||||
// {
|
||||
// final IPartWailaDataProvider channel = new ChannelWailaDataProvider();
|
||||
// final IPartWailaDataProvider storageMonitor = new StorageMonitorWailaDataProvider();
|
||||
// final IPartWailaDataProvider powerState = new PowerStateWailaDataProvider();
|
||||
// final IPartWailaDataProvider p2pState = new P2PStateWailaDataProvider();
|
||||
// final IPartWailaDataProvider partStack = new PartStackWailaDataProvider();
|
||||
//
|
||||
// this.providers = Lists.newArrayList( channel, storageMonitor, powerState, partStack, p2pState );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// final RayTraceResult mop = accessor.getMOP();
|
||||
//
|
||||
//
|
||||
// final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
//
|
||||
// if( maybePart.isPresent() )
|
||||
// {
|
||||
// final IPart part = maybePart.get();
|
||||
//
|
||||
// ItemStack wailaStack = null;
|
||||
//
|
||||
// for( final IPartWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// wailaStack = provider.getWailaStack( part, config, wailaStack );
|
||||
// }
|
||||
// return wailaStack;
|
||||
// }
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// final RayTraceResult mop = accessor.getMOP();
|
||||
//
|
||||
// final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
//
|
||||
// if( maybePart.isPresent() )
|
||||
// {
|
||||
// final IPart part = maybePart.get();
|
||||
//
|
||||
// for( final IPartWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaHead( part, currentToolTip, accessor, config );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// final RayTraceResult mop = accessor.getMOP();
|
||||
//
|
||||
// final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
//
|
||||
// if( maybePart.isPresent() )
|
||||
// {
|
||||
// final IPart part = maybePart.get();
|
||||
//
|
||||
// for( final IPartWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaBody( part, currentToolTip, accessor, config );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// final RayTraceResult mop = accessor.getMOP();
|
||||
//
|
||||
// final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
//
|
||||
// if( maybePart.isPresent() )
|
||||
// {
|
||||
// final IPart part = maybePart.get();
|
||||
//
|
||||
// for( final IPartWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaTail( part, currentToolTip, accessor, config );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag, final World world, BlockPos pos )
|
||||
// {
|
||||
// final RayTraceResult mop = this.tracer.retraceBlock( world, player, pos );
|
||||
//
|
||||
// if( mop != null )
|
||||
// {
|
||||
// final Optional<IPart> maybePart = this.accessor.getMaybePart( te, mop );
|
||||
//
|
||||
// if( maybePart.isPresent() )
|
||||
// {
|
||||
// final IPart part = maybePart.get();
|
||||
//
|
||||
// for( final IPartWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getNBTData( player, part, te, tag, world, pos );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,119 +1,119 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
|
||||
import appeng.integration.modules.waila.tile.ChargerWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider;
|
||||
|
||||
|
||||
/**
|
||||
* Delegation provider for tiles through {@link mcp.mobius.waila.api.IWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Contains all providers
|
||||
*/
|
||||
private final List<IWailaDataProvider> providers;
|
||||
|
||||
/**
|
||||
* Initializes the provider list with all wanted providers
|
||||
*/
|
||||
public TileWailaDataProvider()
|
||||
{
|
||||
final IWailaDataProvider charger = new ChargerWailaDataProvider();
|
||||
final IWailaDataProvider energyCell = new PowerStorageWailaDataProvider();
|
||||
final IWailaDataProvider craftingBlock = new PowerStateWailaDataProvider();
|
||||
final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider();
|
||||
|
||||
this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
for( final IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaHead( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
for( final IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaBody( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
for( final IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getWailaTail( itemStack, currentToolTip, accessor, config );
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
|
||||
{
|
||||
for( final IWailaDataProvider provider : this.providers )
|
||||
{
|
||||
provider.getNBTData( player, te, tag, world, pos );
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.google.common.collect.Lists;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
//
|
||||
//import appeng.integration.modules.waila.tile.ChargerWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.tile.CraftingMonitorWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider;
|
||||
//import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Delegation provider for tiles through {@link mcp.mobius.waila.api.IWailaDataProvider}
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class TileWailaDataProvider implements IWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Contains all providers
|
||||
// */
|
||||
// private final List<IWailaDataProvider> providers;
|
||||
//
|
||||
// /**
|
||||
// * Initializes the provider list with all wanted providers
|
||||
// */
|
||||
// public TileWailaDataProvider()
|
||||
// {
|
||||
// final IWailaDataProvider charger = new ChargerWailaDataProvider();
|
||||
// final IWailaDataProvider energyCell = new PowerStorageWailaDataProvider();
|
||||
// final IWailaDataProvider craftingBlock = new PowerStateWailaDataProvider();
|
||||
// final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider();
|
||||
//
|
||||
// this.providers = Lists.newArrayList( charger, energyCell, craftingBlock, craftingMonitor );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getWailaStack( final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaHead( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// for( final IWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaHead( itemStack, currentToolTip, accessor, config );
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// for( final IWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaBody( itemStack, currentToolTip, accessor, config );
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaTail( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// for( final IWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getWailaTail( itemStack, currentToolTip, accessor, config );
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos)
|
||||
// {
|
||||
// for( final IWailaDataProvider provider : this.providers )
|
||||
// {
|
||||
// provider.getNBTData( player, te, tag, world, pos );
|
||||
// }
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila;
|
||||
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.IntegrationHelper;
|
||||
import appeng.tile.AEBaseTile;
|
||||
|
||||
|
||||
public class WailaModule implements IIntegrationModule
|
||||
{
|
||||
|
||||
public WailaModule()
|
||||
{
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class );
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class );
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaConfigHandler.class );
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataAccessor.class );
|
||||
IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.ITaggedList.class );
|
||||
}
|
||||
|
||||
public static void register( final IWailaRegistrar registrar )
|
||||
{
|
||||
final IWailaDataProvider partHost = new PartWailaDataProvider();
|
||||
|
||||
registrar.registerStackProvider( partHost, AEBaseTile.class );
|
||||
registrar.registerBodyProvider( partHost, AEBaseTile.class );
|
||||
registrar.registerNBTProvider( partHost, AEBaseTile.class );
|
||||
|
||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
|
||||
registrar.registerBodyProvider( tile, AEBaseTile.class );
|
||||
registrar.registerNBTProvider( tile, AEBaseTile.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() throws Throwable
|
||||
{
|
||||
FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
|
||||
}
|
||||
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila;
|
||||
//
|
||||
//
|
||||
//import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
//import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
//
|
||||
//import appeng.integration.IIntegrationModule;
|
||||
//import appeng.integration.IntegrationHelper;
|
||||
//import appeng.tile.AEBaseTile;
|
||||
//
|
||||
//
|
||||
//public class WailaModule implements IIntegrationModule
|
||||
//{
|
||||
//
|
||||
// public WailaModule()
|
||||
// {
|
||||
// IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataProvider.class );
|
||||
// IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaRegistrar.class );
|
||||
// IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaConfigHandler.class );
|
||||
// IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.IWailaDataAccessor.class );
|
||||
// IntegrationHelper.testClassExistence( this, mcp.mobius.waila.api.ITaggedList.class );
|
||||
// }
|
||||
//
|
||||
// public static void register( final IWailaRegistrar registrar )
|
||||
// {
|
||||
// final IWailaDataProvider partHost = new PartWailaDataProvider();
|
||||
//
|
||||
// registrar.registerStackProvider( partHost, AEBaseTile.class );
|
||||
// registrar.registerBodyProvider( partHost, AEBaseTile.class );
|
||||
// registrar.registerNBTProvider( partHost, AEBaseTile.class );
|
||||
//
|
||||
// final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
//
|
||||
// registrar.registerBodyProvider( tile, AEBaseTile.class );
|
||||
// registrar.registerNBTProvider( tile, AEBaseTile.class );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void init() throws Throwable
|
||||
// {
|
||||
// FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
+75
-75
@@ -1,75 +1,75 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
|
||||
|
||||
/**
|
||||
* Default implementation of {@link appeng.integration.modules.waila.part.IPartWailaDataProvider}
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider
|
||||
{
|
||||
@Override
|
||||
public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, final ItemStack partStack )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Default implementation of {@link appeng.integration.modules.waila.part.IPartWailaDataProvider}
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public abstract class BasePartWailaDataProvider implements IPartWailaDataProvider
|
||||
//{
|
||||
// @Override
|
||||
// public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, final ItemStack partStack )
|
||||
// {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaHead( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public List<String> getWailaTail( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
// {
|
||||
// return tag;
|
||||
// }
|
||||
//}
|
||||
|
||||
+163
-163
@@ -1,163 +1,163 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import gnu.trove.map.TObjectByteMap;
|
||||
import gnu.trove.map.hash.TObjectByteHashMap;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.parts.networking.PartCableSmart;
|
||||
import appeng.parts.networking.PartDenseCable;
|
||||
|
||||
|
||||
/**
|
||||
* Channel-information provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Channel key used for the transferred {@link net.minecraft.nbt.NBTTagCompound}
|
||||
*/
|
||||
private static final String ID_USED_CHANNELS = "usedChannels";
|
||||
|
||||
/**
|
||||
* Used cache for channels if the channel was not transmitted through the server.
|
||||
* <p/>
|
||||
* This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
* server.
|
||||
* <p/>
|
||||
* The cache will be updated from the server.
|
||||
*/
|
||||
private final TObjectByteMap<IPart> cache = new TObjectByteHashMap<IPart>();
|
||||
|
||||
/**
|
||||
* Adds the used and max channel to the tool tip
|
||||
*
|
||||
* @param part being looked at part
|
||||
* @param currentToolTip current tool tip
|
||||
* @param accessor wrapper for various world information
|
||||
* @param config config to react to various settings
|
||||
*
|
||||
* @return modified tool tip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
{
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final byte usedChannels = this.getUsedChannels( part, tag, this.cache );
|
||||
|
||||
if( usedChannels >= 0 )
|
||||
{
|
||||
final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
|
||||
final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
||||
currentToolTip.add( formattedToolTip );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the source of the channel.
|
||||
* <p/>
|
||||
* If the client received information of the channels on the server, they are used, else if the cache contains a
|
||||
* previous stored value, this will be used. Default value is 0.
|
||||
*
|
||||
* @param part part to be looked at
|
||||
* @param tag tag maybe containing the channel information
|
||||
* @param cache cache with previous knowledge
|
||||
*
|
||||
* @return used channels on the cable
|
||||
*/
|
||||
private byte getUsedChannels( final IPart part, final NBTTagCompound tag, final TObjectByteMap<IPart> cache )
|
||||
{
|
||||
final byte usedChannels;
|
||||
|
||||
if( tag.hasKey( ID_USED_CHANNELS ) )
|
||||
{
|
||||
usedChannels = tag.getByte( ID_USED_CHANNELS );
|
||||
this.cache.put( part, usedChannels );
|
||||
}
|
||||
else if( this.cache.containsKey( part ) )
|
||||
{
|
||||
usedChannels = this.cache.get( part );
|
||||
}
|
||||
else
|
||||
{
|
||||
usedChannels = -1;
|
||||
}
|
||||
|
||||
return usedChannels;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on server to transfer information from server to client.
|
||||
* <p/>
|
||||
* If the part is a cable, it writes the channel information in the {@code #tag} using the {@code ID_USED_CHANNELS}
|
||||
* key.
|
||||
*
|
||||
* @param player player looking at the part
|
||||
* @param part part being looked at
|
||||
* @param te host of the part
|
||||
* @param tag transferred tag which is send to the client
|
||||
* @param world world of the part
|
||||
* @param pos pos of the part
|
||||
*
|
||||
* @return tag send to the client
|
||||
*/
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
{
|
||||
final NBTTagCompound tempTag = new NBTTagCompound();
|
||||
|
||||
part.writeToNBT( tempTag );
|
||||
|
||||
if( tempTag.hasKey( ID_USED_CHANNELS ) )
|
||||
{
|
||||
final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS );
|
||||
|
||||
tag.setByte( ID_USED_CHANNELS, usedChannels );
|
||||
}
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import gnu.trove.map.TObjectByteMap;
|
||||
//import gnu.trove.map.hash.TObjectByteHashMap;
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.parts.networking.PartCableSmart;
|
||||
//import appeng.parts.networking.PartDenseCable;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Channel-information provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class ChannelWailaDataProvider extends BasePartWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Channel key used for the transferred {@link net.minecraft.nbt.NBTTagCompound}
|
||||
// */
|
||||
// private static final String ID_USED_CHANNELS = "usedChannels";
|
||||
//
|
||||
// /**
|
||||
// * Used cache for channels if the channel was not transmitted through the server.
|
||||
// * <p/>
|
||||
// * This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
// * server.
|
||||
// * <p/>
|
||||
// * The cache will be updated from the server.
|
||||
// */
|
||||
// private final TObjectByteMap<IPart> cache = new TObjectByteHashMap<IPart>();
|
||||
//
|
||||
// /**
|
||||
// * Adds the used and max channel to the tool tip
|
||||
// *
|
||||
// * @param part being looked at part
|
||||
// * @param currentToolTip current tool tip
|
||||
// * @param accessor wrapper for various world information
|
||||
// * @param config config to react to various settings
|
||||
// *
|
||||
// * @return modified tool tip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
// {
|
||||
// final NBTTagCompound tag = accessor.getNBTData();
|
||||
//
|
||||
// final byte usedChannels = this.getUsedChannels( part, tag, this.cache );
|
||||
//
|
||||
// if( usedChannels >= 0 )
|
||||
// {
|
||||
// final byte maxChannels = (byte) ( ( part instanceof PartDenseCable ) ? 32 : 8 );
|
||||
//
|
||||
// final String formattedToolTip = String.format( WailaText.Channels.getLocal(), usedChannels, maxChannels );
|
||||
// currentToolTip.add( formattedToolTip );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Determines the source of the channel.
|
||||
// * <p/>
|
||||
// * If the client received information of the channels on the server, they are used, else if the cache contains a
|
||||
// * previous stored value, this will be used. Default value is 0.
|
||||
// *
|
||||
// * @param part part to be looked at
|
||||
// * @param tag tag maybe containing the channel information
|
||||
// * @param cache cache with previous knowledge
|
||||
// *
|
||||
// * @return used channels on the cable
|
||||
// */
|
||||
// private byte getUsedChannels( final IPart part, final NBTTagCompound tag, final TObjectByteMap<IPart> cache )
|
||||
// {
|
||||
// final byte usedChannels;
|
||||
//
|
||||
// if( tag.hasKey( ID_USED_CHANNELS ) )
|
||||
// {
|
||||
// usedChannels = tag.getByte( ID_USED_CHANNELS );
|
||||
// this.cache.put( part, usedChannels );
|
||||
// }
|
||||
// else if( this.cache.containsKey( part ) )
|
||||
// {
|
||||
// usedChannels = this.cache.get( part );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// usedChannels = -1;
|
||||
// }
|
||||
//
|
||||
// return usedChannels;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Called on server to transfer information from server to client.
|
||||
// * <p/>
|
||||
// * If the part is a cable, it writes the channel information in the {@code #tag} using the {@code ID_USED_CHANNELS}
|
||||
// * key.
|
||||
// *
|
||||
// * @param player player looking at the part
|
||||
// * @param part part being looked at
|
||||
// * @param te host of the part
|
||||
// * @param tag transferred tag which is send to the client
|
||||
// * @param world world of the part
|
||||
// * @param pos pos of the part
|
||||
// *
|
||||
// * @return tag send to the client
|
||||
// */
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
// {
|
||||
// if( part instanceof PartCableSmart || part instanceof PartDenseCable )
|
||||
// {
|
||||
// final NBTTagCompound tempTag = new NBTTagCompound();
|
||||
//
|
||||
// part.writeToNBT( tempTag );
|
||||
//
|
||||
// if( tempTag.hasKey( ID_USED_CHANNELS ) )
|
||||
// {
|
||||
// final byte usedChannels = tempTag.getByte( ID_USED_CHANNELS );
|
||||
//
|
||||
// tag.setByte( ID_USED_CHANNELS, usedChannels );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
|
||||
|
||||
/**
|
||||
* An abstraction layer of the {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} for
|
||||
* {@link appeng.api.parts.IPart}.
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public interface IPartWailaDataProvider
|
||||
{
|
||||
ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack );
|
||||
|
||||
List<String> getWailaHead( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
|
||||
List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
|
||||
List<String> getWailaTail( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
|
||||
NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos );
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * An abstraction layer of the {@link appeng.integration.modules.waila.part.IPartWailaDataProvider} for
|
||||
// * {@link appeng.api.parts.IPart}.
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public interface IPartWailaDataProvider
|
||||
//{
|
||||
// ItemStack getWailaStack( IPart part, IWailaConfigHandler config, ItemStack partStack );
|
||||
//
|
||||
// List<String> getWailaHead( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
//
|
||||
// List<String> getWailaBody( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
//
|
||||
// List<String> getWailaTail( IPart part, List<String> currentToolTip, IWailaDataAccessor accessor, IWailaConfigHandler config );
|
||||
//
|
||||
// NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos );
|
||||
//}
|
||||
|
||||
+158
-158
@@ -1,158 +1,158 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Iterators;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
|
||||
|
||||
/**
|
||||
* Provides information about a P2P tunnel to WAILA.
|
||||
*/
|
||||
public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
|
||||
private static final int STATE_UNLINKED = 0;
|
||||
private static final int STATE_OUTPUT = 1;
|
||||
private static final int STATE_INPUT = 2;
|
||||
public static final String TAG_P2P_STATE = "p2p_state";
|
||||
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param part part with state
|
||||
* @param currentToolTip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
NBTTagCompound nbtData = accessor.getNBTData();
|
||||
if( nbtData.hasKey( TAG_P2P_STATE ) )
|
||||
{
|
||||
int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE );
|
||||
if( stateArr.length == 2 )
|
||||
{
|
||||
int state = stateArr[0];
|
||||
int outputs = stateArr[1];
|
||||
|
||||
switch( state )
|
||||
{
|
||||
case STATE_UNLINKED:
|
||||
currentToolTip.add( WailaText.P2PUnlinked.getLocal() );
|
||||
break;
|
||||
case STATE_OUTPUT:
|
||||
currentToolTip.add( WailaText.P2POutput.getLocal() );
|
||||
break;
|
||||
case STATE_INPUT:
|
||||
currentToolTip.add( getOutputText( outputs ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
if( part instanceof PartP2PTunnel )
|
||||
{
|
||||
PartP2PTunnel tunnel = (PartP2PTunnel) part;
|
||||
|
||||
// The default state
|
||||
int state = STATE_UNLINKED;
|
||||
int outputCount = 0;
|
||||
|
||||
if( !tunnel.isOutput() )
|
||||
{
|
||||
outputCount = getOutputCount( tunnel );
|
||||
if( outputCount > 0 )
|
||||
{
|
||||
// Only set it to INPUT if we know there are any outputs
|
||||
state = STATE_INPUT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PartP2PTunnel input = tunnel.getInput();
|
||||
if( input != null )
|
||||
{
|
||||
state = STATE_OUTPUT;
|
||||
}
|
||||
}
|
||||
|
||||
tag.setIntArray( TAG_P2P_STATE, new int[] {
|
||||
state,
|
||||
outputCount
|
||||
} );
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
private static int getOutputCount( PartP2PTunnel tunnel )
|
||||
{
|
||||
try
|
||||
{
|
||||
return Iterators.size( tunnel.getOutputs().iterator() );
|
||||
}
|
||||
catch( GridAccessException e )
|
||||
{
|
||||
// Well... unknown size it is!
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getOutputText( int outputs )
|
||||
{
|
||||
if( outputs <= 1 )
|
||||
{
|
||||
return WailaText.P2PInputOneOutput.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.google.common.collect.Iterators;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.me.GridAccessException;
|
||||
//import appeng.parts.p2p.PartP2PTunnel;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Provides information about a P2P tunnel to WAILA.
|
||||
// */
|
||||
//public final class P2PStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
//{
|
||||
//
|
||||
// private static final int STATE_UNLINKED = 0;
|
||||
// private static final int STATE_OUTPUT = 1;
|
||||
// private static final int STATE_INPUT = 2;
|
||||
// public static final String TAG_P2P_STATE = "p2p_state";
|
||||
//
|
||||
// /**
|
||||
// * Adds state to the tooltip
|
||||
// *
|
||||
// * @param part part with state
|
||||
// * @param currentToolTip to be added to tooltip
|
||||
// * @param accessor wrapper for various information
|
||||
// * @param config config settings
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// if( part instanceof PartP2PTunnel )
|
||||
// {
|
||||
// NBTTagCompound nbtData = accessor.getNBTData();
|
||||
// if( nbtData.hasKey( TAG_P2P_STATE ) )
|
||||
// {
|
||||
// int[] stateArr = nbtData.getIntArray( TAG_P2P_STATE );
|
||||
// if( stateArr.length == 2 )
|
||||
// {
|
||||
// int state = stateArr[0];
|
||||
// int outputs = stateArr[1];
|
||||
//
|
||||
// switch( state )
|
||||
// {
|
||||
// case STATE_UNLINKED:
|
||||
// currentToolTip.add( WailaText.P2PUnlinked.getLocal() );
|
||||
// break;
|
||||
// case STATE_OUTPUT:
|
||||
// currentToolTip.add( WailaText.P2POutput.getLocal() );
|
||||
// break;
|
||||
// case STATE_INPUT:
|
||||
// currentToolTip.add( getOutputText( outputs ) );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( EntityPlayerMP player, IPart part, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
// {
|
||||
// if( part instanceof PartP2PTunnel )
|
||||
// {
|
||||
// PartP2PTunnel tunnel = (PartP2PTunnel) part;
|
||||
//
|
||||
// // The default state
|
||||
// int state = STATE_UNLINKED;
|
||||
// int outputCount = 0;
|
||||
//
|
||||
// if( !tunnel.isOutput() )
|
||||
// {
|
||||
// outputCount = getOutputCount( tunnel );
|
||||
// if( outputCount > 0 )
|
||||
// {
|
||||
// // Only set it to INPUT if we know there are any outputs
|
||||
// state = STATE_INPUT;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// PartP2PTunnel input = tunnel.getInput();
|
||||
// if( input != null )
|
||||
// {
|
||||
// state = STATE_OUTPUT;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// tag.setIntArray( TAG_P2P_STATE, new int[] {
|
||||
// state,
|
||||
// outputCount
|
||||
// } );
|
||||
// }
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//
|
||||
// private static int getOutputCount( PartP2PTunnel tunnel )
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// return Iterators.size( tunnel.getOutputs().iterator() );
|
||||
// }
|
||||
// catch( GridAccessException e )
|
||||
// {
|
||||
// // Well... unknown size it is!
|
||||
// return 0;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private static String getOutputText( int outputs )
|
||||
// {
|
||||
// if( outputs <= 1 )
|
||||
// {
|
||||
// return WailaText.P2PInputOneOutput.getLocal();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return String.format( WailaText.P2PInputManyOutputs.getLocal(), outputs );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
+47
-47
@@ -1,47 +1,47 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2.
|
||||
* Copyright (c) 2013 - 2015, 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Part ItemStack provider for WAILA
|
||||
*
|
||||
* @author TheJulianJES
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public class PartStackWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, ItemStack partStack )
|
||||
{
|
||||
partStack = part.getItemStack( PartItemStack.PICK );
|
||||
return partStack;
|
||||
}
|
||||
|
||||
}
|
||||
///*
|
||||
// * This file is part of Applied Energistics 2.
|
||||
// * Copyright (c) 2013 - 2015, 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.parts.PartItemStack;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Part ItemStack provider for WAILA
|
||||
// *
|
||||
// * @author TheJulianJES
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public class PartStackWailaDataProvider extends BasePartWailaDataProvider
|
||||
//{
|
||||
//
|
||||
// @Override
|
||||
// public ItemStack getWailaStack( final IPart part, final IWailaConfigHandler config, ItemStack partStack )
|
||||
// {
|
||||
// partStack = part.getItemStack( PartItemStack.PICK );
|
||||
// return partStack;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
+91
-91
@@ -1,91 +1,91 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.core.localization.WailaText;
|
||||
|
||||
|
||||
/**
|
||||
* Power state provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param part part with state
|
||||
* @param currentToolTip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
if( part instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = (IPowerChannelState) part;
|
||||
|
||||
currentToolTip.add( this.getToolTip( state.isActive(), state.isPowered() ) );
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the corresponding tool tip for different values of {@code #isActive} and {@code #isPowered}
|
||||
*
|
||||
* @param isActive if part is active
|
||||
* @param isPowered if part is powered
|
||||
*
|
||||
* @return tooltip of the state
|
||||
*/
|
||||
private String getToolTip( final boolean isActive, final boolean isPowered )
|
||||
{
|
||||
final String result;
|
||||
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
result = WailaText.DeviceOnline.getLocal();
|
||||
}
|
||||
else if( isPowered )
|
||||
{
|
||||
result = WailaText.DeviceMissingChannel.getLocal();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = WailaText.DeviceOffline.getLocal();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.implementations.IPowerChannelState;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Power state provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class PowerStateWailaDataProvider extends BasePartWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Adds state to the tooltip
|
||||
// *
|
||||
// * @param part part with state
|
||||
// * @param currentToolTip to be added to tooltip
|
||||
// * @param accessor wrapper for various information
|
||||
// * @param config config settings
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// if( part instanceof IPowerChannelState )
|
||||
// {
|
||||
// final IPowerChannelState state = (IPowerChannelState) part;
|
||||
//
|
||||
// currentToolTip.add( this.getToolTip( state.isActive(), state.isPowered() ) );
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the corresponding tool tip for different values of {@code #isActive} and {@code #isPowered}
|
||||
// *
|
||||
// * @param isActive if part is active
|
||||
// * @param isPowered if part is powered
|
||||
// *
|
||||
// * @return tooltip of the state
|
||||
// */
|
||||
// private String getToolTip( final boolean isActive, final boolean isPowered )
|
||||
// {
|
||||
// final String result;
|
||||
//
|
||||
// if( isActive && isPowered )
|
||||
// {
|
||||
// result = WailaText.DeviceOnline.getLocal();
|
||||
// }
|
||||
// else if( isPowered )
|
||||
// {
|
||||
// result = WailaText.DeviceMissingChannel.getLocal();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// result = WailaText.DeviceOffline.getLocal();
|
||||
// }
|
||||
//
|
||||
// return result;
|
||||
// }
|
||||
//}
|
||||
|
||||
+81
-81
@@ -1,81 +1,81 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.part;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.implementations.parts.IPartStorageMonitor;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.core.localization.WailaText;
|
||||
|
||||
|
||||
/**
|
||||
* Storage monitor provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Displays the stack if present and if the monitor is locked.
|
||||
* Can handle fluids and items.
|
||||
*
|
||||
* @param part maybe storage monitor
|
||||
* @param currentToolTip to be written to tooltip
|
||||
* @param accessor information wrapper
|
||||
* @param config config option
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
if( part instanceof IPartStorageMonitor )
|
||||
{
|
||||
final IPartStorageMonitor monitor = (IPartStorageMonitor) part;
|
||||
|
||||
final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
final boolean isLocked = monitor.isLocked();
|
||||
|
||||
if( displayed instanceof IAEItemStack )
|
||||
{
|
||||
final IAEItemStack ais = (IAEItemStack) displayed;
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
}
|
||||
else if( displayed instanceof IAEFluidStack )
|
||||
{
|
||||
final IAEFluidStack ais = (IAEFluidStack) displayed;
|
||||
currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) );
|
||||
}
|
||||
|
||||
currentToolTip.add( ( isLocked ) ? WailaText.Locked.getLocal() : WailaText.Unlocked.getLocal() );
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.part;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.implementations.parts.IPartStorageMonitor;
|
||||
//import appeng.api.parts.IPart;
|
||||
//import appeng.api.storage.data.IAEFluidStack;
|
||||
//import appeng.api.storage.data.IAEItemStack;
|
||||
//import appeng.api.storage.data.IAEStack;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Storage monitor provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class StorageMonitorWailaDataProvider extends BasePartWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Displays the stack if present and if the monitor is locked.
|
||||
// * Can handle fluids and items.
|
||||
// *
|
||||
// * @param part maybe storage monitor
|
||||
// * @param currentToolTip to be written to tooltip
|
||||
// * @param accessor information wrapper
|
||||
// * @param config config option
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final IPart part, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// if( part instanceof IPartStorageMonitor )
|
||||
// {
|
||||
// final IPartStorageMonitor monitor = (IPartStorageMonitor) part;
|
||||
//
|
||||
// final IAEStack<?> displayed = monitor.getDisplayed();
|
||||
// final boolean isLocked = monitor.isLocked();
|
||||
//
|
||||
// if( displayed instanceof IAEItemStack )
|
||||
// {
|
||||
// final IAEItemStack ais = (IAEItemStack) displayed;
|
||||
// currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
// }
|
||||
// else if( displayed instanceof IAEFluidStack )
|
||||
// {
|
||||
// final IAEFluidStack ais = (IAEFluidStack) displayed;
|
||||
// currentToolTip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName( ais.getFluidStack() ) );
|
||||
// }
|
||||
//
|
||||
// currentToolTip.add( ( isLocked ) ? WailaText.Locked.getLocal() : WailaText.Unlocked.getLocal() );
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -72,7 +72,7 @@ public final class Tracer
|
||||
double y = player.posY;
|
||||
double z = player.posZ;
|
||||
|
||||
if( player.worldObj.isRemote )
|
||||
if( player.world.isRemote )
|
||||
{
|
||||
// compatibility with eye height changing mods
|
||||
y += player.getEyeHeight() - player.getDefaultEyeHeight();
|
||||
|
||||
@@ -1,78 +1,78 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
|
||||
|
||||
/**
|
||||
* Charger provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class ChargerWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Displays the holding item and its tooltip
|
||||
*
|
||||
* @param itemStack stack of charger
|
||||
* @param currentToolTip unmodified tooltip
|
||||
* @param accessor wrapper information
|
||||
* @param config config option
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof TileCharger )
|
||||
{
|
||||
final TileCharger charger = (TileCharger) te;
|
||||
final IInventory chargerInventory = charger.getInternalInventory();
|
||||
final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
|
||||
|
||||
if( chargingItem != null )
|
||||
{
|
||||
final String currentInventory = chargingItem.getDisplayName();
|
||||
final EntityPlayer player = accessor.getPlayer();
|
||||
|
||||
currentToolTip.add( WailaText.Contains + ": " + currentInventory );
|
||||
chargingItem.getItem().addInformation( chargingItem, player, currentToolTip, true );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.tile;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayer;
|
||||
//import net.minecraft.inventory.IInventory;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
//import appeng.tile.misc.TileCharger;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Charger provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class ChargerWailaDataProvider extends BaseWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Displays the holding item and its tooltip
|
||||
// *
|
||||
// * @param itemStack stack of charger
|
||||
// * @param currentToolTip unmodified tooltip
|
||||
// * @param accessor wrapper information
|
||||
// * @param config config option
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// if( te instanceof TileCharger )
|
||||
// {
|
||||
// final TileCharger charger = (TileCharger) te;
|
||||
// final IInventory chargerInventory = charger.getInternalInventory();
|
||||
// final ItemStack chargingItem = chargerInventory.getStackInSlot( 0 );
|
||||
//
|
||||
// if( chargingItem != null )
|
||||
// {
|
||||
// final String currentInventory = chargingItem.getDisplayName();
|
||||
// final EntityPlayer player = accessor.getPlayer();
|
||||
//
|
||||
// currentToolTip.add( WailaText.Contains + ": " + currentInventory );
|
||||
// chargingItem.getItem().addInformation( chargingItem, player, currentToolTip, true );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//}
|
||||
|
||||
+74
-74
@@ -1,74 +1,74 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
|
||||
|
||||
/**
|
||||
* Crafting-monitor provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Displays the item currently crafted by the CPU cluster
|
||||
*
|
||||
* @param itemStack stack of crafting monitor
|
||||
* @param currentToolTip unmodified tooltip
|
||||
* @param accessor information wrapper
|
||||
* @param config config option
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof TileCraftingMonitorTile )
|
||||
{
|
||||
final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te;
|
||||
final IAEItemStack displayStack = monitor.getJobProgress();
|
||||
|
||||
if( displayStack != null )
|
||||
{
|
||||
final String currentCrafting = displayStack.getItemStack().getDisplayName();
|
||||
|
||||
currentToolTip.add( WailaText.Crafting.getLocal() + ": " + currentCrafting );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.tile;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.storage.data.IAEItemStack;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
//import appeng.tile.crafting.TileCraftingMonitorTile;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Crafting-monitor provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class CraftingMonitorWailaDataProvider extends BaseWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Displays the item currently crafted by the CPU cluster
|
||||
// *
|
||||
// * @param itemStack stack of crafting monitor
|
||||
// * @param currentToolTip unmodified tooltip
|
||||
// * @param accessor information wrapper
|
||||
// * @param config config option
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// if( te instanceof TileCraftingMonitorTile )
|
||||
// {
|
||||
// final TileCraftingMonitorTile monitor = (TileCraftingMonitorTile) te;
|
||||
// final IAEItemStack displayStack = monitor.getJobProgress();
|
||||
//
|
||||
// if( displayStack != null )
|
||||
// {
|
||||
// final String currentCrafting = displayStack.getItemStack().getDisplayName();
|
||||
//
|
||||
// currentToolTip.add( WailaText.Crafting.getLocal() + ": " + currentCrafting );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//}
|
||||
|
||||
+82
-82
@@ -1,82 +1,82 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
|
||||
|
||||
/**
|
||||
* Power state provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStateWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Adds state to the tooltip
|
||||
*
|
||||
* @param itemStack stack of power state
|
||||
* @param currentToolTip to be added to tooltip
|
||||
* @param accessor wrapper for various information
|
||||
* @param config config settings
|
||||
*
|
||||
* @return modified tooltip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
|
||||
if( te instanceof IPowerChannelState )
|
||||
{
|
||||
final IPowerChannelState state = (IPowerChannelState) te;
|
||||
|
||||
final boolean isActive = state.isActive();
|
||||
final boolean isPowered = state.isPowered();
|
||||
|
||||
if( isActive && isPowered )
|
||||
{
|
||||
currentToolTip.add( WailaText.DeviceOnline.getLocal() );
|
||||
}
|
||||
else if( isPowered )
|
||||
{
|
||||
currentToolTip.add( WailaText.DeviceMissingChannel.getLocal() );
|
||||
}
|
||||
else
|
||||
{
|
||||
currentToolTip.add( WailaText.DeviceOffline.getLocal() );
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.tile;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.implementations.IPowerChannelState;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Power state provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class PowerStateWailaDataProvider extends BaseWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Adds state to the tooltip
|
||||
// *
|
||||
// * @param itemStack stack of power state
|
||||
// * @param currentToolTip to be added to tooltip
|
||||
// * @param accessor wrapper for various information
|
||||
// * @param config config settings
|
||||
// *
|
||||
// * @return modified tooltip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
//
|
||||
// if( te instanceof IPowerChannelState )
|
||||
// {
|
||||
// final IPowerChannelState state = (IPowerChannelState) te;
|
||||
//
|
||||
// final boolean isActive = state.isActive();
|
||||
// final boolean isPowered = state.isPowered();
|
||||
//
|
||||
// if( isActive && isPowered )
|
||||
// {
|
||||
// currentToolTip.add( WailaText.DeviceOnline.getLocal() );
|
||||
// }
|
||||
// else if( isPowered )
|
||||
// {
|
||||
// currentToolTip.add( WailaText.DeviceMissingChannel.getLocal() );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// currentToolTip.add( WailaText.DeviceOffline.getLocal() );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//}
|
||||
+174
-174
@@ -1,174 +1,174 @@
|
||||
/*
|
||||
* 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>.
|
||||
*/
|
||||
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import gnu.trove.map.TObjectLongMap;
|
||||
import gnu.trove.map.hash.TObjectLongHashMap;
|
||||
import mcp.mobius.waila.api.ITaggedList;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
import appeng.api.networking.energy.IAEPowerStorage;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.util.Platform;
|
||||
|
||||
|
||||
/**
|
||||
* Power storage provider for WAILA
|
||||
*
|
||||
* @author thatsIch
|
||||
* @version rv2
|
||||
* @since rv2
|
||||
*/
|
||||
public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
{
|
||||
/**
|
||||
* Power key used for the transferred {@link net.minecraft.nbt.NBTTagCompound}
|
||||
*/
|
||||
private static final String ID_CURRENT_POWER = "currentPower";
|
||||
|
||||
/**
|
||||
* Used cache for power if the power was not transmitted through the server.
|
||||
* <p/>
|
||||
* This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
* server.
|
||||
* <p/>
|
||||
* The cache will be updated from the server.
|
||||
*/
|
||||
private final TObjectLongMap<TileEntity> cache = new TObjectLongHashMap<TileEntity>();
|
||||
|
||||
/**
|
||||
* Adds the current and max power to the tool tip
|
||||
* Will ignore if the tile has an energy buffer ( > 0 )
|
||||
*
|
||||
* @param itemStack stack of power storage
|
||||
* @param currentToolTip current tool tip
|
||||
* @param accessor wrapper for various world information
|
||||
* @param config config to react to various settings
|
||||
*
|
||||
* @return modified tool tip
|
||||
*/
|
||||
@Override
|
||||
public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
{
|
||||
// Removes RF tooltip on WAILA 1.5.9+
|
||||
( (ITaggedList<String, String>) currentToolTip ).removeEntries( "RFEnergyStorage" );
|
||||
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
final double maxPower = storage.getAEMaxPower();
|
||||
if( maxPower > 0 )
|
||||
{
|
||||
final NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
final long internalCurrentPower = this.getInternalCurrentPower( tag, te );
|
||||
|
||||
if( internalCurrentPower >= 0 )
|
||||
{
|
||||
final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
|
||||
final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
|
||||
currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called on server to transfer information from server to client.
|
||||
* <p/>
|
||||
* If the {@link net.minecraft.tileentity.TileEntity} is a {@link appeng.api.networking.energy.IAEPowerStorage}, it
|
||||
* writes the power information to the {@code #tag} using the {@code #ID_CURRENT_POWER} key.
|
||||
*
|
||||
* @param player player looking at the power storage
|
||||
* @param te power storage
|
||||
* @param tag transferred tag which is send to the client
|
||||
* @param world world of the power storage
|
||||
* @param pos pos of the power storage
|
||||
*
|
||||
* @return tag send to the client
|
||||
*/
|
||||
@Override
|
||||
public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
{
|
||||
if( te instanceof IAEPowerStorage )
|
||||
{
|
||||
final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
|
||||
if( storage.getAEMaxPower() > 0 )
|
||||
{
|
||||
final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() );
|
||||
|
||||
tag.setLong( ID_CURRENT_POWER, internalCurrentPower );
|
||||
}
|
||||
}
|
||||
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the current power.
|
||||
* <p/>
|
||||
* If the client received power information on the server, they are used, else if the cache contains a previous
|
||||
* stored value, this will be used. Default value is 0.
|
||||
*
|
||||
* @param te te to be looked at
|
||||
* @param tag tag maybe containing the channel information
|
||||
*
|
||||
* @return used channels on the cable
|
||||
*/
|
||||
private long getInternalCurrentPower( final NBTTagCompound tag, final TileEntity te )
|
||||
{
|
||||
final long internalCurrentPower;
|
||||
|
||||
if( tag.hasKey( ID_CURRENT_POWER ) )
|
||||
{
|
||||
internalCurrentPower = tag.getLong( ID_CURRENT_POWER );
|
||||
this.cache.put( te, internalCurrentPower );
|
||||
}
|
||||
else if( this.cache.containsKey( te ) )
|
||||
{
|
||||
internalCurrentPower = this.cache.get( te );
|
||||
}
|
||||
else
|
||||
{
|
||||
internalCurrentPower = -1;
|
||||
}
|
||||
|
||||
return internalCurrentPower;
|
||||
}
|
||||
}
|
||||
///*
|
||||
// * 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>.
|
||||
// */
|
||||
//
|
||||
//package appeng.integration.modules.waila.tile;
|
||||
//
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
//import net.minecraft.entity.player.EntityPlayerMP;
|
||||
//import net.minecraft.item.ItemStack;
|
||||
//import net.minecraft.nbt.NBTTagCompound;
|
||||
//import net.minecraft.tileentity.TileEntity;
|
||||
//import net.minecraft.util.math.BlockPos;
|
||||
//import net.minecraft.world.World;
|
||||
//
|
||||
//import gnu.trove.map.TObjectLongMap;
|
||||
//import gnu.trove.map.hash.TObjectLongHashMap;
|
||||
//import mcp.mobius.waila.api.ITaggedList;
|
||||
//import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
//import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
//
|
||||
//import appeng.api.networking.energy.IAEPowerStorage;
|
||||
//import appeng.core.localization.WailaText;
|
||||
//import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
//import appeng.util.Platform;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * Power storage provider for WAILA
|
||||
// *
|
||||
// * @author thatsIch
|
||||
// * @version rv2
|
||||
// * @since rv2
|
||||
// */
|
||||
//public final class PowerStorageWailaDataProvider extends BaseWailaDataProvider
|
||||
//{
|
||||
// /**
|
||||
// * Power key used for the transferred {@link net.minecraft.nbt.NBTTagCompound}
|
||||
// */
|
||||
// private static final String ID_CURRENT_POWER = "currentPower";
|
||||
//
|
||||
// /**
|
||||
// * Used cache for power if the power was not transmitted through the server.
|
||||
// * <p/>
|
||||
// * This is useful, when a player just started to look at a tile and thus just requested the new information from the
|
||||
// * server.
|
||||
// * <p/>
|
||||
// * The cache will be updated from the server.
|
||||
// */
|
||||
// private final TObjectLongMap<TileEntity> cache = new TObjectLongHashMap<TileEntity>();
|
||||
//
|
||||
// /**
|
||||
// * Adds the current and max power to the tool tip
|
||||
// * Will ignore if the tile has an energy buffer ( > 0 )
|
||||
// *
|
||||
// * @param itemStack stack of power storage
|
||||
// * @param currentToolTip current tool tip
|
||||
// * @param accessor wrapper for various world information
|
||||
// * @param config config to react to various settings
|
||||
// *
|
||||
// * @return modified tool tip
|
||||
// */
|
||||
// @Override
|
||||
// public List<String> getWailaBody( final ItemStack itemStack, final List<String> currentToolTip, final IWailaDataAccessor accessor, final IWailaConfigHandler config )
|
||||
// {
|
||||
// // Removes RF tooltip on WAILA 1.5.9+
|
||||
// ( (ITaggedList<String, String>) currentToolTip ).removeEntries( "RFEnergyStorage" );
|
||||
//
|
||||
// final TileEntity te = accessor.getTileEntity();
|
||||
// if( te instanceof IAEPowerStorage )
|
||||
// {
|
||||
// final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
//
|
||||
// final double maxPower = storage.getAEMaxPower();
|
||||
// if( maxPower > 0 )
|
||||
// {
|
||||
// final NBTTagCompound tag = accessor.getNBTData();
|
||||
//
|
||||
// final long internalCurrentPower = this.getInternalCurrentPower( tag, te );
|
||||
//
|
||||
// if( internalCurrentPower >= 0 )
|
||||
// {
|
||||
// final long internalMaxPower = (long) ( 100 * maxPower );
|
||||
//
|
||||
// final String formatCurrentPower = Platform.formatPowerLong( internalCurrentPower, false );
|
||||
// final String formatMaxPower = Platform.formatPowerLong( internalMaxPower, false );
|
||||
//
|
||||
// currentToolTip.add( WailaText.Contains.getLocal() + ": " + formatCurrentPower + " / " + formatMaxPower );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return currentToolTip;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Called on server to transfer information from server to client.
|
||||
// * <p/>
|
||||
// * If the {@link net.minecraft.tileentity.TileEntity} is a {@link appeng.api.networking.energy.IAEPowerStorage}, it
|
||||
// * writes the power information to the {@code #tag} using the {@code #ID_CURRENT_POWER} key.
|
||||
// *
|
||||
// * @param player player looking at the power storage
|
||||
// * @param te power storage
|
||||
// * @param tag transferred tag which is send to the client
|
||||
// * @param world world of the power storage
|
||||
// * @param pos pos of the power storage
|
||||
// *
|
||||
// * @return tag send to the client
|
||||
// */
|
||||
// @Override
|
||||
// public NBTTagCompound getNBTData( EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos )
|
||||
// {
|
||||
// if( te instanceof IAEPowerStorage )
|
||||
// {
|
||||
// final IAEPowerStorage storage = (IAEPowerStorage) te;
|
||||
//
|
||||
// if( storage.getAEMaxPower() > 0 )
|
||||
// {
|
||||
// final long internalCurrentPower = (long) ( 100 * storage.getAECurrentPower() );
|
||||
//
|
||||
// tag.setLong( ID_CURRENT_POWER, internalCurrentPower );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return tag;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Determines the current power.
|
||||
// * <p/>
|
||||
// * If the client received power information on the server, they are used, else if the cache contains a previous
|
||||
// * stored value, this will be used. Default value is 0.
|
||||
// *
|
||||
// * @param te te to be looked at
|
||||
// * @param tag tag maybe containing the channel information
|
||||
// *
|
||||
// * @return used channels on the cable
|
||||
// */
|
||||
// private long getInternalCurrentPower( final NBTTagCompound tag, final TileEntity te )
|
||||
// {
|
||||
// final long internalCurrentPower;
|
||||
//
|
||||
// if( tag.hasKey( ID_CURRENT_POWER ) )
|
||||
// {
|
||||
// internalCurrentPower = tag.getLong( ID_CURRENT_POWER );
|
||||
// this.cache.put( te, internalCurrentPower );
|
||||
// }
|
||||
// else if( this.cache.containsKey( te ) )
|
||||
// {
|
||||
// internalCurrentPower = this.cache.get( te );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// internalCurrentPower = -1;
|
||||
// }
|
||||
//
|
||||
// return internalCurrentPower;
|
||||
// }
|
||||
//}
|
||||
|
||||
Reference in New Issue
Block a user