AE2 First Commit, the dawn of 1.7 hast arrived.

This commit is contained in:
algorithmx2
2013-12-27 16:59:59 -06:00
commit e9acdcbee2
468 changed files with 47440 additions and 0 deletions
+116
View File
@@ -0,0 +1,116 @@
package appeng.server;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.WrongUsageException;
import net.minecraft.server.MinecraftServer;
import appeng.services.Profiler;
public class AECommand extends CommandBase
{
public AECommand(MinecraftServer server) {
}
@Override
public String getCommandName()
{
return "ae";
}
@Override
public String getCommandUsage(ICommandSender icommandsender)
{
return "commands.ae.usage";
}
@Override
public int getRequiredPermissionLevel()
{
return 2;
}
@Override
public void processCommand(ICommandSender sender, String[] args)
{
if ( args.length == 0 )
{
throw new WrongUsageException( "commands.ae.usage" );
}
else if ( "help".equals( args[0] ) )
{
throw new WrongUsageException( "commands.ae.usage" );
}
else if ( "profile".equals( args[0] ) )
{
if ( args.length > 1 && "start".equals( args[1] ) )
beginProfile( sender, args );
else if ( args.length > 1 && "stop".equals( args[1] ) )
endProfile( sender, args );
else
throw new WrongUsageException( "commands.ae.profile.usage" );
}
else
{
throw new WrongUsageException( "commands.ae.usage" );
}
}
private void endProfile(ICommandSender sender, String[] args)
{
if ( Profiler.instance == null )
{
throw new CommandException( "commands.ae.profiling.nojdk" );
}
if ( Profiler.instance.isRunning )
{
if ( Profiler.instance.profile )
{
Profiler.instance.profile = false;
synchronized (Profiler.instance.lock)
{
Profiler.instance.lock.notify();
}
}
else
throw new CommandException( "commands.ae.profiling.inactive" );
}
else
throw new CommandException( "commands.ae.profiling.nojdk" );
}
private void beginProfile(ICommandSender sender, String[] args)
{
if ( Profiler.instance == null )
{
throw new CommandException( "commands.ae.profiling.nojdk" );
}
if ( Profiler.instance.isRunning )
{
if ( Profiler.instance.profile )
throw new CommandException( "commands.ae.profiling.active" );
else
{
Profiler.instance.profile = true;
synchronized (Profiler.instance.lock)
{
Profiler.instance.lock.notify();
}
}
}
else
throw new CommandException( "commands.ae.profiling.nojdk" );
}
/**
* wtf?
*/
@Override
public int compareTo(Object arg0)
{
return 1;
}
}
+34
View File
@@ -0,0 +1,34 @@
package appeng.server;
public enum AccessType
{
/**
* allows basic access to manipulate the block via gui, or other.
*/
BLOCK_ACCESS,
/**
* Can player deposit items into the network.
*/
NETWORK_DEPOSIT,
/**
* can player withdraw items from the network.
*/
NETWORK_WITHDRAW,
/**
* can player issue crafting requests?
*/
NETWORK_CRAFT,
/**
* can player add new blocks to the network.
*/
NETWORK_BUILD,
/**
* can player manipulate security settings.
*/
NETWORK_SECURITY
}
+14
View File
@@ -0,0 +1,14 @@
package appeng.server;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
public class Security
{
public static boolean hasPermissions(TileEntity myTile, EntityPlayer player, AccessType blockAccess)
{
return true;
}
}
+75
View File
@@ -0,0 +1,75 @@
package appeng.server;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.network.packet.Packet;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.World;
import appeng.block.AEBaseBlock;
import appeng.core.CommonHelper;
import appeng.util.Platform;
import cpw.mods.fml.common.FMLCommonHandler;
public class ServerHelper extends CommonHelper
{
@Override
public List<EntityPlayer> getPlayers()
{
if ( !Platform.isClient() )
{
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
if ( server != null )
return server.getConfigurationManager().playerEntityList;
}
return new ArrayList();
}
@Override
public void sendToAllNearExcept(EntityPlayer p, double x, double y, double z, double dist, World w, Packet packet)
{
if ( Platform.isClient() )
return;
for (EntityPlayer o : getPlayers())
{
EntityPlayerMP entityplayermp = (EntityPlayerMP) o;
if ( entityplayermp != p && entityplayermp.worldObj == w )
{
double dX = x - entityplayermp.posX;
double dY = y - entityplayermp.posY;
double dZ = z - entityplayermp.posZ;
if ( dX * dX + dY * dY + dZ * dZ < dist * dist )
{
entityplayermp.playerNetServerHandler.sendPacketToPlayer( packet );
}
}
}
}
@Override
public void init()
{
}
@Override
public World getWorld()
{
throw new RuntimeException( "This is a server..." );
}
@Override
public void bindTileEntitySpecialRenderer(Class tile, AEBaseBlock blk)
{
throw new RuntimeException( "This is a server..." );
}
}