Search in sources :

Example 1 with TeleporterNetwork

use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.

the class CommandTeleporters method execute.

@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    TeleporterNetwork network = TeleporterNetwork.get(sender.getEntityWorld());
    TextComponentString chat = new TextComponentString("--- There are currently " + network.getSubnets().size() + " teleporter networks ---");
    chat.getStyle().setColor(TextFormatting.DARK_GREEN);
    sender.sendMessage(chat);
    Iterator<String> it = network.getSubnets().iterator();
    while (it.hasNext()) {
        String s = it.next();
        chat = new TextComponentString("(" + network.getSubnetSize(s) + ") " + s);
        sender.sendMessage(chat);
    }
}
Also used : TeleporterNetwork(net.dyeo.teleporter.teleport.TeleporterNetwork) TextComponentString(net.minecraft.util.text.TextComponentString) TextComponentString(net.minecraft.util.text.TextComponentString)

Example 2 with TeleporterNetwork

use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.

the class TileEntityTeleporter method update.

@Override
public void update() {
    if (!this.world.isRemote) {
        TeleporterNetwork netWrapper = TeleporterNetwork.get(this.world);
        int tileDim = this.world.provider.getDimension();
        TeleporterNode thisNode = netWrapper.getNode(this.pos, tileDim);
        if (thisNode == null) {
            thisNode = new TeleporterNode();
            thisNode.pos = this.pos;
            thisNode.dimension = tileDim;
            thisNode.type = this.getWorld().getBlockState(this.pos).getValue(BlockTeleporter.TYPE);
            thisNode.key = TeleporterNetwork.getItemKey(getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0));
            netWrapper.addNode(thisNode);
            this.markDirty();
            netWrapper.markDirty();
        } else {
            netWrapper.updateNode(thisNode);
        }
    }
}
Also used : TeleporterNetwork(net.dyeo.teleporter.teleport.TeleporterNetwork) TeleporterNode(net.dyeo.teleporter.teleport.TeleporterNode)

Example 3 with TeleporterNetwork

use of net.dyeo.teleporter.teleport.TeleporterNetwork in project VanillaTeleporter by dyeo.

the class TileEntityTeleporter method removeFromNetwork.

public void removeFromNetwork() {
    TeleporterNetwork netWrapper = TeleporterNetwork.get(this.world);
    ItemStack key = getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null).getStackInSlot(0);
    netWrapper.removeNode(this.pos, this.world.provider.getDimension(), key);
}
Also used : TeleporterNetwork(net.dyeo.teleporter.teleport.TeleporterNetwork) ItemStack(net.minecraft.item.ItemStack)

Aggregations

TeleporterNetwork (net.dyeo.teleporter.teleport.TeleporterNetwork)3 TeleporterNode (net.dyeo.teleporter.teleport.TeleporterNode)1 ItemStack (net.minecraft.item.ItemStack)1 TextComponentString (net.minecraft.util.text.TextComponentString)1