Added Waila Integration.
This commit is contained in:
parent
96f3c72bfd
commit
39fed650aa
8 changed files with 189 additions and 51 deletions
|
@ -65,26 +65,26 @@ public class AppEng
|
|||
/**
|
||||
* Side, Display Name, ModID ClassPostFix
|
||||
*/
|
||||
IntegrationSide.BOTH, "Industrial Craft 2", "IC2", "IC2", // IC2
|
||||
//IntegrationSide.BOTH, "Railcraft", "Railcraft", "RC", // RC
|
||||
//IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE", // TE
|
||||
//IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft", // MC
|
||||
IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC", // BC
|
||||
IntegrationSide.BOTH, "BuildCraft Power", null, "MJ", // BC
|
||||
//IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT", // GT
|
||||
//IntegrationSide.BOTH, "Universal Electricity", null, "UE", // UE
|
||||
//IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP", // LP
|
||||
// IntegrationSide.CLIENT, "Inventory Tweaks", "", "InvTweaks", // InvTweaks
|
||||
// IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR", // MFR
|
||||
IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU", // DSU
|
||||
//IntegrationSide.BOTH, "Better Storage", "betterstorage", "BS", // BS
|
||||
//IntegrationSide.BOTH, "Factorization", "factorization", "FZ", // FZ
|
||||
//IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry", // Forestry
|
||||
//IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism", // MeK
|
||||
//IntegrationSide.CLIENT, "Waila", "Waila", "Waila", // Waila
|
||||
//IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems", "NEI", // NEI
|
||||
//IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" // FMP
|
||||
});
|
||||
IntegrationSide.BOTH, "Industrial Craft 2", "IC2", "IC2", // IC2
|
||||
// IntegrationSide.BOTH, "Railcraft", "Railcraft", "RC", // RC
|
||||
// IntegrationSide.BOTH, "Thermal Expansion", "ThermalExpansion", "TE", // TE
|
||||
// IntegrationSide.BOTH, "Mystcraft", "Mystcraft", "Mystcraft", // MC
|
||||
IntegrationSide.BOTH, "BuildCraft", "BuildCraft|Silicon", "BC", // BC
|
||||
IntegrationSide.BOTH, "BuildCraft Power", null, "MJ", // BC
|
||||
// IntegrationSide.BOTH, "Greg Tech", "gregtech_addon", "GT", // GT
|
||||
// IntegrationSide.BOTH, "Universal Electricity", null, "UE", // UE
|
||||
// IntegrationSide.BOTH, "Logistics Pipes", "LogisticsPipes|Main", "LP", // LP
|
||||
// IntegrationSide.CLIENT, "Inventory Tweaks", "", "InvTweaks", // InvTweaks
|
||||
// IntegrationSide.BOTH, "Mine Factory Reloaded", "MineFactoryReloaded", "MFR", // MFR
|
||||
IntegrationSide.BOTH, "Deep Storage Unit", null, "DSU", // DSU
|
||||
// IntegrationSide.BOTH, "Better Storage", "betterstorage", "BS", // BS
|
||||
// IntegrationSide.BOTH, "Factorization", "factorization", "FZ", // FZ
|
||||
// IntegrationSide.BOTH, "Forestry", "Forestry", "Forestry", // Forestry
|
||||
// IntegrationSide.BOTH, "Mekanism", "Mekanism", "Mekanism", // MeK
|
||||
IntegrationSide.CLIENT, "Waila", "Waila", "Waila", // Waila
|
||||
// IntegrationSide.CLIENT, "Not Enough Items", "NotEnoughItems", "NEI", // NEI
|
||||
IntegrationSide.BOTH, "Forge MultiPart", "McMultipart", "FMP" // FMP
|
||||
} );
|
||||
|
||||
public boolean isIntegrationEnabled(String Name)
|
||||
{
|
||||
|
|
34
core/localization/WailaText.java
Normal file
34
core/localization/WailaText.java
Normal file
|
@ -0,0 +1,34 @@
|
|||
package appeng.core.localization;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public enum WailaText
|
||||
{
|
||||
|
||||
DeviceOnline, DeviceOffline, DeviceMissingChannel,
|
||||
|
||||
Locked, Unlocked, Showing,
|
||||
|
||||
Contains;
|
||||
|
||||
String root;
|
||||
|
||||
WailaText() {
|
||||
root = "waila.appliedenergistics2";
|
||||
}
|
||||
|
||||
WailaText(String r) {
|
||||
root = r;
|
||||
}
|
||||
|
||||
public String getUnlocalized()
|
||||
{
|
||||
return root + "." + toString();
|
||||
}
|
||||
|
||||
public String getLocal()
|
||||
{
|
||||
return StatCollector.translateToLocal( getUnlocalized() );
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ import buildcraft.transport.PipeIconProvider;
|
|||
import buildcraft.transport.TileGenericPipe;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class BC extends BaseModule implements IBC
|
||||
public class BC extends BaseModule implements IBC
|
||||
{
|
||||
|
||||
public static BC instance;
|
||||
|
@ -174,10 +174,10 @@ public class BC extends BaseModule implements IBC
|
|||
@Override
|
||||
public void Init()
|
||||
{
|
||||
TestClass(IPipeConnection.class);
|
||||
TestClass(ItemFacade.class);
|
||||
TestClass(IToolWrench.class);
|
||||
|
||||
TestClass( IPipeConnection.class );
|
||||
TestClass( ItemFacade.class );
|
||||
TestClass( IToolWrench.class );
|
||||
|
||||
AEApi.instance().partHelper().registerNewLayer( "appeng.api.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" );
|
||||
AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() );
|
||||
}
|
||||
|
|
|
@ -5,12 +5,11 @@ import powercrystals.minefactoryreloaded.api.IDeepStorageUnit;
|
|||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IDSU;
|
||||
import appeng.integration.modules.helpers.MFRDSU;
|
||||
import appeng.integration.modules.helpers.MFRDSUHandler;
|
||||
|
||||
public class DSU extends BaseModule implements IIntegrationModule, IDSU
|
||||
public class DSU extends BaseModule implements IDSU
|
||||
{
|
||||
|
||||
public static DSU instance;
|
||||
|
@ -32,7 +31,7 @@ public class DSU extends BaseModule implements IIntegrationModule, IDSU
|
|||
@Override
|
||||
public void Init()
|
||||
{
|
||||
TestClass(IDeepStorageUnit.class );
|
||||
TestClass( IDeepStorageUnit.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package appeng.integration.modules;
|
||||
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
import appeng.integration.abstraction.IMJ;
|
||||
import appeng.integration.abstraction.helpers.BaseMJperdition;
|
||||
import appeng.integration.modules.helpers.MJPerdition;
|
||||
import appeng.tile.powersink.BuildCraft;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
|
||||
public class MJ extends BaseModule implements IIntegrationModule, IMJ
|
||||
public class MJ extends BaseModule implements IMJ
|
||||
{
|
||||
|
||||
public static MJ instance;
|
||||
|
@ -24,7 +23,7 @@ public class MJ extends BaseModule implements IIntegrationModule, IMJ
|
|||
@Override
|
||||
public void Init() throws Throwable
|
||||
{
|
||||
TestClass(MJPerdition.class);
|
||||
TestClass( MJPerdition.class );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,57 +2,147 @@ package appeng.integration.modules;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaRegistrar;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.Vec3;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.parts.IPartStorageMonitor;
|
||||
import appeng.api.parts.IFacadePart;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.integration.BaseModule;
|
||||
import appeng.tile.misc.TileCharger;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms;
|
||||
|
||||
public class Waila extends BaseModule implements IWailaDataProvider {
|
||||
|
||||
public static void yourRegistrationMethod(IWailaRegistrar registrar)
|
||||
public class Waila extends BaseModule implements IWailaDataProvider
|
||||
{
|
||||
|
||||
public static Waila instance;
|
||||
|
||||
public static void register(IWailaRegistrar registrar)
|
||||
{
|
||||
registrar.registerHeadProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class);
|
||||
registrar.registerBodyProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class);
|
||||
registrar.registerTailProvider( (Waila)AppEng.instance.getIntegration("Waila"), AEBaseBlock.class);
|
||||
// registrar.registerHeadProvider( (Waila) AppEng.instance.getIntegration( "Waila" ), AEBaseBlock.class );
|
||||
registrar.registerBodyProvider( (Waila) AppEng.instance.getIntegration( "Waila" ), AEBaseBlock.class );
|
||||
// registrar.registerTailProvider( (Waila) AppEng.instance.getIntegration( "Waila" ), AEBaseBlock.class );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void Init() throws Throwable {
|
||||
public void Init() throws Throwable
|
||||
{
|
||||
TestClass( IWailaDataProvider.class );
|
||||
TestClass( IWailaRegistrar.class );
|
||||
FMLInterModComms.sendMessage("Waila", "register", "mcp.mobius.waila_demo.ProviderDemo.callbackRegister");
|
||||
FMLInterModComms.sendMessage( "Waila", "register", this.getClass().getName() + ".register" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void PostInit() throws Throwable {
|
||||
// :P
|
||||
public void PostInit() throws Throwable
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
|
||||
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
currenttip.add("AE2 Says Hi");
|
||||
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
TileEntity te = accessor.getTileEntity();
|
||||
|
||||
Object ThingOfInterest = te;
|
||||
if ( te instanceof IPartHost )
|
||||
{
|
||||
MovingObjectPosition mop = accessor.getPosition();
|
||||
Vec3 Pos = mop.hitVec.addVector( -mop.blockX, -mop.blockY, -mop.blockZ );
|
||||
SelectedPart sp = ((IPartHost) te).selectPart( Pos );
|
||||
if ( sp.facade != null )
|
||||
{
|
||||
IFacadePart fp = sp.facade;
|
||||
ThingOfInterest = fp;
|
||||
}
|
||||
else if ( sp.part != null )
|
||||
{
|
||||
IPart part = sp.part;
|
||||
ThingOfInterest = part;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ThingOfInterest instanceof IPartStorageMonitor )
|
||||
{
|
||||
IPartStorageMonitor psm = (IPartStorageMonitor) ThingOfInterest;
|
||||
IAEStack stack = psm.getDisplayed();
|
||||
boolean isLocked = psm.isLocked();
|
||||
|
||||
if ( stack instanceof IAEItemStack )
|
||||
{
|
||||
IAEItemStack ais = (IAEItemStack) stack;
|
||||
currenttip.add( WailaText.Showing.getLocal() + ": " + ais.getItemStack().getDisplayName() );
|
||||
}
|
||||
|
||||
if ( stack instanceof IAEFluidStack )
|
||||
{
|
||||
IAEFluidStack ais = (IAEFluidStack) stack;
|
||||
currenttip.add( WailaText.Showing.getLocal() + ": " + ais.getFluid().getLocalizedName() );
|
||||
}
|
||||
|
||||
if ( isLocked )
|
||||
currenttip.add( WailaText.Locked.getLocal() );
|
||||
else
|
||||
currenttip.add( WailaText.Unlocked.getLocal() );
|
||||
}
|
||||
|
||||
if ( ThingOfInterest instanceof TileCharger )
|
||||
{
|
||||
TileCharger tc = (TileCharger) ThingOfInterest;
|
||||
IInventory inv = tc.getInternalInventory();
|
||||
ItemStack is = inv.getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
currenttip.add( WailaText.Contains + ": " + is.getDisplayName() );
|
||||
is.getItem().addInformation( is, accessor.getPlayer(), currenttip, true );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ThingOfInterest instanceof IPowerChannelState )
|
||||
{
|
||||
IPowerChannelState pbs = (IPowerChannelState) ThingOfInterest;
|
||||
if ( pbs.isActive() && pbs.isPowered() )
|
||||
currenttip.add( WailaText.DeviceOnline.getLocal() );
|
||||
else if ( pbs.isPowered() )
|
||||
currenttip.add( WailaText.DeviceMissingChannel.getLocal() );
|
||||
else
|
||||
currenttip.add( WailaText.DeviceOffline.getLocal() );
|
||||
}
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
|
||||
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
|
||||
{
|
||||
|
||||
return currenttip;
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.client.renderer.RenderBlocks;
|
|||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
|
@ -18,7 +19,7 @@ import appeng.me.GridAccessException;
|
|||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class PartBasicState extends AEBasePart
|
||||
public class PartBasicState extends AEBasePart implements IPowerChannelState
|
||||
{
|
||||
|
||||
protected final int POWERED_FLAG = 1;
|
||||
|
@ -116,4 +117,16 @@ public class PartBasicState extends AEBasePart
|
|||
proxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPowered()
|
||||
{
|
||||
return (clientFlags & POWERED_FLAG) == POWERED_FLAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive()
|
||||
{
|
||||
return (clientFlags & CHANNEL_FLAG) == CHANNEL_FLAG;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
|||
super.writeToStream( data );
|
||||
|
||||
data.writeByte( spin );
|
||||
data.writeBoolean( isLocked );
|
||||
data.writeBoolean( configuredItem != null ? true : false );
|
||||
if ( configuredItem != null )
|
||||
configuredItem.writeToPacket( data );
|
||||
|
@ -112,6 +113,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
|||
boolean stuff = super.readFromStream( data );
|
||||
|
||||
spin = data.readByte();
|
||||
isLocked = data.readBoolean();
|
||||
boolean val = data.readBoolean();
|
||||
if ( val )
|
||||
configuredItem = AEItemStack.loadItemStackFromPacket( data );
|
||||
|
@ -136,6 +138,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
|||
{
|
||||
isLocked = !isLocked;
|
||||
player.addChatMessage( (isLocked ? PlayerMessages.isNowLocked : PlayerMessages.isNowUnlocked).get() );
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
else if ( !isLocked )
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue